From 6f10bb19f6440a123a667b663436a907b2b9895e Mon Sep 17 00:00:00 2001 From: John Reese Date: Thu, 13 Jan 2011 20:58:13 -0500 Subject: [PATCH] Implemented basic highlight matching against nick --- notifo.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/notifo.cpp b/notifo.cpp index 59f6efb..1098e56 100644 --- a/notifo.cpp +++ b/notifo.cpp @@ -32,6 +32,9 @@ class CNotifoMod : public CModule // Too lazy to add CString("\r\n\") everywhere CString crlf; + // BASIC auth string, needs to be encoded each time username/secret is changed + CString notifo_auth; + // Host and URL to send messages to CString notifo_host; CString notifo_url; @@ -39,8 +42,8 @@ class CNotifoMod : public CModule // User agent to use CString user_agent; - // BASIC auth string, needs to be encoded each time username/secret is changed - CString notifo_auth; + // User object + CUser *user; // Configuration options MCString options; @@ -62,6 +65,9 @@ class CNotifoMod : public CModule notifo_auth = ""; user_agent = "ZNC To Notifo"; + // Current user + user = GetUser(); + // Notifo user account and secret options["username"] = ""; options["secret"] = ""; @@ -133,6 +139,24 @@ class CNotifoMod : public CModule #endif } + /** + * Determine if the given message matches any highlight rules. + * + * @param message Message contents + * @return True if message matches a highlight + */ + bool highlight(const CString& message) + { + CNick nick = user->GetIRCNick(); + + if (message.find(nick.GetNick()) != string::npos) + { + return true; + } + + return false; + } + /** * Determine when to notify the user of a channel message. * @@ -143,7 +167,7 @@ class CNotifoMod : public CModule */ bool notify_channel(const CNick& nick, const CChan& channel, const CString& message) { - return false; + return highlight(message); } /**