comparison mcabber/src/commands.c @ 1171:03a38b7ad2e0

Add a collection of commands for key bindings (Lego12239) This patch gives more flexibility to customize the key bindings, by adding a /iline command.
author Mikael Berthe <mikael@lilotux.net>
date Wed, 14 Mar 2007 21:33:17 +0100
parents d5b26a0a9771
children 334ae9f498f1
comparison
equal deleted inserted replaced
1170:29f805d8412f 1171:03a38b7ad2e0
68 static void do_version(char *arg); 68 static void do_version(char *arg);
69 static void do_request(char *arg); 69 static void do_request(char *arg);
70 static void do_event(char *arg); 70 static void do_event(char *arg);
71 static void do_help(char *arg); 71 static void do_help(char *arg);
72 static void do_pgp(char *arg); 72 static void do_pgp(char *arg);
73 static void do_iline(char *arg);
73 74
74 // Global variable for the commands list 75 // Global variable for the commands list
75 static GSList *Commands; 76 static GSList *Commands;
76 77
77 78
130 cmd_add("set", "Set/query an option value", 0, 0, &do_set); 131 cmd_add("set", "Set/query an option value", 0, 0, &do_set);
131 cmd_add("status", "Show or set your status", COMPL_STATUS, 0, &do_status); 132 cmd_add("status", "Show or set your status", COMPL_STATUS, 0, &do_status);
132 cmd_add("status_to", "Show or set your status for one recipient", 133 cmd_add("status_to", "Show or set your status for one recipient",
133 COMPL_JID, COMPL_STATUS, &do_status_to); 134 COMPL_JID, COMPL_STATUS, &do_status_to);
134 cmd_add("version", "Show mcabber version", 0, 0, &do_version); 135 cmd_add("version", "Show mcabber version", 0, 0, &do_version);
136 cmd_add("iline", "Manipulate input buffer", 0, 0, &do_iline);
135 137
136 // Status category 138 // Status category
137 compl_add_category_word(COMPL_STATUS, "online"); 139 compl_add_category_word(COMPL_STATUS, "online");
138 compl_add_category_word(COMPL_STATUS, "avail"); 140 compl_add_category_word(COMPL_STATUS, "avail");
139 compl_add_category_word(COMPL_STATUS, "invisible"); 141 compl_add_category_word(COMPL_STATUS, "invisible");
2713 } 2715 }
2714 2716
2715 free_arg_lst(paramlst); 2717 free_arg_lst(paramlst);
2716 } 2718 }
2717 2719
2720 static void do_iline(char *arg)
2721 {
2722 if (!strcasecmp(arg, "fword")) {
2723 readline_forward_word();
2724 } else if (!strcasecmp(arg, "bword")) {
2725 readline_backward_word();
2726 } else if (!strcasecmp(arg, "word_fdel")) {
2727 readline_forward_kill_word();
2728 } else if (!strcasecmp(arg, "word_bdel")) {
2729 readline_backward_kill_word();
2730 } else if (!strcasecmp(arg, "fchar")) {
2731 readline_forward_char();
2732 } else if (!strcasecmp(arg, "bchar")) {
2733 readline_backward_char();
2734 } else if (!strcasecmp(arg, "char_fdel")) {
2735 readline_forward_kill_char();
2736 } else if (!strcasecmp(arg, "char_bdel")) {
2737 readline_backward_kill_char();
2738 } else if (!strcasecmp(arg, "char_swp")) {
2739 readline_transpose_chars();
2740 } else if (!strcasecmp(arg, "hist_prev")) {
2741 readline_hist_prev();
2742 } else if (!strcasecmp(arg, "hist_next")) {
2743 readline_hist_next();
2744 } else if (!strcasecmp(arg, "iline_start")) {
2745 readline_iline_start();
2746 } else if (!strcasecmp(arg, "iline_end")) {
2747 readline_iline_end();
2748 } else if (!strcasecmp(arg, "iline_fdel")) {
2749 readline_forward_kill_iline();
2750 } else if (!strcasecmp(arg, "iline_bdel")) {
2751 readline_backward_kill_iline();
2752 } else if (!strcasecmp(arg, "send_multiline")) {
2753 readline_send_multiline();
2754 }
2755 }
2756
2718 static void do_connect(char *arg) 2757 static void do_connect(char *arg)
2719 { 2758 {
2720 mcabber_connect(); 2759 mcabber_connect();
2721 } 2760 }
2722 2761