mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
ZNC-Extra no more.
Few the most useless modules are just removed, the others are moved to standard modules.
This commit is contained in:
66
modules/clearbufferonmsg.cpp
Normal file
66
modules/clearbufferonmsg.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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/Chan.h>
|
||||
#include <znc/Modules.h>
|
||||
|
||||
class CClearBufferOnMsgMod : public CModule {
|
||||
public:
|
||||
MODCONSTRUCTOR(CClearBufferOnMsgMod) {}
|
||||
|
||||
void ClearAllBuffers() {
|
||||
if (m_pNetwork) {
|
||||
const vector<CChan*>& vChans = m_pNetwork->GetChans();
|
||||
vector<CChan*>::const_iterator it;
|
||||
|
||||
for (it = vChans.begin(); it != vChans.end(); ++it) {
|
||||
// Skip detached channels, they weren't read yet
|
||||
if ((*it)->IsDetached())
|
||||
continue;
|
||||
|
||||
(*it)->ClearBuffer();
|
||||
// We force KeepBuffer on all channels since this module
|
||||
// doesnt make any sense without
|
||||
(*it)->SetKeepBuffer(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage) {
|
||||
ClearAllBuffers();
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
virtual EModRet OnUserCTCP(CString& sTarget, CString& sMessage) {
|
||||
ClearAllBuffers();
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
virtual EModRet OnUserAction(CString& sTarget, CString& sMessage) {
|
||||
ClearAllBuffers();
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
virtual EModRet OnUserNotice(CString& sTarget, CString& sMessage) {
|
||||
ClearAllBuffers();
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
virtual EModRet OnUserPart(CString& sChannel, CString& sMessage) {
|
||||
ClearAllBuffers();
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
virtual EModRet OnUserTopic(CString& sChannel, CString& sTopic) {
|
||||
ClearAllBuffers();
|
||||
return CONTINUE;
|
||||
}
|
||||
};
|
||||
|
||||
USERMODULEDEFS(CClearBufferOnMsgMod, "Clear all channel buffers whenever the user does something")
|
||||
Reference in New Issue
Block a user