Implemented basic highlight matching against nick

This commit is contained in:
John Reese 2011-01-13 20:58:13 -05:00
parent c4d4718709
commit 6f10bb19f6
1 changed files with 27 additions and 3 deletions

View File

@ -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);
}
/**