Changeset 3864c08
- Timestamp:
- 2011-10-21T03:00:54Z (13 years ago)
- Branches:
- master
- Children:
- e6b41b1
- Parents:
- 6a45181 (diff), aea22cd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
ipc.c
r6a45181 r3864c08 356 356 irc_switch_fd( irc, ipc_child_recv_fd ); 357 357 irc_sync( irc ); 358 irc_ usermsg( irc, "You've successfully taken over your old session" );358 irc_rootmsg( irc, "You've successfully taken over your old session" ); 359 359 ipc_child_recv_fd = -1; 360 360 … … 374 374 { 375 375 /* Master->New connection */ 376 irc_ usermsg( irc, "Could not take over old session" );376 irc_rootmsg( irc, "Could not take over old session" ); 377 377 } 378 378 } … … 412 412 /* Drop credentials, we'll shut down soon and shouldn't overwrite 413 413 any settings. */ 414 irc_ usermsg( irc, "Trying to take over existing session" );414 irc_rootmsg( irc, "Trying to take over existing session" ); 415 415 416 416 irc_desync( irc ); -
irc.c
r6a45181 r3864c08 363 363 if( irc->status & USTATUS_LOGGED_IN ) 364 364 { 365 irc_ usermsg( irc, "Error: Charset mismatch detected. The charset "365 irc_rootmsg( irc, "Error: Charset mismatch detected. The charset " 366 366 "setting is currently set to %s, so please make " 367 367 "sure your IRC client will send and accept text in " … … 767 767 irc->root->last_channel = irc->default_channel; 768 768 769 irc_ usermsg( irc,769 irc_rootmsg( irc, 770 770 "Welcome to the BitlBee gateway!\n\n" 771 771 "If you've never used BitlBee before, please do read the help " … … 910 910 g_free( test ); 911 911 g_iconv_close( oc ); 912 irc_ usermsg( irc, "Unsupported character set: The IRC protocol "912 irc_rootmsg( irc, "Unsupported character set: The IRC protocol " 913 913 "only supports 8-bit character sets." ); 914 914 return NULL; … … 941 941 GSList *l; 942 942 943 irc_ usermsg( irc, "Setting `%s' is obsolete, use the `show_users' "943 irc_rootmsg( irc, "Setting `%s' is obsolete, use the `show_users' " 944 944 "channel setting instead.", set->key ); 945 945 -
irc.h
r6a45181 r3864c08 317 317 void irc_send_login( irc_t *irc ); 318 318 void irc_send_motd( irc_t *irc ); 319 void irc_usermsg( irc_t *irc, char *format, ... ); 319 const char *irc_user_msgdest( irc_user_t *iu ); 320 void irc_rootmsg( irc_t *irc, char *format, ... ); 321 void irc_usermsg( irc_user_t *iu, char *format, ... ); 322 void irc_usernotice( irc_user_t *iu, char *format, ... ); 320 323 void irc_send_join( irc_channel_t *ic, irc_user_t *iu ); 321 324 void irc_send_part( irc_channel_t *ic, irc_user_t *iu, const char *reason ); -
irc_commands.c
r6a45181 r3864c08 92 92 irc->status &= ~USTATUS_IDENTIFIED; 93 93 irc_umode_set( irc, "-R", 1 ); 94 irc_ usermsg( irc, "Changing nicks resets your identify status. "94 irc_rootmsg( irc, "Changing nicks resets your identify status. " 95 95 "Re-identify or register a new account if you want " 96 96 "your configuration to be saved. See \x02help " … … 433 433 { 434 434 set_setstr( &a->set, "password", password ); 435 irc_ usermsg( irc, "Password added to IM account "435 irc_rootmsg( irc, "Password added to IM account " 436 436 "%s(%s)", a->prpl->name, a->user ); 437 437 /* The IRC client may expect this. 491 suggests the OPER -
irc_im.c
r6a45181 r3864c08 197 197 irc_t *irc = bee->ui_data; 198 198 irc_user_t *iu = (irc_user_t *) bu->ui_data; 199 char *dst, *prefix = NULL; 199 const char *dst; 200 char *prefix = NULL; 200 201 char *wrapped, *ts = NULL; 201 irc_channel_t *ic = NULL;202 202 char *msg = g_strdup( msg_ ); 203 203 GSList *l; … … 206 206 ts = irc_format_timestamp( irc, sent_at ); 207 207 208 /* Too similar to irc_usermsg()... */ 209 if( iu->last_channel ) 210 { 211 if( iu->last_channel->flags & IRC_CHANNEL_JOINED ) 212 ic = iu->last_channel; 213 else 214 ic = irc_channel_with_user( irc, iu ); 215 } 216 217 if( ic ) 218 { 219 dst = ic->name; 208 dst = irc_user_msgdest( iu ); 209 if( dst != irc->user->nick ) 210 { 211 /* if not messaging directly, call user by name */ 220 212 prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts ? : "" ); 221 213 } 222 214 else 223 215 { 224 dst = irc->user->nick;225 216 prefix = ts; 226 ts = NULL; 217 ts = NULL; /* don't double-free */ 227 218 } 228 219 … … 993 984 else if( !acc->prpl->chat_join ) 994 985 { 995 irc_ usermsg( ic->irc, "Named chatrooms not supported on that account." );986 irc_rootmsg( ic->irc, "Named chatrooms not supported on that account." ); 996 987 return SET_INVALID; 997 988 } -
irc_send.c
r6a45181 r3864c08 110 110 } 111 111 112 void irc_usermsg( irc_t *irc, char *format, ... ) 113 { 112 /* Used by some funcs that generate PRIVMSGs to figure out if we're talking to 113 this person in /query or in a control channel. WARNING: callers rely on 114 this returning a pointer at irc->user_nick, not a copy of it. */ 115 const char *irc_user_msgdest( irc_user_t *iu ) 116 { 117 irc_t *irc = iu->irc; 114 118 irc_channel_t *ic = NULL; 115 irc_user_t *iu = irc->root; 116 char text[2048]; 117 va_list params; 118 char *dst; 119 120 va_start( params, format ); 121 g_vsnprintf( text, sizeof( text ), format, params ); 122 va_end( params ); 123 124 /* Too similar to bee_irc_user_msg()... */ 119 125 120 if( iu->last_channel ) 126 121 { … … 128 123 ic = iu->last_channel; 129 124 else 130 ic = irc_channel_with_user( irc, i rc->root);125 ic = irc_channel_with_user( irc, iu ); 131 126 } 132 127 133 128 if( ic ) 134 dst =ic->name;129 return ic->name; 135 130 else 136 dst = irc->user->nick; 137 138 irc_send_msg( irc->root, "PRIVMSG", dst, text, NULL ); 131 return irc->user->nick; 132 } 133 134 /* cmd = "PRIVMSG" or "NOTICE" */ 135 static void irc_usermsg_( const char *cmd, irc_user_t *iu, const char *format, va_list params ) 136 { 137 char text[2048]; 138 const char *dst; 139 140 g_vsnprintf( text, sizeof( text ), format, params ); 141 142 dst = irc_user_msgdest( iu ); 143 irc_send_msg( iu, cmd, dst, text, NULL ); 144 } 145 146 void irc_usermsg(irc_user_t *iu, char *format, ... ) 147 { 148 va_list params; 149 va_start( params, format ); 150 irc_usermsg_( "PRIVMSG", iu, format, params ); 151 va_end( params ); 152 } 153 154 void irc_usernotice(irc_user_t *iu, char *format, ... ) 155 { 156 va_list params; 157 va_start( params, format ); 158 irc_usermsg_( "NOTICE", iu, format, params ); 159 va_end( params ); 160 } 161 162 void irc_rootmsg( irc_t *irc, char *format, ... ) 163 { 164 va_list params; 165 va_start( params, format ); 166 irc_usermsg_( "PRIVMSG", irc->root, format, params ); 167 va_end( params ); 139 168 } 140 169 -
nick.c
r6a45181 r3864c08 243 243 int i; 244 244 245 irc_ usermsg( irc, "Warning: Almost had an infinite loop in nick_get()! "245 irc_rootmsg( irc, "Warning: Almost had an infinite loop in nick_get()! " 246 246 "This used to be a fatal BitlBee bug, but we tried to fix it. " 247 247 "This message should *never* appear anymore. " … … 249 249 "Please send all the following lines in your report:" ); 250 250 251 irc_ usermsg( irc, "Trying to get a sane nick for handle %s", bu->handle );251 irc_rootmsg( irc, "Trying to get a sane nick for handle %s", bu->handle ); 252 252 for( i = 0; i < MAX_NICK_LENGTH; i ++ ) 253 irc_ usermsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] );254 255 irc_ usermsg( irc, "FAILED. Returning an insane nick now. Things might break. "253 irc_rootmsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] ); 254 255 irc_rootmsg( irc, "FAILED. Returning an insane nick now. Things might break. " 256 256 "Good luck, and please don't forget to paste the lines up here " 257 257 "in #bitlbee on OFTC or in a mail to wilmer@gaast.net" ); -
otr.c
r6a45181 r3864c08 278 278 e = otrl_privkey_read(irc->otr->us, s); 279 279 if(e && e!=enoent) { 280 irc_ usermsg(irc, "otr load: %s: %s", s, gcry_strerror(e));280 irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 281 281 } 282 282 g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick); 283 283 e = otrl_privkey_read_fingerprints(irc->otr->us, s, NULL, NULL); 284 284 if(e && e!=enoent) { 285 irc_ usermsg(irc, "otr load: %s: %s", s, gcry_strerror(e));285 irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e)); 286 286 } 287 287 … … 291 291 } 292 292 if(kg) { 293 irc_ usermsg(irc, "Notice: "293 irc_rootmsg(irc, "Notice: " 294 294 "The accounts above do not have OTR encryption keys associated with them, yet. " 295 295 "These keys are now being generated in the background. " … … 309 309 e = otrl_privkey_write_fingerprints(irc->otr->us, s); 310 310 if(e) { 311 irc_ usermsg(irc, "otr save: %s: %s", s, gcry_strerror(e));311 irc_rootmsg(irc, "otr save: %s: %s", s, gcry_strerror(e)); 312 312 } 313 313 chmod(s, 0600); … … 348 348 k = otrl_privkey_find(irc->otr->us, a->user, a->prpl->name); 349 349 if(k) { 350 irc_ usermsg(irc, "otr: %s/%s ready", a->user, a->prpl->name);350 irc_rootmsg(irc, "otr: %s/%s ready", a->user, a->prpl->name); 351 351 return 0; 352 352 } if(keygen_in_progress(irc, a->user, a->prpl->name)) { 353 irc_ usermsg(irc, "otr: keygen for %s/%s already in progress", a->user, a->prpl->name);353 irc_rootmsg(irc, "otr: keygen for %s/%s already in progress", a->user, a->prpl->name); 354 354 return 0; 355 355 } else { 356 irc_ usermsg(irc, "otr: starting background keygen for %s/%s", a->user, a->prpl->name);356 irc_rootmsg(irc, "otr: starting background keygen for %s/%s", a->user, a->prpl->name); 357 357 otr_keygen(irc, a->user, a->prpl->name); 358 358 return 1; … … 365 365 char *newmsg = NULL; 366 366 OtrlTLV *tlvs = NULL; 367 char *colormsg;368 367 irc_t *irc = iu->irc; 369 368 struct im_connection *ic = iu->bu->ic; … … 385 384 } else if(!newmsg) { 386 385 /* this was a non-OTR message */ 387 return g_strdup(msg);386 return msg; 388 387 } else { 389 388 /* OTR has processed this message */ 390 389 ConnContext *context = otrl_context_find(irc->otr->us, iu->bu->handle, 391 390 ic->acc->user, ic->acc->prpl->name, 0, NULL, NULL, NULL); 391 392 /* we're done with the original msg, which will be caller-freed. */ 393 /* NB: must not change the newmsg pointer, since we free it. */ 394 msg = newmsg; 392 395 393 396 if(context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED) { … … 397 400 !(ic->flags & OPT_DOES_HTML) && 398 401 set_getbool(&ic->bee->set, "strip_html")) { 399 strip_html( newmsg);402 strip_html(msg); 400 403 } 401 404 402 405 /* coloring */ 403 406 if(set_getbool(&ic->bee->set, "otr_color_encrypted")) { 404 /* color according to f'print trust */405 int color;407 int color; /* color according to f'print trust */ 408 char *pre="", *sep=""; /* optional parts */ 406 409 const char *trust = context->active_fingerprint->trust; 410 407 411 if(trust && trust[0] != '\0') 408 412 color=3; /* green */ … … 410 414 color=5; /* red */ 411 415 412 if(newmsg[0] == ',') { 413 /* could be a problem with the color code */ 414 /* insert a space between color spec and message */ 415 colormsg = g_strdup_printf("\x03%.2d %s\x0F", color, newmsg); 416 } else { 417 colormsg = g_strdup_printf("\x03%.2d%s\x0F", color, newmsg); 416 /* in a query window, keep "/me " uncolored at the beginning */ 417 if(g_strncasecmp(msg, "/me ", 4) == 0 418 && irc_user_msgdest(iu) == irc->user->nick) { 419 msg += 4; /* skip */ 420 pre = "/me "; 418 421 } 422 423 /* comma in first place could mess with the color code */ 424 if(msg[0] == ',') { 425 /* insert a space between color spec and message */ 426 sep = " "; 427 } 428 429 msg = g_strdup_printf("%s\x03%.2d%s%s\x0F", pre, 430 color, sep, msg); 419 431 } 420 } else { 421 colormsg = g_strdup(newmsg); 422 } 423 432 } 433 434 if(msg == newmsg) { 435 msg = g_strdup(newmsg); 436 } 424 437 otrl_message_free(newmsg); 425 return colormsg;438 return msg; 426 439 } 427 440 } … … 431 444 int st; 432 445 char *otrmsg = NULL; 446 char *emsg = msg; /* the message as we hand it to libotr */ 433 447 ConnContext *ctx = NULL; 434 448 irc_t *irc = iu->irc; … … 440 454 } 441 455 442 /* HTML encoding */443 /* consider OTR plaintext to be HTML if otr_does_html is set */444 if(set_getbool(&ic->bee->set, "otr_does_html") &&445 (g_strncasecmp(msg, "<html>", 6) != 0)) {446 msg = escape_html(msg);447 }448 449 st = otrl_message_sending(irc->otr->us, &otr_ops, ic,450 ic->acc->user, ic->acc->prpl->name, iu->bu->handle,451 msg, NULL, &otrmsg, NULL, NULL);452 if(st) {453 return NULL;454 }455 456 456 ctx = otrl_context_find(irc->otr->us, 457 457 iu->bu->handle, ic->acc->user, ic->acc->prpl->name, 458 458 1, NULL, NULL, NULL); 459 460 /* HTML encoding */ 461 /* consider OTR plaintext to be HTML if otr_does_html is set */ 462 if(ctx && ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED && 463 set_getbool(&ic->bee->set, "otr_does_html") && 464 (g_strncasecmp(msg, "<html>", 6) != 0)) { 465 emsg = escape_html(msg); 466 } 467 468 st = otrl_message_sending(irc->otr->us, &otr_ops, ic, 469 ic->acc->user, ic->acc->prpl->name, iu->bu->handle, 470 emsg, NULL, &otrmsg, NULL, NULL); 471 if(emsg != msg) { 472 g_free(emsg); /* we're done with this one */ 473 } 474 if(st) { 475 return NULL; 476 } 459 477 460 478 if(otrmsg) { … … 504 522 505 523 if(!cmd->command) { 506 irc_ usermsg(irc, "%s: unknown subcommand \"%s\", see \x02help otr\x02",524 irc_rootmsg(irc, "%s: unknown subcommand \"%s\", see \x02help otr\x02", 507 525 args[0], args[1]); 508 526 return; … … 510 528 511 529 if(!args[cmd->required_parameters+1]) { 512 irc_ usermsg(irc, "%s %s: not enough arguments (%d req.)",530 irc_rootmsg(irc, "%s %s: not enough arguments (%d req.)", 513 531 args[0], args[1], cmd->required_parameters); 514 532 return; … … 582 600 if (strcmp(accountname, recipient) == 0) { 583 601 /* huh? injecting messages to myself? */ 584 irc_ usermsg(irc, "note to self: %s", message);602 irc_rootmsg(irc, "note to self: %s", message); 585 603 } else { 586 604 /* need to drop some consts here :-( */ … … 597 615 char *msg = g_strdup(message); 598 616 irc_t *irc = ic->bee->ui_data; 617 irc_user_t *u = peeruser(irc, username, protocol); 599 618 600 619 strip_html(msg); 601 irc_usermsg(irc, "otr: %s", msg); 620 if(u) { 621 /* display as a notice from this particular user */ 622 irc_usernotice(u, "%s", msg); 623 } else { 624 irc_rootmsg(irc, "[otr] %s", msg); 625 } 602 626 603 627 g_free(msg); … … 611 635 struct im_connection *ic = check_imc(opdata, accountname, protocol); 612 636 irc_t *irc = ic->bee->ui_data; 637 irc_user_t *u = peeruser(irc, username, protocol); 613 638 char hunam[45]; /* anybody looking? ;-) */ 614 639 615 640 otrl_privkey_hash_to_human(hunam, fingerprint); 616 irc_usermsg(irc, "new fingerprint for %s: %s", 617 peernick(irc, username, protocol), hunam); 641 if(u) { 642 irc_usernotice(u, "new fingerprint: %s", hunam); 643 } else { 644 /* this case shouldn't normally happen */ 645 irc_rootmsg(irc, "new fingerprint for %s/%s: %s", 646 username, protocol, hunam); 647 } 618 648 } 619 649 … … 644 674 if(!otr_update_modeflags(irc, u)) { 645 675 char *trust = u->flags & IRC_USER_OTR_TRUSTED ? "trusted" : "untrusted!"; 646 irc_user msg(irc, "conversation with %s is now off the record (%s)", u->nick, trust);676 irc_usernotice(u, "conversation is now off the record (%s)", trust); 647 677 } 648 678 } … … 664 694 otr_update_uflags(context, u); 665 695 if(!otr_update_modeflags(irc, u)) 666 irc_user msg(irc, "conversation with %s is now in the clear", u->nick);696 irc_usernotice(u, "conversation is now in cleartext"); 667 697 } 668 698 … … 685 715 if(!otr_update_modeflags(irc, u)) { 686 716 char *trust = u->flags & IRC_USER_OTR_TRUSTED ? "trusted" : "untrusted!"; 687 irc_user msg(irc, "otr connection with %s has been refreshed (%s)", u->nick, trust);717 irc_usernotice(u, "otr connection has been refreshed (%s)", trust); 688 718 } 689 719 } … … 729 759 u = irc_user_by_name(irc, args[1]); 730 760 if(!u || !u->bu || !u->bu->ic) { 731 irc_ usermsg(irc, "%s: unknown user", args[1]);761 irc_rootmsg(irc, "%s: unknown user", args[1]); 732 762 return; 733 763 } … … 754 784 u = irc_user_by_name(irc, args[1]); 755 785 if(!u || !u->bu || !u->bu->ic) { 756 irc_ usermsg(irc, "%s: unknown user", args[1]);786 irc_rootmsg(irc, "%s: unknown user", args[1]); 757 787 return; 758 788 } 759 789 if(!(u->bu->flags & BEE_USER_ONLINE)) { 760 irc_ usermsg(irc, "%s is offline", args[1]);790 irc_rootmsg(irc, "%s is offline", args[1]); 761 791 return; 762 792 } … … 785 815 u = irc_user_by_name(irc, args[1]); 786 816 if(!u || !u->bu || !u->bu->ic) { 787 irc_ usermsg(irc, "%s: unknown user", args[1]);817 irc_rootmsg(irc, "%s: unknown user", args[1]); 788 818 return; 789 819 } … … 792 822 u->bu->ic->acc->user, u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 793 823 if(!ctx) { 794 irc_ usermsg(irc, "%s: no otr context with user", args[1]);824 irc_rootmsg(irc, "%s: no otr context with user", args[1]); 795 825 return; 796 826 } … … 804 834 805 835 if(!*p || !*q) { 806 irc_ usermsg(irc, "failed: truncated fingerprint block %d", i+1);836 irc_rootmsg(irc, "failed: truncated fingerprint block %d", i+1); 807 837 return; 808 838 } … … 811 841 y = hexval(*q); 812 842 if(x<0) { 813 irc_ usermsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+1, i+1);843 irc_rootmsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+1, i+1); 814 844 return; 815 845 } 816 846 if(y<0) { 817 irc_ usermsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+2, i+1);847 irc_rootmsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+2, i+1); 818 848 return; 819 849 } … … 824 854 fp = otrl_context_find_fingerprint(ctx, raw, 0, NULL); 825 855 if(!fp) { 826 irc_ usermsg(irc, "failed: no such fingerprint for %s", args[1]);856 irc_rootmsg(irc, "failed: no such fingerprint for %s", args[1]); 827 857 } else { 828 858 char *trust = args[7] ? args[7] : "affirmed"; 829 859 otrl_context_set_trust(fp, trust); 830 irc_ usermsg(irc, "fingerprint match, trust set to \"%s\"", trust);860 irc_rootmsg(irc, "fingerprint match, trust set to \"%s\"", trust); 831 861 if(u->flags & IRC_USER_OTR_ENCRYPTED) 832 862 u->flags |= IRC_USER_OTR_TRUSTED; … … 856 886 ctx = otrl_context_find(irc->otr->us, handle, myhandle, protocol, 0, NULL, NULL, NULL); 857 887 if(!ctx) { 858 irc_ usermsg(irc, "no such context");888 irc_rootmsg(irc, "no such context"); 859 889 g_free(arg); 860 890 return; … … 863 893 irc_user_t *u = irc_user_by_name(irc, args[1]); 864 894 if(!u || !u->bu || !u->bu->ic) { 865 irc_ usermsg(irc, "%s: unknown user", args[1]);895 irc_rootmsg(irc, "%s: unknown user", args[1]); 866 896 g_free(arg); 867 897 return; … … 870 900 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 871 901 if(!ctx) { 872 irc_ usermsg(irc, "no otr context with %s", args[1]);902 irc_rootmsg(irc, "no otr context with %s", args[1]); 873 903 g_free(arg); 874 904 return; … … 878 908 /* show how we resolved the (nick) argument, if we did */ 879 909 if(handle!=arg) { 880 irc_ usermsg(irc, "%s is %s/%s; we are %s/%s to them", args[1],910 irc_rootmsg(irc, "%s is %s/%s; we are %s/%s to them", args[1], 881 911 ctx->username, ctx->protocol, ctx->accountname, ctx->protocol); 882 912 } … … 893 923 n = atoi(args[1]); 894 924 if(n<0 || (!n && strcmp(args[1], "0"))) { 895 irc_ usermsg(irc, "%s: invalid account number", args[1]);925 irc_rootmsg(irc, "%s: invalid account number", args[1]); 896 926 return; 897 927 } … … 900 930 for(i=0; i<n && a; i++, a=a->next); 901 931 if(!a) { 902 irc_ usermsg(irc, "%s: no such account", args[1]);932 irc_rootmsg(irc, "%s: no such account", args[1]); 903 933 return; 904 934 } 905 935 906 936 if(keygen_in_progress(irc, a->user, a->prpl->name)) { 907 irc_ usermsg(irc, "keygen for account %d already in progress", n);937 irc_rootmsg(irc, "keygen for account %d already in progress", n); 908 938 return; 909 939 } … … 927 957 928 958 if(fp == fp->context->active_fingerprint) { 929 irc_ usermsg(irc, "that fingerprint is active, terminate otr connection first");959 irc_rootmsg(irc, "that fingerprint is active, terminate otr connection first"); 930 960 return; 931 961 } … … 943 973 944 974 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 945 irc_ usermsg(irc, "active otr connection with %s, terminate it first",975 irc_rootmsg(irc, "active otr connection with %s, terminate it first", 946 976 peernick(irc, ctx->username, ctx->protocol)); 947 977 return; … … 975 1005 976 1006 if(!args[3]) { 977 irc_ usermsg(irc, "otr %s %s: not enough arguments (2 req.)", args[0], args[1]);1007 irc_rootmsg(irc, "otr %s %s: not enough arguments (2 req.)", args[0], args[1]); 978 1008 return; 979 1009 } … … 982 1012 u = irc_user_by_name(irc, args[2]); 983 1013 if(!u || !u->bu || !u->bu->ic) { 984 irc_ usermsg(irc, "%s: unknown user", args[2]);1014 irc_rootmsg(irc, "%s: unknown user", args[2]); 985 1015 return; 986 1016 } … … 989 1019 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 990 1020 if(!ctx) { 991 irc_ usermsg(irc, "no otr context with %s", args[2]);1021 irc_rootmsg(irc, "no otr context with %s", args[2]); 992 1022 return; 993 1023 } … … 1000 1030 1001 1031 if(fp == ctx->active_fingerprint) { 1002 irc_ usermsg(irc, "that fingerprint is active, terminate otr connection first");1032 irc_rootmsg(irc, "that fingerprint is active, terminate otr connection first"); 1003 1033 return; 1004 1034 } … … 1025 1055 u = irc_user_by_name(irc, args[2]); 1026 1056 if(!u || !u->bu || !u->bu->ic) { 1027 irc_ usermsg(irc, "%s: unknown user", args[2]);1057 irc_rootmsg(irc, "%s: unknown user", args[2]); 1028 1058 return; 1029 1059 } … … 1032 1062 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 1033 1063 if(!ctx) { 1034 irc_ usermsg(irc, "no otr context with %s", args[2]);1064 irc_rootmsg(irc, "no otr context with %s", args[2]); 1035 1065 return; 1036 1066 } 1037 1067 1038 1068 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 1039 irc_ usermsg(irc, "active otr connection with %s, terminate it first", args[2]);1069 irc_rootmsg(irc, "active otr connection with %s, terminate it first", args[2]); 1040 1070 return; 1041 1071 } … … 1070 1100 else 1071 1101 { 1072 irc_ usermsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02",1102 irc_rootmsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02", 1073 1103 args[0], args[1]); 1074 1104 } … … 1096 1126 if(!context) { 1097 1127 /* huh? out of memory or what? */ 1098 irc_ usermsg(irc, "smp: failed to get otr context for %s", u->nick);1128 irc_rootmsg(irc, "smp: failed to get otr context for %s", u->nick); 1099 1129 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1100 1130 otrl_sm_state_free(context->smstate); … … 1104 1134 1105 1135 if (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) { 1106 irc_ usermsg(irc, "smp %s: opponent violated protocol, aborting",1136 irc_rootmsg(irc, "smp %s: opponent violated protocol, aborting", 1107 1137 u->nick); 1108 1138 otrl_message_abort_smp(us, ops, u->bu->ic, context); … … 1114 1144 if (tlv) { 1115 1145 if (nextMsg != OTRL_SMP_EXPECT1) { 1116 irc_ usermsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick);1146 irc_rootmsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick); 1117 1147 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1118 1148 otrl_sm_state_free(context->smstate); 1119 1149 } else { 1120 1150 char *question = g_strndup((char *)tlv->data, tlv->len); 1121 irc_ usermsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick,1151 irc_rootmsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick, 1122 1152 question); 1123 irc_ usermsg(irc, "smp: respond with \x02otr smp %s <answer>\x02",1153 irc_rootmsg(irc, "smp: respond with \x02otr smp %s <answer>\x02", 1124 1154 u->nick); 1125 1155 g_free(question); … … 1130 1160 if (tlv) { 1131 1161 if (nextMsg != OTRL_SMP_EXPECT1) { 1132 irc_ usermsg(irc, "smp %s: spurious SMP1 received, aborting", u->nick);1162 irc_rootmsg(irc, "smp %s: spurious SMP1 received, aborting", u->nick); 1133 1163 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1134 1164 otrl_sm_state_free(context->smstate); 1135 1165 } else { 1136 irc_ usermsg(irc, "smp: initiated by %s"1166 irc_rootmsg(irc, "smp: initiated by %s" 1137 1167 " - respond with \x02otr smp %s <secret>\x02", 1138 1168 u->nick, u->nick); … … 1143 1173 if (tlv) { 1144 1174 if (nextMsg != OTRL_SMP_EXPECT2) { 1145 irc_ usermsg(irc, "smp %s: spurious SMP2 received, aborting", u->nick);1175 irc_rootmsg(irc, "smp %s: spurious SMP2 received, aborting", u->nick); 1146 1176 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1147 1177 otrl_sm_state_free(context->smstate); … … 1154 1184 if (tlv) { 1155 1185 if (nextMsg != OTRL_SMP_EXPECT3) { 1156 irc_ usermsg(irc, "smp %s: spurious SMP3 received, aborting", u->nick);1186 irc_rootmsg(irc, "smp %s: spurious SMP3 received, aborting", u->nick); 1157 1187 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1158 1188 otrl_sm_state_free(context->smstate); … … 1161 1191 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1162 1192 if(context->smstate->received_question) { 1163 irc_ usermsg(irc, "smp %s: correct answer, you are trusted",1193 irc_rootmsg(irc, "smp %s: correct answer, you are trusted", 1164 1194 u->nick); 1165 1195 } else { 1166 irc_ usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",1196 irc_rootmsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1167 1197 u->nick); 1168 1198 } 1169 1199 } else { 1170 1200 if(context->smstate->received_question) { 1171 irc_ usermsg(irc, "smp %s: wrong answer, you are not trusted",1201 irc_rootmsg(irc, "smp %s: wrong answer, you are not trusted", 1172 1202 u->nick); 1173 1203 } else { 1174 irc_ usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",1204 irc_rootmsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1175 1205 u->nick); 1176 1206 } … … 1183 1213 if (tlv) { 1184 1214 if (nextMsg != OTRL_SMP_EXPECT4) { 1185 irc_ usermsg(irc, "smp %s: spurious SMP4 received, aborting", u->nick);1215 irc_rootmsg(irc, "smp %s: spurious SMP4 received, aborting", u->nick); 1186 1216 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1187 1217 otrl_sm_state_free(context->smstate); … … 1189 1219 /* SMP4 received, otrl_message_receiving will have set fp trust */ 1190 1220 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1191 irc_ usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",1221 irc_rootmsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1192 1222 u->nick); 1193 1223 } else { 1194 irc_ usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",1224 irc_rootmsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1195 1225 u->nick); 1196 1226 } … … 1201 1231 tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT); 1202 1232 if (tlv) { 1203 irc_ usermsg(irc, "smp: received abort from %s", u->nick);1233 irc_rootmsg(irc, "smp: received abort from %s", u->nick); 1204 1234 otrl_sm_state_free(context->smstate); 1205 1235 /* smp is in back in EXPECT1 */ … … 1216 1246 u = irc_user_by_name(irc, nick); 1217 1247 if(!u || !u->bu || !u->bu->ic) { 1218 irc_ usermsg(irc, "%s: unknown user", nick);1248 irc_rootmsg(irc, "%s: unknown user", nick); 1219 1249 return; 1220 1250 } 1221 1251 if(!(u->bu->flags & BEE_USER_ONLINE)) { 1222 irc_ usermsg(irc, "%s is offline", nick);1252 irc_rootmsg(irc, "%s is offline", nick); 1223 1253 return; 1224 1254 } … … 1227 1257 u->bu->ic->acc->user, u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 1228 1258 if(!ctx || ctx->msgstate != OTRL_MSGSTATE_ENCRYPTED) { 1229 irc_ usermsg(irc, "smp: otr inactive with %s, try \x02otr connect"1259 irc_rootmsg(irc, "smp: otr inactive with %s, try \x02otr connect" 1230 1260 " %s\x02", nick, nick); 1231 1261 return; … … 1242 1272 if(question) { 1243 1273 /* this was 'otr smpq', just initiate */ 1244 irc_ usermsg(irc, "smp: initiating with %s...", u->nick);1274 irc_rootmsg(irc, "smp: initiating with %s...", u->nick); 1245 1275 otrl_message_initiate_smp_q(irc->otr->us, &otr_ops, u->bu->ic, ctx, 1246 1276 question, (unsigned char *)secret, strlen(secret)); … … 1251 1281 is completed or aborted! */ 1252 1282 if(ctx->smstate->secret == NULL) { 1253 irc_ usermsg(irc, "smp: initiating with %s...", u->nick);1283 irc_rootmsg(irc, "smp: initiating with %s...", u->nick); 1254 1284 otrl_message_initiate_smp(irc->otr->us, &otr_ops, 1255 1285 u->bu->ic, ctx, (unsigned char *)secret, strlen(secret)); … … 1258 1288 /* if we're still in EXPECT1 but smstate is initialized, we must have 1259 1289 received the SMP1, so let's issue a response */ 1260 irc_ usermsg(irc, "smp: responding to %s...", u->nick);1290 irc_rootmsg(irc, "smp: responding to %s...", u->nick); 1261 1291 otrl_message_respond_smp(irc->otr->us, &otr_ops, 1262 1292 u->bu->ic, ctx, (unsigned char *)secret, strlen(secret)); … … 1373 1403 } 1374 1404 if(fp == ctx->active_fingerprint) { 1375 irc_ usermsg(irc, " \x02%s (%s)\x02", human, trust);1405 irc_rootmsg(irc, " \x02%s (%s)\x02", human, trust); 1376 1406 } else { 1377 irc_ usermsg(irc, " %s (%s)", human, trust);1407 irc_rootmsg(irc, " %s (%s)", human, trust); 1378 1408 } 1379 1409 } 1380 1410 if(count==0) 1381 irc_ usermsg(irc, " (none)");1411 irc_rootmsg(irc, " (none)"); 1382 1412 } 1383 1413 … … 1398 1428 1399 1429 if(n>=40) { 1400 irc_ usermsg(irc, "too many fingerprint digits given, expected at most 40");1430 irc_rootmsg(irc, "too many fingerprint digits given, expected at most 40"); 1401 1431 return NULL; 1402 1432 } … … 1405 1435 *(p++) = c; 1406 1436 } else { 1407 irc_ usermsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);1437 irc_rootmsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1); 1408 1438 return NULL; 1409 1439 } … … 1426 1456 } 1427 1457 if(!fp) { 1428 irc_ usermsg(irc, "%s: no match", prefix);1458 irc_rootmsg(irc, "%s: no match", prefix); 1429 1459 return NULL; 1430 1460 } … … 1439 1469 } 1440 1470 if(fp2) { 1441 irc_ usermsg(irc, "%s: multiple matches", prefix);1471 irc_rootmsg(irc, "%s: multiple matches", prefix); 1442 1472 return NULL; 1443 1473 } … … 1462 1492 1463 1493 if(n>=40) { 1464 irc_ usermsg(irc, "too many fingerprint digits given, expected at most 40");1494 irc_rootmsg(irc, "too many fingerprint digits given, expected at most 40"); 1465 1495 return NULL; 1466 1496 } … … 1469 1499 *(p++) = c; 1470 1500 } else { 1471 irc_ usermsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);1501 irc_rootmsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1); 1472 1502 return NULL; 1473 1503 } … … 1490 1520 } 1491 1521 if(!k) { 1492 irc_ usermsg(irc, "%s: no match", prefix);1522 irc_rootmsg(irc, "%s: no match", prefix); 1493 1523 return NULL; 1494 1524 } … … 1503 1533 } 1504 1534 if(k2) { 1505 irc_ usermsg(irc, "%s: multiple matches", prefix);1535 irc_rootmsg(irc, "%s: multiple matches", prefix); 1506 1536 return NULL; 1507 1537 } … … 1518 1548 1519 1549 /* list all privkeys (including ones being generated) */ 1520 irc_ usermsg(irc, "\x1fprivate keys:\x1f");1550 irc_rootmsg(irc, "\x1fprivate keys:\x1f"); 1521 1551 for(key=irc->otr->us->privkey_root; key; key=key->next) { 1522 1552 const char *hash; … … 1524 1554 switch(key->pubkey_type) { 1525 1555 case OTRL_PUBKEY_TYPE_DSA: 1526 irc_ usermsg(irc, " %s/%s - DSA", key->accountname, key->protocol);1556 irc_rootmsg(irc, " %s/%s - DSA", key->accountname, key->protocol); 1527 1557 break; 1528 1558 default: 1529 irc_ usermsg(irc, " %s/%s - type %d", key->accountname, key->protocol,1559 irc_rootmsg(irc, " %s/%s - type %d", key->accountname, key->protocol, 1530 1560 key->pubkey_type); 1531 1561 } … … 1536 1566 hash = otrl_privkey_fingerprint(irc->otr->us, human, key->accountname, key->protocol); 1537 1567 if(hash) /* should always succeed */ 1538 irc_ usermsg(irc, " %s", human);1568 irc_rootmsg(irc, " %s", human); 1539 1569 } 1540 1570 if(irc->otr->sent_accountname) { 1541 irc_ usermsg(irc, " %s/%s - DSA", irc->otr->sent_accountname,1571 irc_rootmsg(irc, " %s/%s - DSA", irc->otr->sent_accountname, 1542 1572 irc->otr->sent_protocol); 1543 irc_ usermsg(irc, " (being generated)");1573 irc_rootmsg(irc, " (being generated)"); 1544 1574 } 1545 1575 for(kg=irc->otr->todo; kg; kg=kg->next) { 1546 irc_ usermsg(irc, " %s/%s - DSA", kg->accountname, kg->protocol);1547 irc_ usermsg(irc, " (queued)");1576 irc_rootmsg(irc, " %s/%s - DSA", kg->accountname, kg->protocol); 1577 irc_rootmsg(irc, " (queued)"); 1548 1578 } 1549 1579 if(key == irc->otr->us->privkey_root && 1550 1580 !irc->otr->sent_accountname && 1551 1581 kg == irc->otr->todo) 1552 irc_ usermsg(irc, " (none)");1582 irc_rootmsg(irc, " (none)"); 1553 1583 1554 1584 /* list all contexts */ 1555 irc_ usermsg(irc, "%s", "");1556 irc_ usermsg(irc, "\x1f" "connection contexts:\x1f (bold=currently encrypted)");1585 irc_rootmsg(irc, "%s", ""); 1586 irc_rootmsg(irc, "\x1f" "connection contexts:\x1f (bold=currently encrypted)"); 1557 1587 for(ctx=irc->otr->us->context_root; ctx; ctx=ctx->next) {\ 1558 1588 irc_user_t *u; … … 1568 1598 1569 1599 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 1570 irc_ usermsg(irc, " \x02%s\x02", userstring);1600 irc_rootmsg(irc, " \x02%s\x02", userstring); 1571 1601 } else { 1572 irc_ usermsg(irc, " %s", userstring);1602 irc_rootmsg(irc, " %s", userstring); 1573 1603 } 1574 1604 … … 1576 1606 } 1577 1607 if(ctx == irc->otr->us->context_root) 1578 irc_ usermsg(irc, " (none)");1608 irc_rootmsg(irc, " (none)"); 1579 1609 } 1580 1610 … … 1583 1613 switch(ctx->otr_offer) { 1584 1614 case OFFER_NOT: 1585 irc_ usermsg(irc, " otr offer status: none sent");1615 irc_rootmsg(irc, " otr offer status: none sent"); 1586 1616 break; 1587 1617 case OFFER_SENT: 1588 irc_ usermsg(irc, " otr offer status: awaiting reply");1618 irc_rootmsg(irc, " otr offer status: awaiting reply"); 1589 1619 break; 1590 1620 case OFFER_ACCEPTED: 1591 irc_ usermsg(irc, " otr offer status: accepted our offer");1621 irc_rootmsg(irc, " otr offer status: accepted our offer"); 1592 1622 break; 1593 1623 case OFFER_REJECTED: 1594 irc_ usermsg(irc, " otr offer status: ignored our offer");1624 irc_rootmsg(irc, " otr offer status: ignored our offer"); 1595 1625 break; 1596 1626 default: 1597 irc_ usermsg(irc, " otr offer status: %d", ctx->otr_offer);1627 irc_rootmsg(irc, " otr offer status: %d", ctx->otr_offer); 1598 1628 } 1599 1629 1600 1630 switch(ctx->msgstate) { 1601 1631 case OTRL_MSGSTATE_PLAINTEXT: 1602 irc_ usermsg(irc, " connection state: cleartext");1632 irc_rootmsg(irc, " connection state: cleartext"); 1603 1633 break; 1604 1634 case OTRL_MSGSTATE_ENCRYPTED: 1605 irc_ usermsg(irc, " connection state: encrypted (v%d)", ctx->protocol_version);1635 irc_rootmsg(irc, " connection state: encrypted (v%d)", ctx->protocol_version); 1606 1636 break; 1607 1637 case OTRL_MSGSTATE_FINISHED: 1608 irc_ usermsg(irc, " connection state: shut down");1638 irc_rootmsg(irc, " connection state: shut down"); 1609 1639 break; 1610 1640 default: 1611 irc_ usermsg(irc, " connection state: %d", ctx->msgstate);1612 } 1613 1614 irc_ usermsg(irc, " fingerprints: (bold=active)");1641 irc_rootmsg(irc, " connection state: %d", ctx->msgstate); 1642 } 1643 1644 irc_rootmsg(irc, " fingerprints: (bold=active)"); 1615 1645 show_fingerprints(irc, ctx); 1616 1646 } … … 1652 1682 1653 1683 if(pipe(to) < 0 || pipe(from) < 0) { 1654 irc_ usermsg(irc, "otr keygen: couldn't create pipe: %s", strerror(errno));1684 irc_rootmsg(irc, "otr keygen: couldn't create pipe: %s", strerror(errno)); 1655 1685 return; 1656 1686 } … … 1659 1689 fromf = fdopen(from[0], "r"); 1660 1690 if(!tof || !fromf) { 1661 irc_ usermsg(irc, "otr keygen: couldn't streamify pipe: %s", strerror(errno));1691 irc_rootmsg(irc, "otr keygen: couldn't streamify pipe: %s", strerror(errno)); 1662 1692 return; 1663 1693 } … … 1665 1695 p = fork(); 1666 1696 if(p<0) { 1667 irc_ usermsg(irc, "otr keygen: couldn't fork: %s", strerror(errno));1697 irc_rootmsg(irc, "otr keygen: couldn't fork: %s", strerror(errno)); 1668 1698 return; 1669 1699 } … … 1745 1775 myfgets(msg, 512, irc->otr->from); 1746 1776 1747 irc_ usermsg(irc, "%s", msg);1777 irc_rootmsg(irc, "%s", msg); 1748 1778 if(filename[0]) { 1749 1779 char *kf = g_strdup_printf("%s%s.otr_keys", global.conf->configdir, irc->user->nick); … … 1819 1849 1820 1850 if(keygen_in_progress(irc, acc->user, acc->prpl->name)) { 1821 irc_ usermsg(irc, "keygen for %s/%s already in progress",1851 irc_rootmsg(irc, "keygen for %s/%s already in progress", 1822 1852 acc->user, acc->prpl->name); 1823 1853 } else { 1824 irc_ usermsg(irc, "starting background keygen for %s/%s",1854 irc_rootmsg(irc, "starting background keygen for %s/%s", 1825 1855 acc->user, acc->prpl->name); 1826 irc_ usermsg(irc, "you will be notified when it completes");1856 irc_rootmsg(irc, "you will be notified when it completes"); 1827 1857 otr_keygen(irc, acc->user, acc->prpl->name); 1828 1858 } 1829 1859 } 1860 1861 /* vim: set noet ts=4 sw=4: */ -
protocols/nogaim.c
r6a45181 r3864c08 216 216 if( a ) 217 217 /* FIXME(wilmer): ui_log callback or so */ 218 irc_ usermsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text );218 irc_rootmsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text ); 219 219 else 220 irc_ usermsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text );220 irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text ); 221 221 222 222 g_free( text ); -
protocols/purple/purple.c
r6a45181 r3864c08 181 181 /** No way to talk to the user right now, invent one when 182 182 this becomes important. 183 irc_ usermsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n",183 irc_rootmsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n", 184 184 name, purple_account_option_get_type( o ) ); 185 185 */ -
query.c
r6a45181 r3864c08 150 150 imcb_log( q->ic, "Accepted: %s", q->question ); 151 151 else 152 irc_ usermsg( irc, "Accepted: %s", q->question );152 irc_rootmsg( irc, "Accepted: %s", q->question ); 153 153 if( q->yes ) 154 154 q->yes( q->data ); … … 159 159 imcb_log( q->ic, "Rejected: %s", q->question ); 160 160 else 161 irc_ usermsg( irc, "Rejected: %s", q->question );161 irc_rootmsg( irc, "Rejected: %s", q->question ); 162 162 if( q->no ) 163 163 q->no( q->data ); … … 179 179 else 180 180 { 181 irc_ usermsg( irc, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );181 irc_rootmsg( irc, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question ); 182 182 } 183 183 } -
root_commands.c
r6a45181 r3864c08 42 42 if( cmd[blaat] == NULL ) \ 43 43 { \ 44 irc_ usermsg( irc, "Not enough parameters given (need %d).", x ); \44 irc_rootmsg( irc, "Not enough parameters given (need %d).", x ); \ 45 45 return y; \ 46 46 } \ … … 69 69 } 70 70 71 irc_ usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );71 irc_rootmsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] ); 72 72 } 73 73 … … 90 90 if( s ) 91 91 { 92 irc_ usermsg( irc, "%s", s );92 irc_rootmsg( irc, "%s", s ); 93 93 g_free( s ); 94 94 } 95 95 else 96 96 { 97 irc_ usermsg( irc, "Error opening helpfile." );97 irc_rootmsg( irc, "Error opening helpfile." ); 98 98 } 99 99 } … … 110 110 if( irc->status & USTATUS_IDENTIFIED ) 111 111 { 112 irc_ usermsg( irc, "You're already logged in." );112 irc_rootmsg( irc, "You're already logged in." ); 113 113 return; 114 114 } … … 128 128 else if( irc->b->accounts != NULL ) 129 129 { 130 irc_ usermsg( irc,130 irc_rootmsg( irc, 131 131 "You're trying to identify yourself, but already have " 132 132 "at least one IM account set up. " … … 138 138 if( password == NULL ) 139 139 { 140 irc_ usermsg( irc, "About to identify, use /OPER to enter the password" );140 irc_rootmsg( irc, "About to identify, use /OPER to enter the password" ); 141 141 irc->status |= OPER_HACK_IDENTIFY; 142 142 return; … … 150 150 switch (status) { 151 151 case STORAGE_INVALID_PASSWORD: 152 irc_ usermsg( irc, "Incorrect password" );152 irc_rootmsg( irc, "Incorrect password" ); 153 153 break; 154 154 case STORAGE_NO_SUCH_USER: 155 irc_ usermsg( irc, "The nick is (probably) not registered" );155 irc_rootmsg( irc, "The nick is (probably) not registered" ); 156 156 break; 157 157 case STORAGE_OK: 158 irc_ usermsg( irc, "Password accepted%s",158 irc_rootmsg( irc, "Password accepted%s", 159 159 load ? ", settings and accounts loaded" : "" ); 160 160 irc_setpass( irc, password ); … … 192 192 case STORAGE_OTHER_ERROR: 193 193 default: 194 irc_ usermsg( irc, "Unknown error while loading configuration" );194 irc_rootmsg( irc, "Unknown error while loading configuration" ); 195 195 break; 196 196 } … … 215 215 if( global.conf->authmode == AUTHMODE_REGISTERED ) 216 216 { 217 irc_ usermsg( irc, "This server does not allow registering new accounts" );217 irc_rootmsg( irc, "This server does not allow registering new accounts" ); 218 218 return; 219 219 } … … 221 221 if( cmd[1] == NULL ) 222 222 { 223 irc_ usermsg( irc, "About to register, use /OPER to enter the password" );223 irc_rootmsg( irc, "About to register, use /OPER to enter the password" ); 224 224 irc->status |= OPER_HACK_REGISTER; 225 225 return; … … 228 228 switch( storage_save( irc, cmd[1], FALSE ) ) { 229 229 case STORAGE_ALREADY_EXISTS: 230 irc_ usermsg( irc, "Nick is already registered" );230 irc_rootmsg( irc, "Nick is already registered" ); 231 231 break; 232 232 233 233 case STORAGE_OK: 234 irc_ usermsg( irc, "Account successfully created" );234 irc_rootmsg( irc, "Account successfully created" ); 235 235 irc_setpass( irc, cmd[1] ); 236 236 irc->status |= USTATUS_IDENTIFIED; … … 245 245 246 246 default: 247 irc_ usermsg( irc, "Error registering" );247 irc_rootmsg( irc, "Error registering" ); 248 248 break; 249 249 } … … 257 257 switch (status) { 258 258 case STORAGE_NO_SUCH_USER: 259 irc_ usermsg( irc, "That account does not exist" );259 irc_rootmsg( irc, "That account does not exist" ); 260 260 break; 261 261 case STORAGE_INVALID_PASSWORD: 262 irc_ usermsg( irc, "Password invalid" );262 irc_rootmsg( irc, "Password invalid" ); 263 263 break; 264 264 case STORAGE_OK: … … 266 266 irc->status &= ~USTATUS_IDENTIFIED; 267 267 irc_umode_set( irc, "-R", 1 ); 268 irc_ usermsg( irc, "Account `%s' removed", irc->user->nick );268 irc_rootmsg( irc, "Account `%s' removed", irc->user->nick ); 269 269 break; 270 270 default: 271 irc_ usermsg( irc, "Error: `%d'", status );271 irc_rootmsg( irc, "Error: `%d'", status ); 272 272 break; 273 273 } … … 277 277 { 278 278 if( ( irc->status & USTATUS_IDENTIFIED ) == 0 ) 279 irc_ usermsg( irc, "Please create an account first" );279 irc_rootmsg( irc, "Please create an account first" ); 280 280 else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK ) 281 irc_ usermsg( irc, "Configuration saved" );282 else 283 irc_ usermsg( irc, "Configuration could not be saved!" );281 irc_rootmsg( irc, "Configuration saved" ); 282 else 283 irc_rootmsg( irc, "Configuration could not be saved!" ); 284 284 } 285 285 … … 290 290 291 291 if( ( val = set_getstr( head, key ) ) ) 292 irc_ usermsg( irc, "%s = `%s'", key, val );292 irc_rootmsg( irc, "%s = `%s'", key, val ); 293 293 else if( !( set = set_find( head, key ) ) ) 294 294 { 295 irc_ usermsg( irc, "Setting `%s' does not exist.", key );295 irc_rootmsg( irc, "Setting `%s' does not exist.", key ); 296 296 if( *head == irc->b->set ) 297 irc_ usermsg( irc, "It might be an account or channel setting. "297 irc_rootmsg( irc, "It might be an account or channel setting. " 298 298 "See \x02help account set\x02 and \x02help channel set\x02." ); 299 299 } 300 300 else if( set->flags & SET_PASSWORD ) 301 irc_ usermsg( irc, "%s = `********' (hidden)", key );302 else 303 irc_ usermsg( irc, "%s is empty", key );301 irc_rootmsg( irc, "%s = `********' (hidden)", key ); 302 else 303 irc_rootmsg( irc, "%s is empty", key ); 304 304 } 305 305 … … 344 344 feedback. */ 345 345 if( st ) 346 irc_ usermsg( irc, "Setting changed successfully" );346 irc_rootmsg( irc, "Setting changed successfully" ); 347 347 else 348 irc_ usermsg( irc, "Failed to change setting" );348 irc_rootmsg( irc, "Failed to change setting" ); 349 349 } 350 350 else … … 377 377 if( a->ic && s && s->flags & ACC_SET_OFFLINE_ONLY ) 378 378 { 379 irc_ usermsg( irc, "This setting can only be changed when the account is %s-line", "off" );379 irc_rootmsg( irc, "This setting can only be changed when the account is %s-line", "off" ); 380 380 return 0; 381 381 } 382 382 else if( !a->ic && s && s->flags & ACC_SET_ONLINE_ONLY ) 383 383 { 384 irc_ usermsg( irc, "This setting can only be changed when the account is %s-line", "on" );384 irc_rootmsg( irc, "This setting can only be changed when the account is %s-line", "on" ); 385 385 return 0; 386 386 } … … 396 396 if( global.conf->authmode == AUTHMODE_REGISTERED && !( irc->status & USTATUS_IDENTIFIED ) ) 397 397 { 398 irc_ usermsg( irc, "This server only accepts registered users" );398 irc_rootmsg( irc, "This server only accepts registered users" ); 399 399 return; 400 400 } … … 413 413 if( strcmp( a->pass, PASSWORD_PENDING ) == 0 ) 414 414 { 415 irc_ usermsg( irc, "Enter password for account %s(%s) "415 irc_rootmsg( irc, "Enter password for account %s(%s) " 416 416 "first (use /OPER)", a->prpl->name, a->user ); 417 417 return; … … 425 425 if( prpl == NULL ) 426 426 { 427 irc_ usermsg( irc, "Unknown protocol" );427 irc_rootmsg( irc, "Unknown protocol" ); 428 428 return; 429 429 } … … 431 431 for( a = irc->b->accounts; a; a = a->next ) 432 432 if( a->prpl == prpl && prpl->handle_cmp( a->user, cmd[3] ) == 0 ) 433 irc_ usermsg( irc, "Warning: You already have an account with "433 irc_rootmsg( irc, "Warning: You already have an account with " 434 434 "protocol `%s' and username `%s'. Are you accidentally " 435 435 "trying to add it twice?", prpl->name, cmd[3] ); … … 438 438 if( cmd[5] ) 439 439 { 440 irc_ usermsg( irc, "Warning: Passing a servername/other flags to `account add' "440 irc_rootmsg( irc, "Warning: Passing a servername/other flags to `account add' " 441 441 "is now deprecated. Use `account set' instead." ); 442 442 set_setstr( &a->set, "server", cmd[5] ); 443 443 } 444 444 445 irc_ usermsg( irc, "Account successfully added%s", cmd[4] ? "" :445 irc_rootmsg( irc, "Account successfully added%s", cmd[4] ? "" : 446 446 ", now use /OPER to enter the password" ); 447 447 … … 453 453 454 454 if( strchr( irc->umode, 'b' ) ) 455 irc_ usermsg( irc, "Account list:" );455 irc_rootmsg( irc, "Account list:" ); 456 456 457 457 for( a = irc->b->accounts; a; a = a->next ) … … 468 468 con = ""; 469 469 470 irc_ usermsg( irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con );470 irc_rootmsg( irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con ); 471 471 472 472 i ++; 473 473 } 474 irc_ usermsg( irc, "End of account list" );474 irc_rootmsg( irc, "End of account list" ); 475 475 476 476 return; … … 484 484 if ( irc->b->accounts ) 485 485 { 486 irc_ usermsg( irc, "Trying to get all accounts connected..." );486 irc_rootmsg( irc, "Trying to get all accounts connected..." ); 487 487 488 488 for( a = irc->b->accounts; a; a = a->next ) … … 490 490 { 491 491 if( strcmp( a->pass, PASSWORD_PENDING ) == 0 ) 492 irc_ usermsg( irc, "Enter password for account %s(%s) "492 irc_rootmsg( irc, "Enter password for account %s(%s) " 493 493 "first (use /OPER)", a->prpl->name, a->user ); 494 494 else … … 498 498 else 499 499 { 500 irc_ usermsg( irc, "No accounts known. Use `account add' to add one." );500 irc_rootmsg( irc, "No accounts known. Use `account add' to add one." ); 501 501 } 502 502 … … 505 505 else if( len >= 2 && g_strncasecmp( cmd[1], "off", len ) == 0 ) 506 506 { 507 irc_ usermsg( irc, "Deactivating all active (re)connections..." );507 irc_rootmsg( irc, "Deactivating all active (re)connections..." ); 508 508 509 509 for( a = irc->b->accounts; a; a = a->next ) … … 530 530 ( a = account_get( irc->b, cmd[1] ) ) == NULL ) 531 531 { 532 irc_ usermsg( irc, "Could not find account `%s'. Note that the syntax "532 irc_rootmsg( irc, "Could not find account `%s'. Note that the syntax " 533 533 "of the account command changed, see \x02help account\x02.", cmd[1] ); 534 534 … … 540 540 if( a->ic ) 541 541 { 542 irc_ usermsg( irc, "Account is still logged in, can't delete" );542 irc_rootmsg( irc, "Account is still logged in, can't delete" ); 543 543 } 544 544 else 545 545 { 546 546 account_del( irc->b, a ); 547 irc_ usermsg( irc, "Account deleted" );547 irc_rootmsg( irc, "Account deleted" ); 548 548 } 549 549 } … … 551 551 { 552 552 if( a->ic ) 553 irc_ usermsg( irc, "Account already online" );553 irc_rootmsg( irc, "Account already online" ); 554 554 else if( strcmp( a->pass, PASSWORD_PENDING ) == 0 ) 555 irc_ usermsg( irc, "Enter password for account %s(%s) "555 irc_rootmsg( irc, "Enter password for account %s(%s) " 556 556 "first (use /OPER)", a->prpl->name, a->user ); 557 557 else … … 567 567 { 568 568 cancel_auto_reconnect( a ); 569 irc_ usermsg( irc, "Reconnect cancelled" );570 } 571 else 572 { 573 irc_ usermsg( irc, "Account already offline" );569 irc_rootmsg( irc, "Reconnect cancelled" ); 570 } 571 else 572 { 573 irc_rootmsg( irc, "Account already offline" ); 574 574 } 575 575 } … … 580 580 else 581 581 { 582 irc_ usermsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[2] );582 irc_rootmsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[2] ); 583 583 } 584 584 } … … 597 597 598 598 if( strchr( irc->umode, 'b' ) ) 599 irc_ usermsg( irc, "Channel list:" );599 irc_rootmsg( irc, "Channel list:" ); 600 600 601 601 for( l = irc->channels; l; l = l->next ) … … 603 603 irc_channel_t *ic = l->data; 604 604 605 irc_ usermsg( irc, "%2d. %s, %s channel%s", i, ic->name,605 irc_rootmsg( irc, "%2d. %s, %s channel%s", i, ic->name, 606 606 set_getstr( &ic->set, "type" ), 607 607 ic->flags & IRC_CHANNEL_JOINED ? " (joined)" : "" ); … … 609 609 i ++; 610 610 } 611 irc_ usermsg( irc, "End of channel list" );611 irc_rootmsg( irc, "End of channel list" ); 612 612 613 613 return; … … 623 623 cmd_set_real( irc, cmd + 1, &ic->set, NULL ); 624 624 else 625 irc_ usermsg( irc, "Could not find channel `%s'", cmd[1] );625 irc_rootmsg( irc, "Could not find channel `%s'", cmd[1] ); 626 626 627 627 return; … … 640 640 ic != ic->irc->default_channel ) 641 641 { 642 irc_ usermsg( irc, "Channel %s deleted.", ic->name );642 irc_rootmsg( irc, "Channel %s deleted.", ic->name ); 643 643 irc_channel_free( ic ); 644 644 } 645 645 else 646 irc_ usermsg( irc, "Couldn't remove channel (main channel %s or "646 irc_rootmsg( irc, "Couldn't remove channel (main channel %s or " 647 647 "channels you're still in cannot be deleted).", 648 648 irc->default_channel->name ); … … 650 650 else 651 651 { 652 irc_ usermsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] );652 irc_rootmsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] ); 653 653 } 654 654 } … … 668 668 if( !( a = account_get( irc->b, cmd[1] ) ) ) 669 669 { 670 irc_ usermsg( irc, "Invalid account" );670 irc_rootmsg( irc, "Invalid account" ); 671 671 return; 672 672 } 673 673 else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) ) 674 674 { 675 irc_ usermsg( irc, "That account is not on-line" );675 irc_rootmsg( irc, "That account is not on-line" ); 676 676 return; 677 677 } … … 681 681 if( !nick_ok( cmd[3] ) ) 682 682 { 683 irc_ usermsg( irc, "The requested nick `%s' is invalid", cmd[3] );683 irc_rootmsg( irc, "The requested nick `%s' is invalid", cmd[3] ); 684 684 return; 685 685 } 686 686 else if( irc_user_by_name( irc, cmd[3] ) ) 687 687 { 688 irc_ usermsg( irc, "The requested nick `%s' already exists", cmd[3] );688 irc_rootmsg( irc, "The requested nick `%s' already exists", cmd[3] ); 689 689 return; 690 690 } … … 704 704 strcmp( s, "group" ) == 0 && 705 705 ( group = set_getstr( &ic->set, "group" ) ) ) 706 irc_ usermsg( irc, "Adding `%s' to contact list (group %s)",706 irc_rootmsg( irc, "Adding `%s' to contact list (group %s)", 707 707 cmd[2], group ); 708 708 else 709 irc_ usermsg( irc, "Adding `%s' to contact list", cmd[2] );709 irc_rootmsg( irc, "Adding `%s' to contact list", cmd[2] ); 710 710 711 711 a->prpl->add_buddy( a->ic, cmd[2], group ); … … 720 720 if( ( bu = bee_user_new( irc->b, a->ic, cmd[2], BEE_USER_LOCAL ) ) && 721 721 ( iu = bu->ui_data ) ) 722 irc_ usermsg( irc, "Temporarily assigned nickname `%s' "722 irc_rootmsg( irc, "Temporarily assigned nickname `%s' " 723 723 "to contact `%s'", iu->nick, cmd[2] ); 724 724 } … … 734 734 if( !( iu = irc_user_by_name( irc, cmd[1] ) ) || !( bu = iu->bu ) ) 735 735 { 736 irc_ usermsg( irc, "Buddy `%s' not found", cmd[1] );736 irc_rootmsg( irc, "Buddy `%s' not found", cmd[1] ); 737 737 return; 738 738 } … … 744 744 bee_user_free( irc->b, bu ); 745 745 746 irc_ usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );746 irc_rootmsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] ); 747 747 g_free( s ); 748 748 … … 760 760 if( !iu || !iu->bu ) 761 761 { 762 irc_ usermsg( irc, "Nick `%s' does not exist", cmd[1] );762 irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] ); 763 763 return; 764 764 } … … 768 768 else if( !( a = account_get( irc->b, cmd[1] ) ) ) 769 769 { 770 irc_ usermsg( irc, "Invalid account" );770 irc_rootmsg( irc, "Invalid account" ); 771 771 return; 772 772 } 773 773 else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) 774 774 { 775 irc_ usermsg( irc, "That account is not on-line" );775 irc_rootmsg( irc, "That account is not on-line" ); 776 776 return; 777 777 } … … 779 779 if( !ic->acc->prpl->get_info ) 780 780 { 781 irc_ usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );781 irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); 782 782 } 783 783 else … … 796 796 if( iu == NULL ) 797 797 { 798 irc_ usermsg( irc, "Nick `%s' does not exist", cmd[1] );798 irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] ); 799 799 } 800 800 else if( del ) … … 802 802 if( iu->bu ) 803 803 bee_irc_user_nick_reset( iu ); 804 irc_ usermsg( irc, "Nickname reset to `%s'", iu->nick );804 irc_rootmsg( irc, "Nickname reset to `%s'", iu->nick ); 805 805 } 806 806 else if( iu == irc->user ) 807 807 { 808 irc_ usermsg( irc, "Use /nick to change your own nickname" );808 irc_rootmsg( irc, "Use /nick to change your own nickname" ); 809 809 } 810 810 else if( !nick_ok( cmd[2] ) ) 811 811 { 812 irc_ usermsg( irc, "Nick `%s' is invalid", cmd[2] );812 irc_rootmsg( irc, "Nick `%s' is invalid", cmd[2] ); 813 813 } 814 814 else if( ( old = irc_user_by_name( irc, cmd[2] ) ) && old != iu ) 815 815 { 816 irc_ usermsg( irc, "Nick `%s' already exists", cmd[2] );816 irc_rootmsg( irc, "Nick `%s' already exists", cmd[2] ); 817 817 } 818 818 else … … 820 820 if( !irc_user_set_nick( iu, cmd[2] ) ) 821 821 { 822 irc_ usermsg( irc, "Error while changing nick" );822 irc_rootmsg( irc, "Error while changing nick" ); 823 823 return; 824 824 } … … 836 836 } 837 837 838 irc_ usermsg( irc, "Nick successfully changed" );838 irc_rootmsg( irc, "Nick successfully changed" ); 839 839 } 840 840 } … … 869 869 format = "%-32.32s %-16.16s"; 870 870 871 irc_ usermsg( irc, format, "Handle", "Nickname" );871 irc_rootmsg( irc, format, "Handle", "Nickname" ); 872 872 for( l = a->ic->deny; l; l = l->next ) 873 873 { 874 874 bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data ); 875 875 irc_user_t *iu = bu ? bu->ui_data : NULL; 876 irc_ usermsg( irc, format, l->data, iu ? iu->nick : "(none)" );877 } 878 irc_ usermsg( irc, "End of list." );876 irc_rootmsg( irc, format, l->data, iu ? iu->nick : "(none)" ); 877 } 878 irc_rootmsg( irc, "End of list." ); 879 879 880 880 return; … … 885 885 if( !iu || !iu->bu ) 886 886 { 887 irc_ usermsg( irc, "Nick `%s' does not exist", cmd[1] );887 irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] ); 888 888 return; 889 889 } … … 893 893 else if( !( a = account_get( irc->b, cmd[1] ) ) ) 894 894 { 895 irc_ usermsg( irc, "Invalid account" );895 irc_rootmsg( irc, "Invalid account" ); 896 896 return; 897 897 } 898 898 else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) 899 899 { 900 irc_ usermsg( irc, "That account is not on-line" );900 irc_rootmsg( irc, "That account is not on-line" ); 901 901 return; 902 902 } … … 904 904 if( !ic->acc->prpl->add_deny || !ic->acc->prpl->rem_permit ) 905 905 { 906 irc_ usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );906 irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); 907 907 } 908 908 else … … 910 910 imc_rem_allow( ic, cmd[2] ); 911 911 imc_add_block( ic, cmd[2] ); 912 irc_ usermsg( irc, "Buddy `%s' moved from allow- to block-list", cmd[2] );912 irc_rootmsg( irc, "Buddy `%s' moved from allow- to block-list", cmd[2] ); 913 913 } 914 914 } … … 929 929 format = "%-32.32s %-16.16s"; 930 930 931 irc_ usermsg( irc, format, "Handle", "Nickname" );931 irc_rootmsg( irc, format, "Handle", "Nickname" ); 932 932 for( l = a->ic->permit; l; l = l->next ) 933 933 { 934 934 bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data ); 935 935 irc_user_t *iu = bu ? bu->ui_data : NULL; 936 irc_ usermsg( irc, format, l->data, iu ? iu->nick : "(none)" );937 } 938 irc_ usermsg( irc, "End of list." );936 irc_rootmsg( irc, format, l->data, iu ? iu->nick : "(none)" ); 937 } 938 irc_rootmsg( irc, "End of list." ); 939 939 940 940 return; … … 945 945 if( !iu || !iu->bu ) 946 946 { 947 irc_ usermsg( irc, "Nick `%s' does not exist", cmd[1] );947 irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] ); 948 948 return; 949 949 } … … 953 953 else if( !( a = account_get( irc->b, cmd[1] ) ) ) 954 954 { 955 irc_ usermsg( irc, "Invalid account" );955 irc_rootmsg( irc, "Invalid account" ); 956 956 return; 957 957 } 958 958 else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) 959 959 { 960 irc_ usermsg( irc, "That account is not on-line" );960 irc_rootmsg( irc, "That account is not on-line" ); 961 961 return; 962 962 } … … 964 964 if( !ic->acc->prpl->rem_deny || !ic->acc->prpl->add_permit ) 965 965 { 966 irc_ usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );966 irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); 967 967 } 968 968 else … … 971 971 imc_add_allow( ic, cmd[2] ); 972 972 973 irc_ usermsg( irc, "Buddy `%s' moved from block- to allow-list", cmd[2] );973 irc_rootmsg( irc, "Buddy `%s' moved from block- to allow-list", cmd[2] ); 974 974 } 975 975 } … … 998 998 if( ( ++times >= 3 ) ) 999 999 { 1000 irc_ usermsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] );1000 irc_rootmsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] ); 1001 1001 last_irc = NULL; 1002 1002 times = 0; … … 1011 1011 } 1012 1012 1013 irc_ usermsg( irc, "Did I ask you something?" );1013 irc_rootmsg( irc, "Did I ask you something?" ); 1014 1014 return; 1015 1015 } … … 1021 1021 if( sscanf( cmd[1], "%d", &numq ) != 1 ) 1022 1022 { 1023 irc_ usermsg( irc, "Invalid query number" );1023 irc_rootmsg( irc, "Invalid query number" ); 1024 1024 return; 1025 1025 } … … 1031 1031 if( !q ) 1032 1032 { 1033 irc_ usermsg( irc, "Uhm, I never asked you something like that..." );1033 irc_rootmsg( irc, "Uhm, I never asked you something like that..." ); 1034 1034 return; 1035 1035 } … … 1071 1071 format = "%-16.16s %-40.40s %s"; 1072 1072 1073 irc_ usermsg( irc, format, "Nick", "Handle/Account", "Status" );1073 irc_rootmsg( irc, format, "Nick", "Handle/Account", "Status" ); 1074 1074 1075 1075 if( irc->root->last_channel && … … 1094 1094 1095 1095 g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user ); 1096 irc_ usermsg( irc, format, iu->nick, s, st );1096 irc_rootmsg( irc, format, iu->nick, s, st ); 1097 1097 } 1098 1098 … … 1112 1112 { 1113 1113 g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user ); 1114 irc_ usermsg( irc, format, iu->nick, s, irc_user_get_away( iu ) );1114 irc_rootmsg( irc, format, iu->nick, s, irc_user_get_away( iu ) ); 1115 1115 } 1116 1116 n_away ++; … … 1129 1129 { 1130 1130 g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user ); 1131 irc_ usermsg( irc, format, iu->nick, s, "Offline" );1131 irc_rootmsg( irc, format, iu->nick, s, "Offline" ); 1132 1132 } 1133 1133 n_offline ++; 1134 1134 } 1135 1135 1136 irc_ usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );1136 irc_rootmsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline ); 1137 1137 } 1138 1138 … … 1144 1144 if( !q ) 1145 1145 { 1146 irc_ usermsg( irc, "There are no pending questions." );1147 return; 1148 } 1149 1150 irc_ usermsg( irc, "Pending queries:" );1146 irc_rootmsg( irc, "There are no pending questions." ); 1147 return; 1148 } 1149 1150 irc_rootmsg( irc, "Pending queries:" ); 1151 1151 1152 1152 for( num = 0; q; q = q->next, num ++ ) 1153 1153 if( q->ic ) /* Not necessary yet, but it might come later */ 1154 irc_ usermsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->acc->user, q->question );1155 else 1156 irc_ usermsg( irc, "%d, BitlBee: %s", num, q->question );1154 irc_rootmsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->acc->user, q->question ); 1155 else 1156 irc_rootmsg( irc, "%d, BitlBee: %s", num, q->question ); 1157 1157 } 1158 1158 … … 1170 1170 if( !( acc = account_get( irc->b, cmd[2] ) ) ) 1171 1171 { 1172 irc_ usermsg( irc, "Invalid account" );1172 irc_rootmsg( irc, "Invalid account" ); 1173 1173 return; 1174 1174 } 1175 1175 else if( !acc->prpl->chat_join ) 1176 1176 { 1177 irc_ usermsg( irc, "Named chatrooms not supported on that account." );1177 irc_rootmsg( irc, "Named chatrooms not supported on that account." ); 1178 1178 return; 1179 1179 } … … 1205 1205 set_setstr( &ic->set, "room", cmd[3] ) ) 1206 1206 { 1207 irc_ usermsg( irc, "Chatroom successfully added." );1207 irc_rootmsg( irc, "Chatroom successfully added." ); 1208 1208 } 1209 1209 else … … 1212 1212 irc_channel_free( ic ); 1213 1213 1214 irc_ usermsg( irc, "Could not add chatroom." );1214 irc_rootmsg( irc, "Could not add chatroom." ); 1215 1215 } 1216 1216 g_free( channel ); … … 1227 1227 if( !iu->bu->ic->acc->prpl->chat_with( iu->bu->ic, iu->bu->handle ) ) 1228 1228 { 1229 irc_ usermsg( irc, "(Possible) failure while trying to open "1229 irc_rootmsg( irc, "(Possible) failure while trying to open " 1230 1230 "a groupchat with %s.", iu->nick ); 1231 1231 } … … 1233 1233 else 1234 1234 { 1235 irc_ usermsg( irc, "Can't open a groupchat with %s.", cmd[2] );1235 irc_rootmsg( irc, "Can't open a groupchat with %s.", cmd[2] ); 1236 1236 } 1237 1237 } … … 1240 1240 g_strcasecmp( cmd[1], "del" ) == 0 ) 1241 1241 { 1242 irc_ usermsg( irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command." );1242 irc_rootmsg( irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command." ); 1243 1243 cmd_channel( irc, cmd ); 1244 1244 } 1245 1245 else 1246 1246 { 1247 irc_ usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] );1247 irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] ); 1248 1248 } 1249 1249 } … … 1260 1260 1261 1261 if( strchr( irc->umode, 'b' ) ) 1262 irc_ usermsg( irc, "Group list:" );1262 irc_rootmsg( irc, "Group list:" ); 1263 1263 1264 1264 for( l = irc->b->groups; l; l = l->next ) 1265 1265 { 1266 1266 bee_group_t *bg = l->data; 1267 irc_ usermsg( irc, "%d. %s", n ++, bg->name );1268 } 1269 irc_ usermsg( irc, "End of group list" );1270 } 1271 else 1272 { 1273 irc_ usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] );1267 irc_rootmsg( irc, "%d. %s", n ++, bg->name ); 1268 } 1269 irc_rootmsg( irc, "End of group list" ); 1270 } 1271 else 1272 { 1273 irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] ); 1274 1274 } 1275 1275 } … … 1284 1284 if( !files ) 1285 1285 { 1286 irc_ usermsg( irc, "No pending transfers" );1286 irc_rootmsg( irc, "No pending transfers" ); 1287 1287 return; 1288 1288 } … … 1305 1305 case LIST: 1306 1306 if ( file->status == FT_STATUS_LISTENING ) 1307 irc_ usermsg( irc,1307 irc_rootmsg( irc, 1308 1308 "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name); 1309 1309 else … … 1314 1314 kb_per_s = file->bytes_transferred / 1024 / diff; 1315 1315 1316 irc_ usermsg( irc,1316 irc_rootmsg( irc, 1317 1317 "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name, 1318 1318 file->bytes_transferred/1024, file->file_size/1024, kb_per_s); … … 1322 1322 if( file->status == FT_STATUS_LISTENING ) 1323 1323 { 1324 irc_ usermsg( irc, "Rejecting file transfer for %s", file->file_name );1324 irc_rootmsg( irc, "Rejecting file transfer for %s", file->file_name ); 1325 1325 imcb_file_canceled( file->ic, file, "Denied by user" ); 1326 1326 } … … 1329 1329 if( file->local_id == fid ) 1330 1330 { 1331 irc_ usermsg( irc, "Canceling file transfer for %s", file->file_name );1331 irc_rootmsg( irc, "Canceling file transfer for %s", file->file_name ); 1332 1332 imcb_file_canceled( file->ic, file, "Canceled by user" ); 1333 1333 } … … 1339 1339 static void cmd_nick( irc_t *irc, char **cmd ) 1340 1340 { 1341 irc_ usermsg( irc, "This command is deprecated. Try: account %s set display_name", cmd[1] );1341 irc_rootmsg( irc, "This command is deprecated. Try: account %s set display_name", cmd[1] ); 1342 1342 } 1343 1343 … … 1354 1354 1355 1355 if( msg ) 1356 irc_ usermsg( irc, "%s: This seems to be your first time using this "1356 irc_rootmsg( irc, "%s: This seems to be your first time using this " 1357 1357 "this version of BitlBee. Here's a list of new " 1358 1358 "features you may like to know about:\n\n%s\n", -
storage_xml.c
r6a45181 r3864c08 269 269 { 270 270 xd->unknown_tag ++; 271 irc_ usermsg( irc, "Warning: Unknown XML tag found in configuration file (%s). "271 irc_rootmsg( irc, "Warning: Unknown XML tag found in configuration file (%s). " 272 272 "This may happen when downgrading BitlBee versions. " 273 273 "This tag will be skipped and the information will be lost " … … 397 397 { 398 398 if( gerr && irc ) 399 irc_ usermsg( irc, "Error from XML-parser: %s", gerr->message );399 irc_rootmsg( irc, "Error from XML-parser: %s", gerr->message ); 400 400 401 401 g_clear_error( &gerr ); … … 473 473 if( ( fd = mkstemp( path ) ) < 0 ) 474 474 { 475 irc_ usermsg( irc, "Error while opening configuration file." );475 irc_rootmsg( irc, "Error while opening configuration file." ); 476 476 return STORAGE_OTHER_ERROR; 477 477 } … … 570 570 if( rename( path, path2 ) != 0 ) 571 571 { 572 irc_ usermsg( irc, "Error while renaming temporary configuration file." );572 irc_rootmsg( irc, "Error while renaming temporary configuration file." ); 573 573 574 574 g_free( path2 ); … … 585 585 g_free( pass_buf ); 586 586 587 irc_ usermsg( irc, "Write error. Disk full?" );587 irc_rootmsg( irc, "Write error. Disk full?" ); 588 588 close( fd ); 589 589
Note: See TracChangeset
for help on using the changeset viewer.