-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ChanServ AKICK Check - pre-release/beta
* Beta/untested version. * Check AKICKs upon startup and when a user does something to affect the matching of an AKICK. See #3.
- Loading branch information
1 parent
b31dcf6
commit 05d453c
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* ChanServ AKICK Check | ||
* | ||
* (C) 2018 - Matt Schatz (genius3000@g3k.solutions) | ||
* Please refer to the GPL License in use by Anope at: | ||
* https://github.com/anope/anope/blob/master/docs/COPYING | ||
* | ||
* Check channel AKICKs upon services start, when a user | ||
* logs in or out of an account, groups a nick, or | ||
* changes their nickname or displayed host. | ||
* | ||
* Configuration to put into your chanserv config: | ||
module { name = "cs_akick_check" } | ||
*/ | ||
|
||
#include "module.h" | ||
|
||
|
||
class CSAkickCheck : public Module | ||
{ | ||
public: | ||
CSAkickCheck(const Anope::string &modname, const Anope::string &creator) | ||
: Module(modname, creator, THIRD) | ||
{ | ||
if (Anope::VersionMajor() != 2 || Anope::VersionMinor() != 0) | ||
throw ModuleException("Requires version 2.0.x of Anope."); | ||
|
||
this->SetAuthor("genius3000"); | ||
this->SetVersion("0.9.0"); | ||
} | ||
|
||
void OnUplinkSync(Server *) anope_override | ||
{ | ||
for (channel_map::const_iterator chan = ChannelList.begin(), chan_end = ChannelList.end(); chan != chan_end; ++chan) | ||
{ | ||
Channel *c = chan->second; | ||
for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) | ||
{ | ||
ChanUserContainer *uc = it->second; | ||
++it; | ||
|
||
c->CheckKick(uc->user); | ||
} | ||
} | ||
} | ||
|
||
void CheckAkicks(User *u) | ||
{ | ||
for (User::ChanUserList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ) | ||
{ | ||
ChanUserContainer *cc = it->second; | ||
++it; | ||
|
||
Channel *c = cc->chan; | ||
if (c) | ||
c->CheckKick(u); | ||
} | ||
} | ||
|
||
void OnNickGroup(User *u, NickAlias *) anope_override | ||
{ | ||
CheckAkicks(u); | ||
} | ||
|
||
void OnNickLogout(User *u) anope_override | ||
{ | ||
CheckAkicks(u); | ||
} | ||
|
||
void OnSetDisplayedHost(User *u) anope_override | ||
{ | ||
CheckAkicks(u); | ||
} | ||
|
||
void OnUserNickChange(User *u, const Anope::string &) anope_override | ||
{ | ||
CheckAkicks(u); | ||
} | ||
|
||
void OnUserLogin(User *u) anope_override | ||
{ | ||
CheckAkicks(u); | ||
} | ||
}; | ||
|
||
MODULE_INIT(CSAkickCheck) |