mirror of https://github.com/SeanOMik/znc-push.git
Implemented basic highlight matching against nick
This commit is contained in:
parent
c4d4718709
commit
6f10bb19f6
30
notifo.cpp
30
notifo.cpp
|
@ -32,6 +32,9 @@ class CNotifoMod : public CModule
|
||||||
// Too lazy to add CString("\r\n\") everywhere
|
// Too lazy to add CString("\r\n\") everywhere
|
||||||
CString crlf;
|
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
|
// Host and URL to send messages to
|
||||||
CString notifo_host;
|
CString notifo_host;
|
||||||
CString notifo_url;
|
CString notifo_url;
|
||||||
|
@ -39,8 +42,8 @@ class CNotifoMod : public CModule
|
||||||
// User agent to use
|
// User agent to use
|
||||||
CString user_agent;
|
CString user_agent;
|
||||||
|
|
||||||
// BASIC auth string, needs to be encoded each time username/secret is changed
|
// User object
|
||||||
CString notifo_auth;
|
CUser *user;
|
||||||
|
|
||||||
// Configuration options
|
// Configuration options
|
||||||
MCString options;
|
MCString options;
|
||||||
|
@ -62,6 +65,9 @@ class CNotifoMod : public CModule
|
||||||
notifo_auth = "";
|
notifo_auth = "";
|
||||||
user_agent = "ZNC To Notifo";
|
user_agent = "ZNC To Notifo";
|
||||||
|
|
||||||
|
// Current user
|
||||||
|
user = GetUser();
|
||||||
|
|
||||||
// Notifo user account and secret
|
// Notifo user account and secret
|
||||||
options["username"] = "";
|
options["username"] = "";
|
||||||
options["secret"] = "";
|
options["secret"] = "";
|
||||||
|
@ -133,6 +139,24 @@ class CNotifoMod : public CModule
|
||||||
#endif
|
#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.
|
* 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)
|
bool notify_channel(const CNick& nick, const CChan& channel, const CString& message)
|
||||||
{
|
{
|
||||||
return false;
|
return highlight(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue