Changeset f7ca587
- Timestamp:
- 2010-07-29T18:18:54Z (14 years ago)
- Branches:
- master
- Children:
- 1521a85
- Parents:
- 2fe5eb9
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
r2fe5eb9 rf7ca587 244 244 g_free( irc->readbuffer ); 245 245 g_free( irc->password ); 246 g_free( irc->last_root_cmd );247 246 248 247 g_free( irc ); … … 729 728 irc_channel_auto_joins( irc, NULL ); 730 729 731 irc-> last_root_cmd = g_strdup( ROOT_CHAN );732 733 irc_ send_msg( irc->root, "PRIVMSG", ROOT_CHAN,734 735 736 737 738 739 "\x02identify\x02 command to identify yourself.", NULL);730 irc->root->last_channel = irc->default_channel; 731 732 irc_usermsg( irc, 733 "Welcome to the BitlBee gateway!\n\n" 734 "If you've never used BitlBee before, please do read the help " 735 "information using the \x02help\x02 command. Lots of FAQs are " 736 "answered there.\n" 737 "If you already have an account on this server, just use the " 738 "\x02identify\x02 command to identify yourself." ); 740 739 741 740 /* This is for bug #209 (use PASS to identify to NickServ). */ -
irc.h
r2fe5eb9 rf7ca587 67 67 struct irc_user *user; 68 68 69 char *last_root_cmd; /* Either the nickname from which the last root70 msg came, or the last channel root was talked71 to. */72 73 69 char *password; /* HACK: Used to save the user's password, but before 74 70 logging in, this may contain a password we should … … 155 151 156 152 GSList *users; /* struct irc_channel_user */ 153 struct irc_user *last_target; 157 154 struct set *set; 158 155 -
irc_channel.c
r2fe5eb9 rf7ca587 481 481 { 482 482 irc_t *irc = ic->irc; 483 irc_user_t *iu; 483 484 const char *s; 484 485 … … 489 490 { 490 491 char to[s-msg+1]; 491 irc_user_t *iu;492 492 493 493 memset( to, 0, sizeof( to ) ); 494 494 strncpy( to, msg, s - msg ); 495 495 while( *(++s) && isspace( *s ) ) {} 496 497 iu = irc_user_by_name( irc, to ); 498 if( iu && iu->f->privmsg ) 499 { 500 iu->last_channel = ic; 501 iu->f->privmsg( iu, s ); 502 } 496 msg = s; 497 498 if( !( iu = irc_user_by_name( irc, to ) ) ) 499 irc_channel_printf( ic, "User does not exist: %s", to ); 503 500 else 504 { 505 irc_channel_printf( ic, "User does not exist: %s", to ); 506 } 507 } 501 ic->last_target = iu; 502 } 503 else if( g_strcasecmp( set_getstr( &irc->b->set, "default_target" ), "last" ) == 0 && 504 ic->last_target && g_slist_find( irc->users, ic->last_target ) ) 505 iu = ic->last_target; 508 506 else 509 { 510 /* TODO: Maybe just use root->privmsg here now? */ 511 char cmd[strlen(msg)+1]; 512 513 g_free( ic->irc->last_root_cmd ); 514 ic->irc->last_root_cmd = g_strdup( ic->name ); 515 516 strcpy( cmd, msg ); 517 root_command_string( ic->irc, cmd ); 507 iu = irc->root; 508 509 if( iu && iu->f->privmsg ) 510 { 511 iu->last_channel = ic; 512 iu->f->privmsg( iu, msg ); 518 513 } 519 514 -
irc_im.c
r2fe5eb9 rf7ca587 215 215 ts = irc_format_timestamp( irc, sent_at ); 216 216 217 /* Too similar to irc_usermsg()... */ 217 218 if( iu->last_channel ) 218 219 { -
irc_send.c
r2fe5eb9 rf7ca587 104 104 void irc_usermsg( irc_t *irc, char *format, ... ) 105 105 { 106 irc_channel_t *ic ;107 irc_user_t *iu ;106 irc_channel_t *ic = NULL; 107 irc_user_t *iu = irc->root; 108 108 char text[1024]; 109 109 va_list params; 110 char *dst; 110 111 111 112 va_start( params, format ); … … 113 114 va_end( params ); 114 115 115 if( irc->last_root_cmd && 116 irc_channel_name_ok( irc->last_root_cmd ) && 117 ( ic = irc_channel_by_name( irc, irc->last_root_cmd ) ) && 118 ic->flags & IRC_CHANNEL_JOINED ) 119 irc_send_msg( irc->root, "PRIVMSG", irc->last_root_cmd, text, NULL ); 120 else if( irc->last_root_cmd && 121 ( iu = irc_user_by_name( irc, irc->last_root_cmd ) ) && 122 iu->f == &irc_user_root_funcs ) 123 irc_send_msg( iu, "PRIVMSG", irc->user->nick, text, NULL ); 124 else 125 { 126 g_free( irc->last_root_cmd ); 127 irc->last_root_cmd = NULL; 128 129 irc_send_msg( irc->root, "PRIVMSG", irc->user->nick, text, NULL ); 130 } 131 132 /*return( irc_msgfrom( irc, u->nick, text ) );*/ 116 /* Too similar to bee_irc_user_msg()... */ 117 if( iu->last_channel ) 118 { 119 if( iu->last_channel->flags & IRC_CHANNEL_JOINED ) 120 ic = iu->last_channel; 121 else if( irc->default_channel->flags & IRC_CHANNEL_JOINED ) 122 ic = irc->default_channel; 123 } 124 125 if( ic ) 126 dst = ic->name; 127 else 128 dst = irc->user->nick; 129 130 irc_send_msg( irc->root, "PRIVMSG", dst, text, NULL ); 133 131 } 134 132 -
irc_user.c
r2fe5eb9 rf7ca587 222 222 char cmd[strlen(msg)+1]; 223 223 224 g_free( iu->irc->last_root_cmd );225 iu->irc->last_root_cmd = g_strdup( iu->nick );226 227 224 strcpy( cmd, msg ); 228 225 root_command_string( iu->irc, cmd ); -
root_commands.c
r2fe5eb9 rf7ca587 560 560 /* If this doesn't match any channel, maybe this is the short 561 561 syntax (only works when used inside a channel). */ 562 if( ( len = strlen( cmd[1] )) &&563 g_strncasecmp( cmd[1], "set", len ) == 0&&564 ( ic = irc_channel_by_name( irc, irc->last_root_cmd ) ))562 if( ( ic = irc->root->last_channel ) && 563 ( len = strlen( cmd[1] ) ) && 564 g_strncasecmp( cmd[1], "set", len ) == 0 ) 565 565 cmd_set_real( irc, cmd + 1, &ic->set, NULL ); 566 566 else … … 642 642 char *s, *group = NULL;; 643 643 644 if( ( ic = irc _channel_by_name( irc, irc->last_root_cmd )) &&644 if( ( ic = irc->root->last_channel ) && 645 645 ( s = set_getstr( &ic->set, "fill_by" ) ) && 646 646 strcmp( s, "group" ) == 0 &&
Note: See TracChangeset
for help on using the changeset viewer.