summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-02-04 23:49:27 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-02-04 23:49:27 +0000
commit308070e01971b0cfaf77de20011f48ce4d6b5a1c (patch)
tree2bdfd84e35cf79eb20dc2a79ddd233789ca84fdf /src
parent3d4cf39940144be19645a3a7cdecf95213b96f26 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/channels.c8
-rw-r--r--src/chanserv.c26
-rw-r--r--src/commands.c8
-rw-r--r--src/core/bs_assign.c4
-rw-r--r--src/core/bs_badwords.c2
-rw-r--r--src/core/bs_bot.c6
-rw-r--r--src/core/bs_botlist.c2
-rw-r--r--src/core/bs_info.c4
-rw-r--r--src/core/bs_kick.c2
-rw-r--r--src/core/bs_set.c8
-rw-r--r--src/core/bs_unassign.c2
-rw-r--r--src/core/cs_access.c18
-rw-r--r--src/core/cs_akick.c2
-rw-r--r--src/core/cs_drop.c8
-rw-r--r--src/core/cs_forbid.c2
-rw-r--r--src/core/cs_getkey.c2
-rw-r--r--src/core/cs_help.c2
-rw-r--r--src/core/cs_info.c30
-rw-r--r--src/core/cs_list.c2
-rw-r--r--src/core/cs_register.c6
-rw-r--r--src/core/cs_set.c8
-rw-r--r--src/core/cs_suspend.c2
-rw-r--r--src/core/cs_topic.c2
-rw-r--r--src/core/cs_xop.c14
-rw-r--r--src/core/hs_group.c6
-rw-r--r--src/core/hs_on.c2
-rw-r--r--src/core/ms_cancel.c2
-rw-r--r--src/core/ms_check.c2
-rw-r--r--src/core/ms_del.c2
-rw-r--r--src/core/ms_info.c22
-rw-r--r--src/core/ms_list.c2
-rw-r--r--src/core/ms_read.c2
-rw-r--r--src/core/ms_rsend.c4
-rw-r--r--src/core/ms_set.c38
-rw-r--r--src/core/ns_access.c12
-rw-r--r--src/core/ns_alist.c6
-rw-r--r--src/core/ns_drop.c8
-rw-r--r--src/core/ns_ghost.c2
-rw-r--r--src/core/ns_group.c15
-rw-r--r--src/core/ns_help.c2
-rw-r--r--src/core/ns_identify.c16
-rw-r--r--src/core/ns_info.c14
-rw-r--r--src/core/ns_list.c8
-rw-r--r--src/core/ns_logout.c12
-rw-r--r--src/core/ns_recover.c4
-rw-r--r--src/core/ns_register.c8
-rw-r--r--src/core/ns_release.c4
-rw-r--r--src/core/ns_resetpass.c6
-rw-r--r--src/core/ns_saset.c4
-rw-r--r--src/core/ns_sendpass.c2
-rw-r--r--src/core/ns_set.c30
-rw-r--r--src/core/ns_status.c8
-rw-r--r--src/core/ns_suspend.c2
-rw-r--r--src/core/os_akill.c2
-rw-r--r--src/core/os_session.c2
-rw-r--r--src/core/os_sgline.c2
-rw-r--r--src/core/os_sqline.c2
-rw-r--r--src/core/os_staff.c2
-rw-r--r--src/core/os_szline.c2
-rw-r--r--src/language.c4
-rw-r--r--src/mail.c2
-rw-r--r--src/memoserv.c19
-rw-r--r--src/modules.c8
-rw-r--r--src/modules/cs_enforce.c2
-rw-r--r--src/modules/hs_request.c4
-rw-r--r--src/modules/ns_maxemail.c2
-rw-r--r--src/nickalias.cpp6
-rw-r--r--src/nickcore.cpp19
-rw-r--r--src/nickserv.c18
-rw-r--r--src/protocol/bahamut.c6
-rw-r--r--src/protocol/inspircd11.c6
-rw-r--r--src/protocol/inspircd12.cpp6
-rw-r--r--src/protocol/ratbox.c6
-rw-r--r--src/protocol/unreal32.c6
-rw-r--r--src/servers.c2
-rw-r--r--src/users.c62
76 files changed, 314 insertions, 291 deletions
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 &param)
{
- 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<ci::string> &params)
{
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<ci::string> &params)
{
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<ci::string> &params)
{
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 Command
notice_lang(Config.s_NickServ, u, NICK_REGISTERED_NO_MASK, u->nick.c_str());
delete nr;
- ircdproto->SendAccountLogin(u, u->nc);
+ ircdproto->SendAccountLogin(u, u->Account());
ircdproto->SetAutoIdentificationToken(u);
if (enc_decrypt(na->nc->pass, tmp_pass) == 1)
@@ -109,7 +109,7 @@ class CommandNSConfirm : public Command
if (!nr)
{
- if (u->nc && u->nc->HasPriv("nickserv/confirm"))
+ if (u->Account() && u->Account()->HasPriv("nickserv/confirm"))
{
/* If an admin, their nick is obviously already regged, so look at the passcode to get the nick
of the user they are trying to validate, and push that user through regardless of passcode */
@@ -156,7 +156,7 @@ class CommandNSConfirm : public Command
bool OnHelp(User *u, const ci::string &subcommand)
{
notice_help(Config.s_NickServ, u, NICK_HELP_CONFIRM);
- if (u->nc && u->nc->HasPriv("nickserv/confirm"))
+ if (u->Account() && u->Account()->HasPriv("nickserv/confirm"))
notice_help(Config.s_NickServ, u, NICK_HELP_CONFIRM_OPER);
return true;
}
diff --git a/src/core/ns_release.c b/src/core/ns_release.c
index 4424d7864..7ec6f85ee 100644
--- a/src/core/ns_release.c
+++ b/src/core/ns_release.c
@@ -57,7 +57,7 @@ class CommandNSRelease : 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)))
{
release(na, 0);
notice_lang(Config.s_NickServ, u, NICK_RELEASED);
@@ -73,7 +73,7 @@ class CommandNSRelease : 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_RELEASE, relstr);
//do_help_limited(Config.s_NickServ, u, this);
diff --git a/src/core/ns_resetpass.c b/src/core/ns_resetpass.c
index fe39341e9..258b8c4b5 100644
--- a/src/core/ns_resetpass.c
+++ b/src/core/ns_resetpass.c
@@ -26,7 +26,7 @@ class CommandNSResetPass : public Command
{
NickAlias *na;
- if (Config.RestrictMail && !u->nc->HasCommand("nickserv/resetpass"))
+ if (Config.RestrictMail && !u->Account()->HasCommand("nickserv/resetpass"))
notice_lang(Config.s_NickServ, u, ACCESS_DENIED);
if (!(na = findnick(params[0].c_str())))
notice_lang(Config.s_NickServ, u, NICK_X_NOT_REGISTERED, params[0].c_str());
@@ -139,8 +139,8 @@ class NSResetPass : public Module
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);
FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(u));
diff --git a/src/core/ns_saset.c b/src/core/ns_saset.c
index 3ae40baea..e7cc089ed 100644
--- a/src/core/ns_saset.c
+++ b/src/core/ns_saset.c
@@ -65,7 +65,7 @@ private:
int len = param.size();
- if (Config.NSSecureAdmins && u->nc != nc && nc->IsServicesOper())
+ if (Config.NSSecureAdmins && u->Account() != nc && nc->IsServicesOper())
{
notice_lang(Config.s_NickServ, u, ACCESS_DENIED);
return MOD_CONT;
@@ -128,7 +128,7 @@ private:
notice_lang(Config.s_NickServ, u, NICK_SASET_EMAIL_UNSET_IMPOSSIBLE);
return MOD_CONT;
}
- else if (Config.NSSecureAdmins && u->nc != nc && nc->IsServicesOper())
+ else if (Config.NSSecureAdmins && u->Account() != nc && nc->IsServicesOper())
{
notice_lang(Config.s_NickServ, u, ACCESS_DENIED);
return MOD_CONT;
diff --git a/src/core/ns_sendpass.c b/src/core/ns_sendpass.c
index 9c3667047..30bf151b0 100644
--- a/src/core/ns_sendpass.c
+++ b/src/core/ns_sendpass.c
@@ -27,7 +27,7 @@ class CommandNSSendPass : public Command
const char *nick = params[0].c_str();
NickAlias *na;
- if (Config.RestrictMail && !u->nc->HasCommand("nickserv/sendpass"))
+ if (Config.RestrictMail && !u->Account()->HasCommand("nickserv/sendpass"))
notice_lang(Config.s_NickServ, u, ACCESS_DENIED);
else if (!(na = findnick(nick)))
notice_lang(Config.s_NickServ, u, NICK_X_NOT_REGISTERED, nick);
diff --git a/src/core/ns_set.c b/src/core/ns_set.c
index 054959a27..7f7348e69 100644
--- a/src/core/ns_set.c
+++ b/src/core/ns_set.c
@@ -463,34 +463,34 @@ class CommandNSSet : public Command
if (na->HasFlag(NS_FORBIDDEN))
notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
*/
- if (u->nc->HasFlag(NI_SUSPENDED))
- notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->nc->display);
+ if (u->Account()->HasFlag(NI_SUSPENDED))
+ notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->Account()->display);
else if (cmd == "DISPLAY")
- return this->DoSetDisplay(u, params, u->nc);
+ return this->DoSetDisplay(u, params, u->Account());
else if (cmd == "PASSWORD")
- return this->DoSetPassword(u, params, u->nc);
+ return this->DoSetPassword(u, params, u->Account());
else if (cmd == "LANGUAGE")
- return this->DoSetLanguage(u, params, u->nc);
+ return this->DoSetLanguage(u, params, u->Account());
else if (cmd == "URL")
- return this->DoSetUrl(u, params, u->nc);
+ return this->DoSetUrl(u, params, u->Account());
else if (cmd == "EMAIL")
- return this->DoSetEmail(u, params, u->nc);
+ return this->DoSetEmail(u, params, u->Account());
else if (cmd == "ICQ")
- return this->DoSetICQ(u, params, u->nc);
+ return this->DoSetICQ(u, params, u->Account());
else if (cmd == "GREET")
- return this->DoSetGreet(u, params, u->nc);
+ return this->DoSetGreet(u, params, u->Account());
else if (cmd == "KILL")
- return this->DoSetKill(u, params, u->nc);
+ return this->DoSetKill(u, params, u->Account());
else if (cmd == "SECURE")
- return this->DoSetSecure(u, params, u->nc);
+ return this->DoSetSecure(u, params, u->Account());
else if (cmd == "PRIVATE")
- return this->DoSetPrivate(u, params, u->nc);
+ return this->DoSetPrivate(u, params, u->Account());
else if (cmd == "MSG")
- return this->DoSetMsg(u, params, u->nc);
+ return this->DoSetMsg(u, params, u->Account());
else if (cmd == "HIDE")
- return this->DoSetHide(u, params, u->nc);
+ return this->DoSetHide(u, params, u->Account());
else if (cmd == "AUTOOP")
- return this->DoSetAutoOP(u, params, u->nc);
+ return this->DoSetAutoOP(u, params, u->Account());
else
notice_lang(Config.s_NickServ, u, NICK_SET_UNKNOWN_OPTION, cmd.c_str());
return MOD_CONT;
diff --git a/src/core/ns_status.c b/src/core/ns_status.c
index 7b600a912..df1e52f98 100644
--- a/src/core/ns_status.c
+++ b/src/core/ns_status.c
@@ -37,17 +37,17 @@ class CommandNSStatus : public Command
if (!(u2 = finduser(nickbuf))) /* Nick is not online */
notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 0, "");
- else if (nick_identified(u2) && na && na->nc == u2->nc) /* Nick is identified */
- notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 3, u2->nc->display);
+ else if (u2->IsIdentified() && na && na->nc == u2->Account()) /* Nick is identified */
+ notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 3, u2->Account()->display);
else if (u2->IsRecognized()) /* Nick is recognised, but NOT identified */
- notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 2, (u2->nc ? u2->nc->display : ""));
+ notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 2, (u2->Account() ? u2->Account()->display : ""));
else if (!na) /* Nick is online, but NOT a registered */
notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 0, "");
else
/* Nick is not identified for the nick, but they could be logged into an account,
* so we tell the user about it
*/
- notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 1, (u2->nc ? u2->nc->display : ""));
+ notice_lang(Config.s_NickServ, u, NICK_STATUS_REPLY, nickbuf.c_str(), 1, (u2->Account() ? u2->Account()->display : ""));
}
return MOD_CONT;
}
diff --git a/src/core/ns_suspend.c b/src/core/ns_suspend.c
index a0e6a5967..7c3dd0ca9 100644
--- a/src/core/ns_suspend.c
+++ b/src/core/ns_suspend.c
@@ -72,7 +72,7 @@ class CommandNSSuspend : public Command
na2->last_quit = sstrdup(reason);
/* removes nicktracking */
if ((u2 = finduser(na2->nick)))
- u2->nc = NULL;
+ u2->Logout();
/* force guestnick */
collide(na2, 0);
}
diff --git a/src/core/os_akill.c b/src/core/os_akill.c
index b87340af2..a045e2bae 100644
--- a/src/core/os_akill.c
+++ b/src/core/os_akill.c
@@ -353,7 +353,7 @@ int akill_view(int number, Akill *ak, User *u, int *sent_header)
snprintf(mask, sizeof(mask), "%s@%s", ak->user, ak->host);
tm = *localtime(&ak->seton);
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
- expire_left(u->nc, expirebuf, sizeof(expirebuf), ak->expires);
+ expire_left(u->Account(), expirebuf, sizeof(expirebuf), ak->expires);
notice_lang(Config.s_OperServ, u, OPER_AKILL_VIEW_FORMAT, number, mask, ak->by, timebuf, expirebuf, ak->reason);
return 1;
diff --git a/src/core/os_session.c b/src/core/os_session.c
index 5bd5515e2..98087aaad 100644
--- a/src/core/os_session.c
+++ b/src/core/os_session.c
@@ -165,7 +165,7 @@ static int exception_view(User *u, const int index, int *sent_header)
tm = *localtime(exceptions[index].time ? &exceptions[index].time : &t);
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
- expire_left(u->nc, expirebuf, sizeof(expirebuf), exceptions[index].expires);
+ expire_left(u->Account(), expirebuf, sizeof(expirebuf), exceptions[index].expires);
notice_lang(Config.s_OperServ, u, OPER_EXCEPTION_VIEW_FORMAT, index + 1, exceptions[index].mask, exceptions[index].who ? exceptions[index].who : "<unknown>", timebuf, expirebuf, exceptions[index].limit, exceptions[index].reason);
return 1;
diff --git a/src/core/os_sgline.c b/src/core/os_sgline.c
index 311ffe380..81d228c00 100644
--- a/src/core/os_sgline.c
+++ b/src/core/os_sgline.c
@@ -358,7 +358,7 @@ int sgline_view(int number, SXLine *sx, User *u, int *sent_header)
tm = *localtime(&sx->seton);
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
- expire_left(u->nc, expirebuf, sizeof(expirebuf), sx->expires);
+ expire_left(u->Account(), expirebuf, sizeof(expirebuf), sx->expires);
notice_lang(Config.s_OperServ, u, OPER_SGLINE_VIEW_FORMAT, number, sx->mask, sx->by, timebuf, expirebuf, sx->reason);
return 1;
diff --git a/src/core/os_sqline.c b/src/core/os_sqline.c
index 226c168fb..8c3beb9ba 100644
--- a/src/core/os_sqline.c
+++ b/src/core/os_sqline.c
@@ -343,7 +343,7 @@ int sqline_view(int number, SXLine *sx, User *u, int *sent_header)
tm = *localtime(&sx->seton);
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
- expire_left(u->nc, expirebuf, sizeof(expirebuf), sx->expires);
+ expire_left(u->Account(), expirebuf, sizeof(expirebuf), sx->expires);
notice_lang(Config.s_OperServ, u, OPER_SQLINE_VIEW_FORMAT, number, sx->mask, sx->by, timebuf, expirebuf, sx->reason);
return 1;
diff --git a/src/core/os_staff.c b/src/core/os_staff.c
index e5b378a6a..39828f520 100644
--- a/src/core/os_staff.c
+++ b/src/core/os_staff.c
@@ -37,7 +37,7 @@ class CommandOSStaff : public Command
/* We have to loop all users as some may be logged into an account but not a nick */
for (User *u2 = firstuser(); u2; u2 = nextuser())
{
- if (u2->nc && u2->nc == na->nc)
+ if (u2->Account() && u2->Account() == na->nc)
{
found = 1;
if (na->nick == u2->nick)
diff --git a/src/core/os_szline.c b/src/core/os_szline.c
index 23bfb39d9..02b864e95 100644
--- a/src/core/os_szline.c
+++ b/src/core/os_szline.c
@@ -342,7 +342,7 @@ int szline_view(int number, SXLine *sx, User *u, int *sent_header)
tm = *localtime(&sx->seton);
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
- expire_left(u->nc, expirebuf, sizeof(expirebuf), sx->expires);
+ expire_left(u->Account(), expirebuf, sizeof(expirebuf), sx->expires);
notice_lang(Config.s_OperServ, u, OPER_SZLINE_VIEW_FORMAT, number, sx->mask, sx->by, timebuf, expirebuf, sx->reason);
return 1;
diff --git a/src/language.c b/src/language.c
index 7e152254f..51aec1031 100644
--- a/src/language.c
+++ b/src/language.c
@@ -233,7 +233,7 @@ void lang_init()
int strftime_lang(char *buf, int size, User * u, int format, struct tm *tm)
{
- int language = u && u->nc ? u->nc->language : Config.NSDefLanguage;
+ int language = u && u->Account() ? u->Account()->language : Config.NSDefLanguage;
char tmpbuf[BUFSIZE], buf2[BUFSIZE];
char *s;
int i, ret;
@@ -326,7 +326,7 @@ const char *getstring(NickCore *nc, int index)
const char *getstring(User *u, int index)
{
- return getstring(u->nc, index);
+ return getstring(u->Account(), index);
}
const char *getstring(int index)
diff --git a/src/mail.c b/src/mail.c
index d901de457..87bab2558 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -91,7 +91,7 @@ MailInfo *MailBegin(User * u, NickCore * nc, char *subject, char *service)
notice_lang(service, u, MAIL_DISABLED);
} else if (((time(NULL) - u->lastmail < Config.MailDelay)
|| (time(NULL) - nc->lastmail < Config.MailDelay))
- && !(u->nc && u->nc->IsServicesOper())) {
+ && !(u->Account() && u->Account()->IsServicesOper())) {
notice_lang(service, u, MAIL_DELAYED, Config.MailDelay);
} else if (!nc->email) {
notice_lang(service, u, MAIL_INVALID, nc->display);
diff --git a/src/memoserv.c b/src/memoserv.c
index 1a60a88bc..1db5aa06d 100644
--- a/src/memoserv.c
+++ b/src/memoserv.c
@@ -89,7 +89,7 @@ void check_memos(User * u)
return;
}
- if (!(nc = u->nc) || !u->IsRecognized() ||
+ if (!(nc = u->Account()) || !u->IsRecognized() ||
!(nc->HasFlag(NI_MEMO_SIGNON))) {
return;
}
@@ -195,8 +195,8 @@ void memo_send(User * u, const char *name, const char *text, int z)
Memo *m;
MemoInfo *mi;
time_t now = time(NULL);
- char *source = u->nc->display;
- int is_servoper = u->nc && u->nc->IsServicesOper();
+ char *source = u->Account()->display;
+ int is_servoper = u->Account() && u->Account()->IsServicesOper();
if (readonly) {
notice_lang(Config.s_MemoServ, u, MEMO_SEND_DISABLED);
@@ -207,7 +207,7 @@ void memo_send(User * u, const char *name, const char *text, int z)
if (z == 3)
syntax_error(Config.s_MemoServ, u, "RSEND", MEMO_RSEND_SYNTAX);
- } else if (!nick_identified(u) && !u->IsRecognized()) {
+ } else if (!u->IsIdentified() && !u->IsRecognized()) {
if (z == 0 || z == 3)
notice_lang(Config.s_MemoServ, u, NICK_IDENTIFY_REQUIRED, Config.s_NickServ);
@@ -281,13 +281,14 @@ void memo_send(User * u, const char *name, const char *text, int z)
for (i = 0; i < nc->aliases.count; i++) {
na = static_cast<NickAlias *>(nc->aliases.list[i]);
- if (finduser(na->nick) && nick_identified(finduser(na->nick)))
- notice_lang(Config.s_MemoServ, finduser(na->nick),
+ User *user = finduser(na->nick);
+ if (user && user->IsIdentified())
+ notice_lang(Config.s_MemoServ, user,
MEMO_NEW_MEMO_ARRIVED, source,
Config.s_MemoServ, m->number);
}
} else {
- if ((u = finduser(name)) && nick_identified(u)
+ if ((u = finduser(name)) && u->IsIdentified()
&& (nc->HasFlag(NI_MEMO_RECEIVE)))
notice_lang(Config.s_MemoServ, u, MEMO_NEW_MEMO_ARRIVED,
source, Config.s_MemoServ, m->number);
@@ -307,8 +308,8 @@ void memo_send(User * u, const char *name, const char *text, int z)
UserContainer *cu = *it;
if (check_access(cu->user, c->ci, CA_MEMO)) {
- if (cu->user->nc
- && (cu->user->nc->HasFlag(NI_MEMO_RECEIVE))
+ if (cu->user->Account()
+ && (cu->user->Account()->HasFlag(NI_MEMO_RECEIVE))
&& get_ignore(cu->user->nick.c_str()) == NULL) {
notice_lang(Config.s_MemoServ, cu->user,
MEMO_NEW_X_MEMO_ARRIVED,
diff --git a/src/modules.c b/src/modules.c
index 7894c580b..3bc2e490f 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -688,8 +688,8 @@ void Module::NoticeLang(const char *source, User * u, int number, ...)
char *s, *t, *buf;
/* Find the users lang, and use it if we can */
- if (u && u->nc) {
- mlang = u->nc->language;
+ if (u && u->Account()) {
+ mlang = u->Account()->language;
}
/* If the users lang isnt supported, drop back to English */
@@ -726,8 +726,8 @@ const char *Module::GetLangString(User * u, int number)
int mlang = Config.NSDefLanguage;
/* Find the users lang, and use it if we can */
- if (u && u->nc)
- mlang = u->nc->language;
+ if (u && u->Account())
+ mlang = u->Account()->language;
/* If the users lang isnt supported, drop back to English */
if (this->lang[mlang].argc == 0)
diff --git a/src/modules/cs_enforce.c b/src/modules/cs_enforce.c
index 9d752cd36..ae7d44305 100644
--- a/src/modules/cs_enforce.c
+++ b/src/modules/cs_enforce.c
@@ -135,7 +135,7 @@ class CommandCSEnforce : public Command
{
UserContainer *uc = *it++;
- if (!nick_identified(uc->user))
+ if (!uc->user->IsIdentified())
{
get_idealban(ci, uc->user, mask, sizeof(mask));
reason = getstring(uc->user, CHAN_NOT_ALLOWED_TO_JOIN);
diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c
index 784fcc59d..84f19806c 100644
--- a/src/modules/hs_request.c
+++ b/src/modules/hs_request.c
@@ -732,8 +732,8 @@ void my_memo_lang(User *u, const char *name, int z, int number, ...)
u2 = finduser(name);
/* Find the users lang, and use it if we cant */
- if (u2 && u2->nc)
- lang = u2->nc->language;
+ if (u2 && u2->Account())
+ lang = u2->Account()->language;
/* If the users lang isnt supported, drop back to enlgish */
if (!me->lang[lang].argc)
diff --git a/src/modules/ns_maxemail.c b/src/modules/ns_maxemail.c
index 4817c5003..4a90b7da6 100644
--- a/src/modules/ns_maxemail.c
+++ b/src/modules/ns_maxemail.c
@@ -138,7 +138,7 @@ int count_email_in_use(const char *email, User * u)
{
for (nc = nclists[i]; nc; nc = nc->next)
{
- if (!(u->nc && u->nc == nc) && nc->email && !stricmp(nc->email, email))
+ if (!(u->Account() && u->Account() == nc) && nc->email && !stricmp(nc->email, email))
++count;
}
}
diff --git a/src/nickalias.cpp b/src/nickalias.cpp
index 5ab62eafa..74883ff06 100644
--- a/src/nickalias.cpp
+++ b/src/nickalias.cpp
@@ -62,11 +62,11 @@ NickAlias::~NickAlias()
/* Second thing to do: look for an user using the alias
* being deleted, and make appropriate changes */
- if ((u = finduser(this->nick)) && u->nc)
+ if ((u = finduser(this->nick)) && u->Account())
{
- ircdproto->SendAccountLogout(u, u->nc);
+ ircdproto->SendAccountLogout(u, u->Account());
ircdproto->SendUnregisteredNick(u);
- u->nc = NULL;
+ u->Logout();
}
/* Accept nicks that have no core, because of database load functions */
diff --git a/src/nickcore.cpp b/src/nickcore.cpp
index 0073e0d32..fc46cd6d4 100644
--- a/src/nickcore.cpp
+++ b/src/nickcore.cpp
@@ -38,20 +38,15 @@ NickCore::~NickCore()
/* Clean up this nick core from any users online using it
* (ones that /nick but remain unidentified)
*/
- User *user;
- for (int i = 0; i < 1024; ++i)
+ for (std::list<User *>::iterator it = this->Users.begin(); it != this->Users.end(); ++it)
{
- for (user = userlist[i]; user; user = user->next)
- {
- if (user->nc && user->nc == this)
- {
- ircdproto->SendAccountLogout(user, user->nc);
- ircdproto->SendUnregisteredNick(user);
- user->nc = NULL;
- FOREACH_MOD(I_OnNickLogout, OnNickLogout(user));
- }
- }
+ User *user = *it;
+ ircdproto->SendAccountLogout(user, user->Account());
+ ircdproto->SendUnregisteredNick(user);
+ user->Logout();
+ FOREACH_MOD(I_OnNickLogout, OnNickLogout(user));
}
+ this->Users.clear();
/* (Hopefully complete) cleanup */
cs_remove_nick(this);
diff --git a/src/nickserv.c b/src/nickserv.c
index 8f4ceea1b..a0994e07d 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -58,7 +58,7 @@ void NickServCollide::Tick(time_t ctime)
{
/* If they identified or don't exist anymore, don't kill them. */
User *u = finduser(na->nick);
- if (!u || u->nc == na->nc || u->my_signon > this->GetSetTime())
+ if (!u || u->Account() == na->nc || u->my_signon > this->GetSetTime())
return;
/* The RELEASE timeout will always add to the beginning of the
@@ -380,20 +380,6 @@ void cancel_user(User * u)
/*************************************************************************/
-/* Return whether a user has identified for their nickname. */
-
-int nick_identified(User * u)
-{
- if (u->nc)
- {
- return 1;
- }
-
- return 0;
-}
-
-/*************************************************************************/
-
/* Remove all nicks which have expired. Also update last-seen time for all
* nicks.
*/
@@ -412,7 +398,7 @@ void expire_nicks()
next = na->next;
User *u = finduser(na->nick);
- if (u && (na->nc->HasFlag(NI_SECURE) ? nick_identified(u) : u->IsRecognized()))
+ if (u && (na->nc->HasFlag(NI_SECURE) ? u->IsIdentified() : u->IsRecognized()))
{
Alog(LOG_DEBUG_2) << "NickServ: updating last seen time for " << na->nick;
na->last_seen = now;
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c
index 4462ee4eb..ddb9747ee 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.c
@@ -325,14 +325,14 @@ class BahamutIRCdProto : public IRCDProto
{
char svidbuf[15];
- if (!u->nc)
+ if (!u->Account())
return;
srand(time(NULL));
snprintf(svidbuf, sizeof(svidbuf), "%d", rand());
- u->nc->Shrink("authenticationtoken");
- u->nc->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
+ u->Account()->Shrink("authenticationtoken");
+ u->Account()->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
BotInfo *bi = findbot(Config.s_NickServ);
u->SetMode(bi, UMODE_REGISTERED);
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index ffd34cb8f..db5f93c23 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -351,13 +351,13 @@ class InspIRCdProto : public IRCDProto
{
char svidbuf[15];
- if (!u->nc)
+ if (!u->Account())
return;
snprintf(svidbuf, sizeof(svidbuf), "%ld", static_cast<long>(u->timestamp));
- u->nc->Shrink("authenticationtoken");
- u->nc->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
+ u->Account()->Shrink("authenticationtoken");
+ u->Account()->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
}
} ircd_proto;
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index 9762d115f..245b37cb6 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -395,7 +395,7 @@ class InspIRCdProto : public IRCDProto
void SetAutoIdentificationToken(User *u)
{
- if (!u->nc)
+ if (!u->Account())
return;
u->SetMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
@@ -871,7 +871,7 @@ int anope_event_uid(const char *source, int ac, const char **av)
user = prev_u_intro;
prev_u_intro = NULL;
if (user) na = findnick(user->nick);
- if (user && user->server->sync == SSYNC_IN_PROGRESS && (!na || na->nc != user->nc))
+ if (user && user->server->sync == SSYNC_IN_PROGRESS && (!na || na->nc != user->Account()))
{
validate_user(user);
if (user->HasMode(UMODE_REGISTERED))
@@ -1156,7 +1156,7 @@ int anope_event_endburst(const char *source, int ac, const char **av)
* If not, validate the user. ~ Viper*/
prev_u_intro = NULL;
if (u) na = findnick(u->nick);
- if (u && u->server->sync == SSYNC_IN_PROGRESS && (!na || na->nc != u->nc))
+ if (u && u->server->sync == SSYNC_IN_PROGRESS && (!na || na->nc != u->Account()))
{
validate_user(u);
if (u->HasMode(UMODE_REGISTERED))
diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c
index 1fc7122e2..dbd32ac10 100644
--- a/src/protocol/ratbox.c
+++ b/src/protocol/ratbox.c
@@ -326,13 +326,13 @@ class RatboxProto : public IRCDTS6Proto
{
char svidbuf[15];
- if (!u->nc)
+ if (!u->Account())
return;
snprintf(svidbuf, sizeof(svidbuf), "%ld", static_cast<long>(u->timestamp));
- u->nc->Shrink("authenticationtoken");
- u->nc->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
+ u->Account()->Shrink("authenticationtoken");
+ u->Account()->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
}
} ircd_proto;
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index ee906b1b8..7963ae6c8 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -449,14 +449,14 @@ class UnrealIRCdProto : public IRCDProto
{
char svidbuf[15];
- if (!u->nc)
+ if (!u->Account())
return;
srand(time(NULL));
snprintf(svidbuf, sizeof(svidbuf), "%d", rand());
- u->nc->Shrink("authenticationtoken");
- u->nc->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
+ u->Account()->Shrink("authenticationtoken");
+ u->Account()->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
BotInfo *bi = findbot(Config.s_NickServ);
u->SetMode(bi, UMODE_REGISTERED);
diff --git a/src/servers.c b/src/servers.c
index 87f24e405..fca229d22 100644
--- a/src/servers.c
+++ b/src/servers.c
@@ -214,7 +214,7 @@ static void delete_server(Server * serv, const char *quitreason)
{
if ((na = findnick(u->nick)) && !na->HasFlag(NS_FORBIDDEN)
&& (!na->nc->HasFlag(NI_SUSPENDED))
- && (u->IsRecognized() || nick_identified(u))) {
+ && (u->IsRecognized() || u->IsIdentified())) {
na->last_seen = time(NULL);
if (na->last_quit)
delete [] na->last_quit;
diff --git a/src/users.c b/src/users.c
index 240a16015..71fd5e8b1 100644
--- a/src/users.c
+++ b/src/users.c
@@ -211,7 +211,7 @@ void User::SetRealname(const std::string &srealname)
this->realname = sstrdup(srealname.c_str());
NickAlias *na = findnick(this->nick);
- if (na && (nick_identified(this) || !this->nc || !this->nc->HasFlag(NI_SECURE) && IsRecognized()))
+ if (na && (this->IsIdentified() || (!this->nc->HasFlag(NI_SECURE) && IsRecognized())))
{
if (na->last_realname)
delete [] na->last_realname;
@@ -356,6 +356,48 @@ void User::AutoID(const char *account)
}
}
+
+/** Login the user to a NickCore
+ * @param core The account the user is useing
+ */
+void User::Login(NickCore *core)
+{
+ nc = core;
+ core->Users.push_back(this);
+}
+
+/** Logout the user
+ */
+void User::Logout()
+{
+ if (!this->nc)
+ return;
+
+ std::list<User *>::iterator it = std::find(this->nc->Users.begin(), this->nc->Users.end(), this);
+ if (it != this->nc->Users.end())
+ {
+ this->nc->Users.erase(it);
+ }
+
+ nc = NULL;
+}
+
+/** Get the account the user is logged in using
+ * @reurn The account or NULL
+ */
+NickCore *User::Account() const
+{
+ return nc;
+}
+
+/** Check if the user is identified for their nick
+ * @return true or false
+ */
+const bool User::IsIdentified() const
+{
+ return nc;
+}
+
/** Check if the user is recognized for their nick (on the nicks access list)
* @return true or false
*/
@@ -838,7 +880,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const
user->SetNewNick(nick);
FOREACH_MOD(I_OnUserNickChange, OnUserNickChange(user, oldnick.c_str()));
- if ((old_na ? old_na->nc : NULL) == user->nc)
+ if ((old_na ? old_na->nc : NULL) == user->Account())
nc_changed = 0;
if (!nc_changed)
@@ -853,7 +895,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const
}
else
{
- if (!nick_identified(user) || !user->IsRecognized())
+ if (!user->IsIdentified() || !user->IsRecognized())
{
ircdproto->SendUnregisteredNick(user);
}
@@ -874,12 +916,12 @@ User *do_nick(const char *source, const char *nick, const char *username, const
if (!(ircd->b_delay_auth && user->server->sync == SSYNC_IN_PROGRESS))
{
NickAlias *ntmp = findnick(user->nick);
- if (ntmp && user->nc == ntmp->nc)
+ if (ntmp && user->Account() == ntmp->nc)
{
nc_changed = 0;
}
- if (!ntmp || ntmp->nc != user->nc || nc_changed)
+ if (!ntmp || ntmp->nc != user->Account() || nc_changed)
{
if (validate_user(user))
check_memos(user);
@@ -889,13 +931,13 @@ User *do_nick(const char *source, const char *nick, const char *username, const
ntmp->last_seen = time(NULL);
user->UpdateHost();
ircdproto->SetAutoIdentificationToken(user);
- Alog() << Config.s_NickServ << ": " << user->GetMask() << "automatically identified for group " << user->nc->display;
+ Alog() << Config.s_NickServ << ": " << user->GetMask() << "automatically identified for group " << user->Account()->display;
}
/* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */
if (ircd->check_nick_id)
{
- if (nick_identified(user))
+ if (user->IsIdentified())
{
ircdproto->SetAutoIdentificationToken(user);
}
@@ -943,7 +985,7 @@ void do_quit(const char *source, int ac, const char **av)
}
Alog(LOG_DEBUG) << source << " quits";
if ((na = findnick(user->nick)) && !na->HasFlag(NS_FORBIDDEN)
- && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || nick_identified(user))) {
+ && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || user->IsIdentified())) {
na->last_seen = time(NULL);
if (na->last_quit)
delete [] na->last_quit;
@@ -975,7 +1017,7 @@ void do_kill(const std::string &nick, const std::string &msg)
return;
}
Alog(LOG_DEBUG) << nick << " killed";
- if ((na = findnick(user->nick)) && !na->HasFlag(NS_FORBIDDEN) && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || nick_identified(user)))
+ if ((na = findnick(user->nick)) && !na->HasFlag(NS_FORBIDDEN) && !na->nc->HasFlag(NI_SUSPENDED) && (user->IsRecognized() || user->IsIdentified()))
{
na->last_seen = time(NULL);
if (na->last_quit)
@@ -1208,7 +1250,7 @@ void UserSetInternalModes(User *user, int ac, const char **av)
--opcnt;
break;
case UMODE_REGISTERED:
- if (add && !nick_identified(user))
+ if (add && !user->IsIdentified())
user->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
break;
case UMODE_CLOAK: