Mercurial > hg
comparison mcabber/src/commands.c @ 187:4ce9ff808baa
[/trunk] Changeset 199 by mikael
* Add the "/buffer" command (/buffer clear, /buffer top, /buffer bottom)
author | mikael |
---|---|
date | Fri, 06 May 2005 09:35:40 +0000 |
parents | aa5b635520ef |
children | 24e6bcb589b0 |
comparison
equal
deleted
inserted
replaced
186:888ad9f15346 | 187:4ce9ff808baa |
---|---|
30 #include "utf8.h" | 30 #include "utf8.h" |
31 #include "utils.h" | 31 #include "utils.h" |
32 | 32 |
33 // Commands callbacks | 33 // Commands callbacks |
34 void do_roster(char *arg); | 34 void do_roster(char *arg); |
35 void do_clear(char *arg); | |
36 void do_status(char *arg); | 35 void do_status(char *arg); |
37 void do_add(char *arg); | 36 void do_add(char *arg); |
38 void do_group(char *arg); | 37 void do_group(char *arg); |
39 void do_say(char *arg); | 38 void do_say(char *arg); |
39 void do_buffer(char *arg); | |
40 void do_clear(char *arg); | |
40 | 41 |
41 // Global variable for the commands list | 42 // Global variable for the commands list |
42 static GSList *Commands; | 43 static GSList *Commands; |
43 | 44 |
44 | 45 |
61 // cmd_init() | 62 // cmd_init() |
62 // ... | 63 // ... |
63 void cmd_init(void) | 64 void cmd_init(void) |
64 { | 65 { |
65 cmd_add("add", "Add a jabber user", COMPL_JID, 0, &do_add); | 66 cmd_add("add", "Add a jabber user", COMPL_JID, 0, &do_add); |
67 cmd_add("buffer", "Manipulate current buddy's buffer (chat window)", | |
68 COMPL_BUFFER, 0, &do_buffer); | |
66 cmd_add("clear", "Clear the dialog window", 0, 0, &do_clear); | 69 cmd_add("clear", "Clear the dialog window", 0, 0, &do_clear); |
67 //cmd_add("del"); | 70 //cmd_add("del"); |
68 cmd_add("group", "Change group display settings", COMPL_GROUP, 0, &do_group); | 71 cmd_add("group", "Change group display settings", COMPL_GROUP, 0, &do_group); |
69 cmd_add("help", "Display some help", COMPL_CMD, 0, NULL); | 72 cmd_add("help", "Display some help", COMPL_CMD, 0, NULL); |
70 //cmd_add("info"); | 73 //cmd_add("info"); |
93 // Roster category | 96 // Roster category |
94 compl_add_category_word(COMPL_ROSTER, "bottom"); | 97 compl_add_category_word(COMPL_ROSTER, "bottom"); |
95 compl_add_category_word(COMPL_ROSTER, "hide_offline"); | 98 compl_add_category_word(COMPL_ROSTER, "hide_offline"); |
96 compl_add_category_word(COMPL_ROSTER, "show_offline"); | 99 compl_add_category_word(COMPL_ROSTER, "show_offline"); |
97 compl_add_category_word(COMPL_ROSTER, "top"); | 100 compl_add_category_word(COMPL_ROSTER, "top"); |
101 | |
102 // Roster category | |
103 compl_add_category_word(COMPL_BUFFER, "bottom"); | |
104 compl_add_category_word(COMPL_BUFFER, "clear"); | |
105 compl_add_category_word(COMPL_BUFFER, "top"); | |
98 | 106 |
99 // Group category | 107 // Group category |
100 compl_add_category_word(COMPL_GROUP, "expand"); | 108 compl_add_category_word(COMPL_GROUP, "expand"); |
101 compl_add_category_word(COMPL_GROUP, "shrink"); | 109 compl_add_category_word(COMPL_GROUP, "shrink"); |
102 compl_add_category_word(COMPL_GROUP, "toggle"); | 110 compl_add_category_word(COMPL_GROUP, "toggle"); |
237 update_roster = TRUE; | 245 update_roster = TRUE; |
238 } else | 246 } else |
239 scr_LogPrint("Unrecognized parameter!"); | 247 scr_LogPrint("Unrecognized parameter!"); |
240 } | 248 } |
241 | 249 |
242 void do_clear(char *arg) | |
243 { | |
244 scr_Clear(); | |
245 } | |
246 | |
247 void do_status(char *arg) | 250 void do_status(char *arg) |
248 { | 251 { |
249 enum imstatus st; | 252 enum imstatus st; |
250 | 253 |
251 if (!arg || (*arg == 0)) { | 254 if (!arg || (*arg == 0)) { |
339 | 342 |
340 buddy_setflags(bud, ROSTER_FLAG_LOCK, TRUE); | 343 buddy_setflags(bud, ROSTER_FLAG_LOCK, TRUE); |
341 send_message(arg); | 344 send_message(arg); |
342 } | 345 } |
343 | 346 |
347 void do_buffer(char *arg) | |
348 { | |
349 if (!strcasecmp(arg, "top")) { | |
350 scr_BufferTop(); | |
351 } else if (!strcasecmp(arg, "bottom")) { | |
352 scr_BufferBottom(); | |
353 } else if (!strcasecmp(arg, "clear")) { | |
354 scr_Clear(); | |
355 } else | |
356 scr_LogPrint("Unrecognized parameter!"); | |
357 } | |
358 | |
359 void do_clear(char *arg) // Alias for "/buffer clear" | |
360 { | |
361 do_buffer("clear"); | |
362 } | |
363 |