diff options
author | Rasmus Eskola <fruitiex@gmail.com> | 2014-09-28 13:31:48 +0300 |
---|---|---|
committer | Rasmus Eskola <fruitiex@gmail.com> | 2014-09-28 13:31:48 +0300 |
commit | ee94be7583841a53bf31b0dba06f85bcdbf40de9 (patch) | |
tree | 848c8432346164da432db40c0a13df76c6d3d2cc | |
parent | c988744d5c1b7cc5347d54a99fdfbbe26f7980bd (diff) | |
parent | 98380dc9a0c215ce5f48576e4deaaebcbb961ca4 (diff) |
Merge pull request #8 from tampakrap/master
Display properly IRC notices
-rw-r--r-- | backlog.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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] <Nick> 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); } |