Changeset 94e7eb3
- Timestamp:
- 2008-02-10T17:56:59Z (17 years ago)
- Branches:
- master
- Children:
- 5d62040
- Parents:
- 8521b02
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
otr.c
r8521b02 r94e7eb3 53 53 void cmd_otr_trust(irc_t *irc, char **args); 54 54 void cmd_otr_info(irc_t *irc, char **args); 55 void cmd_otr_keygen(irc_t *irc, char **args); 55 56 /* void cmd_otr_forget(irc_t *irc, char **args); */ 56 57 … … 61 62 { "trust", 6, &cmd_otr_trust, 0 }, 62 63 { "info", 0, &cmd_otr_info, 0 }, 64 { "keygen", 1, &cmd_otr_keygen, 0 }, 63 65 /* 64 66 { "forget", 1, &cmd_otr_forget, 0 }, … … 771 773 } 772 774 775 void cmd_otr_keygen(irc_t *irc, char **args) 776 { 777 int i, n; 778 account_t *a; 779 780 n = atoi(args[1]); 781 if(n<0 || (!n && strcmp(args[1], "0"))) { 782 irc_usermsg(irc, "%s: invalid account number", args[1]); 783 return; 784 } 785 786 a = irc->accounts; 787 for(i=0; i<n && a; i++, a=a->next); 788 if(!a) { 789 irc_usermsg(irc, "%s: no such account", args[1]); 790 return; 791 } 792 793 if(otrl_privkey_find(irc->otr_us, a->user, a->prpl->name)) { 794 char *s = g_strdup_printf("account %d already has a key, replace it?", n); 795 query_add(irc, a->ic, s, yes_keygen, no_keygen, a); 796 } else { 797 otr_keygen(irc, a->user, a->prpl->name); 798 } 799 } 800 773 801 774 802 /*** local helpers / subroutines: ***/ … … 1220 1248 account_t *acc = (account_t *)data; 1221 1249 1222 irc_usermsg(acc->irc, " proceeding without key, otr inoperable on%s/%s",1250 irc_usermsg(acc->irc, "keygen cancelled for %s/%s", 1223 1251 acc->user, acc->prpl->name); 1224 /* TODO:1225 irc_usermsg(acc->irc, "setting otr policy for %s/%s to \"never\"",1226 acc->user, acc->prpl->name);1227 set_setstr(acc->set, "otr_policy", "never");1228 */1229 1252 } 1230 1253 -
query.c
r8521b02 r94e7eb3 140 140 if( ans ) 141 141 { 142 imcb_log( q->ic, "Accepted: %s", q->question ); 142 if(q->ic) 143 imcb_log( q->ic, "Accepted: %s", q->question ); 144 else 145 irc_usermsg( irc, "Accepted: %s", q->question ); 143 146 q->yes( NULL, q->data ); 144 147 } 145 148 else 146 149 { 147 imcb_log( q->ic, "Rejected: %s", q->question ); 150 if(q->ic) 151 imcb_log( q->ic, "Rejected: %s", q->question ); 152 else 153 irc_usermsg( irc, "Rejected: %s", q->question ); 148 154 q->no( NULL, q->data ); 149 155 }
Note: See TracChangeset
for help on using the changeset viewer.