Changeset 2f53ada
- Timestamp:
- 2010-03-27T15:16:16Z (15 years ago)
- Branches:
- master
- Children:
- 280c56a
- Parents:
- b919363
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.h
rb919363 r2f53ada 170 170 void irc_send_topic( irc_channel_t *ic, gboolean topic_change ); 171 171 void irc_send_whois( irc_user_t *iu ); 172 void irc_send_who( irc_t *irc, GSList *l, const char *channel ); 172 173 173 174 /* irc_user.c */ -
irc_commands.c
rb919363 r2f53ada 214 214 irc_send_num( irc, 502, ":Don't touch their modes" ); 215 215 } 216 } 217 218 static void irc_cmd_who( irc_t *irc, char **cmd ) 219 { 220 char *channel = cmd[1]; 221 irc_channel_t *ic; 222 struct groupchat *c; 223 GList *l; 224 225 if( !channel || *channel == '0' || *channel == '*' || !*channel ) 226 irc_send_who( irc, irc->users, "**" ); 227 else if( ( ic = irc_channel_by_name( irc, channel ) ) ) 228 irc_send_who( irc, ic->users, channel ); 229 else 230 irc_send_num( irc, 403, "%s :No such channel", channel ); 216 231 } 217 232 … … 300 315 irc_send( irc, cmd[1], cmd[2], ( g_strcasecmp( cmd[0], "NOTICE" ) == 0 ) ? OPT_AWAY : 0 ); 301 316 } 302 }303 304 static void irc_cmd_who( irc_t *irc, char **cmd )305 {306 char *channel = cmd[1];307 user_t *u = irc->users;308 struct groupchat *c;309 GList *l;310 311 if( !channel || *channel == '0' || *channel == '*' || !*channel )312 while( u )313 {314 irc_send_num( irc, 352, "%s %s %s %s %s %c :0 %s", u->online ? irc->channel : "*", u->user, u->host, irc->myhost, u->nick, u->online ? ( u->away ? 'G' : 'H' ) : 'G', u->realname );315 u = u->next;316 }317 else if( g_strcasecmp( channel, irc->channel ) == 0 )318 while( u )319 {320 if( u->online )321 irc_send_num( irc, 352, "%s %s %s %s %s %c :0 %s", channel, u->user, u->host, irc->myhost, u->nick, u->away ? 'G' : 'H', u->realname );322 u = u->next;323 }324 else if( ( c = irc_chat_by_channel( irc, channel ) ) )325 for( l = c->in_room; l; l = l->next )326 {327 if( ( u = user_findhandle( c->ic, l->data ) ) )328 irc_send_num( irc, 352, "%s %s %s %s %s %c :0 %s", channel, u->user, u->host, irc->myhost, u->nick, u->away ? 'G' : 'H', u->realname );329 }330 else if( ( u = user_find( irc, channel ) ) )331 irc_send_num( irc, 352, "%s %s %s %s %s %c :0 %s", channel, u->user, u->host, irc->myhost, u->nick, u->online ? ( u->away ? 'G' : 'H' ) : 'G', u->realname );332 333 irc_send_num( irc, 315, "%s :End of /WHO list", channel?channel:"**" );334 317 } 335 318 … … 571 554 { "motd", 0, irc_cmd_motd, IRC_CMD_LOGGED_IN }, 572 555 { "mode", 1, irc_cmd_mode, IRC_CMD_LOGGED_IN }, 556 { "who", 0, irc_cmd_who, IRC_CMD_LOGGED_IN }, 573 557 #if 0 574 558 { "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN }, … … 576 560 { "privmsg", 1, irc_cmd_privmsg, IRC_CMD_LOGGED_IN }, 577 561 { "notice", 1, irc_cmd_privmsg, IRC_CMD_LOGGED_IN }, 578 { "who", 0, irc_cmd_who, IRC_CMD_LOGGED_IN },579 562 { "userhost", 1, irc_cmd_userhost, IRC_CMD_LOGGED_IN }, 580 563 { "ison", 1, irc_cmd_ison, IRC_CMD_LOGGED_IN }, -
irc_send.c
rb919363 r2f53ada 225 225 irc_send_num( irc, 318, "%s :End of /WHOIS list", iu->nick ); 226 226 } 227 228 void irc_send_who( irc_t *irc, GSList *l, const char *channel ) 229 { 230 while( l ) 231 { 232 irc_user_t *iu = l->data; 233 /* TODO(wilmer): Restore away/channel information here */ 234 irc_send_num( irc, 352, "%s %s %s %s %s %c :0 %s", 235 "*", iu->user, iu->host, irc->root->host, 236 iu->nick, 'H', iu->fullname ); 237 l = l->next; 238 } 239 240 irc_send_num( irc, 315, "%s :End of /WHO list", channel ); 241 }
Note: See TracChangeset
for help on using the changeset viewer.