~ubuntu-branches/ubuntu/trusty/znc/trusty

« back to all changes in this revision

Viewing changes to modules/buffextras.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-05-06 09:18:27 UTC
  • mfrom: (21.1.5 experimental)
  • Revision ID: package-import@ubuntu.com-20130506091827-08sixjiyy3hjfx6b
Tags: 1.0-4
* Change section from znc-tcl to interpreters.
* Uploading to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004-2011  See the AUTHORS file for details.
 
2
 * Copyright (C) 2004-2012  See the AUTHORS file for details.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify it
5
5
 * under the terms of the GNU General Public License version 2 as published
6
6
 * by the Free Software Foundation.
7
7
 */
8
8
 
9
 
#include "Chan.h"
10
 
#include "User.h"
11
 
#include "Modules.h"
 
9
#include <znc/Chan.h>
 
10
#include <znc/User.h>
 
11
#include <znc/IRCNetwork.h>
 
12
#include <znc/Modules.h>
 
13
 
 
14
using std::vector;
12
15
 
13
16
class CBuffExtras : public CModule {
14
17
public:
17
20
        virtual ~CBuffExtras() {}
18
21
 
19
22
        void AddBuffer(CChan& Channel, const CString& sMessage) {
20
 
                // If they have keep buffer disabled, only add messages if no client is connected
21
 
                if (!Channel.KeepBuffer() && m_pUser->IsUserAttached())
 
23
                // If they have AutoClearChanBuffer enabled, only add messages if no client is connected
 
24
                if (Channel.AutoClearChanBuffer() && m_pNetwork->IsUserOnline())
22
25
                        return;
23
26
 
24
 
                CString s = ":" + GetModNick() + "!" + GetModName() + "@znc.in PRIVMSG "
25
 
                        + Channel.GetName() + " :" + m_pUser->AddTimestamp(sMessage);
26
 
                Channel.AddBuffer(s);
 
27
                Channel.AddBuffer(":" + GetModNick() + "!" + GetModName() + "@znc.in PRIVMSG " + _NAMEDFMT(Channel.GetName()) + " :{text}", sMessage);
27
28
        }
28
29
 
29
30
        virtual void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs) {
31
32
        }
32
33
 
33
34
        virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) {
34
 
                AddBuffer(Channel, OpNick.GetNickMask() + " kicked " + sKickedNick
35
 
                                        + " Reason: [" + sMessage + "]");
 
35
                AddBuffer(Channel, OpNick.GetNickMask() + " kicked " + sKickedNick + " Reason: [" + sMessage + "]");
36
36
        }
37
37
 
38
38
        virtual void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) {
70
70
        Info.SetWikiPage("buffextras");
71
71
}
72
72
 
73
 
MODULEDEFS(CBuffExtras, "Add joins, parts etc. to the playback buffer")
 
73
USERMODULEDEFS(CBuffExtras, "Add joins, parts etc. to the playback buffer")
74
74