- Timestamp:
- 2011-10-03T14:56:58Z (13 years ago)
- Branches:
- master
- Children:
- 409c2de
- Parents:
- 3231485
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
otr.c
r3231485 re67e513 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; … … 521 521 522 522 if(!cmd->command) { 523 irc_ usermsg(irc, "%s: unknown subcommand \"%s\", see \x02help otr\x02",523 irc_rootmsg(irc, "%s: unknown subcommand \"%s\", see \x02help otr\x02", 524 524 args[0], args[1]); 525 525 return; … … 527 527 528 528 if(!args[cmd->required_parameters+1]) { 529 irc_ usermsg(irc, "%s %s: not enough arguments (%d req.)",529 irc_rootmsg(irc, "%s %s: not enough arguments (%d req.)", 530 530 args[0], args[1], cmd->required_parameters); 531 531 return; … … 599 599 if (strcmp(accountname, recipient) == 0) { 600 600 /* huh? injecting messages to myself? */ 601 irc_ usermsg(irc, "note to self: %s", message);601 irc_rootmsg(irc, "note to self: %s", message); 602 602 } else { 603 603 /* need to drop some consts here :-( */ … … 618 618 strip_html(msg); 619 619 if(u) { 620 /* display message like it came from this particular user */621 bee_irc_msg_from_user(u, msg, 0 /* sent_at */);620 /* display as a notice from this particular user */ 621 irc_usernotice(u, "%s", msg); 622 622 } else { 623 irc_ usermsg(irc, "otr:%s", msg);623 irc_rootmsg(irc, "[otr] %s", msg); 624 624 } 625 625 … … 637 637 638 638 otrl_privkey_hash_to_human(hunam, fingerprint); 639 irc_ usermsg(irc, "new fingerprint for %s: %s",639 irc_rootmsg(irc, "new fingerprint for %s: %s", 640 640 peernick(irc, username, protocol), hunam); 641 641 } … … 667 667 if(!otr_update_modeflags(irc, u)) { 668 668 char *trust = u->flags & IRC_USER_OTR_TRUSTED ? "trusted" : "untrusted!"; 669 irc_ usermsg(irc, "conversation with %s is now off the record (%s)", u->nick, trust);669 irc_rootmsg(irc, "conversation with %s is now off the record (%s)", u->nick, trust); 670 670 } 671 671 } … … 687 687 otr_update_uflags(context, u); 688 688 if(!otr_update_modeflags(irc, u)) 689 irc_ usermsg(irc, "conversation with %s is now in the clear", u->nick);689 irc_rootmsg(irc, "conversation with %s is now in the clear", u->nick); 690 690 } 691 691 … … 708 708 if(!otr_update_modeflags(irc, u)) { 709 709 char *trust = u->flags & IRC_USER_OTR_TRUSTED ? "trusted" : "untrusted!"; 710 irc_ usermsg(irc, "otr connection with %s has been refreshed (%s)", u->nick, trust);710 irc_rootmsg(irc, "otr connection with %s has been refreshed (%s)", u->nick, trust); 711 711 } 712 712 } … … 752 752 u = irc_user_by_name(irc, args[1]); 753 753 if(!u || !u->bu || !u->bu->ic) { 754 irc_ usermsg(irc, "%s: unknown user", args[1]);754 irc_rootmsg(irc, "%s: unknown user", args[1]); 755 755 return; 756 756 } … … 777 777 u = irc_user_by_name(irc, args[1]); 778 778 if(!u || !u->bu || !u->bu->ic) { 779 irc_ usermsg(irc, "%s: unknown user", args[1]);779 irc_rootmsg(irc, "%s: unknown user", args[1]); 780 780 return; 781 781 } 782 782 if(!(u->bu->flags & BEE_USER_ONLINE)) { 783 irc_ usermsg(irc, "%s is offline", args[1]);783 irc_rootmsg(irc, "%s is offline", args[1]); 784 784 return; 785 785 } … … 808 808 u = irc_user_by_name(irc, args[1]); 809 809 if(!u || !u->bu || !u->bu->ic) { 810 irc_ usermsg(irc, "%s: unknown user", args[1]);810 irc_rootmsg(irc, "%s: unknown user", args[1]); 811 811 return; 812 812 } … … 815 815 u->bu->ic->acc->user, u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 816 816 if(!ctx) { 817 irc_ usermsg(irc, "%s: no otr context with user", args[1]);817 irc_rootmsg(irc, "%s: no otr context with user", args[1]); 818 818 return; 819 819 } … … 827 827 828 828 if(!*p || !*q) { 829 irc_ usermsg(irc, "failed: truncated fingerprint block %d", i+1);829 irc_rootmsg(irc, "failed: truncated fingerprint block %d", i+1); 830 830 return; 831 831 } … … 834 834 y = hexval(*q); 835 835 if(x<0) { 836 irc_ usermsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+1, i+1);836 irc_rootmsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+1, i+1); 837 837 return; 838 838 } 839 839 if(y<0) { 840 irc_ usermsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+2, i+1);840 irc_rootmsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+2, i+1); 841 841 return; 842 842 } … … 847 847 fp = otrl_context_find_fingerprint(ctx, raw, 0, NULL); 848 848 if(!fp) { 849 irc_ usermsg(irc, "failed: no such fingerprint for %s", args[1]);849 irc_rootmsg(irc, "failed: no such fingerprint for %s", args[1]); 850 850 } else { 851 851 char *trust = args[7] ? args[7] : "affirmed"; 852 852 otrl_context_set_trust(fp, trust); 853 irc_ usermsg(irc, "fingerprint match, trust set to \"%s\"", trust);853 irc_rootmsg(irc, "fingerprint match, trust set to \"%s\"", trust); 854 854 if(u->flags & IRC_USER_OTR_ENCRYPTED) 855 855 u->flags |= IRC_USER_OTR_TRUSTED; … … 879 879 ctx = otrl_context_find(irc->otr->us, handle, myhandle, protocol, 0, NULL, NULL, NULL); 880 880 if(!ctx) { 881 irc_ usermsg(irc, "no such context");881 irc_rootmsg(irc, "no such context"); 882 882 g_free(arg); 883 883 return; … … 886 886 irc_user_t *u = irc_user_by_name(irc, args[1]); 887 887 if(!u || !u->bu || !u->bu->ic) { 888 irc_ usermsg(irc, "%s: unknown user", args[1]);888 irc_rootmsg(irc, "%s: unknown user", args[1]); 889 889 g_free(arg); 890 890 return; … … 893 893 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 894 894 if(!ctx) { 895 irc_ usermsg(irc, "no otr context with %s", args[1]);895 irc_rootmsg(irc, "no otr context with %s", args[1]); 896 896 g_free(arg); 897 897 return; … … 901 901 /* show how we resolved the (nick) argument, if we did */ 902 902 if(handle!=arg) { 903 irc_ usermsg(irc, "%s is %s/%s; we are %s/%s to them", args[1],903 irc_rootmsg(irc, "%s is %s/%s; we are %s/%s to them", args[1], 904 904 ctx->username, ctx->protocol, ctx->accountname, ctx->protocol); 905 905 } … … 916 916 n = atoi(args[1]); 917 917 if(n<0 || (!n && strcmp(args[1], "0"))) { 918 irc_ usermsg(irc, "%s: invalid account number", args[1]);918 irc_rootmsg(irc, "%s: invalid account number", args[1]); 919 919 return; 920 920 } … … 923 923 for(i=0; i<n && a; i++, a=a->next); 924 924 if(!a) { 925 irc_ usermsg(irc, "%s: no such account", args[1]);925 irc_rootmsg(irc, "%s: no such account", args[1]); 926 926 return; 927 927 } 928 928 929 929 if(keygen_in_progress(irc, a->user, a->prpl->name)) { 930 irc_ usermsg(irc, "keygen for account %d already in progress", n);930 irc_rootmsg(irc, "keygen for account %d already in progress", n); 931 931 return; 932 932 } … … 950 950 951 951 if(fp == fp->context->active_fingerprint) { 952 irc_ usermsg(irc, "that fingerprint is active, terminate otr connection first");952 irc_rootmsg(irc, "that fingerprint is active, terminate otr connection first"); 953 953 return; 954 954 } … … 966 966 967 967 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 968 irc_ usermsg(irc, "active otr connection with %s, terminate it first",968 irc_rootmsg(irc, "active otr connection with %s, terminate it first", 969 969 peernick(irc, ctx->username, ctx->protocol)); 970 970 return; … … 998 998 999 999 if(!args[3]) { 1000 irc_ usermsg(irc, "otr %s %s: not enough arguments (2 req.)", args[0], args[1]);1000 irc_rootmsg(irc, "otr %s %s: not enough arguments (2 req.)", args[0], args[1]); 1001 1001 return; 1002 1002 } … … 1005 1005 u = irc_user_by_name(irc, args[2]); 1006 1006 if(!u || !u->bu || !u->bu->ic) { 1007 irc_ usermsg(irc, "%s: unknown user", args[2]);1007 irc_rootmsg(irc, "%s: unknown user", args[2]); 1008 1008 return; 1009 1009 } … … 1012 1012 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 1013 1013 if(!ctx) { 1014 irc_ usermsg(irc, "no otr context with %s", args[2]);1014 irc_rootmsg(irc, "no otr context with %s", args[2]); 1015 1015 return; 1016 1016 } … … 1023 1023 1024 1024 if(fp == ctx->active_fingerprint) { 1025 irc_ usermsg(irc, "that fingerprint is active, terminate otr connection first");1025 irc_rootmsg(irc, "that fingerprint is active, terminate otr connection first"); 1026 1026 return; 1027 1027 } … … 1048 1048 u = irc_user_by_name(irc, args[2]); 1049 1049 if(!u || !u->bu || !u->bu->ic) { 1050 irc_ usermsg(irc, "%s: unknown user", args[2]);1050 irc_rootmsg(irc, "%s: unknown user", args[2]); 1051 1051 return; 1052 1052 } … … 1055 1055 u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 1056 1056 if(!ctx) { 1057 irc_ usermsg(irc, "no otr context with %s", args[2]);1057 irc_rootmsg(irc, "no otr context with %s", args[2]); 1058 1058 return; 1059 1059 } 1060 1060 1061 1061 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 1062 irc_ usermsg(irc, "active otr connection with %s, terminate it first", args[2]);1062 irc_rootmsg(irc, "active otr connection with %s, terminate it first", args[2]); 1063 1063 return; 1064 1064 } … … 1093 1093 else 1094 1094 { 1095 irc_ usermsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02",1095 irc_rootmsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02", 1096 1096 args[0], args[1]); 1097 1097 } … … 1119 1119 if(!context) { 1120 1120 /* huh? out of memory or what? */ 1121 irc_ usermsg(irc, "smp: failed to get otr context for %s", u->nick);1121 irc_rootmsg(irc, "smp: failed to get otr context for %s", u->nick); 1122 1122 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1123 1123 otrl_sm_state_free(context->smstate); … … 1127 1127 1128 1128 if (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) { 1129 irc_ usermsg(irc, "smp %s: opponent violated protocol, aborting",1129 irc_rootmsg(irc, "smp %s: opponent violated protocol, aborting", 1130 1130 u->nick); 1131 1131 otrl_message_abort_smp(us, ops, u->bu->ic, context); … … 1137 1137 if (tlv) { 1138 1138 if (nextMsg != OTRL_SMP_EXPECT1) { 1139 irc_ usermsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick);1139 irc_rootmsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick); 1140 1140 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1141 1141 otrl_sm_state_free(context->smstate); 1142 1142 } else { 1143 1143 char *question = g_strndup((char *)tlv->data, tlv->len); 1144 irc_ usermsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick,1144 irc_rootmsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick, 1145 1145 question); 1146 irc_ usermsg(irc, "smp: respond with \x02otr smp %s <answer>\x02",1146 irc_rootmsg(irc, "smp: respond with \x02otr smp %s <answer>\x02", 1147 1147 u->nick); 1148 1148 g_free(question); … … 1153 1153 if (tlv) { 1154 1154 if (nextMsg != OTRL_SMP_EXPECT1) { 1155 irc_ usermsg(irc, "smp %s: spurious SMP1 received, aborting", u->nick);1155 irc_rootmsg(irc, "smp %s: spurious SMP1 received, aborting", u->nick); 1156 1156 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1157 1157 otrl_sm_state_free(context->smstate); 1158 1158 } else { 1159 irc_ usermsg(irc, "smp: initiated by %s"1159 irc_rootmsg(irc, "smp: initiated by %s" 1160 1160 " - respond with \x02otr smp %s <secret>\x02", 1161 1161 u->nick, u->nick); … … 1166 1166 if (tlv) { 1167 1167 if (nextMsg != OTRL_SMP_EXPECT2) { 1168 irc_ usermsg(irc, "smp %s: spurious SMP2 received, aborting", u->nick);1168 irc_rootmsg(irc, "smp %s: spurious SMP2 received, aborting", u->nick); 1169 1169 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1170 1170 otrl_sm_state_free(context->smstate); … … 1177 1177 if (tlv) { 1178 1178 if (nextMsg != OTRL_SMP_EXPECT3) { 1179 irc_ usermsg(irc, "smp %s: spurious SMP3 received, aborting", u->nick);1179 irc_rootmsg(irc, "smp %s: spurious SMP3 received, aborting", u->nick); 1180 1180 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1181 1181 otrl_sm_state_free(context->smstate); … … 1184 1184 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1185 1185 if(context->smstate->received_question) { 1186 irc_ usermsg(irc, "smp %s: correct answer, you are trusted",1186 irc_rootmsg(irc, "smp %s: correct answer, you are trusted", 1187 1187 u->nick); 1188 1188 } else { 1189 irc_ usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",1189 irc_rootmsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1190 1190 u->nick); 1191 1191 } 1192 1192 } else { 1193 1193 if(context->smstate->received_question) { 1194 irc_ usermsg(irc, "smp %s: wrong answer, you are not trusted",1194 irc_rootmsg(irc, "smp %s: wrong answer, you are not trusted", 1195 1195 u->nick); 1196 1196 } else { 1197 irc_ usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",1197 irc_rootmsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1198 1198 u->nick); 1199 1199 } … … 1206 1206 if (tlv) { 1207 1207 if (nextMsg != OTRL_SMP_EXPECT4) { 1208 irc_ usermsg(irc, "smp %s: spurious SMP4 received, aborting", u->nick);1208 irc_rootmsg(irc, "smp %s: spurious SMP4 received, aborting", u->nick); 1209 1209 otrl_message_abort_smp(us, ops, u->bu->ic, context); 1210 1210 otrl_sm_state_free(context->smstate); … … 1212 1212 /* SMP4 received, otrl_message_receiving will have set fp trust */ 1213 1213 if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) { 1214 irc_ usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",1214 irc_rootmsg(irc, "smp %s: secrets proved equal, fingerprint trusted", 1215 1215 u->nick); 1216 1216 } else { 1217 irc_ usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",1217 irc_rootmsg(irc, "smp %s: secrets did not match, fingerprint not trusted", 1218 1218 u->nick); 1219 1219 } … … 1224 1224 tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT); 1225 1225 if (tlv) { 1226 irc_ usermsg(irc, "smp: received abort from %s", u->nick);1226 irc_rootmsg(irc, "smp: received abort from %s", u->nick); 1227 1227 otrl_sm_state_free(context->smstate); 1228 1228 /* smp is in back in EXPECT1 */ … … 1239 1239 u = irc_user_by_name(irc, nick); 1240 1240 if(!u || !u->bu || !u->bu->ic) { 1241 irc_ usermsg(irc, "%s: unknown user", nick);1241 irc_rootmsg(irc, "%s: unknown user", nick); 1242 1242 return; 1243 1243 } 1244 1244 if(!(u->bu->flags & BEE_USER_ONLINE)) { 1245 irc_ usermsg(irc, "%s is offline", nick);1245 irc_rootmsg(irc, "%s is offline", nick); 1246 1246 return; 1247 1247 } … … 1250 1250 u->bu->ic->acc->user, u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL); 1251 1251 if(!ctx || ctx->msgstate != OTRL_MSGSTATE_ENCRYPTED) { 1252 irc_ usermsg(irc, "smp: otr inactive with %s, try \x02otr connect"1252 irc_rootmsg(irc, "smp: otr inactive with %s, try \x02otr connect" 1253 1253 " %s\x02", nick, nick); 1254 1254 return; … … 1265 1265 if(question) { 1266 1266 /* this was 'otr smpq', just initiate */ 1267 irc_ usermsg(irc, "smp: initiating with %s...", u->nick);1267 irc_rootmsg(irc, "smp: initiating with %s...", u->nick); 1268 1268 otrl_message_initiate_smp_q(irc->otr->us, &otr_ops, u->bu->ic, ctx, 1269 1269 question, (unsigned char *)secret, strlen(secret)); … … 1274 1274 is completed or aborted! */ 1275 1275 if(ctx->smstate->secret == NULL) { 1276 irc_ usermsg(irc, "smp: initiating with %s...", u->nick);1276 irc_rootmsg(irc, "smp: initiating with %s...", u->nick); 1277 1277 otrl_message_initiate_smp(irc->otr->us, &otr_ops, 1278 1278 u->bu->ic, ctx, (unsigned char *)secret, strlen(secret)); … … 1281 1281 /* if we're still in EXPECT1 but smstate is initialized, we must have 1282 1282 received the SMP1, so let's issue a response */ 1283 irc_ usermsg(irc, "smp: responding to %s...", u->nick);1283 irc_rootmsg(irc, "smp: responding to %s...", u->nick); 1284 1284 otrl_message_respond_smp(irc->otr->us, &otr_ops, 1285 1285 u->bu->ic, ctx, (unsigned char *)secret, strlen(secret)); … … 1396 1396 } 1397 1397 if(fp == ctx->active_fingerprint) { 1398 irc_ usermsg(irc, " \x02%s (%s)\x02", human, trust);1398 irc_rootmsg(irc, " \x02%s (%s)\x02", human, trust); 1399 1399 } else { 1400 irc_ usermsg(irc, " %s (%s)", human, trust);1400 irc_rootmsg(irc, " %s (%s)", human, trust); 1401 1401 } 1402 1402 } 1403 1403 if(count==0) 1404 irc_ usermsg(irc, " (none)");1404 irc_rootmsg(irc, " (none)"); 1405 1405 } 1406 1406 … … 1421 1421 1422 1422 if(n>=40) { 1423 irc_ usermsg(irc, "too many fingerprint digits given, expected at most 40");1423 irc_rootmsg(irc, "too many fingerprint digits given, expected at most 40"); 1424 1424 return NULL; 1425 1425 } … … 1428 1428 *(p++) = c; 1429 1429 } else { 1430 irc_ usermsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);1430 irc_rootmsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1); 1431 1431 return NULL; 1432 1432 } … … 1449 1449 } 1450 1450 if(!fp) { 1451 irc_ usermsg(irc, "%s: no match", prefix);1451 irc_rootmsg(irc, "%s: no match", prefix); 1452 1452 return NULL; 1453 1453 } … … 1462 1462 } 1463 1463 if(fp2) { 1464 irc_ usermsg(irc, "%s: multiple matches", prefix);1464 irc_rootmsg(irc, "%s: multiple matches", prefix); 1465 1465 return NULL; 1466 1466 } … … 1485 1485 1486 1486 if(n>=40) { 1487 irc_ usermsg(irc, "too many fingerprint digits given, expected at most 40");1487 irc_rootmsg(irc, "too many fingerprint digits given, expected at most 40"); 1488 1488 return NULL; 1489 1489 } … … 1492 1492 *(p++) = c; 1493 1493 } else { 1494 irc_ usermsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);1494 irc_rootmsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1); 1495 1495 return NULL; 1496 1496 } … … 1513 1513 } 1514 1514 if(!k) { 1515 irc_ usermsg(irc, "%s: no match", prefix);1515 irc_rootmsg(irc, "%s: no match", prefix); 1516 1516 return NULL; 1517 1517 } … … 1526 1526 } 1527 1527 if(k2) { 1528 irc_ usermsg(irc, "%s: multiple matches", prefix);1528 irc_rootmsg(irc, "%s: multiple matches", prefix); 1529 1529 return NULL; 1530 1530 } … … 1541 1541 1542 1542 /* list all privkeys (including ones being generated) */ 1543 irc_ usermsg(irc, "\x1fprivate keys:\x1f");1543 irc_rootmsg(irc, "\x1fprivate keys:\x1f"); 1544 1544 for(key=irc->otr->us->privkey_root; key; key=key->next) { 1545 1545 const char *hash; … … 1547 1547 switch(key->pubkey_type) { 1548 1548 case OTRL_PUBKEY_TYPE_DSA: 1549 irc_ usermsg(irc, " %s/%s - DSA", key->accountname, key->protocol);1549 irc_rootmsg(irc, " %s/%s - DSA", key->accountname, key->protocol); 1550 1550 break; 1551 1551 default: 1552 irc_ usermsg(irc, " %s/%s - type %d", key->accountname, key->protocol,1552 irc_rootmsg(irc, " %s/%s - type %d", key->accountname, key->protocol, 1553 1553 key->pubkey_type); 1554 1554 } … … 1559 1559 hash = otrl_privkey_fingerprint(irc->otr->us, human, key->accountname, key->protocol); 1560 1560 if(hash) /* should always succeed */ 1561 irc_ usermsg(irc, " %s", human);1561 irc_rootmsg(irc, " %s", human); 1562 1562 } 1563 1563 if(irc->otr->sent_accountname) { 1564 irc_ usermsg(irc, " %s/%s - DSA", irc->otr->sent_accountname,1564 irc_rootmsg(irc, " %s/%s - DSA", irc->otr->sent_accountname, 1565 1565 irc->otr->sent_protocol); 1566 irc_ usermsg(irc, " (being generated)");1566 irc_rootmsg(irc, " (being generated)"); 1567 1567 } 1568 1568 for(kg=irc->otr->todo; kg; kg=kg->next) { 1569 irc_ usermsg(irc, " %s/%s - DSA", kg->accountname, kg->protocol);1570 irc_ usermsg(irc, " (queued)");1569 irc_rootmsg(irc, " %s/%s - DSA", kg->accountname, kg->protocol); 1570 irc_rootmsg(irc, " (queued)"); 1571 1571 } 1572 1572 if(key == irc->otr->us->privkey_root && 1573 1573 !irc->otr->sent_accountname && 1574 1574 kg == irc->otr->todo) 1575 irc_ usermsg(irc, " (none)");1575 irc_rootmsg(irc, " (none)"); 1576 1576 1577 1577 /* list all contexts */ 1578 irc_ usermsg(irc, "%s", "");1579 irc_ usermsg(irc, "\x1f" "connection contexts:\x1f (bold=currently encrypted)");1578 irc_rootmsg(irc, "%s", ""); 1579 irc_rootmsg(irc, "\x1f" "connection contexts:\x1f (bold=currently encrypted)"); 1580 1580 for(ctx=irc->otr->us->context_root; ctx; ctx=ctx->next) {\ 1581 1581 irc_user_t *u; … … 1591 1591 1592 1592 if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) { 1593 irc_ usermsg(irc, " \x02%s\x02", userstring);1593 irc_rootmsg(irc, " \x02%s\x02", userstring); 1594 1594 } else { 1595 irc_ usermsg(irc, " %s", userstring);1595 irc_rootmsg(irc, " %s", userstring); 1596 1596 } 1597 1597 … … 1599 1599 } 1600 1600 if(ctx == irc->otr->us->context_root) 1601 irc_ usermsg(irc, " (none)");1601 irc_rootmsg(irc, " (none)"); 1602 1602 } 1603 1603 … … 1606 1606 switch(ctx->otr_offer) { 1607 1607 case OFFER_NOT: 1608 irc_ usermsg(irc, " otr offer status: none sent");1608 irc_rootmsg(irc, " otr offer status: none sent"); 1609 1609 break; 1610 1610 case OFFER_SENT: 1611 irc_ usermsg(irc, " otr offer status: awaiting reply");1611 irc_rootmsg(irc, " otr offer status: awaiting reply"); 1612 1612 break; 1613 1613 case OFFER_ACCEPTED: 1614 irc_ usermsg(irc, " otr offer status: accepted our offer");1614 irc_rootmsg(irc, " otr offer status: accepted our offer"); 1615 1615 break; 1616 1616 case OFFER_REJECTED: 1617 irc_ usermsg(irc, " otr offer status: ignored our offer");1617 irc_rootmsg(irc, " otr offer status: ignored our offer"); 1618 1618 break; 1619 1619 default: 1620 irc_ usermsg(irc, " otr offer status: %d", ctx->otr_offer);1620 irc_rootmsg(irc, " otr offer status: %d", ctx->otr_offer); 1621 1621 } 1622 1622 1623 1623 switch(ctx->msgstate) { 1624 1624 case OTRL_MSGSTATE_PLAINTEXT: 1625 irc_ usermsg(irc, " connection state: cleartext");1625 irc_rootmsg(irc, " connection state: cleartext"); 1626 1626 break; 1627 1627 case OTRL_MSGSTATE_ENCRYPTED: 1628 irc_ usermsg(irc, " connection state: encrypted (v%d)", ctx->protocol_version);1628 irc_rootmsg(irc, " connection state: encrypted (v%d)", ctx->protocol_version); 1629 1629 break; 1630 1630 case OTRL_MSGSTATE_FINISHED: 1631 irc_ usermsg(irc, " connection state: shut down");1631 irc_rootmsg(irc, " connection state: shut down"); 1632 1632 break; 1633 1633 default: 1634 irc_ usermsg(irc, " connection state: %d", ctx->msgstate);1635 } 1636 1637 irc_ usermsg(irc, " fingerprints: (bold=active)");1634 irc_rootmsg(irc, " connection state: %d", ctx->msgstate); 1635 } 1636 1637 irc_rootmsg(irc, " fingerprints: (bold=active)"); 1638 1638 show_fingerprints(irc, ctx); 1639 1639 } … … 1675 1675 1676 1676 if(pipe(to) < 0 || pipe(from) < 0) { 1677 irc_ usermsg(irc, "otr keygen: couldn't create pipe: %s", strerror(errno));1677 irc_rootmsg(irc, "otr keygen: couldn't create pipe: %s", strerror(errno)); 1678 1678 return; 1679 1679 } … … 1682 1682 fromf = fdopen(from[0], "r"); 1683 1683 if(!tof || !fromf) { 1684 irc_ usermsg(irc, "otr keygen: couldn't streamify pipe: %s", strerror(errno));1684 irc_rootmsg(irc, "otr keygen: couldn't streamify pipe: %s", strerror(errno)); 1685 1685 return; 1686 1686 } … … 1688 1688 p = fork(); 1689 1689 if(p<0) { 1690 irc_ usermsg(irc, "otr keygen: couldn't fork: %s", strerror(errno));1690 irc_rootmsg(irc, "otr keygen: couldn't fork: %s", strerror(errno)); 1691 1691 return; 1692 1692 } … … 1768 1768 myfgets(msg, 512, irc->otr->from); 1769 1769 1770 irc_ usermsg(irc, "%s", msg);1770 irc_rootmsg(irc, "%s", msg); 1771 1771 if(filename[0]) { 1772 1772 char *kf = g_strdup_printf("%s%s.otr_keys", global.conf->configdir, irc->user->nick); … … 1842 1842 1843 1843 if(keygen_in_progress(irc, acc->user, acc->prpl->name)) { 1844 irc_ usermsg(irc, "keygen for %s/%s already in progress",1844 irc_rootmsg(irc, "keygen for %s/%s already in progress", 1845 1845 acc->user, acc->prpl->name); 1846 1846 } else { 1847 irc_ usermsg(irc, "starting background keygen for %s/%s",1847 irc_rootmsg(irc, "starting background keygen for %s/%s", 1848 1848 acc->user, acc->prpl->name); 1849 irc_ usermsg(irc, "you will be notified when it completes");1849 irc_rootmsg(irc, "you will be notified when it completes"); 1850 1850 otr_keygen(irc, acc->user, acc->prpl->name); 1851 1851 } 1852 1852 } 1853 1853 1854 /* vim: noet ts=4 sw=4*/1854 /* vim: set noet ts=4 sw=4: */
Note: See TracChangeset
for help on using the changeset viewer.