Anope IRC Services  Version 2.0
regchannel.h
Go to the documentation of this file.
1 /*
2  *
3  * (C) 2008-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  */
9 
10 #ifndef REGCHANNEL_H
11 #define REGCHANNEL_H
12 
13 #include "memo.h"
14 #include "modes.h"
15 #include "extensible.h"
16 #include "logger.h"
17 #include "modules.h"
18 #include "serialize.h"
19 #include "bots.h"
20 
22 
24 
25 /* AutoKick data. */
27 {
28  public:
29  /* Channel this autokick is on */
31 
34 
37  time_t addtime;
38  time_t last_used;
39 
40  AutoKick();
41  ~AutoKick();
42  void Serialize(Serialize::Data &data) const anope_override;
43  static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
44 };
45 
46 /* It matters that Base is here before Extensible (it is inherited by Serializable)
47  */
49 {
50  /* channels who reference this one */
52  private:
53  Serialize::Reference<NickCore> founder; /* Channel founder */
54  Serialize::Reference<NickCore> successor; /* Who gets the channel if the founder nick is dropped or expires */
55  Serialize::Checker<std::vector<ChanAccess *> > access; /* List of authorized users */
56  Serialize::Checker<std::vector<AutoKick *> > akick; /* List of users to kickban */
58 
59  public:
60  friend class ChanAccess;
61  friend class AutoKick;
62 
63  Anope::string name; /* Channel name */
65 
67  time_t last_used;
68 
69  Anope::string last_topic; /* The last topic that was set on this channel */
71  time_t last_topic_time; /* Time */
72 
73  Channel::ModeList last_modes; /* The last modes set on this channel */
74 
75  int16_t bantype;
76 
78 
79  Channel *c; /* Pointer to channel, if the channel exists */
80 
81  /* For BotServ */
82  Serialize::Reference<BotInfo> bi; /* Bot used on this channel */
83 
84  time_t banexpire; /* Time bans expire in */
85 
89  ChannelInfo(const Anope::string &chname);
90 
94  ChannelInfo(const ChannelInfo &ci);
95 
96  ~ChannelInfo();
97 
98  void Serialize(Serialize::Data &data) const anope_override;
100 
104  void SetFounder(NickCore *nc);
105 
109  NickCore *GetFounder() const;
110 
111  void SetSuccessor(NickCore *nc);
112  NickCore *GetSuccessor() const;
113 
117  BotInfo *WhoSends() const;
118 
122  void AddAccess(ChanAccess *access);
123 
131  ChanAccess *GetAccess(unsigned index) const;
132 
136  AccessGroup AccessFor(const User *u);
137  AccessGroup AccessFor(const NickCore *nc);
138 
142  unsigned GetAccessCount() const;
143 
147  unsigned GetDeepAccessCount() const;
148 
155  ChanAccess *EraseAccess(unsigned index);
156 
161  void ClearAccess();
162 
170  AutoKick* AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
171 
179  AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
180 
185  AutoKick* GetAkick(unsigned index) const;
186 
190  unsigned GetAkickCount() const;
191 
195  void EraseAkick(unsigned index);
196 
199  void ClearAkick();
200 
206  int16_t GetLevel(const Anope::string &priv) const;
207 
212  void SetLevel(const Anope::string &priv, int16_t level);
213 
217  void RemoveLevel(const Anope::string &priv);
218 
221  void ClearLevels();
222 
228  Anope::string GetIdealBan(User *u) const;
229 
234  static ChannelInfo* Find(const Anope::string &name);
235 
236  void AddChannelReference(const Anope::string &what);
237  void RemoveChannelReference(const Anope::string &what);
238  void GetChannelReferences(std::deque<Anope::string> &chans);
239 };
240 
246 extern CoreExport bool IsFounder(const User *user, const ChannelInfo *ci);
247 
248 #endif // REGCHANNEL_H
Definition: bots.h:24
time_t banexpire
Definition: regchannel.h:84
Definition: hashcomp.h:84
Anope::string name
Definition: regchannel.h:63
Anope::string desc
Definition: regchannel.h:64
time_t last_topic_time
Definition: regchannel.h:71
Anope::map< int > references
Definition: regchannel.h:51
Definition: users.h:34
CoreExport bool IsFounder(const User *user, const ChannelInfo *ci)
Definition: regchannel.cpp:642
CoreExport time_t CurTime
Definition: main.cpp:41
Channel::ModeList last_modes
Definition: regchannel.h:73
Serialize::Reference< NickCore > successor
Definition: regchannel.h:54
int16_t bantype
Definition: regchannel.h:75
std::multimap< Anope::string, Anope::string > ModeList
Definition: channels.h:36
void Serialize(Serialize::Data &data) const anope_override
Definition: regchannel.cpp:43
Serialize::Reference< ChannelInfo > ci
Definition: regchannel.h:30
Channel * c
Definition: regchannel.h:79
Definition: memo.h:40
CoreExport Serialize::Checker< registered_channel_map > RegisteredChannelList
Anope::string reason
Definition: regchannel.h:35
time_t last_used
Definition: regchannel.h:67
time_t last_used
Definition: regchannel.h:38
Serialize::Checker< std::vector< ChanAccess * > > access
Definition: regchannel.h:55
virtual void Serialize(Serialize::Data &data) const =0
#define anope_override
Definition: services.h:56
Anope::string last_topic_setter
Definition: regchannel.h:70
Serialize::Checker< std::vector< AutoKick * > > akick
Definition: regchannel.h:56
MemoInfo memos
Definition: regchannel.h:77
Anope::string creator
Definition: regchannel.h:36
Anope::hash_map< ChannelInfo * > registered_channel_map
Definition: regchannel.h:21
#define CoreExport
Definition: services.h:62
Anope::string last_topic
Definition: regchannel.h:69
Anope::map< int16_t > levels
Definition: regchannel.h:57
Anope::string mask
Definition: regchannel.h:32
Serialize::Reference< NickCore > nc
Definition: regchannel.h:33
Serialize::Reference< NickCore > founder
Definition: regchannel.h:53
static Serializable * Unserialize(Serializable *obj, Serialize::Data &)
Definition: regchannel.cpp:56
Serialize::Reference< BotInfo > bi
Definition: regchannel.h:82
time_t addtime
Definition: regchannel.h:37
time_t time_registered
Definition: regchannel.h:66