about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-26 22:08:53 +0100
committerJames Booth <boothj5@gmail.com>2014-04-26 22:08:53 +0100
commit06d81ed9ce7808a23267718ad24c32f957d95109 (patch)
tree06a6c112edba7a853ae23132f6158d10d4d0a20a /src/command/commands.c
parentf44cf86f23f7b4183c5864a74e42b9f632c2c640 (diff)
downloadprofani-tty-06d81ed9ce7808a23267718ad24c32f957d95109.tar.gz
Send SMP init message with /otr secret
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 940a7f5a..915fbe17 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -2788,7 +2788,23 @@ cmd_otr(gchar **args, struct cmd_help_t help)
             otr_untrust(recipient);
         }
         return TRUE;
-
+    } else if (strcmp(args[0], "secret") == 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_formatted_line('!', 0, "You are not currently in an OTR session.");
+        } else {
+            char *secret = args[1];
+            if (secret == NULL) {
+                cons_show("Usage: %s", help.usage);
+            } else {
+                char *recipient = ui_current_recipient();
+                otr_smp_init_secret(recipient, secret);
+                ui_current_print_formatted_line('!', 0, "OTR secret entered", secret);
+            }
+        }
+        return TRUE;
     } else {
         cons_show("Usage: %s", help.usage);
         return TRUE;