summaryrefslogtreecommitdiff
path: root/images/znc/privmsg.cpp
diff options
context:
space:
mode:
authorSystem administrator2017-05-29 13:26:10 +0200
committerSystem administrator2017-05-29 13:26:10 +0200
commitbc5c44dd049bad3b007be48b3f8d90886d63c105 (patch)
treea381d989db2295f228f9bc95a774f0cc9aef4c40 /images/znc/privmsg.cpp
downloadserver-bc5c44dd049bad3b007be48b3f8d90886d63c105.tar.gz
server-bc5c44dd049bad3b007be48b3f8d90886d63c105.tar.xz
server-bc5c44dd049bad3b007be48b3f8d90886d63c105.zip
Initial commit
Diffstat (limited to 'images/znc/privmsg.cpp')
-rw-r--r--images/znc/privmsg.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/images/znc/privmsg.cpp b/images/znc/privmsg.cpp
new file mode 100644
index 0000000..0659f96
--- /dev/null
+++ b/images/znc/privmsg.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2004-2012 See the AUTHORS file for details.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <znc/IRCNetwork.h>
+#include <znc/Modules.h>
+
+class CPrivMsgMod : public CModule {
+public:
+ MODCONSTRUCTOR(CPrivMsgMod) {}
+
+ virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage) {
+ if (m_pNetwork && m_pNetwork->GetIRCSock() && !m_pNetwork->IsChan(sTarget)) {
+ m_pNetwork->PutUser(":" + m_pNetwork->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage, NULL, m_pClient);
+ }
+
+ return CONTINUE;
+ }
+
+ virtual EModRet OnUserAction(CString& sTarget, CString& sMessage) {
+ if (m_pNetwork && m_pNetwork->GetIRCSock() && !m_pNetwork->IsChan(sTarget)) {
+ m_pNetwork->PutUser(":" + m_pNetwork->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :\x01" + "ACTION " + sMessage + "\x01", NULL, m_pClient);
+ }
+
+ return CONTINUE;
+ }
+};
+
+template<> void TModInfo<CPrivMsgMod>(CModInfo& Info) {
+ Info.SetWikiPage("privmsg");
+ Info.AddType(CModInfo::NetworkModule);
+ Info.AddType(CModInfo::GlobalModule);
+}
+
+USERMODULEDEFS(CPrivMsgMod, "Send outgoing PRIVMSGs and CTCP ACTIONs to other clients")
+