From 98380dc9a0c215ce5f48576e4deaaebcbb961ca4 Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Sun, 21 Sep 2014 11:28:12 +0300 Subject: Display properly IRC notices --- backlog.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'backlog.cpp') diff --git a/backlog.cpp b/backlog.cpp index 4e87a48..07e70c6 100644 --- a/backlog.cpp +++ b/backlog.cpp @@ -186,6 +186,7 @@ void CBacklogMod::OnModCommand(const CString& sCommand) { size_t FirstWS = Line.find_first_of(' '); // position of first whitespace char in line size_t NickLen = 3; CString Nick = "***"; + CString MessageType = "PRIVMSG "; try { // a log line looks like: [HH:MM:SS] Message @@ -197,8 +198,15 @@ void CBacklogMod::OnModCommand(const CString& sCommand) { // but we don't want them in Nick so subtract by two Nick = Line.substr(FirstWS + 2, NickLen - 2); } + else if(Line.at(FirstWS + 1) == '-') { // IRC notice + // nicklen includes surrounding - - + NickLen = Line.find_first_of('-', FirstWS + 2) - Line.find_first_of('-') + 1; + // but we don't want them in Nick so subtract by two + Nick = Line.substr(FirstWS + 2, NickLen - 2); + MessageType = "NOTICE "; + } - m_pNetwork->PutUser(":" + Nick + "!znc@znc.in PRIVMSG " + Channel + " :" + Line.substr(0, FirstWS) + Line.substr(FirstWS + NickLen + 1, Line.npos), GetClient()); + m_pNetwork->PutUser(":" + Nick + "!znc@znc.in " + MessageType + Channel + " :" + Line.substr(0, FirstWS) + Line.substr(FirstWS + NickLen + 1, Line.npos), GetClient()); } catch (int e) { PutModule("Malformed log line! " + Line); } -- cgit v1.2.3