summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gmail.com>2014-09-21 11:28:12 +0300
committerTheo Chatzimichos <tampakrap@gmail.com>2014-09-21 11:29:25 +0300
commit98380dc9a0c215ce5f48576e4deaaebcbb961ca4 (patch)
tree848c8432346164da432db40c0a13df76c6d3d2cc
parentc988744d5c1b7cc5347d54a99fdfbbe26f7980bd (diff)
Display properly IRC notices
-rw-r--r--backlog.cpp10
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);
}