1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added /otr end command

This commit is contained in:
James Booth 2014-01-11 23:59:20 +00:00
parent a3217bcf8c
commit 494aaadba4
2 changed files with 16 additions and 1 deletions

View File

@ -2346,6 +2346,20 @@ cmd_otr(gchar **args, struct cmd_help_t help)
}
}
return TRUE;
} else if (strcmp(args[0], "end") == 0) {
win_type_t win_type = ui_current_win_type();
if (win_type != WIN_CHAT) {
ui_current_print_line("You must be in a regular chat window to use OTR.");
} 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_gone_insecure(recipient);
otr_end_session(recipient);
}
return TRUE;
} else {
cons_show("Usage: %s", help.usage);
return TRUE;

View File

@ -442,7 +442,6 @@ _ui_close_connected_win(int index)
#ifdef HAVE_LIBOTR
ProfWin *window = wins_get_by_num(index);
if (window->is_otr) {
cons_debug("Ending OTR session");
otr_end_session(window->from);
}
#endif
@ -599,6 +598,7 @@ _ui_gone_secure(const char * const recipient)
ProfWin *window = wins_get_by_recipient(recipient);
if (window != NULL) {
window->is_otr = TRUE;
win_vprint_line(window, '!', 0, "OTR session started.");
if (wins_is_current(window)) {
GString *recipient_str = _get_recipient_string(window);
@ -616,6 +616,7 @@ _ui_gone_insecure(const char * const recipient)
ProfWin *window = wins_get_by_recipient(recipient);
if (window != NULL) {
window->is_otr = FALSE;
win_vprint_line(window, '!', 0, "OTR session ended.");
if (wins_is_current(window)) {
GString *recipient_str = _get_recipient_string(window);