]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_whois.cpp
m_spanningtree Rewrite /map
[user/henk/code/inspircd.git] / src / commands / cmd_whois.cpp
index a6a4447b95bb80b4d383f1d5bb6e09cb70eecef3..29322f8021b122a6c1e3a4502389a5ebd485305a 100644 (file)
@@ -65,7 +65,7 @@ std::string CommandWhois::ChannelList(User* source, User* dest, bool spy)
 
        for (UCListIter i = dest->chans.begin(); i != dest->chans.end(); i++)
        {
-               Channel* c = *i;
+               Channel* c = (*i)->chan;
                /* If the target is the sender, neither +p nor +s is set, or
                 * the channel contains the user, it is not a spy channel
                 */
@@ -80,7 +80,7 @@ void CommandWhois::SplitChanList(User* source, User* dest, const std::string& cl
 {
        std::string line;
        std::ostringstream prefix;
-       std::string::size_type start, pos, length;
+       std::string::size_type start, pos;
 
        prefix << dest->nick << " :";
        line = prefix.str();
@@ -88,23 +88,13 @@ void CommandWhois::SplitChanList(User* source, User* dest, const std::string& cl
 
        for (start = 0; (pos = cl.find(' ', start)) != std::string::npos; start = pos+1)
        {
-               length = (pos == std::string::npos) ? cl.length() : pos;
-
-               if (line.length() + namelen + length - start > 510)
+               if (line.length() + namelen + pos - start > 510)
                {
                        ServerInstance->SendWhoisLine(source, dest, 319, line);
                        line = prefix.str();
                }
 
-               if(pos == std::string::npos)
-               {
-                       line.append(cl.substr(start, length - start));
-                       break;
-               }
-               else
-               {
-                       line.append(cl.substr(start, length - start + 1));
-               }
+               line.append(cl.substr(start, pos - start + 1));
        }
 
        if (line.length() != prefix.str().length())
@@ -144,8 +134,7 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne
        }
        else
        {
-               std::string serverdesc = ServerInstance->GetServerDescription(dest->server);
-               ServerInstance->SendWhoisLine(user, dest, 312, "%s %s :%s", dest->nick.c_str(), dest->server.c_str(), serverdesc.c_str());
+               ServerInstance->SendWhoisLine(user, dest, 312, "%s %s :%s", dest->nick.c_str(), dest->server->GetName().c_str(), dest->server->GetDesc().c_str());
        }
 
        if (dest->IsAway())