about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/command/command.c1
-rw-r--r--src/command/commands.c24
2 files changed, 25 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 5e38a7be..af91bf16 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -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
diff --git a/src/command/commands.c b/src/command/commands.c
index 4aa0df5b..2fe4c2f6 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -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;