diff options
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/cmd_nick.cpp | 2 | ||||
-rw-r--r-- | src/commands/cmd_notice.cpp | 8 | ||||
-rw-r--r-- | src/commands/cmd_privmsg.cpp | 8 | ||||
-rw-r--r-- | src/commands/cmd_stats.cpp | 12 | ||||
-rw-r--r-- | src/commands/cmd_whois.cpp | 5 |
5 files changed, 21 insertions, 14 deletions
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index a079e59d0..4c26d947f 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -66,7 +66,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User { newnick = user->uuid; } - else if (!ServerInstance->IsNick(newnick.c_str(), ServerInstance->Config->Limits.NickMax)) + else if (!ServerInstance->IsNick(newnick, ServerInstance->Config->Limits.NickMax)) { user->WriteNumeric(432, "%s %s :Erroneous Nickname", user->nick.c_str(),newnick.c_str()); return CMD_FAILURE; diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp index d5ef7ba1d..d0845a051 100644 --- a/src/commands/cmd_notice.cpp +++ b/src/commands/cmd_notice.cpp @@ -57,7 +57,9 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use CUList exempt_list; - user->idle_lastmsg = ServerInstance->Time(); + LocalUser* localuser = IS_LOCAL(user); + if (localuser) + localuser->idle_lastmsg = ServerInstance->Time(); if (ServerInstance->Parser->LoopCall(user, this, parameters, 0)) return CMD_SUCCESS; @@ -98,7 +100,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use if (chan) { - if (IS_LOCAL(user)) + if (localuser) { if ((chan->IsModeSet('n')) && (!chan->HasUser(user))) { @@ -166,7 +168,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use const char* destnick = parameters[0].c_str(); - if (IS_LOCAL(user)) + if (localuser) { const char* targetserver = strchr(destnick, '@'); diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index cefdd4800..09314e8a9 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -56,7 +56,9 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us Channel *chan; CUList except_list; - user->idle_lastmsg = ServerInstance->Time(); + LocalUser* localuser = IS_LOCAL(user); + if (localuser) + localuser->idle_lastmsg = ServerInstance->Time(); if (ServerInstance->Parser->LoopCall(user, this, parameters, 0)) return CMD_SUCCESS; @@ -99,7 +101,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us if (chan) { - if (IS_LOCAL(user) && chan->GetPrefixValue(user) < VOICE_VALUE) + if (localuser && chan->GetPrefixValue(user) < VOICE_VALUE) { if (chan->IsModeSet('n') && !chan->HasUser(user)) { @@ -169,7 +171,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us const char* destnick = parameters[0].c_str(); - if (IS_LOCAL(user)) + if (localuser) { const char* targetserver = strchr(destnick, '@'); diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index 9a5bfc52d..c37b041a9 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -161,13 +161,15 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results) case 'P': { - int idx = 0; - for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++) + unsigned int idx = 0; + for (std::list<User*>::const_iterator i = ServerInstance->Users->all_opers.begin(); i != ServerInstance->Users->all_opers.end(); ++i) { - if (IS_OPER(i->second) && !ServerInstance->ULine(i->second->server)) + User* oper = *i; + if (!ServerInstance->ULine(oper->server)) { - results.push_back(sn+" 249 "+user->nick+" :"+i->second->nick+" ("+i->second->ident+"@"+i->second->dhost+") Idle: "+ - (IS_LOCAL(i->second) ? ConvToStr(ServerInstance->Time() - i->second->idle_lastmsg) + " secs" : "unavailable")); + LocalUser* lu = IS_LOCAL(oper); + results.push_back(sn+" 249 " + user->nick + " :" + oper->nick + " (" + oper->ident + "@" + oper->dhost + ") Idle: " + + (lu ? ConvToStr(ServerInstance->Time() - lu->idle_lastmsg) + " secs" : "unavailable")); idx++; } } diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index ba2ad9c15..3a07fce7b 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -74,9 +74,10 @@ CmdResult CommandWhois::Handle (const std::vector<std::string>& parameters, User * For remote users (/w remoteuser remoteuser), spanningtree will handle calling do_whois, so we can ignore this case. * Thanks to djGrrr for not being impatient while I have a crap day coding. :p -- w00t */ - if (IS_LOCAL(dest) && (ServerInstance->Config->HideWhoisServer.empty() || parameters.size() > 1)) + LocalUser* localuser = IS_LOCAL(dest); + if (localuser && (ServerInstance->Config->HideWhoisServer.empty() || parameters.size() > 1)) { - idle = abs((long)((dest->idle_lastmsg)-ServerInstance->Time())); + idle = abs((long)((localuser->idle_lastmsg)-ServerInstance->Time())); signon = dest->signon; } |