1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added /pgp end command

This commit is contained in:
James Booth 2015-06-21 20:20:28 +01:00
parent f81652e84e
commit 217fcff420
2 changed files with 25 additions and 0 deletions

View File

@ -1601,6 +1601,7 @@ cmd_init(void)
autocomplete_add(pgp_ac, "fps");
autocomplete_add(pgp_ac, "libver");
autocomplete_add(pgp_ac, "start");
autocomplete_add(pgp_ac, "end");
}
void

View File

@ -4261,6 +4261,30 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
chatwin->enc_mode = PROF_ENC_PGP;
ui_current_print_formatted_line('!', 0, "PGP encyption enabled.");
return TRUE;
}
if (g_strcmp0(args[0], "end") == 0) {
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
if (window->type != WIN_CHAT) {
cons_show("You must be in a regular chat window to end PGP encrpytion.");
return TRUE;
}
ProfChatWin *chatwin = (ProfChatWin*)window;
if (chatwin->enc_mode != PROF_ENC_PGP) {
ui_current_print_formatted_line('!', 0, "PGP encryption is not currently enabled.");
return TRUE;
}
chatwin->enc_mode = PROF_ENC_NONE;
ui_current_print_formatted_line('!', 0, "PGP encyption disabled.");
return TRUE;
}
return TRUE;