Implemented handling of channel messages and actions

This commit is contained in:
John Reese 2011-01-13 20:39:08 -05:00
parent 304bef93f0
commit c4d4718709
1 changed files with 48 additions and 2 deletions

View File

@ -136,12 +136,14 @@ class CNotifoMod : public CModule
/** /**
* Determine when to notify the user of a channel message. * Determine when to notify the user of a channel message.
* *
* @param nick Nick that sent the message
* @param channel Channel the message was sent to * @param channel Channel the message was sent to
* @param message Message contents
* @return Notification should be sent * @return Notification should be sent
*/ */
bool notify_channel(const CChan& channel) bool notify_channel(const CNick& nick, const CChan& channel, const CString& message)
{ {
return true; return false;
} }
/** /**
@ -175,6 +177,50 @@ class CNotifoMod : public CModule
return true; return true;
} }
/**
* Handle channel messages.
*
* @param nick Nick that sent the message
* @param channel Channel the message was sent to
* @param message Message contents
*/
EModRet OnChanMsg(CNick& nick, CChan& channel, CString& message)
{
if (notify_channel(nick, channel, message))
{
CString title = "Highlight";
CString msg = channel.GetName();
msg += ": <" + nick.GetNick();
msg += "> " + message;
send_message(msg, title);
}
return CONTINUE;
}
/**
* Handle channel actions.
*
* @param nick Nick that sent the action
* @param channel Channel the message was sent to
* @param message Message contents
*/
EModRet OnChanAction(CNick& nick, CChan& channel, CString& message)
{
if (notify_channel(nick, channel, message))
{
CString title = "Highlight";
CString msg = channel.GetName();
msg += ": " + nick.GetNick();
msg += " " + message;
send_message(msg, title);
}
return CONTINUE;
}
/** /**
* Handle a private message. * Handle a private message.
* *