From 308070e01971b0cfaf77de20011f48ce4d6b5a1c Mon Sep 17 00:00:00 2001 From: Adam- Date: Thu, 4 Feb 2010 23:49:27 +0000 Subject: We now store a list of users using a NickCore in the NickCore, this prevents having to loop every user all the time to find them git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2780 5417fbe8-f217-4b02-8779-1006273d7864 --- include/account.h | 2 ++ include/extern.h | 1 - include/users.h | 22 ++++++++++++++-- src/channels.c | 8 +++--- src/chanserv.c | 26 +++++++++---------- src/commands.c | 8 +++--- src/core/bs_assign.c | 4 +-- src/core/bs_badwords.c | 2 +- src/core/bs_bot.c | 6 ++--- src/core/bs_botlist.c | 2 +- src/core/bs_info.c | 4 +-- src/core/bs_kick.c | 2 +- src/core/bs_set.c | 8 +++--- src/core/bs_unassign.c | 2 +- src/core/cs_access.c | 18 ++++++------- src/core/cs_akick.c | 2 +- src/core/cs_drop.c | 8 +++--- src/core/cs_forbid.c | 2 +- src/core/cs_getkey.c | 2 +- src/core/cs_help.c | 2 +- src/core/cs_info.c | 30 +++++++++++----------- src/core/cs_list.c | 2 +- src/core/cs_register.c | 6 ++--- src/core/cs_set.c | 8 +++--- src/core/cs_suspend.c | 2 +- src/core/cs_topic.c | 2 +- src/core/cs_xop.c | 14 +++++----- src/core/hs_group.c | 6 ++--- src/core/hs_on.c | 2 +- src/core/ms_cancel.c | 2 +- src/core/ms_check.c | 2 +- src/core/ms_del.c | 2 +- src/core/ms_info.c | 22 ++++++++-------- src/core/ms_list.c | 2 +- src/core/ms_read.c | 2 +- src/core/ms_rsend.c | 4 +-- src/core/ms_set.c | 38 +++++++++++++-------------- src/core/ns_access.c | 12 ++++----- src/core/ns_alist.c | 6 ++--- src/core/ns_drop.c | 8 +++--- src/core/ns_ghost.c | 2 +- src/core/ns_group.c | 15 +++++------ src/core/ns_help.c | 2 +- src/core/ns_identify.c | 16 ++++++------ src/core/ns_info.c | 14 +++++----- src/core/ns_list.c | 8 +++--- src/core/ns_logout.c | 12 ++++----- src/core/ns_recover.c | 4 +-- src/core/ns_register.c | 8 +++--- src/core/ns_release.c | 4 +-- src/core/ns_resetpass.c | 6 ++--- src/core/ns_saset.c | 4 +-- src/core/ns_sendpass.c | 2 +- src/core/ns_set.c | 30 +++++++++++----------- src/core/ns_status.c | 8 +++--- src/core/ns_suspend.c | 2 +- src/core/os_akill.c | 2 +- src/core/os_session.c | 2 +- src/core/os_sgline.c | 2 +- src/core/os_sqline.c | 2 +- src/core/os_staff.c | 2 +- src/core/os_szline.c | 2 +- src/language.c | 4 +-- src/mail.c | 2 +- src/memoserv.c | 19 +++++++------- src/modules.c | 8 +++--- src/modules/cs_enforce.c | 2 +- src/modules/hs_request.c | 4 +-- src/modules/ns_maxemail.c | 2 +- src/nickalias.cpp | 6 ++--- src/nickcore.cpp | 19 +++++--------- src/nickserv.c | 18 ++----------- src/protocol/bahamut.c | 6 ++--- src/protocol/inspircd11.c | 6 ++--- src/protocol/inspircd12.cpp | 6 ++--- src/protocol/ratbox.c | 6 ++--- src/protocol/unreal32.c | 6 ++--- src/servers.c | 2 +- src/users.c | 62 +++++++++++++++++++++++++++++++++++++-------- 79 files changed, 336 insertions(+), 294 deletions(-) diff --git a/include/account.h b/include/account.h index 02e6508d4..3f39c3b4a 100644 --- a/include/account.h +++ b/include/account.h @@ -122,6 +122,8 @@ class CoreExport NickCore : public Extensible, public Flags NickCore *next, *prev; + std::list Users; + char *display; /* How the nick is displayed */ std::string pass; /* Password of the nicks */ char *email; /* E-mail associated to the nick */ diff --git a/include/extern.h b/include/extern.h index 6c147897a..a4ed84ac1 100644 --- a/include/extern.h +++ b/include/extern.h @@ -385,7 +385,6 @@ E void ns_init(); E void nickserv(User * u, char *buf); E int validate_user(User * u); E void cancel_user(User * u); -E int nick_identified(User * u); E void expire_nicks(); E void expire_requests(); EI int ns_do_register(User * u); diff --git a/include/users.h b/include/users.h index dba200770..525df393b 100644 --- a/include/users.h +++ b/include/users.h @@ -30,6 +30,7 @@ class CoreExport User : public Extensible bool OnAccess; /* If the user is on the access list of the nick theyre on */ std::bitset<128> modes; /* Bitset of mode names the user has set on them */ std::map Params; /* Map of user modes and the params this user has */ + NickCore *nc; /* NickCore account the user is currently loggged in as */ public: // XXX: exposing a tiny bit too much User *next, *prev; @@ -45,8 +46,6 @@ class CoreExport User : public Extensible time_t timestamp; /* Timestamp of the nick */ time_t my_signon; /* When did _we_ see the user? */ - NickCore *nc; - int isSuperAdmin; /* is SuperAdmin on or off? */ /* Channels the user is in */ @@ -155,6 +154,25 @@ class CoreExport User : public Extensible */ void AutoID(const char *acc); + /** Login the user to a NickCore + * @param core The account the user is useing + */ + void Login(NickCore *core); + + /** Logout the user + */ + void Logout(); + + /** Get the account the user is logged in using + * @reurn The account or NULL + */ + NickCore *Account() const; + + /** Check if the user is identified for their nick + * @return true or false + */ + const bool IsIdentified() const; + /** Check if the user is recognized for their nick (on the nicks access list) * @return true or false */ diff --git a/src/channels.c b/src/channels.c index a6f998f65..4f764b8fc 100644 --- a/src/channels.c +++ b/src/channels.c @@ -166,7 +166,7 @@ void Channel::JoinUser(User *user) if (Config.s_BotServ && this->ci && this->ci->bi) { if (this->users.size() >= Config.BSMinUsers && (this->ci->botflags.HasFlag(BS_GREET)) - && user->nc && user->nc->greet && check_access(user, this->ci, CA_GREET)) + && user->Account() && user->Account()->greet && check_access(user, this->ci, CA_GREET)) { /* Only display the greet if the main uplink we're connected * to has synced, or we'll get greet-floods when the net @@ -174,7 +174,7 @@ void Channel::JoinUser(User *user) */ if (is_sync(user->server)) { - ircdproto->SendPrivmsg(this->ci->bi, this->name.c_str(), "[%s] %s", user->nc->display, user->nc->greet); + ircdproto->SendPrivmsg(this->ci->bi, this->name.c_str(), "[%s] %s", user->Account()->display, user->Account()->greet); this->ci->bi->lastmsg = time(NULL); } } @@ -1138,7 +1138,7 @@ User *nc_on_chan(Channel * c, NickCore * nc) { UserContainer *uc = *it; - if (uc->user->nc == nc) + if (uc->user->Account() == nc) return uc->user; } return NULL; @@ -1474,7 +1474,7 @@ void chan_set_correct_modes(User * user, Channel * c, int give_modes) Alog(LOG_DEBUG) << "Setting correct user modes for " << user->nick << " on " << c->name << " (" << (give_modes ? "" : "not ") << "giving modes)"; - if (give_modes && !get_ignore(user->nick.c_str()) && (!user->nc || !user->nc->HasFlag(NI_AUTOOP))) + if (give_modes && !get_ignore(user->nick.c_str()) && (!user->Account() || !user->Account()->HasFlag(NI_AUTOOP))) { if (owner && check_access(user, ci, CA_AUTOOWNER)) c->SetMode(NULL, CMODE_OWNER, user->nick); diff --git a/src/chanserv.c b/src/chanserv.c index deb0f139c..fd69ec8d0 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -520,7 +520,7 @@ int check_should_op(User * user, char *chan) if (!ci || (ci->HasFlag(CI_FORBIDDEN)) || *chan == '+') return 0; - if ((ci->HasFlag(CI_SECURE)) && !nick_identified(user)) + if ((ci->HasFlag(CI_SECURE)) && !user->IsIdentified()) return 0; if (check_access(user, ci, CA_AUTOOP)) @@ -544,7 +544,7 @@ int check_should_voice(User * user, char *chan) if (!ci || (ci->HasFlag(CI_FORBIDDEN)) || *chan == '+') return 0; - if ((ci->HasFlag(CI_SECURE)) && !nick_identified(user)) + if ((ci->HasFlag(CI_SECURE)) && !user->IsIdentified()) return 0; if (check_access(user, ci, CA_AUTOVOICE)) @@ -648,8 +648,8 @@ bool ChannelInfo::CheckKick(User *user) do_kick = true; } - if (user->nc || user->IsRecognized()) - nc = user->nc; + if (user->Account() || user->IsRecognized()) + nc = user->Account(); else nc = NULL; @@ -1084,8 +1084,8 @@ bool IsFounder(User *user, ChannelInfo *ci) if (IsRealFounder(user, ci)) return true; - if (user->nc) - access = ci->GetAccess(user->nc); + if (user->Account()) + access = ci->GetAccess(user->Account()); else { NickAlias *na = findnick(user->nick); @@ -1094,7 +1094,7 @@ bool IsFounder(User *user, ChannelInfo *ci) } /* If they're QOP+ and theyre identified or theyre recognized and the channel isn't secure */ - if (access && access->level >= ACCESS_QOP && (user->nc || (user->IsRecognized() && !(ci->HasFlag(CI_SECURE))))) + if (access && access->level >= ACCESS_QOP && (user->Account() || (user->IsRecognized() && !(ci->HasFlag(CI_SECURE))))) return true; return false; @@ -1113,7 +1113,7 @@ bool IsRealFounder(User *user, ChannelInfo *ci) if (user->isSuperAdmin) return true; - if (user->nc && user->nc == ci->founder) + if (user->Account() && user->Account() == ci->founder) return true; return false; @@ -1141,9 +1141,9 @@ int get_access(User *user, ChannelInfo *ci) if (IsFounder(user, ci)) return ACCESS_FOUNDER; - if (nick_identified(user)) + if (user->IsIdentified()) { - access = ci->GetAccess(user->nc); + access = ci->GetAccess(user->Account()); if (access) return access->level; } @@ -1165,12 +1165,12 @@ void update_cs_lastseen(User * user, ChannelInfo * ci) { ChanAccess *access; - if (!ci || !user || !user->nc) + if (!ci || !user || !user->Account()) return; - if (IsFounder(user, ci) || nick_identified(user) + if (IsFounder(user, ci) || user->IsIdentified() || (user->IsRecognized() && !ci->HasFlag(CI_SECURE))) - if ((access = ci->GetAccess(user->nc))) + if ((access = ci->GetAccess(user->Account()))) access->last_seen = time(NULL); } diff --git a/src/commands.c b/src/commands.c index 4e3b36e7a..ba97c931a 100644 --- a/src/commands.c +++ b/src/commands.c @@ -68,7 +68,7 @@ void mod_run_cmd(const std::string &service, User * u, CommandHash * cmdTable[], if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED)) { // Command requires registered users only - if (!nick_identified(u)) + if (!u->IsIdentified()) { notice_lang(service, u, NICK_IDENTIFY_REQUIRED, Config.s_NickServ); Alog() << "Access denied for unregistered user " << u->nick << " with service " << service << " and command " << cmd; @@ -150,7 +150,7 @@ void mod_run_cmd(const std::string &service, User * u, CommandHash * cmdTable[], // If the command requires a permission, and they aren't registered or don't have the required perm, DENIED if (!c->permission.empty()) { - if (!u->nc->HasCommand(c->permission)) + if (!u->Account()->HasCommand(c->permission)) { notice_lang(service, u, ACCESS_DENIED); Alog() << "Access denied for user " << u->nick << " with service " << service << " and command " << cmd; @@ -198,10 +198,10 @@ void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[], const char notice_lang(service, u, COMMAND_REQUIRES_PERM, c->permission.c_str()); /* User isn't identified and needs to be to use this command */ - if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !nick_identified(u)) + if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->IsIdentified()) notice_lang(service, u, COMMAND_IDENTIFY_REQUIRED); /* User doesn't have the proper permission to use this command */ - else if (!c->permission.empty() && (!u->nc || (!u->nc->HasCommand(c->permission)))) + else if (!c->permission.empty() && (!u->Account() || (!u->Account()->HasCommand(c->permission)))) notice_lang(service, u, COMMAND_CANNOT_USE); /* User can use this command */ else diff --git a/src/core/bs_assign.c b/src/core/bs_assign.c index af2ad87f9..d518a6a9b 100644 --- a/src/core/bs_assign.c +++ b/src/core/bs_assign.c @@ -43,13 +43,13 @@ class CommandBSAssign : public Command ci = cs_findchan(chan); - if (ci->botflags.HasFlag(BS_NOBOT) || (!check_access(u, ci, CA_ASSIGN) && !u->nc->HasPriv("botserv/administration"))) + if (ci->botflags.HasFlag(BS_NOBOT) || (!check_access(u, ci, CA_ASSIGN) && !u->Account()->HasPriv("botserv/administration"))) { notice_lang(Config.s_BotServ, u, ACCESS_DENIED); return MOD_CONT; } - if (bi->HasFlag(BI_PRIVATE) && !u->nc->HasCommand("botserv/assign/private")) + if (bi->HasFlag(BI_PRIVATE) && !u->Account()->HasCommand("botserv/assign/private")) { notice_lang(Config.s_BotServ, u, ACCESS_DENIED); return MOD_CONT; diff --git a/src/core/bs_badwords.c b/src/core/bs_badwords.c index e71438183..9c13560ad 100644 --- a/src/core/bs_badwords.c +++ b/src/core/bs_badwords.c @@ -184,7 +184,7 @@ class CommandBSBadwords : public Command ci = cs_findchan(chan); - if (!check_access(u, ci, CA_BADWORDS) && (!need_args || !u->nc->HasPriv("botserv/administration"))) + if (!check_access(u, ci, CA_BADWORDS) && (!need_args || !u->Account()->HasPriv("botserv/administration"))) { notice_lang(Config.s_BotServ, u, ACCESS_DENIED); return MOD_CONT; diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c index 56be53b33..cfaafac23 100644 --- a/src/core/bs_bot.c +++ b/src/core/bs_bot.c @@ -334,7 +334,7 @@ class CommandBSBot : public Command if (cmd == "ADD") { // ADD nick user host real - 5 - if (!u->nc->HasCommand("botserv/bot/add")) + if (!u->Account()->HasCommand("botserv/bot/add")) { notice_lang(Config.s_BotServ, u, ACCESS_DENIED); return MOD_CONT; @@ -357,7 +357,7 @@ class CommandBSBot : public Command { // CHANGE oldn newn user host real - 6 // but only oldn and newn are required - if (!u->nc->HasCommand("botserv/bot/change")) + if (!u->Account()->HasCommand("botserv/bot/change")) { notice_lang(Config.s_BotServ, u, ACCESS_DENIED); return MOD_CONT; @@ -374,7 +374,7 @@ class CommandBSBot : public Command else if (cmd == "DEL") { // DEL nick - if (!u->nc->HasCommand("botserv/bot/del")) + if (!u->Account()->HasCommand("botserv/bot/del")) { notice_lang(Config.s_BotServ, u, ACCESS_DENIED); return MOD_CONT; diff --git a/src/core/bs_botlist.c b/src/core/bs_botlist.c index 8e3ca925a..fbae61911 100644 --- a/src/core/bs_botlist.c +++ b/src/core/bs_botlist.c @@ -43,7 +43,7 @@ class CommandBSBotList : public Command } } - if (u->nc->HasCommand("botserv/botlist") && count < nbots) { + if (u->Account()->HasCommand("botserv/botlist") && count < nbots) { notice_lang(Config.s_BotServ, u, BOT_BOTLIST_PRIVATE_HEADER); for (i = 0; i < 256; i++) { diff --git a/src/core/bs_info.c b/src/core/bs_info.c index 8d1a00c9a..ac4c21f92 100644 --- a/src/core/bs_info.c +++ b/src/core/bs_info.c @@ -75,12 +75,12 @@ class CommandBSInfo : public Command notice_lang(Config.s_BotServ, u, BOT_INFO_BOT_OPTIONS, getstring(u, (bi->HasFlag(BI_PRIVATE) ? BOT_INFO_OPT_PRIVATE : BOT_INFO_OPT_NONE))); notice_lang(Config.s_BotServ, u, BOT_INFO_BOT_USAGE, bi->chancount); - if (u->nc->HasPriv("botserv/administration")) + if (u->Account()->HasPriv("botserv/administration")) this->send_bot_channels(u, bi); } else if ((ci = cs_findchan(query))) { - if (!IsFounder(u, ci) && !u->nc->HasPriv("botserv/administration")) + if (!IsFounder(u, ci) && !u->Account()->HasPriv("botserv/administration")) { notice_lang(Config.s_BotServ, u, ACCESS_DENIED); return MOD_CONT; diff --git a/src/core/bs_kick.c b/src/core/bs_kick.c index be0815a29..7bce96b56 100644 --- a/src/core/bs_kick.c +++ b/src/core/bs_kick.c @@ -37,7 +37,7 @@ class CommandBSKick : public Command syntax_error(Config.s_BotServ, u, "KICK", BOT_KICK_SYNTAX); else if (value != "ON" && value != "OFF") syntax_error(Config.s_BotServ, u, "KICK", BOT_KICK_SYNTAX); - else if (!check_access(u, ci, CA_SET) && !u->nc->HasPriv("botserv/administration")) + else if (!check_access(u, ci, CA_SET) && !u->Account()->HasPriv("botserv/administration")) notice_lang(Config.s_BotServ, u, ACCESS_DENIED); else if (!ci->bi) notice_help(Config.s_BotServ, u, BOT_NOT_ASSIGNED); diff --git a/src/core/bs_set.c b/src/core/bs_set.c index b8cc3ae12..69c6612f7 100644 --- a/src/core/bs_set.c +++ b/src/core/bs_set.c @@ -36,7 +36,7 @@ class CommandBSSet : public Command return MOD_CONT; } - if (u->nc->HasCommand("botserv/set/private") && option == "PRIVATE") + if (u->Account()->HasCommand("botserv/set/private") && option == "PRIVATE") { BotInfo *bi; @@ -63,7 +63,7 @@ class CommandBSSet : public Command return MOD_CONT; } else if (!(ci = cs_findchan(chan))) notice_lang(Config.s_BotServ, u, CHAN_X_NOT_REGISTERED, chan); - else if (!u->nc->HasPriv("botserv/administration") && !check_access(u, ci, CA_SET)) + else if (!u->Account()->HasPriv("botserv/administration") && !check_access(u, ci, CA_SET)) notice_lang(Config.s_BotServ, u, ACCESS_DENIED); else { if (option == "DONTKICKOPS") { @@ -114,7 +114,7 @@ class CommandBSSet : public Command syntax_error(Config.s_BotServ, u, "SET GREET", BOT_SET_GREET_SYNTAX); } - } else if (u->nc->HasCommand("botserv/set/nobot") && option == "NOBOT") { + } else if (u->Account()->HasCommand("botserv/set/nobot") && option == "NOBOT") { if (value == "ON") { ci->botflags.SetFlag(BS_NOBOT); if (ci->bi) @@ -150,7 +150,7 @@ class CommandBSSet : public Command if (subcommand.empty()) { notice_help(Config.s_BotServ, u, BOT_HELP_SET); - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_BotServ, u, BOT_SERVADMIN_HELP_SET); } else if (subcommand == "DONTKICKOPS") diff --git a/src/core/bs_unassign.c b/src/core/bs_unassign.c index a29f0099f..0505b8ea6 100644 --- a/src/core/bs_unassign.c +++ b/src/core/bs_unassign.c @@ -30,7 +30,7 @@ class CommandBSUnassign : public Command if (readonly) notice_lang(Config.s_BotServ, u, BOT_ASSIGN_READONLY); - else if (!u->nc->HasPriv("botserv/administration") && !check_access(u, ci, CA_ASSIGN)) + else if (!u->Account()->HasPriv("botserv/administration") && !check_access(u, ci, CA_ASSIGN)) notice_lang(Config.s_BotServ, u, ACCESS_DENIED); else if (!ci->bi) notice_help(Config.s_BotServ, u, BOT_NOT_ASSIGNED); diff --git a/src/core/cs_access.c b/src/core/cs_access.c index 808141aa0..d26891d73 100644 --- a/src/core/cs_access.c +++ b/src/core/cs_access.c @@ -20,7 +20,7 @@ static int access_del(User * u, ChannelInfo *ci, ChanAccess * access, int *perm, char *nick; if (!access->in_use) return 0; - if (uacc <= access->level && !u->nc->HasPriv("chanserv/access/modify")) + if (uacc <= access->level && !u->Account()->HasPriv("chanserv/access/modify")) { (*perm)++; return 0; @@ -97,7 +97,7 @@ static int access_view(User *u, int index, ChannelInfo *ci, int *sent_header) } memset(&timebuf, 0, sizeof(timebuf)); - if (ci->c && u->nc && nc_on_chan(ci->c, u->nc)) + if (ci->c && u->Account() && nc_on_chan(ci->c, u->Account())) sprintf(timebuf, "Now"); else if (access->last_seen == 0) sprintf(timebuf, "Never"); @@ -163,9 +163,9 @@ class CommandCSAccess : public Command notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_XOP, Config.s_ChanServ); } else if (( - (is_list && !check_access(u, ci, CA_ACCESS_LIST) && !u->nc->HasCommand("chanserv/access/list")) + (is_list && !check_access(u, ci, CA_ACCESS_LIST) && !u->Account()->HasCommand("chanserv/access/list")) || - (!is_list && !check_access(u, ci, CA_ACCESS_CHANGE) && !u->nc->HasPriv("chanserv/access/modify")) + (!is_list && !check_access(u, ci, CA_ACCESS_CHANGE) && !u->Account()->HasPriv("chanserv/access/modify")) )) notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); else if (cmd == "ADD") @@ -179,7 +179,7 @@ class CommandCSAccess : public Command level = atoi(s); ulev = get_access(u, ci); - if (level >= ulev && !u->nc->HasPriv("chanserv/access/modify")) + if (level >= ulev && !u->Account()->HasPriv("chanserv/access/modify")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -213,7 +213,7 @@ class CommandCSAccess : public Command if (access) { /* Don't allow lowering from a level >= ulev */ - if (access->level >= ulev && !u->nc->HasPriv("chanserv/access/modify")) + if (access->level >= ulev && !u->Account()->HasPriv("chanserv/access/modify")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -305,7 +305,7 @@ class CommandCSAccess : public Command notice_lang(Config.s_ChanServ, u, CHAN_ACCESS_NOT_FOUND, nick, chan); return MOD_CONT; } - if (get_access(u, ci) <= access->level && !u->nc->HasPriv("chanserv/access/modify")) + if (get_access(u, ci) <= access->level && !u->Account()->HasPriv("chanserv/access/modify")) { deleted = 0; notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); @@ -396,7 +396,7 @@ class CommandCSAccess : public Command return MOD_CONT; } - if (!IsFounder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) + if (!IsFounder(u, ci) && !u->Account()->HasPriv("chanserv/access/modify")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -454,7 +454,7 @@ class CommandCSLevels : public Command this->OnSyntaxError(u, cmd); else if (ci->HasFlag(CI_XOP)) notice_lang(Config.s_ChanServ, u, CHAN_LEVELS_XOP); - else if (!IsFounder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) + else if (!IsFounder(u, ci) && !u->Account()->HasPriv("chanserv/access/modify")) notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); else if (cmd == "SET") { level = strtol(s, &error, 10); diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c index 2a45cd83c..355dd09ee 100644 --- a/src/core/cs_akick.c +++ b/src/core/cs_akick.c @@ -522,7 +522,7 @@ class CommandCSAKick : public Command if (mask.empty() && (cmd == "ADD" || cmd == "STICK" || cmd == "UNSTICK" || cmd == "DEL")) this->OnSyntaxError(u, cmd); - else if (!check_access(u, ci, CA_AKICK) && !u->nc->HasPriv("chanserv/access/modify")) + else if (!check_access(u, ci, CA_AKICK) && !u->Account()->HasPriv("chanserv/access/modify")) notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); else if (cmd != "LIST" && cmd != "VIEW" && cmd != "ENFORCE" && readonly) notice_lang(Config.s_ChanServ, u, CHAN_AKICK_DISABLED); diff --git a/src/core/cs_drop.c b/src/core/cs_drop.c index 1a94d9ff6..657e39762 100644 --- a/src/core/cs_drop.c +++ b/src/core/cs_drop.c @@ -37,19 +37,19 @@ class CommandCSDrop : public Command ci = cs_findchan(chan); - if ((ci->HasFlag(CI_FORBIDDEN)) && !u->nc->HasCommand("chanserv/drop")) + if ((ci->HasFlag(CI_FORBIDDEN)) && !u->Account()->HasCommand("chanserv/drop")) { notice_lang(Config.s_ChanServ, u, CHAN_X_FORBIDDEN, chan); return MOD_CONT; } - if ((ci->HasFlag(CI_SUSPENDED)) && !u->nc->HasCommand("chanserv/drop")) + if ((ci->HasFlag(CI_SUSPENDED)) && !u->Account()->HasCommand("chanserv/drop")) { notice_lang(Config.s_ChanServ, u, CHAN_X_FORBIDDEN, chan); return MOD_CONT; } - if ((ci->HasFlag(CI_SECUREFOUNDER) ? !IsRealFounder(u, ci) : !IsFounder(u, ci)) && !u->nc->HasCommand("chanserv/drop")) + if ((ci->HasFlag(CI_SECUREFOUNDER) ? !IsRealFounder(u, ci) : !IsFounder(u, ci)) && !u->Account()->HasCommand("chanserv/drop")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -92,7 +92,7 @@ class CommandCSDrop : public Command bool OnHelp(User *u, const ci::string &subcommand) { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_ChanServ, u, CHAN_SERVADMIN_HELP_DROP); else notice_help(Config.s_ChanServ, u, CHAN_HELP_DROP); diff --git a/src/core/cs_forbid.c b/src/core/cs_forbid.c index 64a707c8f..ecaae1df5 100644 --- a/src/core/cs_forbid.c +++ b/src/core/cs_forbid.c @@ -79,7 +79,7 @@ class CommandCSForbid : public Command if (is_oper(uc->user)) continue; - c->Kick(findbot(Config.s_ChanServ), uc->user, "%s", reason ? reason : getstring(uc->user->nc, CHAN_FORBID_REASON)); + c->Kick(findbot(Config.s_ChanServ), uc->user, "%s", reason ? reason : getstring(uc->user->Account(), CHAN_FORBID_REASON)); } } diff --git a/src/core/cs_getkey.c b/src/core/cs_getkey.c index 3e92a2efd..3fd53351f 100644 --- a/src/core/cs_getkey.c +++ b/src/core/cs_getkey.c @@ -30,7 +30,7 @@ class CommandCSGetKey : public Command ci = cs_findchan(chan); - if (!check_access(u, ci, CA_GETKEY) && !u->nc->HasCommand("chanserv/getkey")) + if (!check_access(u, ci, CA_GETKEY) && !u->Account()->HasCommand("chanserv/getkey")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; diff --git a/src/core/cs_help.c b/src/core/cs_help.c index 80f4e6358..c7be1e787 100644 --- a/src/core/cs_help.c +++ b/src/core/cs_help.c @@ -58,7 +58,7 @@ class CommandCSHelp : public Command FOREACH_MOD(I_OnChanServHelp, OnChanServHelp(u)); if (Config.CSExpire >= 86400) notice_help(Config.s_ChanServ, u, CHAN_HELP_EXPIRES, Config.CSExpire / 86400); - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_ChanServ, u, CHAN_SERVADMIN_HELP); } }; diff --git a/src/core/cs_info.c b/src/core/cs_info.c index 97330aadb..07d210afa 100644 --- a/src/core/cs_info.c +++ b/src/core/cs_info.c @@ -44,7 +44,7 @@ class CommandCSInfo : public Command ChannelInfo *ci; char buf[BUFSIZE]; struct tm *tm; - bool has_auspex = u->nc && u->nc->HasPriv("chanserv/auspex"); + bool has_auspex = u->Account() && u->Account()->HasPriv("chanserv/auspex"); int show_all = 0; time_t expt; ChannelMode *cm; @@ -104,21 +104,21 @@ class CommandCSInfo : public Command notice_lang(Config.s_ChanServ, u, CHAN_INFO_BANTYPE, ci->bantype); std::string optbuf; - CheckOptStr(optbuf, CI_KEEPTOPIC, getstring(u, CHAN_INFO_OPT_KEEPTOPIC), ci, u->nc); - CheckOptStr(optbuf, CI_OPNOTICE, getstring(u, CHAN_INFO_OPT_OPNOTICE), ci, u->nc); - CheckOptStr(optbuf, CI_PEACE, getstring(u, CHAN_INFO_OPT_PEACE), ci, u->nc); - CheckOptStr(optbuf, CI_PRIVATE, getstring(u, CHAN_INFO_OPT_PRIVATE), ci, u->nc); - CheckOptStr(optbuf, CI_RESTRICTED, getstring(u, CHAN_INFO_OPT_RESTRICTED), ci, u->nc); - CheckOptStr(optbuf, CI_SECURE, getstring(u, CHAN_INFO_OPT_SECURE), ci, u->nc); - CheckOptStr(optbuf, CI_SECUREFOUNDER, getstring(u, CHAN_INFO_OPT_SECUREFOUNDER), ci, u->nc); - CheckOptStr(optbuf, CI_SECUREOPS, getstring(u, CHAN_INFO_OPT_SECUREOPS), ci, u->nc); + CheckOptStr(optbuf, CI_KEEPTOPIC, getstring(u, CHAN_INFO_OPT_KEEPTOPIC), ci, u->Account()); + CheckOptStr(optbuf, CI_OPNOTICE, getstring(u, CHAN_INFO_OPT_OPNOTICE), ci, u->Account()); + CheckOptStr(optbuf, CI_PEACE, getstring(u, CHAN_INFO_OPT_PEACE), ci, u->Account()); + CheckOptStr(optbuf, CI_PRIVATE, getstring(u, CHAN_INFO_OPT_PRIVATE), ci, u->Account()); + CheckOptStr(optbuf, CI_RESTRICTED, getstring(u, CHAN_INFO_OPT_RESTRICTED), ci, u->Account()); + CheckOptStr(optbuf, CI_SECURE, getstring(u, CHAN_INFO_OPT_SECURE), ci, u->Account()); + CheckOptStr(optbuf, CI_SECUREFOUNDER, getstring(u, CHAN_INFO_OPT_SECUREFOUNDER), ci, u->Account()); + CheckOptStr(optbuf, CI_SECUREOPS, getstring(u, CHAN_INFO_OPT_SECUREOPS), ci, u->Account()); if (ci->HasFlag(CI_SIGNKICK)) - CheckOptStr(optbuf, CI_SIGNKICK, getstring(u, CHAN_INFO_OPT_SIGNKICK), ci, u->nc); + CheckOptStr(optbuf, CI_SIGNKICK, getstring(u, CHAN_INFO_OPT_SIGNKICK), ci, u->Account()); else - CheckOptStr(optbuf, CI_SIGNKICK_LEVEL, getstring(u, CHAN_INFO_OPT_SIGNKICK), ci, u->nc); - CheckOptStr(optbuf, CI_TOPICLOCK, getstring(u, CHAN_INFO_OPT_TOPICLOCK), ci, u->nc); - CheckOptStr(optbuf, CI_XOP, getstring(u, CHAN_INFO_OPT_XOP), ci, u->nc); - CheckOptStr(optbuf, CI_PERSIST, getstring(u, CHAN_INFO_OPT_PERSIST), ci, u->nc); + CheckOptStr(optbuf, CI_SIGNKICK_LEVEL, getstring(u, CHAN_INFO_OPT_SIGNKICK), ci, u->Account()); + CheckOptStr(optbuf, CI_TOPICLOCK, getstring(u, CHAN_INFO_OPT_TOPICLOCK), ci, u->Account()); + CheckOptStr(optbuf, CI_XOP, getstring(u, CHAN_INFO_OPT_XOP), ci, u->Account()); + CheckOptStr(optbuf, CI_PERSIST, getstring(u, CHAN_INFO_OPT_PERSIST), ci, u->Account()); notice_lang(Config.s_ChanServ, u, CHAN_INFO_OPTIONS, optbuf.empty() ? getstring(u, CHAN_INFO_OPT_NONE) : optbuf.c_str()); notice_lang(Config.s_ChanServ, u, CHAN_INFO_MODE_LOCK, get_mlock_modes(ci, 1)); @@ -152,7 +152,7 @@ class CommandCSInfo : public Command bool OnHelp(User *u, const ci::string &subcommand) { notice_lang(Config.s_ChanServ, u, CHAN_HELP_INFO); - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_lang(Config.s_ChanServ, u, CHAN_SERVADMIN_HELP_INFO); return true; diff --git a/src/core/cs_list.c b/src/core/cs_list.c index af1bbd0aa..3046e8873 100644 --- a/src/core/cs_list.c +++ b/src/core/cs_list.c @@ -32,7 +32,7 @@ public: ChannelInfo *ci; unsigned nchans, i; char buf[BUFSIZE]; - bool is_servadmin = u->nc->HasCommand("chanserv/list"); + bool is_servadmin = u->Account()->HasCommand("chanserv/list"); int count = 0, from = 0, to = 0, tofree = 0; char *tmp = NULL; char *s = NULL; diff --git a/src/core/cs_register.c b/src/core/cs_register.c index 67c4d0ff7..8d0766304 100644 --- a/src/core/cs_register.c +++ b/src/core/cs_register.c @@ -51,8 +51,8 @@ class CommandCSRegister : public Command notice_lang(Config.s_ChanServ, u, CHAN_MAY_NOT_BE_REGISTERED, chan); else if (!c->HasUserStatus(u, CMODE_OP)) notice_lang(Config.s_ChanServ, u, CHAN_MUST_BE_CHANOP); - else if (Config.CSMaxReg && u->nc->channelcount >= Config.CSMaxReg && !u->nc->HasPriv("chanserv/no-register-limit")) - notice_lang(Config.s_ChanServ, u, u->nc->channelcount > Config.CSMaxReg ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, Config.CSMaxReg); + else if (Config.CSMaxReg && u->Account()->channelcount >= Config.CSMaxReg && !u->Account()->HasPriv("chanserv/no-register-limit")) + notice_lang(Config.s_ChanServ, u, u->Account()->channelcount > Config.CSMaxReg ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, Config.CSMaxReg); else if (!(ci = new ChannelInfo(chan))) { Alog() << Config.s_ChanServ << ": makechan() failed for REGISTER " << chan; @@ -62,7 +62,7 @@ class CommandCSRegister : public Command { c->ci = ci; ci->c = c; - ci->founder = u->nc; + ci->founder = u->Account(); ci->desc = sstrdup(desc); if (c->topic) diff --git a/src/core/cs_set.c b/src/core/cs_set.c index 2d8981072..01de1007a 100644 --- a/src/core/cs_set.c +++ b/src/core/cs_set.c @@ -36,7 +36,7 @@ class CommandCSSet : public Command } nc = na->nc; - if (Config.CSMaxReg && nc->channelcount >= Config.CSMaxReg && !u->nc->HasPriv("chanserv/no-register-limit")) + if (Config.CSMaxReg && nc->channelcount >= Config.CSMaxReg && !u->Account()->HasPriv("chanserv/no-register-limit")) { notice_lang(Config.s_ChanServ, u, CHAN_SET_FOUNDER_TOO_MANY_CHANS, param.c_str()); return MOD_CONT; @@ -605,7 +605,7 @@ class CommandCSSet : public Command CommandReturn DoSetNoExpire(User * u, ChannelInfo * ci, const ci::string ¶m) { - if (!u->nc->HasCommand("chanserv/set/noexpire")) + if (!u->Account()->HasCommand("chanserv/set/noexpire")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -637,7 +637,7 @@ class CommandCSSet : public Command ci::string cmd = params[1]; ci::string param = params.size() > 2 ? params[2] : ""; ChannelInfo *ci = cs_findchan(chan); - bool is_servadmin = u->nc->HasPriv("chanserv/set"); + bool is_servadmin = u->Account()->HasPriv("chanserv/set"); if (readonly) { notice_lang(Config.s_ChanServ, u, CHAN_SET_DISABLED); @@ -726,7 +726,7 @@ class CommandCSSet : public Command if (subcommand.empty()) { notice_help(Config.s_ChanServ, u, CHAN_HELP_SET); - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_ChanServ, u, CHAN_SERVADMIN_HELP_SET); } else if (subcommand == "FOUNDER") diff --git a/src/core/cs_suspend.c b/src/core/cs_suspend.c index d356e36e2..9a3907831 100644 --- a/src/core/cs_suspend.c +++ b/src/core/cs_suspend.c @@ -69,7 +69,7 @@ class CommandCSSuspend : public Command if (is_oper(uc->user)) continue; - c->Kick(NULL, uc->user, "%s", reason ? reason : getstring(uc->user->nc, CHAN_SUSPEND_REASON)); + c->Kick(NULL, uc->user, "%s", reason ? reason : getstring(uc->user->Account(), CHAN_SUSPEND_REASON)); } } diff --git a/src/core/cs_topic.c b/src/core/cs_topic.c index 67546d8e8..f9896df7f 100644 --- a/src/core/cs_topic.c +++ b/src/core/cs_topic.c @@ -35,7 +35,7 @@ class CommandCSTopic : public Command if (!c) notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); - else if (!check_access(u, ci, CA_TOPIC) && !u->nc->HasCommand("chanserv/topic")) + else if (!check_access(u, ci, CA_TOPIC) && !u->Account()->HasCommand("chanserv/topic")) notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); else { diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c index 130f62943..1fa32265e 100644 --- a/src/core/cs_xop.c +++ b/src/core/cs_xop.c @@ -138,7 +138,7 @@ class XOPBase : public Command short ulev = get_access(u, ci); - if ((level >= ulev || ulev < ACCESS_AOP) && !u->nc->HasPriv("chanserv/access/modify")) + if ((level >= ulev || ulev < ACCESS_AOP) && !u->Account()->HasPriv("chanserv/access/modify")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -163,7 +163,7 @@ class XOPBase : public Command /** * Patch provided by PopCorn to prevert AOP's reducing SOP's levels **/ - if (access->level >= ulev && !u->nc->HasPriv("chanserv/access/modify")) + if (access->level >= ulev && !u->Account()->HasPriv("chanserv/access/modify")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -234,7 +234,7 @@ class XOPBase : public Command short ulev = get_access(u, ci); - if ((level >= ulev || ulev < ACCESS_AOP) && !u->nc->HasPriv("chanserv/access/modify")) + if ((level >= ulev || ulev < ACCESS_AOP) && !u->Account()->HasPriv("chanserv/access/modify")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -279,7 +279,7 @@ class XOPBase : public Command return MOD_CONT; } - if (ulev <= access->level && !u->nc->HasPriv("chanserv/access/modify")) + if (ulev <= access->level && !u->Account()->HasPriv("chanserv/access/modify")) { deleted = 0; notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); @@ -311,7 +311,7 @@ class XOPBase : public Command int sent_header = 0; const char *nick = params.size() > 2 ? params[2].c_str() : NULL; - if (level < ACCESS_AOP && !u->nc->HasCommand("chanserv/aop/list")) + if (level < ACCESS_AOP && !u->Account()->HasCommand("chanserv/aop/list")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -355,7 +355,7 @@ class XOPBase : public Command return MOD_CONT; } - if (!IsFounder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) + if (!IsFounder(u, ci) && !u->Account()->HasPriv("chanserv/access/modify")) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); return MOD_CONT; @@ -573,7 +573,7 @@ int xop_del(User *u, ChannelInfo *ci, ChanAccess *access, int *perm, int uacc, i if (!access->in_use || access->level != xlev) return 0; char *nick = access->nc->display; - if (uacc <= access->level && !u->nc->HasPriv("chanserv/access/modify")) + if (uacc <= access->level && !u->Account()->HasPriv("chanserv/access/modify")) { ++(*perm); return 0; diff --git a/src/core/hs_group.c b/src/core/hs_group.c index c40a38572..06b657fde 100644 --- a/src/core/hs_group.c +++ b/src/core/hs_group.c @@ -27,13 +27,13 @@ class CommandHSGroup : public Command CommandReturn Execute(User *u, const std::vector ¶ms) { NickAlias *na = findnick(u->nick); - if (na && u->nc == na->nc && na->hostinfo.HasVhost()) + if (na && u->Account() == na->nc && na->hostinfo.HasVhost()) { HostServSyncVhosts(na); if (!na->hostinfo.GetIdent().empty()) - notice_lang(Config.s_HostServ, u, HOST_IDENT_GROUP, u->nc->display, na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str()); + notice_lang(Config.s_HostServ, u, HOST_IDENT_GROUP, u->Account()->display, na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str()); else - notice_lang(Config.s_HostServ, u, HOST_GROUP, u->nc->display, na->hostinfo.GetHost().c_str()); + notice_lang(Config.s_HostServ, u, HOST_GROUP, u->Account()->display, na->hostinfo.GetHost().c_str()); } else notice_lang(Config.s_HostServ, u, HOST_NOT_ASSIGNED); diff --git a/src/core/hs_on.c b/src/core/hs_on.c index a9922e921..b1daf7275 100644 --- a/src/core/hs_on.c +++ b/src/core/hs_on.c @@ -25,7 +25,7 @@ class CommandHSOn : public Command CommandReturn Execute(User *u, const std::vector ¶ms) { NickAlias *na = findnick(u->nick); - if (na && u->nc == na->nc && na->hostinfo.HasVhost()) + if (na && u->Account() == na->nc && na->hostinfo.HasVhost()) { if (!na->hostinfo.GetIdent().empty()) notice_lang(Config.s_HostServ, u, HOST_IDENT_ACTIVATED, na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str()); diff --git a/src/core/ms_cancel.c b/src/core/ms_cancel.c index 601b90c4d..2a2f67b4d 100644 --- a/src/core/ms_cancel.c +++ b/src/core/ms_cancel.c @@ -46,7 +46,7 @@ class CommandMSCancel : public Command for (i = mi->memos.size() - 1; i >= 0; --i) { - if ((mi->memos[i]->HasFlag(MF_UNREAD)) && !stricmp(mi->memos[i]->sender.c_str(), u->nc->display) && !mi->memos[i]->HasFlag(MF_NOTIFYS)) + if ((mi->memos[i]->HasFlag(MF_UNREAD)) && !stricmp(mi->memos[i]->sender.c_str(), u->Account()->display) && !mi->memos[i]->HasFlag(MF_NOTIFYS)) { delmemo(mi, mi->memos[i]->number); notice_lang(Config.s_MemoServ, u, MEMO_CANCELLED, name); diff --git a/src/core/ms_check.c b/src/core/ms_check.c index 964808754..b2968c3d5 100644 --- a/src/core/ms_check.c +++ b/src/core/ms_check.c @@ -55,7 +55,7 @@ class CommandMSCheck : public Command for (i = mi->memos.size() - 1; i >= 0; --i) { - if (!stricmp(mi->memos[i]->sender.c_str(), u->nc->display)) + if (!stricmp(mi->memos[i]->sender.c_str(), u->Account()->display)) { found = 1; /* Yes, we've found the memo */ diff --git a/src/core/ms_del.c b/src/core/ms_del.c index 1951e3c71..e13732f88 100644 --- a/src/core/ms_del.c +++ b/src/core/ms_del.c @@ -57,7 +57,7 @@ class CommandMSDel : public Command } else { - mi = &u->nc->memos; + mi = &u->Account()->memos; } if (numstr.empty() || (!isdigit(numstr[0]) && numstr != "ALL" && numstr != "LAST")) this->OnSyntaxError(u, numstr); diff --git a/src/core/ms_info.c b/src/core/ms_info.c index 50febbd60..6e835d7e6 100644 --- a/src/core/ms_info.c +++ b/src/core/ms_info.c @@ -30,7 +30,7 @@ class CommandMSInfo : public Command const char *name = params.size() ? params[0].c_str() : NULL; int hardmax = 0; - if (name && *name != '#' && u->nc->HasPriv("memoserv/info")) + if (name && *name != '#' && u->Account()->HasPriv("memoserv/info")) { na = findnick(name); if (!na) @@ -68,11 +68,11 @@ class CommandMSInfo : public Command } else { - mi = &u->nc->memos; - hardmax = u->nc->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0; + mi = &u->Account()->memos; + hardmax = u->Account()->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0; } - if (name && (ci || na->nc != u->nc)) + if (name && (ci || na->nc != u->Account())) { if (mi->memos.empty()) notice_lang(Config.s_MemoServ, u, MEMO_INFO_X_NO_MEMOS, name); @@ -131,7 +131,7 @@ class CommandMSInfo : public Command notice_lang(Config.s_MemoServ, u, MEMO_INFO_X_NOTIFY_OFF, name); } } - else /* !name || (!ci || na->nc == u->nc) */ + else /* !name || (!ci || na->nc == u->Account()) */ { if (mi->memos.empty()) notice_lang(Config.s_MemoServ, u, MEMO_INFO_NO_MEMOS); @@ -162,14 +162,14 @@ class CommandMSInfo : public Command if (!mi->memomax) { - if (!u->nc->IsServicesOper() && hardmax) + if (!u->Account()->IsServicesOper() && hardmax) notice_lang(Config.s_MemoServ, u, MEMO_INFO_HARD_LIMIT_ZERO); else notice_lang(Config.s_MemoServ, u, MEMO_INFO_LIMIT_ZERO); } else if (mi->memomax > 0) { - if (!u->nc->IsServicesOper() && hardmax) + if (!u->Account()->IsServicesOper() && hardmax) notice_lang(Config.s_MemoServ, u, MEMO_INFO_HARD_LIMIT, mi->memomax); else notice_lang(Config.s_MemoServ, u, MEMO_INFO_LIMIT, mi->memomax); @@ -178,11 +178,11 @@ class CommandMSInfo : public Command notice_lang(Config.s_MemoServ, u, MEMO_INFO_NO_LIMIT); /* Ripped too. But differently because of a seg fault (loughs) */ - if (u->nc->HasFlag(NI_MEMO_RECEIVE) && u->nc->HasFlag(NI_MEMO_SIGNON)) + if (u->Account()->HasFlag(NI_MEMO_RECEIVE) && u->Account()->HasFlag(NI_MEMO_SIGNON)) notice_lang(Config.s_MemoServ, u, MEMO_INFO_NOTIFY_ON); - else if (u->nc->HasFlag(NI_MEMO_RECEIVE)) + else if (u->Account()->HasFlag(NI_MEMO_RECEIVE)) notice_lang(Config.s_MemoServ, u, MEMO_INFO_NOTIFY_RECEIVE); - else if (u->nc->HasFlag(NI_MEMO_SIGNON)) + else if (u->Account()->HasFlag(NI_MEMO_SIGNON)) notice_lang(Config.s_MemoServ, u, MEMO_INFO_NOTIFY_SIGNON); else notice_lang(Config.s_MemoServ, u, MEMO_INFO_NOTIFY_OFF); @@ -192,7 +192,7 @@ class CommandMSInfo : public Command bool OnHelp(User *u, const ci::string &subcommand) { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_MemoServ, u, MEMO_SERVADMIN_HELP_INFO); else notice_help(Config.s_MemoServ, u, MEMO_HELP_INFO); diff --git a/src/core/ms_list.c b/src/core/ms_list.c index 16cccd41c..71509c50f 100644 --- a/src/core/ms_list.c +++ b/src/core/ms_list.c @@ -51,7 +51,7 @@ class CommandMSList : public Command } else { - mi = &u->nc->memos; + mi = &u->Account()->memos; } if (!param.empty() && !isdigit(param[0]) && param != "NEW") this->OnSyntaxError(u, param); diff --git a/src/core/ms_read.c b/src/core/ms_read.c index 2009c9847..8497f43ab 100644 --- a/src/core/ms_read.c +++ b/src/core/ms_read.c @@ -52,7 +52,7 @@ class CommandMSRead : public Command } else { - mi = &u->nc->memos; + mi = &u->Account()->memos; } num = !numstr.empty() ? atoi(numstr.c_str()) : -1; if (numstr.empty() || (numstr != "LAST" && numstr != "NEW" && num <= 0)) diff --git a/src/core/ms_rsend.c b/src/core/ms_rsend.c index a4c06a4cd..397c6d6b3 100644 --- a/src/core/ms_rsend.c +++ b/src/core/ms_rsend.c @@ -32,7 +32,7 @@ class CommandMSRSend : public Command /* prevent user from rsend to themselves */ if ((na = findnick(nick))) { - if (na->nc == u->nc) + if (na->nc == u->Account()) { notice_lang(Config.s_MemoServ, u, MEMO_NO_RSEND_SELF); return MOD_CONT; @@ -47,7 +47,7 @@ class CommandMSRSend : public Command if (Config.MSMemoReceipt == 1) { /* Services opers and above can use rsend */ - if (u->nc->IsServicesOper()) + if (u->Account()->IsServicesOper()) memo_send(u, nick, text, z); else notice_lang(Config.s_MemoServ, u, ACCESS_DENIED); diff --git a/src/core/ms_set.c b/src/core/ms_set.c index 722d61375..81e0960da 100644 --- a/src/core/ms_set.c +++ b/src/core/ms_set.c @@ -24,27 +24,27 @@ class CommandMSSet : public Command if (param == "ON") { - u->nc->SetFlag(NI_MEMO_SIGNON); - u->nc->SetFlag(NI_MEMO_RECEIVE); + u->Account()->SetFlag(NI_MEMO_SIGNON); + u->Account()->SetFlag(NI_MEMO_RECEIVE); notice_lang(Config.s_MemoServ, u, MEMO_SET_NOTIFY_ON, Config.s_MemoServ); } else if (param == "LOGON") { - u->nc->SetFlag(NI_MEMO_SIGNON); - u->nc->UnsetFlag(NI_MEMO_RECEIVE); + u->Account()->SetFlag(NI_MEMO_SIGNON); + u->Account()->UnsetFlag(NI_MEMO_RECEIVE); notice_lang(Config.s_MemoServ, u, MEMO_SET_NOTIFY_LOGON, Config.s_MemoServ); } else if (param == "NEW") { - u->nc->UnsetFlag(NI_MEMO_SIGNON); - u->nc->SetFlag(NI_MEMO_RECEIVE); + u->Account()->UnsetFlag(NI_MEMO_SIGNON); + u->Account()->SetFlag(NI_MEMO_RECEIVE); notice_lang(Config.s_MemoServ, u, MEMO_SET_NOTIFY_NEW, Config.s_MemoServ); } else if (param == "MAIL") { - if (u->nc->email) + if (u->Account()->email) { - u->nc->SetFlag(NI_MEMO_MAIL); + u->Account()->SetFlag(NI_MEMO_MAIL); notice_lang(Config.s_MemoServ, u, MEMO_SET_NOTIFY_MAIL); } else @@ -52,14 +52,14 @@ class CommandMSSet : public Command } else if (param == "NOMAIL") { - u->nc->UnsetFlag(NI_MEMO_MAIL); + u->Account()->UnsetFlag(NI_MEMO_MAIL); notice_lang(Config.s_MemoServ, u, MEMO_SET_NOTIFY_NOMAIL); } else if (param == "OFF") { - u->nc->UnsetFlag(NI_MEMO_SIGNON); - u->nc->UnsetFlag(NI_MEMO_RECEIVE); - u->nc->UnsetFlag(NI_MEMO_MAIL); + u->Account()->UnsetFlag(NI_MEMO_SIGNON); + u->Account()->UnsetFlag(NI_MEMO_RECEIVE); + u->Account()->UnsetFlag(NI_MEMO_MAIL); notice_lang(Config.s_MemoServ, u, MEMO_SET_NOTIFY_OFF, Config.s_MemoServ); } else @@ -74,9 +74,9 @@ class CommandMSSet : public Command ci::string p3 = params.size() > 3 ? params[3] : ""; ci::string user, chan; int32 limit; - NickCore *nc = u->nc; + NickCore *nc = u->Account(); ChannelInfo *ci = NULL; - bool is_servadmin = u->nc->HasPriv("memoserv/set-limit"); + bool is_servadmin = u->Account()->HasPriv("memoserv/set-limit"); if (p1[0] == '#') { @@ -181,21 +181,21 @@ class CommandMSSet : public Command mi->memomax = limit; if (limit > 0) { - if (chan.empty() && nc == u->nc) + if (chan.empty() && nc == u->Account()) notice_lang(Config.s_MemoServ, u, MEMO_SET_YOUR_LIMIT, limit); else notice_lang(Config.s_MemoServ, u, MEMO_SET_LIMIT, !chan.empty() ? chan.c_str() : user.c_str(), limit); } else if (!limit) { - if (chan.empty() && nc == u->nc) + if (chan.empty() && nc == u->Account()) notice_lang(Config.s_MemoServ, u, MEMO_SET_YOUR_LIMIT_ZERO); else notice_lang(Config.s_MemoServ, u, MEMO_SET_LIMIT_ZERO, !chan.empty() ? chan.c_str() : user.c_str()); } else { - if (chan.empty() && nc == u->nc) + if (chan.empty() && nc == u->Account()) notice_lang(Config.s_MemoServ, u, MEMO_UNSET_YOUR_LIMIT); else notice_lang(Config.s_MemoServ, u, MEMO_UNSET_LIMIT, !chan.empty() ? chan.c_str() : user.c_str()); @@ -210,7 +210,7 @@ class CommandMSSet : public Command CommandReturn Execute(User *u, const std::vector ¶ms) { ci::string cmd = params[0]; - MemoInfo *mi = &u->nc->memos; + MemoInfo *mi = &u->Account()->memos; if (readonly) { @@ -237,7 +237,7 @@ class CommandMSSet : public Command notice_help(Config.s_MemoServ, u, MEMO_HELP_SET_NOTIFY); else if (subcommand == "LIMIT") { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_MemoServ, u, MEMO_SERVADMIN_HELP_SET_LIMIT, Config.MSMaxMemos); else notice_help(Config.s_MemoServ, u, MEMO_HELP_SET_LIMIT, Config.MSMaxMemos); diff --git a/src/core/ns_access.c b/src/core/ns_access.c index b46344475..60d4252e2 100644 --- a/src/core/ns_access.c +++ b/src/core/ns_access.c @@ -125,7 +125,7 @@ class CommandNSAccess : public Command const char *mask = params.size() > 1 ? params[1].c_str() : NULL; NickAlias *na; - if (cmd == "LIST" && u->nc->IsServicesOper() && mask && (na = findnick(params[1].c_str()))) + if (cmd == "LIST" && u->Account()->IsServicesOper() && mask && (na = findnick(params[1].c_str()))) return this->DoServAdminList(u, params, na->nc); if (mask && !strchr(mask, '@')) @@ -138,14 +138,14 @@ class CommandNSAccess : public Command else if (na->HasFlag(NS_FORBIDDEN)) notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick); */ - else if (u->nc->HasFlag(NI_SUSPENDED)) - notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->nc->display); + else if (u->Account()->HasFlag(NI_SUSPENDED)) + notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->Account()->display); else if (cmd == "ADD") - return this->DoAdd(u, u->nc, mask); + return this->DoAdd(u, u->Account(), mask); else if (cmd == "DEL") - return this->DoDel(u, u->nc, mask); + return this->DoDel(u, u->Account(), mask); else if (cmd == "LIST") - return this->DoList(u, u->nc, mask); + return this->DoList(u, u->Account(), mask); else this->OnSyntaxError(u, ""); return MOD_CONT; diff --git a/src/core/ns_alist.c b/src/core/ns_alist.c index 7c9b43350..b375c126a 100644 --- a/src/core/ns_alist.c +++ b/src/core/ns_alist.c @@ -38,12 +38,12 @@ class CommandNSAList : public Command NickAlias *na; int min_level = 0; - int is_servadmin = u->nc->IsServicesOper(); + int is_servadmin = u->Account()->IsServicesOper(); unsigned lev_param = 0; if (!is_servadmin) /* Non service admins can only see their own levels */ - na = findnick(u->nc->display); + na = findnick(u->Account()->display); else { /* Services admins can request ALIST on nicks. @@ -130,7 +130,7 @@ class CommandNSAList : public Command bool OnHelp(User *u, const ci::string &subcommand) { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP_ALIST); else notice_help(Config.s_NickServ, u, NICK_HELP_ALIST); diff --git a/src/core/ns_drop.c b/src/core/ns_drop.c index 152287b2f..a4ad89239 100644 --- a/src/core/ns_drop.c +++ b/src/core/ns_drop.c @@ -40,7 +40,7 @@ class CommandNSDrop : public Command { if (nick) { - if ((nr = findrequestnick(nick)) && u->nc->IsServicesOper()) + if ((nr = findrequestnick(nick)) && u->Account()->IsServicesOper()) { if (Config.WallDrop) ircdproto->SendGlobops(findbot(Config.s_NickServ), "\2%s\2 used DROP on \2%s\2", u->nick.c_str(), nick); @@ -56,11 +56,11 @@ class CommandNSDrop : public Command return MOD_CONT; } - is_mine = u->nc && u->nc == na->nc; + is_mine = u->Account() && u->Account() == na->nc; if (is_mine && !nick) my_nick = sstrdup(na->nick); - if (!is_mine && !u->nc->HasPriv("nickserv/drop")) + if (!is_mine && !u->Account()->HasPriv("nickserv/drop")) notice_lang(Config.s_NickServ, u, ACCESS_DENIED); else if (Config.NSSecureAdmins && !is_mine && na->nc->IsServicesOper()) notice_lang(Config.s_NickServ, u, ACCESS_DENIED); @@ -98,7 +98,7 @@ class CommandNSDrop : public Command bool OnHelp(User *u, const ci::string &subcommand) { - if (u->nc && u->nc->HasPriv("nickserv/drop")) + if (u->Account() && u->Account()->HasPriv("nickserv/drop")) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP_DROP); else notice_help(Config.s_NickServ, u, NICK_HELP_DROP); diff --git a/src/core/ns_ghost.c b/src/core/ns_ghost.c index 771dc6195..49c36b303 100644 --- a/src/core/ns_ghost.c +++ b/src/core/ns_ghost.c @@ -60,7 +60,7 @@ class CommandNSGhost : public Command } else { - if (u->nc == na->nc || (!(na->nc->HasFlag(NI_SECURE)) && is_on_access(u, na->nc))) + if (u->Account() == na->nc || (!(na->nc->HasFlag(NI_SECURE)) && is_on_access(u, na->nc))) { std::string buf = "GHOST command used by " + u->nick; kill_user(Config.s_NickServ, nick, buf.c_str()); diff --git a/src/core/ns_group.c b/src/core/ns_group.c index cb463d96f..65b655ec7 100644 --- a/src/core/ns_group.c +++ b/src/core/ns_group.c @@ -67,7 +67,7 @@ class CommandNSGroup : public Command notice_lang(Config.s_NickServ, u, NICK_X_NOT_REGISTERED, nick); else if (time(NULL) < u->lastnickreg + Config.NSRegDelay) notice_lang(Config.s_NickServ, u, NICK_GROUP_PLEASE_WAIT, (Config.NSRegDelay + u->lastnickreg) - time(NULL)); - else if (u->nc && u->nc->HasFlag(NI_SUSPENDED)) + else if (u->Account() && u->Account()->HasFlag(NI_SUSPENDED)) { Alog() << Config.s_NickServ << ": " << u->GetMask() << " tried to use GROUP from SUSPENDED nick " << target->nick; notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->nick.c_str()); @@ -81,7 +81,7 @@ class CommandNSGroup : public Command notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, nick); else if (na && target->nc == na->nc) notice_lang(Config.s_NickServ, u, NICK_GROUP_SAME, target->nick); - else if (na && na->nc != u->nc) + else if (na && na->nc != u->Account()) notice_lang(Config.s_NickServ, u, NICK_IDENTIFY_REQUIRED, Config.s_NickServ); else if (Config.NSMaxAliases && (target->nc->aliases.count >= Config.NSMaxAliases) && !target->nc->IsServicesOper()) notice_lang(Config.s_NickServ, u, NICK_GROUP_TOO_MANY, target->nick, Config.s_NickServ, Config.s_NickServ); @@ -119,8 +119,7 @@ class CommandNSGroup : public Command na->last_realname = sstrdup(u->realname); na->time_registered = na->last_seen = time(NULL); - u->nc = na->nc; - + u->Login(na->nc); FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target)); ircdproto->SetAutoIdentificationToken(u); @@ -165,10 +164,10 @@ class CommandNSGList : public Command { const char *nick = params.size() ? params[0].c_str() : NULL; - NickCore *nc = u->nc; + NickCore *nc = u->Account(); int i; - if (nick && (stricmp(nick, u->nick.c_str()) && !u->nc->IsServicesOper())) + if (nick && (stricmp(nick, u->nick.c_str()) && !u->Account()->IsServicesOper())) notice_lang(Config.s_NickServ, u, ACCESS_DENIED, Config.s_NickServ); else if (nick && (!findnick(nick) || !(nc = findnick(nick)->nc))) notice_lang(Config.s_NickServ, u, !nick ? NICK_NOT_REGISTERED : NICK_X_NOT_REGISTERED, nick); @@ -191,7 +190,7 @@ class CommandNSGList : public Command tm = localtime(&expt); strftime_lang(buf, sizeof(buf), finduser(na2->nick), STRFTIME_DATE_TIME_FORMAT, tm); } - notice_lang(Config.s_NickServ, u, u->nc->IsServicesOper() && !wont_expire ? NICK_GLIST_REPLY_ADMIN : NICK_GLIST_REPLY, wont_expire ? '!' : ' ', na2->nick, buf); + notice_lang(Config.s_NickServ, u, u->Account()->IsServicesOper() && !wont_expire ? NICK_GLIST_REPLY_ADMIN : NICK_GLIST_REPLY, wont_expire ? '!' : ' ', na2->nick, buf); } } notice_lang(Config.s_NickServ, u, NICK_GLIST_FOOTER, nc->aliases.count); @@ -202,7 +201,7 @@ class CommandNSGList : public Command bool OnHelp(User *u, const ci::string &subcommand) { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP_GLIST); else notice_help(Config.s_NickServ, u, NICK_HELP_GLIST); diff --git a/src/core/ns_help.c b/src/core/ns_help.c index fcd2cc23e..64db11e8d 100644 --- a/src/core/ns_help.c +++ b/src/core/ns_help.c @@ -44,7 +44,7 @@ class CommandNSHelp : public Command { notice_help(Config.s_NickServ, u, NICK_HELP); FOREACH_MOD(I_OnNickServHelp, OnNickServHelp(u)); - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP); if (Config.NSExpire >= 86400) notice_help(Config.s_NickServ, u, NICK_HELP_EXPIRES, Config.NSExpire / 86400); diff --git a/src/core/ns_identify.c b/src/core/ns_identify.c index 44aebeb1a..a0a217677 100644 --- a/src/core/ns_identify.c +++ b/src/core/ns_identify.c @@ -48,7 +48,7 @@ class CommandNSIdentify : public Command * however you can not identify again for the group you're already * identified as */ - else if (u->nc && u->nc == na->nc) + else if (u->Account() && u->Account() == na->nc) notice_lang(Config.s_NickServ, u, NICK_ALREADY_IDENTIFIED); else if (!(res = enc_check_password(pass, na->nc->pass))) { @@ -60,38 +60,38 @@ class CommandNSIdentify : public Command notice_lang(Config.s_NickServ, u, NICK_IDENTIFY_FAILED); else { - if (nick_identified(u)) + if (u->IsIdentified()) { - Alog() << Config.s_NickServ << ": " << u->GetMask() << " logged out of account " << u->nc->display; + Alog() << Config.s_NickServ << ": " << u->GetMask() << " logged out of account " << u->Account()->display; } if (na->last_realname) delete [] na->last_realname; na->last_realname = sstrdup(u->realname); na->last_seen = time(NULL); - u->nc = na->nc; - ircdproto->SendAccountLogin(u, u->nc); + u->Login(na->nc); + ircdproto->SendAccountLogin(u, u->Account()); ircdproto->SetAutoIdentificationToken(u); u->UpdateHost(); FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(u)); - Alog() << Config.s_NickServ << ": " << u->GetMask() << " identified for account " << u->nc->display; + Alog() << Config.s_NickServ << ": " << u->GetMask() << " identified for account " << u->Account()->display; notice_lang(Config.s_NickServ, u, NICK_IDENTIFY_SUCCEEDED); if (ircd->vhost) do_on_id(u); if (Config.NSModeOnID) do_setmodes(u); - if (Config.NSForceEmail && u->nc && !u->nc->email) + if (Config.NSForceEmail && u->Account() && !u->Account()->email) { notice_lang(Config.s_NickServ, u, NICK_IDENTIFY_EMAIL_REQUIRED); notice_help(Config.s_NickServ, u, NICK_IDENTIFY_EMAIL_HOWTO); } - if (nick_identified(u)) + if (u->IsIdentified()) check_memos(u); /* Clear any timers */ diff --git a/src/core/ns_info.c b/src/core/ns_info.c index 230597637..7243a4c44 100644 --- a/src/core/ns_info.c +++ b/src/core/ns_info.c @@ -56,11 +56,11 @@ class CommandNSInfo : public Command if ((nr = findrequestnick(nick))) { notice_lang(Config.s_NickServ, u, NICK_IS_PREREG); - if (!param.empty() && param == "ALL" && u->nc && u->nc->IsServicesOper()) + if (!param.empty() && param == "ALL" && u->Account() && u->Account()->IsServicesOper()) notice_lang(Config.s_NickServ, u, NICK_INFO_EMAIL, nr->email); else { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_lang(Config.s_NickServ, u, NICK_INFO_FOR_MORE, Config.s_NickServ, nr->nick); } } @@ -86,12 +86,12 @@ class CommandNSInfo : public Command /* Is the real owner of the nick we're looking up online? -TheShadow */ User *u2 = finduser(na->nick); - if (u2 && u2->nc == na->nc) + if (u2 && u2->Account() == na->nc) nick_online = 1; /* Only show hidden fields to owner and sadmins and only when the ALL * parameter is used. -TheShadow */ - if (!param.empty() && param == "ALL" && u->nc && (na->nc == u->nc || u->nc->IsServicesOper())) + if (!param.empty() && param == "ALL" && u->Account() && (na->nc == u->Account() || u->Account()->IsServicesOper())) show_hidden = 1; notice_lang(Config.s_NickServ, u, NICK_INFO_REALNAME, na->nick, na->last_realname); @@ -172,7 +172,7 @@ class CommandNSInfo : public Command notice_lang(Config.s_NickServ, u, NICK_INFO_NO_EXPIRE); else { - if (u->nc->IsServicesOper()) + if (u->Account()->IsServicesOper()) { expt = na->last_seen + Config.NSExpire; tm = localtime(&expt); @@ -182,7 +182,7 @@ class CommandNSInfo : public Command } } - if (!show_hidden && u->nc && (na->nc == u->nc || u->nc->IsServicesOper())) + if (!show_hidden && u->Account() && (na->nc == u->Account() || u->Account()->IsServicesOper())) notice_lang(Config.s_NickServ, u, NICK_INFO_FOR_MORE, Config.s_NickServ, na->nick); } return MOD_CONT; @@ -190,7 +190,7 @@ class CommandNSInfo : public Command bool OnHelp(User *u, const ci::string &subcommand) { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP_INFO); else notice_help(Config.s_NickServ, u, NICK_HELP_INFO); diff --git a/src/core/ns_list.c b/src/core/ns_list.c index b18b9ffcf..b0d90f8b6 100644 --- a/src/core/ns_list.c +++ b/src/core/ns_list.c @@ -43,7 +43,7 @@ class CommandNSList : public Command NickCore *mync; unsigned nnicks, i; char buf[BUFSIZE]; - bool is_servadmin = u->nc->IsServicesOper(); + bool is_servadmin = u->Account()->IsServicesOper(); NickRequest *nr = NULL; char noexpire_char = ' '; int count = 0, from = 0, to = 0, tofree = 0; @@ -119,7 +119,7 @@ class CommandNSList : public Command } } - mync = u->nc; + mync = u->Account(); notice_lang(Config.s_NickServ, u, NICK_LIST_HEADER, pattern); if (!unconfirmed) @@ -195,7 +195,7 @@ class CommandNSList : public Command bool OnHelp(User *u, const ci::string &subcommand) { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP_LIST); else notice_help(Config.s_NickServ, u, NICK_HELP_LIST); @@ -205,7 +205,7 @@ class CommandNSList : public Command void OnSyntaxError(User *u, const ci::string &subcommand) { - if (u->nc->IsServicesOper()) + if (u->Account()->IsServicesOper()) syntax_error(Config.s_NickServ, u, "LIST", NICK_LIST_SERVADMIN_SYNTAX); else syntax_error(Config.s_NickServ, u, "LIST", NICK_LIST_SYNTAX); diff --git a/src/core/ns_logout.c b/src/core/ns_logout.c index c36c46615..fcb14fb8e 100644 --- a/src/core/ns_logout.c +++ b/src/core/ns_logout.c @@ -32,11 +32,11 @@ class CommandNSLogout : public Command User *u2; NickAlias *na; - if (!u->nc->IsServicesOper() && nick) + if (!u->Account()->IsServicesOper() && nick) this->OnSyntaxError(u, ""); else if (!(u2 = (nick ? finduser(nick) : u))) notice_lang(Config.s_NickServ, u, NICK_X_NOT_IN_USE, nick); - else if (nick && u2->nc && !u2->nc->IsServicesOper()) + else if (nick && u2->Account() && !u2->Account()->IsServicesOper()) notice_lang(Config.s_NickServ, u, NICK_LOGOUT_SERVICESADMIN, nick); else { @@ -58,13 +58,13 @@ class CommandNSLogout : public Command notice_lang(Config.s_NickServ, u, NICK_LOGOUT_SUCCEEDED); /* Clear any timers again */ - if (na && u->nc->HasFlag(NI_KILLPROTECT)) + if (na && u->Account()->HasFlag(NI_KILLPROTECT)) del_ns_timeout(na, TO_COLLIDE); - ircdproto->SendAccountLogout(u2, u2->nc); + ircdproto->SendAccountLogout(u2, u2->Account()); ircdproto->SendUnregisteredNick(u2); - u2->nc = NULL; + u2->Logout(); /* Send out an event */ FOREACH_MOD(I_OnNickLogout, OnNickLogout(u2)); @@ -74,7 +74,7 @@ class CommandNSLogout : public Command bool OnHelp(User *u, const ci::string &subcommand) { - if (u->nc && u->nc->IsServicesOper()) + if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP_LOGOUT); else notice_help(Config.s_NickServ, u, NICK_HELP_LOGOUT); diff --git a/src/core/ns_recover.c b/src/core/ns_recover.c index 059aee92d..0937d6891 100644 --- a/src/core/ns_recover.c +++ b/src/core/ns_recover.c @@ -68,7 +68,7 @@ class CommandNSRecover : public Command } else { - if (u->nc == na->nc || (!(na->nc->HasFlag(NI_SECURE)) && is_on_access(u, na->nc))) + if (u->Account() == na->nc || (!(na->nc->HasFlag(NI_SECURE)) && is_on_access(u, na->nc))) { char relstr[192]; @@ -91,7 +91,7 @@ class CommandNSRecover : public Command char relstr[192]; /* Convert Config.NSReleaseTimeout seconds to string format */ - duration(u->nc, relstr, sizeof(relstr), Config.NSReleaseTimeout); + duration(u->Account(), relstr, sizeof(relstr), Config.NSReleaseTimeout); notice_help(Config.s_NickServ, u, NICK_HELP_RECOVER, relstr); //do_help_limited(Config.s_NickServ, u, this); diff --git a/src/core/ns_register.c b/src/core/ns_register.c index 298256eba..a351711dc 100644 --- a/src/core/ns_register.c +++ b/src/core/ns_register.c @@ -60,7 +60,7 @@ class CommandNSConfirm : public Command if (!force) { - u->nc = na->nc; + u->Login(na->nc); Alog() << Config.s_NickServ << ": '" << u->nick << "' registered by " << u->GetIdent() << "@" << u->host << " (e-mail: " << (nr->email ? nr->email : "none") << ")"; if (Config.NSAddAccessOnReg) notice_lang(Config.s_NickServ, u, NICK_REGISTERED, u->nick.c_str(), na->nc->GetAccess(0).c_str()); @@ -68,7 +68,7 @@ class CommandNSConfirm : public C