changeset 2107:1bd9978ed5d0

Added carbon command Also added help commands for carbons Added auto completion for carbons command
author Roeland Jago Douma <roeland@famdouma.nl>
date Tue, 15 Oct 2013 18:55:18 +0200
parents 72876dcf9094
children adfd962e1343
files mcabber/doc/help/en/hlp.txt mcabber/doc/help/en/hlp_carbons.txt mcabber/mcabber/commands.c mcabber/mcabber/compl.c mcabber/mcabber/compl.h
diffstat 5 files changed, 34 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/doc/help/en/hlp.txt	Tue Oct 15 18:51:39 2013 +0200
+++ b/mcabber/doc/help/en/hlp.txt	Tue Oct 15 18:55:18 2013 +0200
@@ -3,4 +3,4 @@
 
 Display some help about a command or a topic.
 If no argument provided a usage of this command is printed.
-Available commands: add, alias, authorization, bind, buffer, chat_disable, clear, color, connect, del, disconnect, echo, event, group, help, iline, info, module, move, msay, otr, otrpolicy, pgp, quit, rawxml, rename, request, room, roster, say_to, say, screen_refresh, set, source, status_to, status, version.
+Available commands: add, alias, authorization, bind, buffer, carbons, chat_disable, clear, color, connect, del, disconnect, echo, event, group, help, iline, info, module, move, msay, otr, otrpolicy, pgp, quit, rawxml, rename, request, room, roster, say_to, say, screen_refresh, set, source, status_to, status, version.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mcabber/doc/help/en/hlp_carbons.txt	Tue Oct 15 18:55:18 2013 +0200
@@ -0,0 +1,11 @@
+
+  /carbons info
+  /carbons enable
+  /carbons disable
+
+/carbons info
+  Print information about the current state of carbons
+/carbons enable
+  Enable carbons
+/carbons distable
+  Disable carbons
--- a/mcabber/mcabber/commands.c	Tue Oct 15 18:51:39 2013 +0200
+++ b/mcabber/mcabber/commands.c	Tue Oct 15 18:55:18 2013 +0200
@@ -39,6 +39,7 @@
 #include "settings.h"
 #include "events.h"
 #include "otr.h"
+#include "carbons.h"
 #include "utf8.h"
 #include "xmpp.h"
 #include "main.h"
@@ -94,6 +95,7 @@
 static void do_otrpolicy(char *arg);
 static void do_echo(char *arg);
 static void do_module(char *arg);
+static void do_carbons(char *arg);
 
 static void room_bookmark(gpointer bud, char *arg);
 
@@ -190,6 +192,7 @@
   cmd_add("bind", "Add an key binding", 0, 0, &do_bind, NULL);
   cmd_add("buffer", "Manipulate current buddy's buffer (chat window)",
           COMPL_BUFFER, 0, &do_buffer, NULL);
+  cmd_add("carbons", "Mange carbons settings", COMPL_CARBONS, 0, &do_carbons, NULL);
   cmd_add("chat_disable", "Disable chat mode", 0, 0, &do_chat_disable, NULL);
   cmd_add("clear", "Clear the dialog window", 0, 0, &do_clear, NULL);
   cmd_add("color", "Set coloring options", COMPL_COLOR, 0, &do_color, NULL);
@@ -390,6 +393,11 @@
   compl_add_category_word(COMPL_MODULE, "load");
   compl_add_category_word(COMPL_MODULE, "unload");
 #endif
+
+  // Carbons category
+  compl_add_category_word(COMPL_CARBONS, "info");
+  compl_add_category_word(COMPL_CARBONS, "enable");
+  compl_add_category_word(COMPL_CARBONS, "disable");
 }
 
 //  expandalias(line)
@@ -4151,4 +4159,15 @@
     scr_print_logwindow(arg);
 }
 
+static void do_carbons(char *arg)
+{
+  if (!strcasecmp(arg, "info")) {
+    carbons_info();
+  } else if (!strcasecmp(arg, "enable")) {
+
+  } else if (!strcasecmp(arg, "disable")) {
+
+  }
+}
+
 /* vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2:  For Vim users... */
--- a/mcabber/mcabber/compl.c	Tue Oct 15 18:51:39 2013 +0200
+++ b/mcabber/mcabber/compl.c	Tue Oct 15 18:55:18 2013 +0200
@@ -134,6 +134,7 @@
   register_builtin_cat(COMPL_OTR, NULL);
   register_builtin_cat(COMPL_OTRPOLICY, NULL);
   register_builtin_cat(COMPL_MODULE, NULL);
+  register_builtin_cat(COMPL_CARBONS, NULL);
 }
 
 #ifdef MODULES_ENABLE
--- a/mcabber/mcabber/compl.h	Tue Oct 15 18:51:39 2013 +0200
+++ b/mcabber/mcabber/compl.h	Tue Oct 15 18:55:18 2013 +0200
@@ -27,8 +27,9 @@
 #define COMPL_OTR         20
 #define COMPL_OTRPOLICY   21
 #define COMPL_MODULE      22
+#define COMPL_CARBONS     23
 /* private */
-#define COMPL_MAX_ID      22
+#define COMPL_MAX_ID      23
 
 void compl_init_system(void); /* private */