mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
(Yes, it's that time of the year again) Signed-off-by: Uli Schlachter <psychon@znc.in> git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2260 726aef4b-f618-498e-8847-2d620e286838
40 lines
964 B
C++
40 lines
964 B
C++
/*
|
|
* Copyright (C) 2004-2011 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"
|
|
#include "Client.h"
|
|
|
|
class CMotdFileMod : public CGlobalModule {
|
|
public:
|
|
GLOBALMODCONSTRUCTOR(CMotdFileMod) {}
|
|
virtual ~CMotdFileMod() {}
|
|
|
|
virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
|
|
if (sArgs.empty()) {
|
|
sMessage = "Argument must be path to a MOTD file";
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
virtual void OnClientLogin() {
|
|
CString sFile = GetArgs();
|
|
CString sBuffer;
|
|
CFile cFile(sFile);
|
|
if (!cFile.Open(O_RDONLY)) {
|
|
m_pClient->PutStatusNotice("Could not open MOTD file");
|
|
return;
|
|
}
|
|
while (cFile.ReadLine(sBuffer))
|
|
m_pClient->PutStatusNotice(sBuffer);
|
|
cFile.Close();
|
|
}
|
|
};
|
|
|
|
GLOBALMODULEDEFS(CMotdFileMod, "Send MOTD from a file")
|