summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-02 02:19:09 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-02 02:19:09 +0000
commite786e52f6a59b5d3041befe59646a48e6dad393b (patch)
treeea5d9573b45ac505dff16cb3c91b07c456038de1
parent1c08c20a5a1156852dbd3184360bf3ea40378916 (diff)
Attempted /who fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1279 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/commands.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 6fd516d99..1f8af3b8a 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -196,6 +196,7 @@ extern file_cache MOTD;
extern file_cache RULES;
extern address_cache IP;
+extern std::vector<userrec*> all_opers;
// This table references users by file descriptor.
// its an array to make it VERY fast, as all lookups are referenced
@@ -1038,7 +1039,8 @@ void handle_who(char **parameters, int pcnt, userrec *user)
strncat(tmp, "H" ,9);
}
if (strchr(u->modes,'o')) { strncat(tmp, "*" ,9); }
- WriteServ(user->fd,"352 %s %s %s %s %s %s %s :0 %s",user->nick, u->nick, 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[0].channel ? u->chans[0].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]);
}
@@ -1047,24 +1049,19 @@ void handle_who(char **parameters, int pcnt, userrec *user)
{
if ((!strcmp(parameters[0],"0")) || (!strcmp(parameters[0],"*")) && (!strcmp(parameters[1],"o")))
{
- for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
+ for (std::vector<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++)
{
- if ((common_channels(user,i->second)) && (isnick(i->second->nick)))
- {
- if (strchr(i->second->modes,'o'))
- {
- // 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.
- strcpy(tmp, "");
- if (strcmp(i->second->awaymsg, "")) {
- strncat(tmp, "G" ,9);
- } else {
- strncat(tmp, "H" ,9);
- }
-
- WriteServ(user->fd,"352 %s %s %s %s %s %s %s* :0 %s",user->nick, user->nick, i->second->ident, i->second->dhost, i->second->server, i->second->nick, tmp, i->second->fullname);
- }
- }
+ // 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;
+ strcpy(tmp, "");
+ if (strcmp(oper->awaymsg, "")) {
+ strncat(tmp, "G" ,9);
+ } else {
+ strncat(tmp, "H" ,9);
+ }
+ WriteServ(user->fd,"352 %s %s %s %s %s %s %s* :0 %s", user->nick, oper->chans[0].channel ? oper->chans[0].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;