diff options
author | Adam <Adam@anope.org> | 2010-11-22 13:50:08 -0600 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-12 19:36:18 -0500 |
commit | 9870ee04ddfe0c6c9875b16641109d0f6585c706 (patch) | |
tree | bfdf02e98da39d94a323115c5b87b2a90be86cae | |
parent | 1a286397e36b9442e43f67584e026f321a10d552 (diff) |
Removed some unused code paths in some of the modules
-rw-r--r-- | include/language.h | 4 | ||||
-rw-r--r-- | modules/core/cs_forbid.cpp | 8 | ||||
-rw-r--r-- | modules/core/cs_suspend.cpp | 70 | ||||
-rw-r--r-- | modules/core/ns_forbid.cpp | 50 | ||||
-rw-r--r-- | modules/core/ns_group.cpp | 35 | ||||
-rw-r--r-- | modules/core/ns_register.cpp | 12 | ||||
-rw-r--r-- | modules/core/ns_saset.cpp | 3 | ||||
-rw-r--r-- | modules/core/ns_set.cpp | 3 | ||||
-rw-r--r-- | src/language.cpp | 8 |
9 files changed, 64 insertions, 129 deletions
diff --git a/include/language.h b/include/language.h index dc365df9c..ec3595060 100644 --- a/include/language.h +++ b/include/language.h @@ -87,7 +87,6 @@ enum LanguageString NICK_REG_DELAY, NICK_GROUP_SYNTAX, NICK_GROUP_DISABLED, - NICK_GROUP_FAILED, NICK_GROUP_PLEASE_WAIT, NICK_GROUP_CHANGE_DISABLED, NICK_GROUP_SAME, @@ -251,7 +250,6 @@ enum LanguageString NICK_FORBID_SYNTAX, NICK_FORBID_SYNTAX_REASON, NICK_FORBID_SUCCEEDED, - NICK_FORBID_FAILED, NICK_REQUESTED, NICK_REG_RESENT, NICK_REG_UNABLE, @@ -568,12 +566,10 @@ enum LanguageString CHAN_FORBID_SYNTAX, CHAN_FORBID_SYNTAX_REASON, CHAN_FORBID_SUCCEEDED, - CHAN_FORBID_FAILED, CHAN_FORBID_REASON, CHAN_SUSPEND_SYNTAX, CHAN_SUSPEND_SYNTAX_REASON, CHAN_SUSPEND_SUCCEEDED, - CHAN_SUSPEND_FAILED, CHAN_SUSPEND_REASON, CHAN_UNSUSPEND_SYNTAX, CHAN_UNSUSPEND_ERROR, diff --git a/modules/core/cs_forbid.cpp b/modules/core/cs_forbid.cpp index 25fd90868..14f35b57c 100644 --- a/modules/core/cs_forbid.cpp +++ b/modules/core/cs_forbid.cpp @@ -51,14 +51,6 @@ class CommandCSForbid : public Command delete ci; ci = new ChannelInfo(chan); - if (!ci) - { - // this cant happen? - //Alog() << Config->s_ChanServ << ": Valid FORBID for " << ci->name << " by " << u->nick << " failed"; - u->SendMessage(ChanServ, CHAN_FORBID_FAILED, chan.c_str()); - return MOD_CONT; - } - ci->SetFlag(CI_FORBIDDEN); ci->forbidby = u->nick; ci->forbidreason = reason; diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp index 37d088c2d..085ac6a65 100644 --- a/modules/core/cs_suspend.cpp +++ b/modules/core/cs_suspend.cpp @@ -51,40 +51,32 @@ class CommandCSSuspend : public Command if (readonly) u->SendMessage(ChanServ, READ_ONLY_MODE); - if (ci) - { - ci->SetFlag(CI_SUSPENDED); - ci->forbidby = u->nick; - if (!reason.empty()) - ci->forbidreason = reason; + ci->SetFlag(CI_SUSPENDED); + ci->forbidby = u->nick; + if (!reason.empty()) + ci->forbidreason = reason; - if ((c = findchan(ci->name))) + if ((c = findchan(ci->name))) + { + for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) { - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) - { - UserContainer *uc = *it++; + UserContainer *uc = *it++; - if (is_oper(uc->user)) - continue; + if (is_oper(uc->user)) + continue; - c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), CHAN_SUSPEND_REASON).c_str()); - } + c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), CHAN_SUSPEND_REASON).c_str()); } + } - if (Config->WallForbid) - ircdproto->SendGlobops(ChanServ, "\2%s\2 used SUSPEND on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); + if (Config->WallForbid) + ircdproto->SendGlobops(ChanServ, "\2%s\2 used SUSPEND on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); - Log(LOG_ADMIN, u, this, ci) << (!reason.empty() ? reason : "No reason"); - u->SendMessage(ChanServ, CHAN_SUSPEND_SUCCEEDED, chan.c_str()); + Log(LOG_ADMIN, u, this, ci) << (!reason.empty() ? reason : "No reason"); + u->SendMessage(ChanServ, CHAN_SUSPEND_SUCCEEDED, chan.c_str()); + + FOREACH_MOD(I_OnChanSuspend, OnChanSuspend(ci)); - FOREACH_MOD(I_OnChanSuspend, OnChanSuspend(ci)); - } - else - { - // cant happen? - //Alog() << Config->s_ChanServ << ": Valid SUSPEND for " << ci->name << " by " << u->GetMask() << " failed"; - u->SendMessage(ChanServ, CHAN_SUSPEND_FAILED, chan.c_str()); - } return MOD_CONT; } @@ -133,27 +125,19 @@ class CommandCSUnSuspend : public Command return MOD_CONT; } - if (ci) - { - Log(LOG_ADMIN, u, this, ci) << " was suspended for: " << (!ci->forbidreason.empty() ? ci->forbidreason : "No reason"); + Log(LOG_ADMIN, u, this, ci) << " was suspended for: " << (!ci->forbidreason.empty() ? ci->forbidreason : "No reason"); - ci->UnsetFlag(CI_SUSPENDED); - ci->forbidreason.clear(); - ci->forbidby.clear(); + ci->UnsetFlag(CI_SUSPENDED); + ci->forbidreason.clear(); + ci->forbidby.clear(); - if (Config->WallForbid) - ircdproto->SendGlobops(ChanServ, "\2%s\2 used UNSUSPEND on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); + if (Config->WallForbid) + ircdproto->SendGlobops(ChanServ, "\2%s\2 used UNSUSPEND on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); - u->SendMessage(ChanServ, CHAN_UNSUSPEND_SUCCEEDED, chan.c_str()); + u->SendMessage(ChanServ, CHAN_UNSUSPEND_SUCCEEDED, chan.c_str()); + + FOREACH_MOD(I_OnChanUnsuspend, OnChanUnsuspend(ci)); - FOREACH_MOD(I_OnChanUnsuspend, OnChanUnsuspend(ci)); - } - else - { - // cant happen ? - //Alog() << Config->s_ChanServ << ": Valid UNSUSPEND for " << chan << " by " << u->nick << " failed"; - u->SendMessage(ChanServ, CHAN_UNSUSPEND_FAILED, chan.c_str()); - } return MOD_CONT; } diff --git a/modules/core/ns_forbid.cpp b/modules/core/ns_forbid.cpp index c54392289..ab401b1a8 100644 --- a/modules/core/ns_forbid.cpp +++ b/modules/core/ns_forbid.cpp @@ -52,41 +52,33 @@ class CommandNSForbid : public Command NickCore *nc = new NickCore(nick); nc->SetFlag(NI_FORBIDDEN); na = new NickAlias(nick, nc); - if (na) - { - na->SetFlag(NS_FORBIDDEN); - na->last_usermask = u->nick; - if (!reason.empty()) - na->last_realname = reason; + na->SetFlag(NS_FORBIDDEN); + na->last_usermask = u->nick; + if (!reason.empty()) + na->last_realname = reason; - User *curr = finduser(na->nick); + User *curr = finduser(na->nick); - if (curr) - { - curr->SendMessage(NickServ, FORCENICKCHANGE_NOW); - curr->Collide(na); - } + if (curr) + { + curr->SendMessage(NickServ, FORCENICKCHANGE_NOW); + curr->Collide(na); + } - if (ircd->sqline) - { - XLine x(na->nick, !reason.empty() ? reason : "Forbidden"); - ircdproto->SendSQLine(&x); - } + if (ircd->sqline) + { + XLine x(na->nick, !reason.empty() ? reason : "Forbidden"); + ircdproto->SendSQLine(&x); + } - if (Config->WallForbid) - ircdproto->SendGlobops(NickServ, "\2%s\2 used FORBID on \2%s\2", u->nick.c_str(), nick.c_str()); + if (Config->WallForbid) + ircdproto->SendGlobops(NickServ, "\2%s\2 used FORBID on \2%s\2", u->nick.c_str(), nick.c_str()); - Log(LOG_ADMIN, u, this) << "to forbid nick " << nick; - u->SendMessage(NickServ, NICK_FORBID_SUCCEEDED, nick.c_str()); + Log(LOG_ADMIN, u, this) << "to forbid nick " << nick; + u->SendMessage(NickServ, NICK_FORBID_SUCCEEDED, nick.c_str()); + + FOREACH_MOD(I_OnNickForbidden, OnNickForbidden(na)); - FOREACH_MOD(I_OnNickForbidden, OnNickForbidden(na)); - } - else - { - // XXX cant happen ? - //Alog() << Config->s_NickServ << ": Valid FORBID for " << nick << " by " << u->nick << " failed"; - u->SendMessage(NickServ, NICK_FORBID_FAILED, nick.c_str()); - } return MOD_CONT; } diff --git a/modules/core/ns_group.cpp b/modules/core/ns_group.cpp index 44f13a202..59d7ac8e7 100644 --- a/modules/core/ns_group.cpp +++ b/modules/core/ns_group.cpp @@ -61,7 +61,7 @@ class CommandNSGroup : public Command u->SendMessage(NickServ, NICK_GROUP_PLEASE_WAIT, (Config->NSRegDelay + u->lastnickreg) - Anope::CurTime); else if (u->Account() && u->Account()->HasFlag(NI_SUSPENDED)) { - //Alog() << Config->s_NickServ << ": " << u->GetMask() << " tried to use GROUP from SUSPENDED nick " << target->nick; + Log(NickServ) << NickServ << u->GetMask() << " tried to use GROUP from SUSPENDED nick " << target->nick; u->SendMessage(NickServ, NICK_X_SUSPENDED, u->nick.c_str()); } else if (target && target->nc->HasFlag(NI_SUSPENDED)) @@ -110,31 +110,22 @@ class CommandNSGroup : public Command na = new NickAlias(u->nick, target->nc); - if (na) - { - Anope::string last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost(); - na->last_usermask = last_usermask; - na->last_realname = u->realname; - na->time_registered = na->last_seen = Anope::CurTime; + Anope::string last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost(); + na->last_usermask = last_usermask; + na->last_realname = u->realname; + na->time_registered = na->last_seen = Anope::CurTime; - u->Login(na->nc); - FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target)); - ircdproto->SetAutoIdentificationToken(u); - u->SetMode(NickServ, UMODE_REGISTERED); + u->Login(na->nc); + FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target)); + ircdproto->SetAutoIdentificationToken(u); + u->SetMode(NickServ, UMODE_REGISTERED); - Log(LOG_COMMAND, u, this) << "makes " << u->nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")"; - u->SendMessage(NickServ, NICK_GROUP_JOINED, target->nick.c_str()); + Log(LOG_COMMAND, u, this) << "makes " << u->nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")"; + u->SendMessage(NickServ, NICK_GROUP_JOINED, target->nick.c_str()); - u->lastnickreg = Anope::CurTime; + u->lastnickreg = Anope::CurTime; - check_memos(u); - } - else - { - // XXX not possible? - //Alog() << Config->s_NickServ << ": makealias(" << u->nick << ") failed"; - u->SendMessage(NickServ, NICK_GROUP_FAILED); - } + check_memos(u); } } return MOD_CONT; diff --git a/modules/core/ns_register.cpp b/modules/core/ns_register.cpp index 4a1f74e9d..f0304d119 100644 --- a/modules/core/ns_register.cpp +++ b/modules/core/ns_register.cpp @@ -21,15 +21,6 @@ class CommandNSConfirm : public Command CommandReturn ActuallyConfirmNick(User *u, NickRequest *nr, bool force) { NickAlias *na = new NickAlias(nr->nick, new NickCore(nr->nick)); - - if (!na) - { - // XXX - //Alog() << Config->s_NickServ << ": makenick(" << u->nick << ") failed"; - u->SendMessage(NickServ, NICK_REGISTRATION_FAILED); - return MOD_CONT; - } - Anope::string tmp_pass; na->nc->pass = nr->password; @@ -251,8 +242,7 @@ class CommandNSRegister : public CommandNSConfirm /* i.e. there's already such a nick regged */ if (na->HasFlag(NS_FORBIDDEN)) { - // XXX - //Alog() << Config->s_NickServ << ": " << u->GetIdent() << "@" << u->host << " tried to register FORBIDden nick " << u->nick; + Log(NickServ) << u->GetMask() << " tried to register FORBIDden nick " << u->nick; u->SendMessage(NickServ, NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); } else diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp index f3ca83909..d91bdd41d 100644 --- a/modules/core/ns_saset.cpp +++ b/modules/core/ns_saset.cpp @@ -199,8 +199,7 @@ class CommandNSSASetPassword : public Command if (enc_encrypt(params[1], nc->pass)) { - // XXX - //Alog() << Config->s_NickServ << ": Failed to encrypt password for " << nc->display << " (saset)"; + Log(NickServ) << "Failed to encrypt password for " << nc->display << " (saset)"; u->SendMessage(NickServ, NICK_SASET_PASSWORD_FAILED, nc->display.c_str()); return MOD_CONT; } diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp index a8a08d3cb..f5cc9a2d3 100644 --- a/modules/core/ns_set.cpp +++ b/modules/core/ns_set.cpp @@ -180,8 +180,7 @@ class CommandNSSetPassword : public Command if (enc_encrypt(param, u->Account()->pass) < 0) { - // XXX ? - //Alog() << Config->s_NickServ << ": Failed to encrypt password for " << u->Account()->display << " (set)"; + Log(NickServ) << "Failed to encrypt password for " << u->Account()->display << " (set)"; u->SendMessage(NickServ, NICK_SASET_PASSWORD_FAILED); return MOD_CONT; } diff --git a/src/language.cpp b/src/language.cpp index 1a42527e9..7554421f0 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -315,8 +315,6 @@ const char *const language_strings[LANG_STRING_COUNT] = { _("GROUP target password"), /* NICK_GROUP_DISABLED */ _("Sorry, nickname grouping is temporarily disabled."), - /* NICK_GROUP_FAILED */ - _("Sorry, grouping failed."), /* NICK_GROUP_PLEASE_WAIT */ _("Please wait %d seconds before using the GROUP command again."), /* NICK_GROUP_CHANGE_DISABLED */ @@ -666,8 +664,6 @@ const char *const language_strings[LANG_STRING_COUNT] = { _("FORBID nickname reason"), /* NICK_FORBID_SUCCEEDED */ _("Nick %s is now forbidden."), - /* NICK_FORBID_FAILED */ - _("Couldn't forbid nick %s!"), /* NICK_REQUESTED */ _("This nick has already been requested, please check your e-mail address for the pass code"), /* NICK_REG_RESENT */ @@ -1323,8 +1319,6 @@ const char *const language_strings[LANG_STRING_COUNT] = { _("FORBID channel reason"), /* CHAN_FORBID_SUCCEEDED */ _("Channel %s is now forbidden."), - /* CHAN_FORBID_FAILED */ - _("Couldn't forbid channel %s!"), /* CHAN_FORBID_REASON */ _("This channel has been forbidden."), /* CHAN_SUSPEND_SYNTAX */ @@ -1333,8 +1327,6 @@ const char *const language_strings[LANG_STRING_COUNT] = { _("SUSPEND channel reason"), /* CHAN_SUSPEND_SUCCEEDED */ _("Channel %s is now suspended."), - /* CHAN_SUSPEND_FAILED */ - _("Couldn't suspended channel %s!"), /* CHAN_SUSPEND_REASON */ _("This channel has been suspended."), /* CHAN_UNSUSPEND_SYNTAX */ |