diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-12-16 23:50:33 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-12-16 23:50:33 +0000 |
commit | 453963eeaeb4232df3e331522408034606cfefd6 (patch) | |
tree | c123bfffcf7be9c385d559829d2b3fe1533a3427 | |
parent | aad1a4ca8d8613042684ad5498dde2b87f44444b (diff) |
Moved /chanserv unban to its own module and added support for unbanning a nickname, this readds !unban nick
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2709 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | Changes.conf | 1 | ||||
-rw-r--r-- | Changes.lang | 4 | ||||
-rw-r--r-- | data/example.conf | 2 | ||||
-rw-r--r-- | lang/cat.l | 12 | ||||
-rw-r--r-- | lang/de.l | 17 | ||||
-rw-r--r-- | lang/en_us.l | 12 | ||||
-rw-r--r-- | lang/es.l | 12 | ||||
-rw-r--r-- | lang/fr.l | 14 | ||||
-rw-r--r-- | lang/gr.l | 11 | ||||
-rw-r--r-- | lang/hun.l | 12 | ||||
-rw-r--r-- | lang/it.l | 12 | ||||
-rw-r--r-- | lang/nl.l | 10 | ||||
-rw-r--r-- | lang/pl.l | 14 | ||||
-rw-r--r-- | lang/pt.l | 12 | ||||
-rw-r--r-- | lang/ru.l | 12 | ||||
-rw-r--r-- | lang/tr.l | 12 | ||||
-rw-r--r-- | src/core/cs_ban.c | 50 | ||||
-rw-r--r-- | src/core/cs_unban.c | 94 |
19 files changed, 196 insertions, 118 deletions
@@ -2,6 +2,7 @@ Anope Version 1.9.2 -------------------- A K alias to chanserv kick command A KB alias to chanserv ban command +F Unban command to accept an optional nick arg Anope Version 1.9.1 -------------------- diff --git a/Changes.conf b/Changes.conf index a80701f35..f084f452d 100644 --- a/Changes.conf +++ b/Changes.conf @@ -5,6 +5,7 @@ options:enablelogchannel added to auto turn on the logchannel on startup options:mlock added to configure the default mlock modes on new channels ** MODIFIED CONFIGURATION DIRECTIVES ** +chanserv:modules added cs_unban ** DELETED CONFIGURATION DIRECTIVES ** diff --git a/Changes.lang b/Changes.lang index a6b8c0cb2..f03318734 100644 --- a/Changes.lang +++ b/Changes.lang @@ -37,6 +37,7 @@ Anope Version 1.9.2 NICK_CONFIRM_SUCCESS NICK_HELP_CMD_RESETPASS NICK_HELP_RESETPASS + CHAN_UNBANNED_OTHER *** Mod Strings: CHAN_HELP_SET @@ -45,6 +46,9 @@ Anope Version 1.9.2 CHAN_HELP_ACCESS CHAN_HELP_SET NICK_HELP_CONFIRM + CHAN_UNBAN_SYNTAX + CHAN_HELP_CMD_UNBAN + CHAN_HELP_UNBAN *** Del Strings: CHAN_PASSWORD_IS diff --git a/data/example.conf b/data/example.conf index 756d0c883..39036bb02 100644 --- a/data/example.conf +++ b/data/example.conf @@ -899,7 +899,7 @@ chanserv * The core modules to load for ChanServ. This is a space separated list that corresponds * to the base names of the modules for ChanServ. This directive is optional, but highly recommended. */ - modules = "cs_help cs_register cs_set cs_xop cs_access cs_akick cs_drop cs_ban cs_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info forbid cs_suspend cs_status" + modules = "cs_help cs_register cs_set cs_xop cs_access cs_akick cs_drop cs_ban cs_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info forbid cs_suspend cs_status cs_unban" /* * The default options for newly registered channels. Note that changing these options diff --git a/lang/cat.l b/lang/cat.l index 26a2209ca..9488b9d36 100644 --- a/lang/cat.l +++ b/lang/cat.l @@ -1668,9 +1668,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN canal + UNBAN canal [nick] CHAN_UNBANNED Has estat desbanegat de %s. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4238,7 +4240,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Manipulate the topic of the specified channel CHAN_HELP_CMD_UNBAN - UNBAN Remove all bans preventing you from entering a channel + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Voices a selected nick on a channel CHAN_HELP_CMD_VOP @@ -5061,10 +5063,10 @@ CHAN_HELP_INVITE i major en el canal. CHAN_HELP_UNBAN - Sintàxi: UNBAN canal + Sintàxi: UNBAN canal [nick] - Li diu a %S que esborri tots els bans que no permeten que - entris al canal donat. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Per defecte, limitat a AOPs o aquells amb nivell 5 i major en el canal. @@ -1675,9 +1675,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN Channel + UNBAN Channel [nick] CHAN_UNBANNED Dein Ban in %s wurde entfernt. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # CLEAR responses CHAN_TOPIC_SYNTAX @@ -4273,7 +4275,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Ändert den Topic des angegebenen Channels CHAN_HELP_CMD_UNBAN - UNBAN Enfernt ein ban(s) die dich betreffen aus einen Channel + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Gibt den angegebenen User Voice-Status in einen Channel CHAN_HELP_CMD_VOP @@ -5101,13 +5103,14 @@ CHAN_HELP_INVITE (oder INVITE) hat. CHAN_HELP_UNBAN - Syntax: UNBAN Channel + Syntax: UNBAN Channel [nick] - Durch %S werden alle Bans entfernt, die dich am joinen - des Channels hindern. Eine Vorraussetzung dafür ist - allerdings, dass dein Level in dem Channel grösser als - 5 (oder UNBAN)ist. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. + By default, limited to AOPs or those with level 5 and above + on the channel. + CHAN_HELP_KICK Syntax: KICK Channel Nickname [Grund] diff --git a/lang/en_us.l b/lang/en_us.l index deb0ec482..d954f48dd 100644 --- a/lang/en_us.l +++ b/lang/en_us.l @@ -1636,9 +1636,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN channel + UNBAN channel [nick] CHAN_UNBANNED You have been unbanned from %s. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4083,7 +4085,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Manipulate the topic of the specified channel CHAN_HELP_CMD_UNBAN - UNBAN Remove all bans preventing you from entering a channel + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Voices a selected nick on a channel CHAN_HELP_CMD_VOP @@ -4873,10 +4875,10 @@ CHAN_HELP_INVITE on the channel. CHAN_HELP_UNBAN - Syntax: UNBAN channel + Syntax: UNBAN channel [nick] - Tells %S to remove all bans preventing you from - entering the given channel. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. By default, limited to AOPs or those with level 5 and above on the channel. @@ -1666,9 +1666,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN canal + UNBAN canal [nick] CHAN_UNBANNED Has sido desbaneado de %s. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4209,7 +4211,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Manipulate the topic of the specified channel CHAN_HELP_CMD_UNBAN - UNBAN Remove all bans preventing you from entering a channel + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Voices a selected nick on a channel CHAN_HELP_CMD_VOP @@ -5034,10 +5036,10 @@ CHAN_HELP_INVITE y mayor en el canal. CHAN_HELP_UNBAN - Sintaxis: UNBAN canal + Sintaxis: UNBAN canal [nick] - Le dice a %S que remueva todos los bans previeniendo - que entres al canal dado. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Por defecto, limitado a AOPs o aquellos con nivel 5 y mayor en el canal. @@ -1676,9 +1676,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN canal + UNBAN canal [nick] CHAN_UNBANNED Vous avez été débanni de %s. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4272,7 +4274,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Change le sujet sur un canal spécifié CHAN_HELP_CMD_UNBAN - UNBAN Retire tous les bans vous empêchant d'entrer sur un canal + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Donne un voice au pseudo spécifié sur un canal CHAN_HELP_CMD_VOP @@ -5095,11 +5097,11 @@ CHAN_HELP_INVITE d'accès de 5 ou plus sur le canal. CHAN_HELP_UNBAN - Syntaxe: UNBAN canal + Syntaxe: UNBAN canal [nick] + + Tells %S to remove all bans preventing you or the given + user from entering the given channel. - Demande à %S d'enlever tous les bans vous empêchant - d'entrer sur le canal donné. - Par défaut, limité aux AOPs ou à ceux ayant un niveau d'accès de 5 ou plus sur le canal. @@ -1670,9 +1670,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN êáíÜëé + UNBAN êáíÜëé [nick] CHAN_UNBANNED ãéíåò unban áðü ôï %s. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4228,7 +4230,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Manipulate the topic of the specified channel CHAN_HELP_CMD_UNBAN - UNBAN Remove all bans preventing you from entering a channel + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Voices a selected nick on a channel CHAN_HELP_CMD_VOP @@ -5008,9 +5010,10 @@ CHAN_HELP_INVITE ðáñáðÜíù óôï êáíÜëé. CHAN_HELP_UNBAN - Óýíôáîç: UNBAN êáíÜëé + Óýíôáîç: UNBAN êáíÜëé [nick] - ÆçôÜåé áðü ôïí %S íá áöáéñÝóåé üëá ôá bans áíÜëïãá ãéá ðïéï êáíÜëé ôïõ æçôÜò. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Áðü default, ÷ñçóéìïðïéåßôáé áðü ôïõò AOPs Þ áõôïýò ðïõ Ý÷ïõí level 5 êáé ðáñáðÜíù óôï êáíÜëé. diff --git a/lang/hun.l b/lang/hun.l index 990cb39de..4a4cd7307 100644 --- a/lang/hun.l +++ b/lang/hun.l @@ -1664,9 +1664,11 @@ CHAN_INVITE_SUCCESS # UNBAN válaszok CHAN_UNBAN_SYNTAX - UNBAN #szoba + UNBAN #szoba [nick] CHAN_UNBANNED %s csatornán a tiltást levetetted magadról. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC válaszok CHAN_TOPIC_SYNTAX @@ -4150,7 +4152,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Manipulate the topic of the specified channel CHAN_HELP_CMD_UNBAN - UNBAN Remove all bans preventing you from entering a channel + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Voices a selected nick on a channel CHAN_HELP_CMD_VOP @@ -4948,10 +4950,10 @@ CHAN_HELP_INVITE kell rendelkezned a csatornán, hogy használhasd. CHAN_HELP_UNBAN - Syntax: UNBAN #szoba + Syntax: UNBAN #szoba [nick] - A %S leveszi rólad a kitiltást és szabadon - beléphetsz a csatonára. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Alapbeállítás szerint, min. AOP vagy 5-ös access szinttel kell rendelkezned, hogy használhasd. @@ -1640,9 +1640,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN canale + UNBAN canale [nick] CHAN_UNBANNED I ban che ti riguardavano sono stati rimossi da %s. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4102,7 +4104,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Cambia il topic di un canale CHAN_HELP_CMD_UNBAN - UNBAN Rimuove i ban che impediscono l'accesso a un canale + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Assegna lo stato di voice a un utente (+v) CHAN_HELP_CMD_VOP @@ -4939,10 +4941,10 @@ CHAN_HELP_INVITE livello di accesso 5 o superiori sul canale. CHAN_HELP_UNBAN - Sintassi: UNBAN canale + Sintassi: UNBAN canale [nick] - Chiede a %S di rimuovere tutti i ban che non ti - permettono di entrare sul canale specificato. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Di default, il comando è limitato agli AOP o agli utenti con livello di accesso 5 o superiori sul canale. @@ -1657,9 +1657,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN kanaal + UNBAN kanaal [nick] CHAN_UNBANNED Bans met betrekking tot jou op %s zijn opgeheven. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4998,10 +5000,10 @@ CHAN_HELP_INVITE niveau 5 of hoger op het kanaal. CHAN_HELP_UNBAN - Gebruik: UNBAN kanaal + Gebruik: UNBAN kanaal [nick] - Zorgt ervoor dat %S alle bans verwijdert die je ervan - belemmeren het gegeven kanaal te joinen. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Standaard is dit gelimiteerd tot AOPs of degenen met niveau 5 of hoger op het kanaal. @@ -2158,11 +2158,14 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN kana³ + UNBAN kana³ [nick] CHAN_UNBANNED Ban na kanale %s zosta³ zdjêty. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. + # TOPIC responses CHAN_TOPIC_SYNTAX TOPIC kana³ [temat] @@ -5186,7 +5189,7 @@ CHAN_HELP_CMD_TOPIC TOPIC Zmienia temat podanego kana³u CHAN_HELP_CMD_UNBAN - UNBAN Usuwa wszystkie bany blokuj±ce wej¶cie na kana³ + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Nadaje wskazanej osobie prawo g³osu @@ -6020,11 +6023,10 @@ CHAN_HELP_INVITE dostêpu 5 lub wy¿szy. CHAN_HELP_UNBAN - Sk³adnia: UNBAN kana³ + Sk³adnia: UNBAN kana³ [nick] - Sprawia, ¿e %S zdejmie wszystkie bany, które - uniemo¿liwiaj± wydaj±cemu komendê wej¶cie na - wskazany kana³. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Standardowo ta komenda jest dostêpna dla u¿ytkowników wpisanych na listê AOP lub posiadaj±cych poziom @@ -1658,9 +1658,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN canal + UNBAN canal [nick] CHAN_UNBANNED Você não está mais banido do %s. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4106,7 +4108,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Modifica o tópico de um canal CHAN_HELP_CMD_UNBAN - UNBAN Remove todos os bans permitindo que você entre em um canal + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Atribui status de Voice a um nick no canal CHAN_HELP_CMD_VOP @@ -4902,10 +4904,10 @@ CHAN_HELP_INVITE nível de acesso 5 ou superior no canal. CHAN_HELP_UNBAN - Sintaxe: UNBAN #canal + Sintaxe: UNBAN #canal [nick] - Diz ao %S para remover todos os bans permitindo que - você entre em um canal. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Por padrão, é limitado aos AOPs ou àqueles que possuem nível de acesso 5 ou superior no canal. @@ -1637,9 +1637,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN #êàíàë + UNBAN #êàíàë [nick] CHAN_UNBANNED Âû áûëè ðàçáàíåíû íà êàíàëå %s. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4166,7 +4168,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Óñòàíîâêà òîïèêà íà êàíàëå ïîñðåäñòâîì ñåðâèñîâ CHAN_HELP_CMD_UNBAN - UNBAN Óäàëåíèå íà êàíàëå âñåõ áàíîâ, êîòîðûå íå ïîçâîëÿþò âàì âîéòè + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Óñòàíîâêà ñòàòóñà âîéñà (+v) óêàçàííîìó íèêó íà êàíàëå CHAN_HELP_CMD_VOP @@ -5008,10 +5010,10 @@ CHAN_HELP_INVITE ëèöàìè ñ óðîâíåì äîñòóïà 5 è âûøå. CHAN_HELP_UNBAN - Ñèíòàêñèñ: UNBAN #êàíàë + Ñèíòàêñèñ: UNBAN #êàíàë [nick] - Ïîñûëàåò %S çàïðîñ íà óäàëåíèå ñ óêàçàííîãî êàíàëà âñåõ áàíîâ, - êîòîðûå íå ïîçâîëÿþò âàì íà íåãî (êàíàë) çàéòè. + Remove all bans preventing a user from entering a channel + user from entering the given channel. Ïî-óìîë÷àíèþ, äàííàÿ êîìàíäà ìîæåò áûòü èñïîëüçîâàíà AOP'àìè èëè ëèöàìè ñ óðîâíåì äîñòóïà 5 è âûøå. @@ -1664,9 +1664,11 @@ CHAN_INVITE_SUCCESS # UNBAN responses CHAN_UNBAN_SYNTAX - UNBAN kanaladý + UNBAN kanaladý [name] CHAN_UNBANNED %s kanalýndaki banýnýz kaldýrýldý. +CHAN_UNBANNED_OTHER + %s has been unbanned from %s. # TOPIC responses CHAN_TOPIC_SYNTAX @@ -4218,7 +4220,7 @@ CHAN_HELP_CMD_OP CHAN_HELP_CMD_TOPIC TOPIC Manipulate the topic of the specified channel CHAN_HELP_CMD_UNBAN - UNBAN Remove all bans preventing you from entering a channel + UNBAN Remove all bans preventing a user from entering a channel CHAN_HELP_CMD_VOICE VOICE Voices a selected nick on a channel CHAN_HELP_CMD_VOP @@ -4977,10 +4979,10 @@ CHAN_HELP_INVITE üzeri olanlar kullanabilir. CHAN_HELP_UNBAN - Kullanýmý: UNBAN kanaladý + Kullanýmý: UNBAN kanaladý [nick] - %S'e sizin kanala girmenizi engelleyen tüm banlarý kaldýrmasýný - söyler. + Tells %S to remove all bans preventing you or the given + user from entering the given channel. Varsayýlan olarak, AOP lar ile 5 ve üzeri access seviyesi olanlar kullanabilir. diff --git a/src/core/cs_ban.c b/src/core/cs_ban.c index f6fb4f092..62d69724e 100644 --- a/src/core/cs_ban.c +++ b/src/core/cs_ban.c @@ -105,54 +105,6 @@ class CommandCSBan : public Command }; - -class CommandCSUnban : public Command -{ - public: - CommandCSUnban() : Command("UNBAN", 1, 1) - { - - } - - CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) - { - const char *chan = params[0].c_str(); - Channel *c; - ChannelInfo *ci; - - if (!(c = findchan(chan))) - { - notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); - return MOD_CONT; - } - - ci = c->ci; - - if (!check_access(u, ci, CA_UNBAN)) - { - notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); - return MOD_CONT; - } - - common_unban(ci, u->nick); - notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED, chan); - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - notice_help(Config.s_ChanServ, u, CHAN_HELP_UNBAN); - return true; - } - - void OnSyntaxError(User *u, const ci::string &subcommand) - { - syntax_error(Config.s_ChanServ, u, "UNBAN", CHAN_UNBAN_SYNTAX); - } -}; - - - class CSBan : public Module { public: @@ -163,14 +115,12 @@ class CSBan : public Module this->SetType(CORE); this->AddCommand(CHANSERV, new CommandCSBan("BAN")); this->AddCommand(CHANSERV, new CommandCSBan("KB")); - this->AddCommand(CHANSERV, new CommandCSUnban()); ModuleManager::Attach(I_OnChanServHelp, this); } void OnChanServHelp(User *u) { notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_BAN); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_UNBAN); } }; diff --git a/src/core/cs_unban.c b/src/core/cs_unban.c new file mode 100644 index 000000000..2217bfa07 --- /dev/null +++ b/src/core/cs_unban.c @@ -0,0 +1,94 @@ +/* ChanServ core functions + * + * (C) 2003-2009 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandCSUnban : public Command +{ + public: + CommandCSUnban() : Command("UNBAN", 1, 2) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + const char *chan = params[0].c_str(); + Channel *c; + User *u2; + + if (!(c = findchan(chan))) + { + notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); + return MOD_CONT; + } + + if (!check_access(u, c->ci, CA_UNBAN)) + { + notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); + return MOD_CONT; + } + + u2 = u; + if (params.size() > 1) + u2 = finduser(params[1].c_str()); + + if (!u2) + { + notice_lang(Config.s_ChanServ, u, NICK_X_NOT_IN_USE, params[1].c_str()); + return MOD_CONT; + } + + common_unban(c->ci, u2->nick); + if (u2 == u) + notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED, c->name); + else + notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED_OTHER, u2->nick, c->name); + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + notice_help(Config.s_ChanServ, u, CHAN_HELP_UNBAN); + return true; + } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + syntax_error(Config.s_ChanServ, u, "UNBAN", CHAN_UNBAN_SYNTAX); + } +}; + +class CSUnban : public Module +{ + public: + CSUnban(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + this->AddCommand(CHANSERV, new CommandCSUnban()); + + ModuleManager::Attach(I_OnChanServHelp, this); + } + + void OnChanServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_UNBAN); + } +}; + +MODULE_INIT(CSUnban) + |