about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-06-01 22:49:51 +0100
committerJames Booth <boothj5@gmail.com>2013-06-01 22:49:51 +0100
commit55f4e3ebcac71b8c52f021b378ef2efff58ac71b (patch)
tree2ca8679fa4a432c3ba543505d49373526ed6aa9a
parentae7da18d7e7fded02153c31d3b0385995528b136 (diff)
downloadprofani-tty-55f4e3ebcac71b8c52f021b378ef2efff58ac71b.tar.gz
Added autocomplete to /sub deny
-rw-r--r--src/command/command.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index d5919496..79e1fdd2 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -3278,6 +3278,20 @@ _sub_autocomplete(char *input, int *size)
             free(auto_msg);
             free(found);
         }
+    } else if ((strncmp(input, "/sub deny ", 10) == 0) && (*size > 10)) {
+        for (i = 10; i < *size; i++) {
+            inp_cpy[i-10] = input[i];
+        }
+        inp_cpy[(*size) - 10] = '\0';
+        found = presence_sub_request_find(inp_cpy);
+        if (found != NULL) {
+            auto_msg = (char *) malloc((10 + (strlen(found) + 0)) * sizeof(char));
+            strcpy(auto_msg, "/sub deny ");
+            strcat(auto_msg, found);
+            inp_replace_input(input, auto_msg, size);
+            free(auto_msg);
+            free(found);
+        }
     } else if ((strncmp(input, "/sub ", 5) == 0) && (*size > 5)) {
         _parameter_autocomplete_with_ac(input, size, "/sub", sub_ac);
     }