From f5590832cc64a3e6f7b209cf51f2bf70444f1f50 Mon Sep 17 00:00:00 2001 From: John Reese Date: Thu, 13 Jan 2011 17:40:41 -0500 Subject: [PATCH] Implemented PM notifications --- notifo.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/notifo.cpp b/notifo.cpp index e4223db..4f0f03b 100644 --- a/notifo.cpp +++ b/notifo.cpp @@ -133,6 +133,21 @@ class CNotifoMod : public CModule #endif } + /** + * Notify the user of a private message. + * + * @param nick Nick that sent the message + * @param message Message contents + */ + void notify_pm(const CNick& nick, const CString& message) + { + CString title = "Private Message"; + CString msg = "From " + nick.GetNick(); + msg += ": " + message; + + send_message(msg, title); + } + protected: bool OnLoad(const CString& args, CString& message) @@ -145,6 +160,18 @@ class CNotifoMod : public CModule return true; } + /** + * Handle a private message + * + * @param nick Nick that sent the message + * @param message Message contents + */ + EModRet OnPrivMsg(CNick& nick, CString& message) + { + notify_pm(nick, message); + return CONTINUE; + } + /** * Handle direct commands to the *notifo virtual user. *