Anope IRC Services  Version 2.0
cs_statusupdate.cpp
Go to the documentation of this file.
1 /*
2  * (C) 2003-2014 Anope Team
3  * Contact us at team@anope.org
4  *
5  * Please read COPYING and README for further details.
6  */
7 
8 #include "module.h"
9 
10 class StatusUpdate : public Module
11 {
12  public:
13  StatusUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
14  {
15 
16  }
17 
19  {
20  if (ci->c)
21  for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
22  {
23  User *user = it->second->user;
24 
26  if (user->server != Me && access->Matches(user, user->Account(), p))
27  {
28  AccessGroup ag = ci->AccessFor(user);
29 
30  for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
31  {
33  if (!ag.HasPriv("AUTO" + cms->name))
34  ci->c->RemoveMode(NULL, cms, user->GetUID());
35  }
36  ci->c->SetCorrectModes(user, true);
37  }
38  }
39  }
40 
42  {
43  if (ci->c)
44  for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
45  {
46  User *user = it->second->user;
47 
49  if (user->server != Me && access->Matches(user, user->Account(), p))
50  {
51  AccessGroup ag = ci->AccessFor(user);
52 
53  for (unsigned i = 0; i < ModeManager::GetStatusChannelModesByRank().size(); ++i)
54  {
56  if (!ag.HasPriv("AUTO" + cms->name))
57  ci->c->RemoveMode(NULL, cms, user->GetUID());
58  }
59  }
60  }
61  }
62 };
63 
std::pair< Set, Set > Path
Definition: access.h:87
void OnAccessAdd(ChannelInfo *ci, CommandSource &, ChanAccess *access) anope_override
Definition: hashcomp.h:84
Definition: users.h:34
bool HasPriv(const Anope::string &priv) const
Definition: access.cpp:384
const Anope::string & GetUID() const
Definition: users.cpp:230
#define anope_override
Definition: services.h:56
#define MODULE_INIT(x)
Definition: modules.h:45
Server * server
Definition: users.h:77
NickCore * Account() const
Definition: users.cpp:422
CoreExport Server * Me
Definition: servers.cpp:24
static const std::vector< ChannelModeStatus * > & GetStatusChannelModesByRank()
Definition: modes.cpp:581
void OnAccessDel(ChannelInfo *ci, CommandSource &, ChanAccess *access) anope_override
Anope::string name
Definition: modes.h:43
StatusUpdate(const Anope::string &modname, const Anope::string &creator)