Added /otr trust|untrust commands
This commit is contained in:
@@ -570,14 +570,16 @@ static struct cmd_t command_defs[] =
|
||||
|
||||
{ "/otr",
|
||||
cmd_otr, parse_args, 1, 2, NULL,
|
||||
{ "/otr gen|myfp|theirfp|start|end", "Off The Record encryption commands.",
|
||||
{ "/otr gen|myfp|theirfp|start|end",
|
||||
"-------------------------------",
|
||||
{ "/otr gen|myfp|theirfp|start|end|trust|untrust", "Off The Record encryption commands.",
|
||||
{ "/otr gen|myfp|theirfp|start|end|trust|untrust",
|
||||
"---------------------------------------------",
|
||||
"gen - Generate your private key.",
|
||||
"myfp - Show your fingerprint.",
|
||||
"theirfp - Show contacts fingerprint.",
|
||||
"start - Start an OTR session with the current recipient.",
|
||||
"end - End the current OTR session,",
|
||||
"trust - Indicate that you have verified the contact's fingerprint.",
|
||||
"untrust - Indicate the the contact's fingerprint is not verified,",
|
||||
NULL } } },
|
||||
|
||||
{ "/outtype",
|
||||
@@ -989,6 +991,8 @@ cmd_init(void)
|
||||
autocomplete_add(otr_ac, "end");
|
||||
autocomplete_add(otr_ac, "myfp");
|
||||
autocomplete_add(otr_ac, "theirfp");
|
||||
autocomplete_add(otr_ac, "trust");
|
||||
autocomplete_add(otr_ac, "untrust");
|
||||
|
||||
cmd_history_init();
|
||||
}
|
||||
|
||||
@@ -2359,6 +2359,32 @@ cmd_otr(gchar **args, struct cmd_help_t help)
|
||||
otr_end_session(recipient);
|
||||
}
|
||||
return TRUE;
|
||||
} else if (strcmp(args[0], "trust") == 0) {
|
||||
win_type_t win_type = ui_current_win_type();
|
||||
|
||||
if (win_type != WIN_CHAT) {
|
||||
ui_current_print_line("You must be in an OTR session to trust a recipient.");
|
||||
} else if (!ui_current_win_is_otr()) {
|
||||
ui_current_print_line("You are not currently in an OTR session.");
|
||||
} else {
|
||||
char *recipient = ui_current_recipient();
|
||||
ui_trust(recipient);
|
||||
otr_trust(recipient);
|
||||
}
|
||||
return TRUE;
|
||||
} else if (strcmp(args[0], "untrust") == 0) {
|
||||
win_type_t win_type = ui_current_win_type();
|
||||
|
||||
if (win_type != WIN_CHAT) {
|
||||
ui_current_print_line("You must be in an OTR session to untrust a recipient.");
|
||||
} else if (!ui_current_win_is_otr()) {
|
||||
ui_current_print_line("You are not currently in an OTR session.");
|
||||
} else {
|
||||
char *recipient = ui_current_recipient();
|
||||
ui_untrust(recipient);
|
||||
otr_untrust(recipient);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
} else {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
|
||||
Reference in New Issue
Block a user