From b404fae21b88f4e214b461c4e4ead9eaa02454ef Mon Sep 17 00:00:00 2001 From: cflakes Date: Sun, 10 Jan 2010 11:57:54 +0000 Subject: [PATCH] Importing the block_motd module into the extra module package. Psychon is probably its author since I grabbed it from here: http://people.znc.in/~psychon/znc/modules/, so thanks psychon! :> git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1700 726aef4b-f618-498e-8847-2d620e286838 --- modules/extra/block_motd.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 modules/extra/block_motd.cpp diff --git a/modules/extra/block_motd.cpp b/modules/extra/block_motd.cpp new file mode 100644 index 00000000..75e6f9ab --- /dev/null +++ b/modules/extra/block_motd.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2004-2009 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 "Modules.h" + +class CBlockMotd : public CModule { +public: + MODCONSTRUCTOR(CBlockMotd) { + } + + virtual ~CBlockMotd() { + } + + virtual EModRet OnRaw(CString &sLine) { + const CString sCmd = sLine.Token(1); + + if (sCmd == "375" /* begin of MOTD */ + || sCmd == "372" /* MOTD */) + return HALT; + if (sCmd == "376" /* End of MOTD */) { + sLine = sLine.Token(0) + " 422 " + + sLine.Token(2) + " :MOTD blocked by ZNC"; + } + return CONTINUE; + } +}; + +MODULEDEFS(CBlockMotd, "Block the MOTD from IRC so it's not sent to your client(s).")