Changeset b95932e
- Timestamp:
- 2010-03-27T03:39:23Z (15 years ago)
- Branches:
- master
- Children:
- 83e92bf
- Parents:
- 63a520b
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
r63a520b rb95932e 594 594 irc->user = irc_user_new( irc, iu->nick ); 595 595 irc->user->user = iu->user; 596 irc->user->host = iu->host; 596 597 irc->user->fullname = iu->fullname; 597 g_free( iu->fullname );598 598 g_free( iu->nick ); 599 g_free( iu->host );600 599 g_free( iu ); 601 600 -
irc.h
r63a520b rb95932e 87 87 typedef struct irc_user 88 88 { 89 irc_t *irc; 90 89 91 char *nick; 90 92 char *user; … … 159 161 void irc_send_names( irc_channel_t *ic ); 160 162 void irc_send_topic( irc_channel_t *ic ); 163 void irc_send_whois( irc_user_t *iu ); 161 164 162 165 /* irc_user.c */ -
irc_commands.c
r63a520b rb95932e 155 155 irc_send_num( irc, 442, "%s :You're not on that channel", cmd[1] ); 156 156 } 157 } 158 159 static void irc_cmd_whois( irc_t *irc, char **cmd ) 160 { 161 char *nick = cmd[1]; 162 irc_user_t *iu = irc_user_find( irc, nick ); 163 164 if( iu ) 165 irc_send_whois( iu ); 166 else 167 irc_send_num( irc, 401, "%s :Nick does not exist", nick ); 168 } 169 170 static void irc_cmd_whowas( irc_t *irc, char **cmd ) 171 { 172 /* For some reason irssi tries a whowas when whois fails. We can 173 ignore this, but then the user never gets a "user not found" 174 message from irssi which is a bit annoying. So just respond 175 with not-found and irssi users will get better error messages */ 176 177 irc_send_num( irc, 406, "%s :Nick does not exist", cmd[1] ); 178 irc_send_num( irc, 369, "%s :End of WHOWAS", cmd[1] ); 157 179 } 158 180 … … 475 497 } 476 498 477 static void irc_cmd_whois( irc_t *irc, char **cmd )478 {479 char *nick = cmd[1];480 user_t *u = user_find( irc, nick );481 482 if( u )483 {484 irc_send_num( irc, 311, "%s %s %s * :%s", u->nick, u->user, u->host, u->realname );485 486 if( u->ic )487 irc_send_num( irc, 312, "%s %s.%s :%s network", u->nick, u->ic->acc->user,488 u->ic->acc->server && *u->ic->acc->server ? u->ic->acc->server : "",489 u->ic->acc->prpl->name );490 else491 irc_send_num( irc, 312, "%s %s :%s", u->nick, irc->myhost, IRCD_INFO );492 493 if( !u->online )494 irc_send_num( irc, 301, "%s :%s", u->nick, "User is offline" );495 else if( u->away )496 irc_send_num( irc, 301, "%s :%s", u->nick, u->away );497 if( u->status_msg )498 irc_send_num( irc, 333, "%s :Status: %s", u->nick, u->status_msg );499 500 irc_send_num( irc, 318, "%s :End of /WHOIS list", nick );501 }502 else503 {504 irc_send_num( irc, 401, "%s :Nick does not exist", nick );505 }506 }507 508 static void irc_cmd_whowas( irc_t *irc, char **cmd )509 {510 /* For some reason irssi tries a whowas when whois fails. We can511 ignore this, but then the user never gets a "user not found"512 message from irssi which is a bit annoying. So just respond513 with not-found and irssi users will get better error messages */514 515 irc_send_num( irc, 406, "%s :Nick does not exist", cmd[1] );516 irc_send_num( irc, 369, "%s :End of WHOWAS", cmd[1] );517 }518 519 499 static void irc_cmd_nickserv( irc_t *irc, char **cmd ) 520 500 { … … 583 563 { "names", 1, irc_cmd_names, IRC_CMD_LOGGED_IN }, 584 564 { "part", 1, irc_cmd_part, IRC_CMD_LOGGED_IN }, 565 { "whois", 1, irc_cmd_whois, IRC_CMD_LOGGED_IN }, 566 { "whowas", 1, irc_cmd_whowas, IRC_CMD_LOGGED_IN }, 585 567 #if 0 586 568 { "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN }, … … 595 577 { "topic", 1, irc_cmd_topic, IRC_CMD_LOGGED_IN }, 596 578 { "away", 0, irc_cmd_away, IRC_CMD_LOGGED_IN }, 597 { "whois", 1, irc_cmd_whois, IRC_CMD_LOGGED_IN },598 { "whowas", 1, irc_cmd_whowas, IRC_CMD_LOGGED_IN },599 579 { "nickserv", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN }, 600 580 { "ns", 1, irc_cmd_nickserv, IRC_CMD_LOGGED_IN }, -
irc_send.c
r63a520b rb95932e 189 189 irc_send_num( ic->irc, 331, "%s :No topic for this channel", ic->name ); 190 190 } 191 192 void irc_send_whois( irc_user_t *iu ) 193 { 194 irc_t *irc = iu->irc; 195 196 irc_send_num( irc, 311, "%s %s %s * :%s", 197 iu->nick, iu->user, iu->host, iu->fullname ); 198 199 /* 200 if( u->ic ) 201 irc_send_num( irc, 312, "%s %s.%s :%s network", u->nick, u->ic->acc->user, 202 u->ic->acc->server && *u->ic->acc->server ? u->ic->acc->server : "", 203 u->ic->acc->prpl->name ); 204 else 205 irc_send_num( irc, 312, "%s %s :%s", u->nick, irc->myhost, IRCD_INFO ); 206 */ 207 208 /* 209 if( u->away ) 210 irc_send_num( irc, 301, "%s :%s", u->nick, u->away ); 211 if( u->status_msg ) 212 irc_send_num( irc, 333, "%s :Status: %s", u->nick, u->status_msg ); 213 */ 214 215 irc_send_num( irc, 318, "%s :End of /WHOIS list", iu->nick ); 216 } -
irc_user.c
r63a520b rb95932e 30 30 irc_user_t *iu = g_new0( irc_user_t, 1 ); 31 31 32 iu->irc = irc; 32 33 iu->nick = g_strdup( nick ); 33 34 iu->user = iu->host = iu->fullname = iu->nick;
Note: See TracChangeset
for help on using the changeset viewer.