]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_who.cpp
- first steps towards a working IPv6 port. I'll work more on this tomorrow. :-P
[user/henk/code/inspircd.git] / src / cmd_who.cpp
index c25fa611d13cadee5cd5a27537efeeb835772513..f5a376e3972300cae96aa09b2cdacf2f217dbca2 100644 (file)
@@ -71,12 +71,12 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user)
        {
                if ((IS_SINGLE(parameters[0],'0')) || (IS_SINGLE(parameters[0],'*')))
                {
-                       if ((user->chans.size()) && (user->chans[0].channel))
+                       if ((user->chans.size()) && (((ucrec*)*(user->chans.begin()))->channel))
                        {
                                int n_list = 0;
                                for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
                                {
-                                       Ptr = i->second->chans[0].channel;
+                                       Ptr = ((ucrec*)*(i->second->chans.begin()))->channel;
                                        // suggested by phidjit and FCS
                                        if ((!common_channels(user,i->second)) && (isnick(i->second->nick)))
                                        {
@@ -127,12 +127,12 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user)
                                                if (*i->second->oper) { charlcat(tmp, '*', 9); }
                                                strlcat(tmp, cmode(i->second, Ptr),5);
                                                WriteServ(user->fd,"352 %s %s %s %s %s %s %s :0 %s",user->nick, Ptr->name, i->second->ident, i->second->dhost, i->second->server, i->second->nick, tmp, i->second->fullname);
-                                                n_list++;
-                                                if (n_list > Config->MaxWhoResults)
-                                                {
-                                                        WriteServ(user->fd,"523 %s WHO :Command aborted: More results than configured limit",user->nick);
-                                                        break;
-                                                }
+                                               n_list++;
+                                               if (n_list > Config->MaxWhoResults)
+                                               {
+                                                       WriteServ(user->fd,"523 %s WHO :Command aborted: More results than configured limit",user->nick);
+                                                       break;
+                                               }
 
                                        }
                                }
@@ -156,18 +156,18 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user)
                                        charlcat(tmp, 'H' ,9);
                                }
                                if (*u->oper) { charlcat(tmp, '*' ,9); }
-                               WriteServ(user->fd,"352 %s %s %s %s %s %s %s :0 %s",user->nick, u->chans.size() && u->chans[0].channel ? u->chans[0].channel->name
-                                : "*", u->ident, u->dhost, u->server, u->nick, tmp, u->fullname);
+                               WriteServ(user->fd,"352 %s %s %s %s %s %s %s :0 %s",user->nick, u->chans.size() && ((ucrec*)*(u->chans.begin()))->channel ? ((ucrec*)*(u->chans.begin()))->channel->name
+                               : "*", u->ident, u->dhost, u->server, u->nick, tmp, u->fullname);
                        }
                        WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, parameters[0]);
                }
        }
        if (pcnt == 2)
        {
-                if ((IS_SINGLE(parameters[0],'0')) || (IS_SINGLE(parameters[0],'*')) && (IS_SINGLE(parameters[1],'o')))
-                {
+               if ((IS_SINGLE(parameters[0],'0')) || (IS_SINGLE(parameters[0],'*')) && (IS_SINGLE(parameters[1],'o')))
+               {
                        for (std::vector<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++)
-                        {
+                       {
                                // If i were a rich man.. I wouldn't need to me making these bugfixes..
                                // But i'm a poor bastard with nothing better to do.
                                userrec* oper = *i;
@@ -177,12 +177,12 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user)
                                } else {
                                        charlcat(tmp, 'H' ,9);
                                }
-                                WriteServ(user->fd,"352 %s %s %s %s %s %s %s* :0 %s", user->nick, oper->chans.size() && oper->chans[0].channel ? oper->chans[0].channel->name 
+                               WriteServ(user->fd,"352 %s %s %s %s %s %s %s* :0 %s", user->nick, oper->chans.size() && ((ucrec*)*(oper->chans.begin()))->channel ? ((ucrec*)*(oper->chans.begin()))->channel->name
                                : "*", oper->ident, oper->dhost, oper->server, oper->nick, tmp, oper->fullname);
-                        }
-                        WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, parameters[0]);
-                        return;
-                }
+                       }
+                       WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, parameters[0]);
+                       return;
+               }
        }
 }