about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-13 18:56:04 +0000
committerJames Booth <boothj5@gmail.com>2014-01-13 18:56:04 +0000
commitaa4dede30aac6222d9299e45ad6076f14819b53c (patch)
tree57f5f2fbc68155259d152c960dbde54dadf5a8c9 /src/command
parentbeec3d2f1f3389d87c94c76861a5cdb438790069 (diff)
downloadprofani-tty-aa4dede30aac6222d9299e45ad6076f14819b53c.tar.gz
Moved otr autocompletion to function
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/command/command.c b/src/command/command.c
index ba976023..9bab19da 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -65,6 +65,7 @@ static char * _who_autocomplete(char *input, int *size);
 static char * _roster_autocomplete(char *input, int *size);
 static char * _group_autocomplete(char *input, int *size);
 static char * _bookmark_autocomplete(char *input, int *size);
+static char * _otr_autocomplete(char *input, int *size);
 
 GHashTable *commands = NULL;
 
@@ -576,7 +577,7 @@ static struct cmd_t command_defs[] =
           "gen - Generate your private key.",
           "myfp - Show your fingerprint.",
           "theirfp - Show contacts fingerprint.",
-          "start - Start an OTR session with the current recipient.",
+          "start <contact> - Start an OTR session with the contact, or the current recipient if in a chat window and no argument supplied.",
           "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,",
@@ -1323,7 +1324,7 @@ _cmd_complete_parameters(char *input, int *size)
         return;
     }
 
-    gchar *cmds[] = { "/help", "/prefs", "/log", "/disco", "/close", "/wins", "/otr" };
+    gchar *cmds[] = { "/help", "/prefs", "/log", "/disco", "/close", "/wins" };
     Autocomplete completers[] = { help_ac, prefs_ac, log_ac, disco_ac, close_ac, wins_ac, otr_ac };
 
     for (i = 0; i < ARRAY_SIZE(cmds); i++) {
@@ -1338,7 +1339,7 @@ _cmd_complete_parameters(char *input, int *size)
     autocompleter acs[] = { _who_autocomplete, _sub_autocomplete, _notify_autocomplete,
         _autoaway_autocomplete, _titlebar_autocomplete, _theme_autocomplete,
         _account_autocomplete, _roster_autocomplete, _group_autocomplete,
-        _bookmark_autocomplete, _autoconnect_autocomplete };
+        _bookmark_autocomplete, _autoconnect_autocomplete, _otr_autocomplete };
 
     for (i = 0; i < ARRAY_SIZE(acs); i++) {
         result = acs[i](input, size);
@@ -1559,6 +1560,19 @@ _autoconnect_autocomplete(char *input, int *size)
 }
 
 static char *
+_otr_autocomplete(char *input, int *size)
+{
+    char *result = NULL;
+
+    result = autocomplete_param_with_ac(input, size, "/otr", otr_ac);
+    if (result != NULL) {
+        return result;
+    }
+
+    return NULL;
+}
+
+static char *
 _theme_autocomplete(char *input, int *size)
 {
     char *result = NULL;