Changes in root_commands.c [3064ea4:23c4e64]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
root_commands.c
r3064ea4 r23c4e64 29 29 #include "bitlbee.h" 30 30 #include "help.h" 31 #include "otr.h"32 31 33 32 #include <string.h> … … 205 204 } 206 205 206 struct cmd_account_del_data 207 { 208 account_t *a; 209 irc_t *irc; 210 }; 211 212 void cmd_account_del_yes( void *data ) 213 { 214 struct cmd_account_del_data *cad = data; 215 account_t *a; 216 217 for( a = cad->irc->accounts; a && a != cad->a; a = a->next ); 218 219 if( a == NULL ) 220 { 221 irc_usermsg( cad->irc, "Account already deleted" ); 222 } 223 else if( a->ic ) 224 { 225 irc_usermsg( cad->irc, "Account is still logged in, can't delete" ); 226 } 227 else 228 { 229 account_del( cad->irc, a ); 230 irc_usermsg( cad->irc, "Account deleted" ); 231 } 232 g_free( data ); 233 } 234 235 void cmd_account_del_no( void *data ) 236 { 237 g_free( data ); 238 } 239 207 240 static void cmd_account( irc_t *irc, char **cmd ) 208 241 { … … 242 275 243 276 irc_usermsg( irc, "Account successfully added" ); 244 245 if(otr_check_for_key(a)) {246 irc_usermsg(irc, "otr: you will be notified when it completes");247 }248 277 } 249 278 else if( g_strcasecmp( cmd[1], "del" ) == 0 ) … … 263 292 else 264 293 { 265 account_del( irc, a ); 266 irc_usermsg( irc, "Account deleted" ); 294 struct cmd_account_del_data *cad; 295 char *msg; 296 297 cad = g_malloc( sizeof( struct cmd_account_del_data ) ); 298 cad->a = a; 299 cad->irc = irc; 300 301 msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will " 302 "also forget all your saved nicknames. If you want " 303 "to change your username/password, use the `account " 304 "set' command. Are you sure you want to delete this " 305 "account?", a->prpl->name, a->user ); 306 query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad ); 307 g_free( msg ); 267 308 } 268 309 } … … 382 423 acc_handle = g_strdup( cmd[2] ); 383 424 425 if( !acc_handle ) 426 { 427 irc_usermsg( irc, "Not enough parameters given (need %d)", 3 ); 428 return; 429 } 430 384 431 if( ( tmp = strchr( acc_handle, '/' ) ) ) 385 432 { … … 454 501 { 455 502 add_on_server = 0; 456 cmd ++; /* So evil... :-D */503 cmd ++; 457 504 } 458 505 … … 486 533 } 487 534 488 /* By making this optional, you can talk to people without having to489 add them to your *real* (server-side) contact list. */490 535 if( add_on_server ) 491 536 a->ic->acc->prpl->add_buddy( a->ic, cmd[2], NULL ); 492 493 /* add_buddy( a->ic, NULL, cmd[2], cmd[2] ); */ 537 else 538 /* Yeah, officially this is a call-*back*... So if we just 539 called add_buddy, we'll wait for the IM server to respond 540 before we do this. */ 541 imcb_add_buddy( a->ic, cmd[2], NULL ); 494 542 495 543 irc_usermsg( irc, "Adding `%s' to your contact list", cmd[2] ); … … 561 609 g_free( irc->mynick ); 562 610 irc->mynick = g_strdup( cmd[2] ); 611 612 if( strcmp( cmd[0], "set_rename" ) != 0 ) 613 set_setstr( &irc->set, "root_nick", cmd[2] ); 563 614 } 564 615 else if( u->send_handler == buddy_send_handler ) … … 569 620 irc_usermsg( irc, "Nick successfully changed" ); 570 621 } 622 } 623 624 char *set_eval_root_nick( set_t *set, char *new_nick ) 625 { 626 irc_t *irc = set->data; 627 628 if( strcmp( irc->mynick, new_nick ) != 0 ) 629 { 630 char *cmd[] = { "set_rename", irc->mynick, new_nick, NULL }; 631 632 cmd_rename( irc, cmd ); 633 } 634 635 return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : NULL; 571 636 } 572 637 … … 773 838 else 774 839 irc_usermsg( irc, "%s is empty", set_name ); 840 841 if( strchr( set_name, '/' ) ) 842 irc_usermsg( irc, "Warning: / found in setting name, you're probably looking for the `account set' command." ); 775 843 } 776 844 else … … 996 1064 { "qlist", 0, cmd_qlist, 0 }, 997 1065 { "join_chat", 2, cmd_join_chat, 0 }, 998 { "otr", 1, cmd_otr, 0 },999 1066 { NULL } 1000 1067 };
Note: See TracChangeset
for help on using the changeset viewer.