mirror of
https://github.com/znc/znc.git
synced 2026-05-08 22:34:45 +02:00
Import the buffextras module from znc-extra
This module adds topic changes, nick changes, parts, joins, quits, kicks and mode changes to the buffer playback. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1592 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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 "Chan.h"
|
||||
#include "User.h"
|
||||
#include "Modules.h"
|
||||
|
||||
class CBuffExtras : public CModule {
|
||||
public:
|
||||
MODCONSTRUCTOR(CBuffExtras) {}
|
||||
|
||||
virtual ~CBuffExtras() {}
|
||||
|
||||
void AddBuffer(CChan& Channel, const CString& sMessage) {
|
||||
// If they have keep buffer disabled, only add messages if a client is connected
|
||||
if (!Channel.KeepBuffer() && m_pUser->IsUserAttached())
|
||||
return;
|
||||
|
||||
CString s = ":" + GetModNick() + "!" + GetModName() + "@znc.in PRIVMSG "
|
||||
+ Channel.GetName() + " :" + m_pUser->AddTimestamp(sMessage);
|
||||
Channel.AddBuffer(s);
|
||||
}
|
||||
|
||||
virtual void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs) {
|
||||
AddBuffer(Channel, OpNick.GetNickMask() + " set mode: " + sModes + " " + sArgs);
|
||||
}
|
||||
|
||||
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) {
|
||||
AddBuffer(Channel, OpNick.GetNickMask() + " kicked " + sKickedNick
|
||||
+ " Reason: [" + sMessage + "]");
|
||||
}
|
||||
|
||||
virtual void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) {
|
||||
vector<CChan*>::const_iterator it;
|
||||
CString sMsg = Nick.GetNickMask() + " quit with message: [" + sMessage + "]";
|
||||
for (it = vChans.begin(); it != vChans.end(); it++) {
|
||||
AddBuffer(**it, sMsg);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnJoin(const CNick& Nick, CChan& Channel) {
|
||||
AddBuffer(Channel, Nick.GetNickMask() + " joined");
|
||||
}
|
||||
|
||||
virtual void OnPart(const CNick& Nick, CChan& Channel) {
|
||||
AddBuffer(Channel, Nick.GetNickMask() + " parted");
|
||||
}
|
||||
|
||||
virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans) {
|
||||
vector<CChan*>::const_iterator it;
|
||||
CString sMsg = OldNick.GetNickMask() + " is now known as " + sNewNick;
|
||||
for (it = vChans.begin(); it != vChans.end(); it++) {
|
||||
AddBuffer(**it, sMsg);
|
||||
}
|
||||
}
|
||||
|
||||
virtual EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) {
|
||||
AddBuffer(Channel, Nick.GetNickMask() + " changed the topic to: " + sTopic);
|
||||
|
||||
return CONTINUE;
|
||||
}
|
||||
};
|
||||
|
||||
MODULEDEFS(CBuffExtras, "Add joins, parts etc. to the playback buffer")
|
||||
|
||||
Reference in New Issue
Block a user