diff mcabber/src/commands.c @ 1173:960f34ec22a2

Add init_bindings() for default key bindings (Lego12239)
author Mikael Berthe <mikael@lilotux.net>
date Tue, 03 Apr 2007 20:30:34 +0200
parents 334ae9f498f1
children 10733d7de004
line wrap: on
line diff
--- a/mcabber/src/commands.c	Tue Apr 03 20:30:28 2007 +0200
+++ b/mcabber/src/commands.c	Tue Apr 03 20:30:34 2007 +0200
@@ -42,6 +42,9 @@
 #define IMSTATUS_NOTAVAILABLE   "notavail"
 #define IMSTATUS_DONOTDISTURB   "dnd"
 
+// Return value container for the following functions
+static int retval_for_cmds;
+
 // Commands callbacks
 static void do_roster(char *arg);
 static void do_status(char *arg);
@@ -96,6 +99,10 @@
 
 //  cmd_init()
 // Commands table initialization
+// !!!
+// After changing commands names and it arguments names here, you must change
+// ones in init_bindings()!
+//
 void cmd_init(void)
 {
   cmd_add("add", "Add a jabber user", COMPL_JID, 0, &do_add);
@@ -413,9 +420,10 @@
   while (*p && (*p == ' '))
     p++;
   // Call command-specific function
+  retval_for_cmds = 0;
   (*curcmd->func)(p);
   g_free(xpline);
-  return 0;
+  return retval_for_cmds;
 }
 
 //  process_line(line)
@@ -2721,6 +2729,10 @@
   free_arg_lst(paramlst);
 }
 
+/* !!!
+  After changing the /iline arguments names here, you must change ones
+  in init_bindings().
+*/
 static void do_iline(char *arg)
 {
   if (!strcasecmp(arg, "fword")) {
@@ -2762,9 +2774,9 @@
   } else if (!strcasecmp(arg, "send_multiline")) {
     readline_send_multiline();
   } else if (!strcasecmp(arg, "iline_accept")) {
-    readline_accept_line();
+    retval_for_cmds = readline_accept_line();
   } else if (!strcasecmp(arg, "iline_accept_down_hist")) { // May be too long
-    readline_accept_line_down_hist();
+    retval_for_cmds = readline_accept_line_down_hist();
   } else if (!strcasecmp(arg, "compl_cancel")) {
     readline_cancel_completion();
   } else if (!strcasecmp(arg, "compl_do")) {