Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/commands.c @ 1192:7b8765c10abb
New command: /source
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 21 Apr 2007 12:06:13 +0200 |
parents | be06bbe7e449 |
children | 6f602d3270a4 |
comparison
equal
deleted
inserted
replaced
1191:b2ed413d8f3d | 1192:7b8765c10abb |
---|---|
74 static void do_help(char *arg); | 74 static void do_help(char *arg); |
75 static void do_pgp(char *arg); | 75 static void do_pgp(char *arg); |
76 static void do_iline(char *arg); | 76 static void do_iline(char *arg); |
77 static void do_screen_refresh(char *arg); | 77 static void do_screen_refresh(char *arg); |
78 static void do_chat_disable(char *arg); | 78 static void do_chat_disable(char *arg); |
79 static void do_source(char *arg); | |
79 | 80 |
80 // Global variable for the commands list | 81 // Global variable for the commands list |
81 static GSList *Commands; | 82 static GSList *Commands; |
82 | 83 |
83 | 84 |
136 cmd_add("say", "Say something to the selected buddy", 0, 0, &do_say); | 137 cmd_add("say", "Say something to the selected buddy", 0, 0, &do_say); |
137 cmd_add("say_to", "Say something to a specific buddy", COMPL_JID, 0, | 138 cmd_add("say_to", "Say something to a specific buddy", COMPL_JID, 0, |
138 &do_say_to); | 139 &do_say_to); |
139 //cmd_add("search"); | 140 //cmd_add("search"); |
140 cmd_add("set", "Set/query an option value", 0, 0, &do_set); | 141 cmd_add("set", "Set/query an option value", 0, 0, &do_set); |
142 cmd_add("source", "Read a configuration file", 0, 0, &do_source); | |
141 cmd_add("status", "Show or set your status", COMPL_STATUS, 0, &do_status); | 143 cmd_add("status", "Show or set your status", COMPL_STATUS, 0, &do_status); |
142 cmd_add("status_to", "Show or set your status for one recipient", | 144 cmd_add("status_to", "Show or set your status for one recipient", |
143 COMPL_JID, COMPL_STATUS, &do_status_to); | 145 COMPL_JID, COMPL_STATUS, &do_status_to); |
144 cmd_add("version", "Show mcabber version", 0, 0, &do_version); | 146 cmd_add("version", "Show mcabber version", 0, 0, &do_version); |
145 cmd_add("iline", "Manipulate input buffer", 0, 0, &do_iline); | 147 cmd_add("iline", "Manipulate input buffer", 0, 0, &do_iline); |
2799 static void do_chat_disable(char *arg) | 2801 static void do_chat_disable(char *arg) |
2800 { | 2802 { |
2801 readline_disable_chat_mode(); | 2803 readline_disable_chat_mode(); |
2802 } | 2804 } |
2803 | 2805 |
2806 static void do_source(char *arg) | |
2807 { | |
2808 static int recur_level; | |
2809 gchar *filename; | |
2810 if (!*arg) { | |
2811 scr_LogPrint(LPRINT_NORMAL, "Missing filename."); | |
2812 return; | |
2813 } | |
2814 if (recur_level > 20) { | |
2815 scr_LogPrint(LPRINT_LOGNORM, "** Too many source commands!"); | |
2816 return; | |
2817 } | |
2818 filename = g_strdup(arg); | |
2819 strip_arg_special_chars(filename); | |
2820 recur_level++; | |
2821 cfg_read_file(filename, FALSE); | |
2822 recur_level--; | |
2823 g_free(filename); | |
2824 } | |
2825 | |
2804 static void do_connect(char *arg) | 2826 static void do_connect(char *arg) |
2805 { | 2827 { |
2806 mcabber_connect(); | 2828 mcabber_connect(); |
2807 } | 2829 } |
2808 | 2830 |