Changeset 003a12b
- Timestamp:
- 2010-04-14T13:35:41Z (15 years ago)
- Branches:
- master
- Children:
- 4c3519a
- Parents:
- d7d677d
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.h
rd7d677d r003a12b 210 210 int irc_user_set_nick( irc_user_t *iu, const char *new ); 211 211 gint irc_user_cmp( gconstpointer a_, gconstpointer b_ ); 212 const char *irc_user_get_away( irc_user_t *iu ); 212 213 213 214 /* irc_util.c */ -
irc_commands.c
rd7d677d r003a12b 384 384 irc_send_num( irc, 482, "%s :Invite impossible; User/Channel non-existent or incompatible", channel ); 385 385 } 386 #endif 386 387 387 388 static void irc_cmd_userhost( irc_t *irc, char **cmd ) 388 389 { 389 user_t *u;390 390 int i; 391 391 … … 397 397 398 398 for( i = 1; cmd[i]; i ++ ) 399 if( ( u = user_find( irc, cmd[i] ) ) ) 400 { 401 if( u->online && u->away ) 402 irc_send_num( irc, 302, ":%s=-%s@%s", u->nick, u->user, u->host ); 403 else 404 irc_send_num( irc, 302, ":%s=+%s@%s", u->nick, u->user, u->host ); 405 } 399 { 400 irc_user_t *iu = irc_user_by_name( irc, cmd[i] ); 401 402 if( iu ) 403 irc_send_num( irc, 302, ":%s=%c%s@%s", iu->nick, 404 irc_user_get_away( iu ) ? '-' : '+', 405 iu->user, iu->host ); 406 } 406 407 } 407 408 408 409 static void irc_cmd_ison( irc_t *irc, char **cmd ) 409 410 { 410 user_t *u;411 411 char buff[IRC_MAX_LINE]; 412 412 int lenleft, i; … … 424 424 while( *this ) 425 425 { 426 irc_user_t *iu; 427 426 428 if( ( next = strchr( this, ' ' ) ) ) 427 429 *next = 0; 428 430 429 if( ( u = user_find( irc, this ) ) && u->online ) 430 { 431 lenleft -= strlen( u->nick ) + 1; 431 if( ( iu = irc_user_by_name( irc, this ) ) && 432 iu->bu && iu->bu->flags & BEE_USER_ONLINE ) 433 { 434 lenleft -= strlen( iu->nick ) + 1; 432 435 433 436 if( lenleft < 0 ) 434 437 break; 435 438 436 strcat( buff, u->nick );439 strcat( buff, iu->nick ); 437 440 strcat( buff, " " ); 438 441 } … … 470 473 { 471 474 char *nick; 472 user_t *u;475 irc_user_t *iu; 473 476 474 477 if( !cmd[i][0] || !cmd[i][1] ) … … 478 481 nick_lc( nick ); 479 482 480 u = user_find( irc, nick );483 iu = irc_user_by_name( irc, nick ); 481 484 482 485 if( cmd[i][0] == '+' ) … … 485 488 g_hash_table_insert( irc->watches, nick, nick ); 486 489 487 if( u && u->online ) 488 irc_send_num( irc, 604, "%s %s %s %d :%s", u->nick, u->user, u->host, (int) time( NULL ), "is online" ); 490 if( iu && iu->bu && iu->bu->flags & BEE_USER_ONLINE ) 491 irc_send_num( irc, 604, "%s %s %s %d :%s", iu->nick, iu->user, 492 iu->host, (int) time( NULL ), "is online" ); 489 493 else 490 irc_send_num( irc, 605, "%s %s %s %d :%s", nick, "*", "*", (int) time( NULL ), "is offline" ); 494 irc_send_num( irc, 605, "%s %s %s %d :%s", nick, "*", "*", 495 (int) time( NULL ), "is offline" ); 491 496 } 492 497 else if( cmd[i][0] == '-' ) … … 505 510 } 506 511 512 #if 0 507 513 static void irc_cmd_topic( irc_t *irc, char **cmd ) 508 514 { … … 610 616 { "version", 0, irc_cmd_version, IRC_CMD_LOGGED_IN }, 611 617 { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN }, 612 { "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN }, 618 { "userhost", 1, irc_cmd_userhost, IRC_CMD_LOGGED_IN }, 619 { "ison", 1, irc_cmd_ison, IRC_CMD_LOGGED_IN }, 620 { "watch", 1, irc_cmd_watch, IRC_CMD_LOGGED_IN }, 613 621 #if 0 614 622 { "invite", 2, irc_cmd_invite, IRC_CMD_LOGGED_IN }, 615 623 { "notice", 1, irc_cmd_privmsg, IRC_CMD_LOGGED_IN }, 616 { "userhost", 1, irc_cmd_userhost, IRC_CMD_LOGGED_IN },617 { "ison", 1, irc_cmd_ison, IRC_CMD_LOGGED_IN },618 { "watch", 1, irc_cmd_watch, IRC_CMD_LOGGED_IN },619 624 { "topic", 1, irc_cmd_topic, IRC_CMD_LOGGED_IN }, 620 625 #endif 626 { "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN }, 621 627 { "die", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 622 628 { "deaf", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, -
irc_im.c
rd7d677d r003a12b 80 80 { 81 81 irc_t *irc = bee->ui_data; 82 irc_user_t *iu = bu->ui_data; 82 83 irc_channel_t *ic = irc->channels->data; /* For now, just pick the first channel. */ 83 84 … … 85 86 { 86 87 if( bu->flags & BEE_USER_ONLINE ) 87 irc_channel_add_user( ic, (irc_user_t*) bu->ui_data ); 88 { 89 if( g_hash_table_lookup( irc->watches, iu->key ) ) 90 irc_send_num( irc, 600, "%s %s %s %d :%s", iu->nick, iu->user, 91 iu->host, (int) time( NULL ), "logged online" ); 92 93 irc_channel_add_user( ic, iu ); 94 } 88 95 else 89 irc_channel_del_user( ic, (irc_user_t*) bu->ui_data ); 96 { 97 if( g_hash_table_lookup( irc->watches, iu->key ) ) 98 irc_send_num( irc, 601, "%s %s %s %d :%s", iu->nick, iu->user, 99 iu->host, (int) time( NULL ), "logged offline" ); 100 101 irc_channel_del_user( ic, iu ); 102 } 90 103 } 91 104 -
irc_user.c
rd7d677d r003a12b 133 133 } 134 134 135 const char *irc_user_get_away( irc_user_t *iu ) 136 { 137 irc_t *irc = iu->irc; 138 bee_user_t *bu = iu->bu; 139 140 if( iu == irc->user ) 141 return set_getstr( &irc->b->set, "away" ); 142 else if( bu ) 143 { 144 if( !bu->flags & BEE_USER_ONLINE ) 145 return "Offline"; 146 else if( bu->flags & BEE_USER_AWAY ) 147 /* TODO: status msgs, etc. */ 148 return bu->status; 149 } 150 151 return NULL; 152 } 153 135 154 /* User-type dependent functions, for root/NickServ: */ 136 155 static gboolean root_privmsg( irc_user_t *iu, const char *msg )
Note: See TracChangeset
for help on using the changeset viewer.