diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-17 02:56:05 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-17 02:56:05 +0000 |
commit | e78066213a7fd58ab20271fae145d3f52a7191ce (patch) | |
tree | 753bb50d6c9fc6140c34f123a72074622030ee20 | |
parent | 610dbf5c921698babff1dcb1d404e0fc46153254 (diff) |
Fix bug #1041, patch by Adam (with coding style tweaks by me), CS LOGOUT should work as expected now.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2174 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | lang/cat.l | 2 | ||||
-rw-r--r-- | lang/de.l | 2 | ||||
-rw-r--r-- | lang/en_us.l | 3 | ||||
-rw-r--r-- | lang/es.l | 2 | ||||
-rw-r--r-- | lang/fr.l | 2 | ||||
-rw-r--r-- | lang/gr.l | 2 | ||||
-rw-r--r-- | lang/hun.l | 2 | ||||
-rw-r--r-- | lang/it.l | 2 | ||||
-rw-r--r-- | lang/nl.l | 2 | ||||
-rw-r--r-- | lang/pl.l | 2 | ||||
-rw-r--r-- | lang/pt.l | 2 | ||||
-rw-r--r-- | lang/ru.l | 2 | ||||
-rw-r--r-- | lang/tr.l | 2 | ||||
-rw-r--r-- | src/core/cs_logout.c | 63 |
14 files changed, 62 insertions, 28 deletions
diff --git a/lang/cat.l b/lang/cat.l index 5761c87cc..96e1f927a 100644 --- a/lang/cat.l +++ b/lang/cat.l @@ -1117,6 +1117,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Tots els usuaris identificats han estat desconnectats del canal %s (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX @@ -1129,6 +1129,8 @@ CHAN_LOGOUT_SUCCEEDED Der User %s wurde vom Channel %s ausgeloggt. CHAN_LOGOUT_ALL_SUCCEEDED Alle identifizierten User wurden vom Channel ausgeloggt %s (except the channel founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX diff --git a/lang/en_us.l b/lang/en_us.l index 32dd938da..e36caed47 100644 --- a/lang/en_us.l +++ b/lang/en_us.l @@ -1094,6 +1094,9 @@ CHAN_LOGOUT_ALL_SUCCEEDED All users identified have been logged out of channel %s (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. + # DROP responses CHAN_DROP_SYNTAX @@ -1115,6 +1115,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Todos los usuarios identificados han sido desconectados del canal %s (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX @@ -1128,6 +1128,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Tous les utilisateurs identifiés au canal %s ne le sont plus (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX @@ -1115,6 +1115,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED ¼ëïé ïé ÷ñÞóôåò logged out áðü ôï êáíÜëé %s (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX diff --git a/lang/hun.l b/lang/hun.l index dec2d83e4..67cd450fa 100644 --- a/lang/hun.l +++ b/lang/hun.l @@ -1107,6 +1107,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Minden felhasználó kijelentkezett a %s csatornáról (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP válaszok CHAN_DROP_SYNTAX @@ -1105,6 +1105,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Tutti gli utenti non sono più identificati per il canale %s (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX @@ -1119,6 +1119,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Alle geidentificeerde gebruikers zijn uitgelogd van kanaal %s (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX @@ -1432,6 +1432,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Wylogowano zidentyfikowanych u¿ytkowników z kana³u %s (bez w³a¶ciciela). CHAN_LOGOUT_FOUNDER_FAILED Nie mo¿esz siê wylogowaæ z %s (jeste¶ w³a¶cicielem). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX @@ -1114,6 +1114,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Todos os usuários registrados foram desconectados do canal %s (except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX @@ -1084,6 +1084,8 @@ CHAN_IDENTIFY_SUCCEEDED Ïàðîëü ïðèíÿò, òåïåðü âàø óðîâåíü äîñòóïà íà êàíàëå %s - âëàäåëåö. CHAN_LOGOUT_FOUNDER_FAILED Âû íå ìîæåòå äåèäåíòèôèöèðîâàòü ñåáÿ îòíîñòèòåëüíî êàíàëà %s ò.ê. âû åãî ðåàëüíûé âëàäåëåö. +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # LOGOUT responses CHAN_LOGOUT_SYNTAX @@ -1122,6 +1122,8 @@ CHAN_LOGOUT_ALL_SUCCEEDED Tüm tanýmlý kullanýcýlar artýk %s kanalý tarafýndan tanýnmýyor (Except the channel founder). CHAN_LOGOUT_FOUNDER_FAILED You may not log out of %s (you are founder). +CHAN_LOGOUT_NOT_LOGGEDIN + %s was not logged into %s. # DROP responses CHAN_DROP_SYNTAX diff --git a/src/core/cs_logout.c b/src/core/cs_logout.c index 86bc25407..682a4b201 100644 --- a/src/core/cs_logout.c +++ b/src/core/cs_logout.c @@ -28,12 +28,12 @@ void myChanServHelp(User * u) class CommandCSLogout : public Command { private: - void make_unidentified(User * u, ChannelInfo * ci) + int make_unidentified(User *u, ChannelInfo *ci) { struct u_chaninfolist *uci; if (!u || !ci) - return; + return 0; for (uci = u->founder_chans; uci; uci = uci->next) { @@ -46,13 +46,16 @@ class CommandCSLogout : public Command else u->founder_chans = uci->next; delete uci; - break; + + return 1; } } + + return 0; } public: - CommandCSLogout() : Command("LOGOUT", 2, 2) + CommandCSLogout() : Command("LOGOUT", 1, 2) { } @@ -63,41 +66,41 @@ class CommandCSLogout : public Command const char *nick = params.size() > 1 ? params[1].c_str() : NULL; ChannelInfo *ci; User *u2 = NULL; + int is_admin = u->nc->HasCommand("chanserv/logout"); - if (!(ci = cs_findchan(chan))) - { + if (!is_admin && !nick) + this->OnSyntaxError(u); + else if (!(ci = cs_findchan(chan))) notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, chan); - } else if ((ci->flags & CI_FORBIDDEN)) - { notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, chan); - } else if (nick && !(u2 = finduser(nick))) - { notice_lang(s_ChanServ, u, NICK_X_NOT_IN_USE, nick); - } - else if (u2 != u && !is_real_founder(u, ci)) - { + else if (u2 != u && !is_real_founder(u, ci) && !is_admin) notice_lang(s_ChanServ, u, ACCESS_DENIED); - } else if (u2 == u && is_real_founder(u, ci)) - { /* Since founders can not logout we should tell them -katsklaw */ notice_lang(s_ChanServ, u, CHAN_LOGOUT_FOUNDER_FAILED, chan); - } - else { - if (u2) { - make_unidentified(u2, ci); - notice_lang(s_ChanServ, u, CHAN_LOGOUT_SUCCEEDED, nick, chan); - alog("%s: User %s!%s@%s has been logged out of channel %s.", - s_ChanServ, u2->nick, u2->GetIdent().c_str(), u2->host, chan); - } else { + else + { + if (u2) + { + if (make_unidentified(u2, ci)) + { + notice_lang(s_ChanServ, u, CHAN_LOGOUT_SUCCEEDED, nick, chan); + alog("%s: User %s!%s@%s has been logged out of channel %s.", s_ChanServ, u2->nick, u2->GetIdent().c_str(), u2->host, chan); + } + else + notice_lang(s_ChanServ, u, CHAN_LOGOUT_NOT_LOGGEDIN, nick, chan); + } + else + { int i; for (i = 0; i < 1024; i++) for (u2 = userlist[i]; u2; u2 = u2->next) make_unidentified(u2, ci); notice_lang(s_ChanServ, u, CHAN_LOGOUT_ALL_SUCCEEDED, chan); - alog("%s: All users identified have been logged out of channel %s.", s_ChanServ, chan); + alog("%s: User %s!%s@%s logged all identified users out of channel %s.", s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, chan); } } @@ -106,13 +109,19 @@ class CommandCSLogout : public Command bool OnHelp(User *u, const std::string &subcommand) { - notice_help(s_NickServ, u, CHAN_HELP_LOGOUT); + if (u->nc->HasCommand("chanserv/logout")) + notice_help(s_NickServ, u, CHAN_SERVADMIN_HELP_LOGOUT); + else + notice_help(s_NickServ, u, CHAN_HELP_LOGOUT); return true; } void OnSyntaxError(User *u) { - syntax_error(s_NickServ, u, "LOGOUT", CHAN_LOGOUT_SYNTAX); + if (u->nc->HasCommand("chanserv/logout")) + syntax_error(s_NickServ, u, "LOGOUT", CHAN_LOGOUT_SERVADMIN_SYNTAX); + else + syntax_error(s_NickServ, u, "LOGOUT", CHAN_LOGOUT_SYNTAX); } }; @@ -130,6 +139,4 @@ class CSLogout : public Module } }; - - MODULE_INIT("cs_logout", CSLogout) |