1 | /********************************************************************\ |
---|
2 | * BitlBee -- An IRC to other IM-networks gateway * |
---|
3 | * * |
---|
4 | * Copyright 2002-2010 Wilmer van der Gaast and others * |
---|
5 | \********************************************************************/ |
---|
6 | |
---|
7 | /* User manager (root) commands */ |
---|
8 | |
---|
9 | /* |
---|
10 | This program is free software; you can redistribute it and/or modify |
---|
11 | it under the terms of the GNU General Public License as published by |
---|
12 | the Free Software Foundation; either version 2 of the License, or |
---|
13 | (at your option) any later version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, |
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | GNU General Public License for more details. |
---|
19 | |
---|
20 | You should have received a copy of the GNU General Public License with |
---|
21 | the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; |
---|
22 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, |
---|
23 | Suite 330, Boston, MA 02111-1307 USA |
---|
24 | */ |
---|
25 | |
---|
26 | #define BITLBEE_CORE |
---|
27 | #include "commands.h" |
---|
28 | #include "bitlbee.h" |
---|
29 | #include "help.h" |
---|
30 | #include "chat.h" |
---|
31 | |
---|
32 | #include <string.h> |
---|
33 | |
---|
34 | void root_command_string( irc_t *irc, char *command ) |
---|
35 | { |
---|
36 | root_command( irc, split_command_parts( command ) ); |
---|
37 | } |
---|
38 | |
---|
39 | #define MIN_ARGS( x, y... ) \ |
---|
40 | do \ |
---|
41 | { \ |
---|
42 | int blaat; \ |
---|
43 | for( blaat = 0; blaat <= x; blaat ++ ) \ |
---|
44 | if( cmd[blaat] == NULL ) \ |
---|
45 | { \ |
---|
46 | irc_usermsg( irc, "Not enough parameters given (need %d).", x ); \ |
---|
47 | return y; \ |
---|
48 | } \ |
---|
49 | } while( 0 ) |
---|
50 | |
---|
51 | void root_command( irc_t *irc, char *cmd[] ) |
---|
52 | { |
---|
53 | int i, len; |
---|
54 | |
---|
55 | if( !cmd[0] ) |
---|
56 | return; |
---|
57 | |
---|
58 | len = strlen( cmd[0] ); |
---|
59 | for( i = 0; commands[i].command; i++ ) |
---|
60 | if( g_strncasecmp( commands[i].command, cmd[0], len ) == 0 ) |
---|
61 | { |
---|
62 | if( commands[i+1].command && |
---|
63 | g_strncasecmp( commands[i+1].command, cmd[0], len ) == 0 ) |
---|
64 | /* Only match on the first letters if the match is unique. */ |
---|
65 | break; |
---|
66 | |
---|
67 | MIN_ARGS( commands[i].required_parameters ); |
---|
68 | |
---|
69 | commands[i].execute( irc, cmd ); |
---|
70 | return; |
---|
71 | } |
---|
72 | |
---|
73 | irc_usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] ); |
---|
74 | } |
---|
75 | |
---|
76 | static void cmd_help( irc_t *irc, char **cmd ) |
---|
77 | { |
---|
78 | char param[80]; |
---|
79 | int i; |
---|
80 | char *s; |
---|
81 | |
---|
82 | memset( param, 0, sizeof(param) ); |
---|
83 | for ( i = 1; (cmd[i] != NULL && ( strlen(param) < (sizeof(param)-1) ) ); i++ ) { |
---|
84 | if ( i != 1 ) // prepend space except for the first parameter |
---|
85 | strcat(param, " "); |
---|
86 | strncat( param, cmd[i], sizeof(param) - strlen(param) - 1 ); |
---|
87 | } |
---|
88 | |
---|
89 | s = help_get( &(global.help), param ); |
---|
90 | if( !s ) s = help_get( &(global.help), "" ); |
---|
91 | |
---|
92 | if( s ) |
---|
93 | { |
---|
94 | irc_usermsg( irc, "%s", s ); |
---|
95 | g_free( s ); |
---|
96 | } |
---|
97 | else |
---|
98 | { |
---|
99 | irc_usermsg( irc, "Error opening helpfile." ); |
---|
100 | } |
---|
101 | } |
---|
102 | |
---|
103 | static void cmd_account( irc_t *irc, char **cmd ); |
---|
104 | |
---|
105 | static void cmd_identify( irc_t *irc, char **cmd ) |
---|
106 | { |
---|
107 | storage_status_t status = storage_load( irc, cmd[1] ); |
---|
108 | char *account_on[] = { "account", "on", NULL }; |
---|
109 | |
---|
110 | if( strchr( irc->umode, 'R' ) != NULL ) |
---|
111 | { |
---|
112 | irc_usermsg( irc, "You're already logged in." ); |
---|
113 | return; |
---|
114 | } |
---|
115 | |
---|
116 | switch (status) { |
---|
117 | case STORAGE_INVALID_PASSWORD: |
---|
118 | irc_usermsg( irc, "Incorrect password" ); |
---|
119 | break; |
---|
120 | case STORAGE_NO_SUCH_USER: |
---|
121 | irc_usermsg( irc, "The nick is (probably) not registered" ); |
---|
122 | break; |
---|
123 | case STORAGE_OK: |
---|
124 | irc_usermsg( irc, "Password accepted, settings and accounts loaded" ); |
---|
125 | irc_setpass( irc, cmd[1] ); |
---|
126 | irc->status |= USTATUS_IDENTIFIED; |
---|
127 | irc_umode_set( irc, "+R", 1 ); |
---|
128 | if( set_getbool( &irc->b->set, "auto_connect" ) ) |
---|
129 | cmd_account( irc, account_on ); |
---|
130 | break; |
---|
131 | case STORAGE_OTHER_ERROR: |
---|
132 | default: |
---|
133 | irc_usermsg( irc, "Unknown error while loading configuration" ); |
---|
134 | break; |
---|
135 | } |
---|
136 | } |
---|
137 | |
---|
138 | static void cmd_register( irc_t *irc, char **cmd ) |
---|
139 | { |
---|
140 | if( global.conf->authmode == AUTHMODE_REGISTERED ) |
---|
141 | { |
---|
142 | irc_usermsg( irc, "This server does not allow registering new accounts" ); |
---|
143 | return; |
---|
144 | } |
---|
145 | |
---|
146 | switch( storage_save( irc, cmd[1], FALSE ) ) { |
---|
147 | case STORAGE_ALREADY_EXISTS: |
---|
148 | irc_usermsg( irc, "Nick is already registered" ); |
---|
149 | break; |
---|
150 | |
---|
151 | case STORAGE_OK: |
---|
152 | irc_usermsg( irc, "Account successfully created" ); |
---|
153 | irc_setpass( irc, cmd[1] ); |
---|
154 | irc->status |= USTATUS_IDENTIFIED; |
---|
155 | irc_umode_set( irc, "+R", 1 ); |
---|
156 | break; |
---|
157 | |
---|
158 | default: |
---|
159 | irc_usermsg( irc, "Error registering" ); |
---|
160 | break; |
---|
161 | } |
---|
162 | } |
---|
163 | |
---|
164 | static void cmd_drop( irc_t *irc, char **cmd ) |
---|
165 | { |
---|
166 | storage_status_t status; |
---|
167 | |
---|
168 | status = storage_remove (irc->user->nick, cmd[1]); |
---|
169 | switch (status) { |
---|
170 | case STORAGE_NO_SUCH_USER: |
---|
171 | irc_usermsg( irc, "That account does not exist" ); |
---|
172 | break; |
---|
173 | case STORAGE_INVALID_PASSWORD: |
---|
174 | irc_usermsg( irc, "Password invalid" ); |
---|
175 | break; |
---|
176 | case STORAGE_OK: |
---|
177 | irc_setpass( irc, NULL ); |
---|
178 | irc->status &= ~USTATUS_IDENTIFIED; |
---|
179 | irc_umode_set( irc, "-R", 1 ); |
---|
180 | irc_usermsg( irc, "Account `%s' removed", irc->user->nick ); |
---|
181 | break; |
---|
182 | default: |
---|
183 | irc_usermsg( irc, "Error: `%d'", status ); |
---|
184 | break; |
---|
185 | } |
---|
186 | } |
---|
187 | |
---|
188 | static void cmd_save( irc_t *irc, char **cmd ) |
---|
189 | { |
---|
190 | if( ( irc->status & USTATUS_IDENTIFIED ) == 0 ) |
---|
191 | irc_usermsg( irc, "Please create an account first" ); |
---|
192 | else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK ) |
---|
193 | irc_usermsg( irc, "Configuration saved" ); |
---|
194 | else |
---|
195 | irc_usermsg( irc, "Configuration could not be saved!" ); |
---|
196 | } |
---|
197 | |
---|
198 | static void cmd_showset( irc_t *irc, set_t **head, char *key ) |
---|
199 | { |
---|
200 | char *val; |
---|
201 | |
---|
202 | if( ( val = set_getstr( head, key ) ) ) |
---|
203 | irc_usermsg( irc, "%s = `%s'", key, val ); |
---|
204 | else |
---|
205 | irc_usermsg( irc, "%s is empty", key ); |
---|
206 | } |
---|
207 | |
---|
208 | typedef set_t** (*cmd_set_findhead)( irc_t*, char* ); |
---|
209 | typedef int (*cmd_set_checkflags)( irc_t*, set_t *set ); |
---|
210 | |
---|
211 | static int cmd_set_real( irc_t *irc, char **cmd, cmd_set_findhead findhead, cmd_set_checkflags checkflags ) |
---|
212 | { |
---|
213 | char *set_full = NULL, *set_name = NULL, *tmp; |
---|
214 | set_t **head; |
---|
215 | |
---|
216 | if( cmd[1] && g_strncasecmp( cmd[1], "-del", 4 ) == 0 ) |
---|
217 | { |
---|
218 | MIN_ARGS( 2, 0 ); |
---|
219 | set_full = cmd[2]; |
---|
220 | } |
---|
221 | else |
---|
222 | set_full = cmd[1]; |
---|
223 | |
---|
224 | if( findhead == NULL ) |
---|
225 | { |
---|
226 | set_name = set_full; |
---|
227 | |
---|
228 | head = &irc->b->set; |
---|
229 | } |
---|
230 | else |
---|
231 | { |
---|
232 | char *id; |
---|
233 | |
---|
234 | if( ( tmp = strchr( set_full, '/' ) ) ) |
---|
235 | { |
---|
236 | id = g_strndup( set_full, ( tmp - set_full ) ); |
---|
237 | set_name = tmp + 1; |
---|
238 | } |
---|
239 | else |
---|
240 | { |
---|
241 | id = g_strdup( set_full ); |
---|
242 | } |
---|
243 | |
---|
244 | if( ( head = findhead( irc, id ) ) == NULL ) |
---|
245 | { |
---|
246 | g_free( id ); |
---|
247 | irc_usermsg( irc, "Could not find setting." ); |
---|
248 | return 0; |
---|
249 | } |
---|
250 | g_free( id ); |
---|
251 | } |
---|
252 | |
---|
253 | if( cmd[1] && cmd[2] && set_name ) |
---|
254 | { |
---|
255 | set_t *s = set_find( head, set_name ); |
---|
256 | int st; |
---|
257 | |
---|
258 | if( s && checkflags && checkflags( irc, s ) == 0 ) |
---|
259 | return 0; |
---|
260 | |
---|
261 | if( g_strncasecmp( cmd[1], "-del", 4 ) == 0 ) |
---|
262 | st = set_reset( head, set_name ); |
---|
263 | else |
---|
264 | st = set_setstr( head, set_name, cmd[2] ); |
---|
265 | |
---|
266 | if( set_getstr( head, set_name ) == NULL ) |
---|
267 | { |
---|
268 | if( st ) |
---|
269 | irc_usermsg( irc, "Setting changed successfully" ); |
---|
270 | else |
---|
271 | irc_usermsg( irc, "Failed to change setting" ); |
---|
272 | } |
---|
273 | else |
---|
274 | { |
---|
275 | cmd_showset( irc, head, set_name ); |
---|
276 | } |
---|
277 | } |
---|
278 | else if( set_name ) |
---|
279 | { |
---|
280 | cmd_showset( irc, head, set_name ); |
---|
281 | } |
---|
282 | else |
---|
283 | { |
---|
284 | set_t *s = *head; |
---|
285 | while( s ) |
---|
286 | { |
---|
287 | cmd_showset( irc, &s, s->key ); |
---|
288 | s = s->next; |
---|
289 | } |
---|
290 | } |
---|
291 | |
---|
292 | return 1; |
---|
293 | } |
---|
294 | |
---|
295 | static set_t **cmd_account_set_findhead( irc_t *irc, char *id ) |
---|
296 | { |
---|
297 | account_t *a; |
---|
298 | |
---|
299 | if( ( a = account_get( irc->b, id ) ) ) |
---|
300 | return &a->set; |
---|
301 | else |
---|
302 | return NULL; |
---|
303 | } |
---|
304 | |
---|
305 | static int cmd_account_set_checkflags( irc_t *irc, set_t *s ) |
---|
306 | { |
---|
307 | account_t *a = s->data; |
---|
308 | |
---|
309 | if( a->ic && s && s->flags & ACC_SET_OFFLINE_ONLY ) |
---|
310 | { |
---|
311 | irc_usermsg( irc, "This setting can only be changed when the account is %s-line", "off" ); |
---|
312 | return 0; |
---|
313 | } |
---|
314 | else if( !a->ic && s && s->flags & ACC_SET_ONLINE_ONLY ) |
---|
315 | { |
---|
316 | irc_usermsg( irc, "This setting can only be changed when the account is %s-line", "on" ); |
---|
317 | return 0; |
---|
318 | } |
---|
319 | |
---|
320 | return 1; |
---|
321 | } |
---|
322 | |
---|
323 | static void cmd_account( irc_t *irc, char **cmd ) |
---|
324 | { |
---|
325 | account_t *a; |
---|
326 | |
---|
327 | if( global.conf->authmode == AUTHMODE_REGISTERED && !( irc->status & USTATUS_IDENTIFIED ) ) |
---|
328 | { |
---|
329 | irc_usermsg( irc, "This server only accepts registered users" ); |
---|
330 | return; |
---|
331 | } |
---|
332 | |
---|
333 | if( g_strcasecmp( cmd[1], "add" ) == 0 ) |
---|
334 | { |
---|
335 | struct prpl *prpl; |
---|
336 | |
---|
337 | MIN_ARGS( 4 ); |
---|
338 | |
---|
339 | prpl = find_protocol( cmd[2] ); |
---|
340 | |
---|
341 | if( prpl == NULL ) |
---|
342 | { |
---|
343 | irc_usermsg( irc, "Unknown protocol" ); |
---|
344 | return; |
---|
345 | } |
---|
346 | |
---|
347 | a = account_add( irc->b, prpl, cmd[3], cmd[4] ); |
---|
348 | if( cmd[5] ) |
---|
349 | { |
---|
350 | irc_usermsg( irc, "Warning: Passing a servername/other flags to `account add' " |
---|
351 | "is now deprecated. Use `account set' instead." ); |
---|
352 | set_setstr( &a->set, "server", cmd[5] ); |
---|
353 | } |
---|
354 | |
---|
355 | irc_usermsg( irc, "Account successfully added" ); |
---|
356 | } |
---|
357 | else if( g_strcasecmp( cmd[1], "del" ) == 0 ) |
---|
358 | { |
---|
359 | MIN_ARGS( 2 ); |
---|
360 | |
---|
361 | if( !( a = account_get( irc->b, cmd[2] ) ) ) |
---|
362 | { |
---|
363 | irc_usermsg( irc, "Invalid account" ); |
---|
364 | } |
---|
365 | else if( a->ic ) |
---|
366 | { |
---|
367 | irc_usermsg( irc, "Account is still logged in, can't delete" ); |
---|
368 | } |
---|
369 | else |
---|
370 | { |
---|
371 | account_del( irc->b, a ); |
---|
372 | irc_usermsg( irc, "Account deleted" ); |
---|
373 | } |
---|
374 | } |
---|
375 | else if( g_strcasecmp( cmd[1], "list" ) == 0 ) |
---|
376 | { |
---|
377 | int i = 0; |
---|
378 | |
---|
379 | if( strchr( irc->umode, 'b' ) ) |
---|
380 | irc_usermsg( irc, "Account list:" ); |
---|
381 | |
---|
382 | for( a = irc->b->accounts; a; a = a->next ) |
---|
383 | { |
---|
384 | char *con; |
---|
385 | |
---|
386 | if( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) |
---|
387 | con = " (connected)"; |
---|
388 | else if( a->ic ) |
---|
389 | con = " (connecting)"; |
---|
390 | else if( a->reconnect ) |
---|
391 | con = " (awaiting reconnect)"; |
---|
392 | else |
---|
393 | con = ""; |
---|
394 | |
---|
395 | irc_usermsg( irc, "%2d. %s, %s%s", i, a->prpl->name, a->user, con ); |
---|
396 | |
---|
397 | i ++; |
---|
398 | } |
---|
399 | irc_usermsg( irc, "End of account list" ); |
---|
400 | } |
---|
401 | else if( g_strcasecmp( cmd[1], "on" ) == 0 ) |
---|
402 | { |
---|
403 | if( cmd[2] ) |
---|
404 | { |
---|
405 | if( ( a = account_get( irc->b, cmd[2] ) ) ) |
---|
406 | { |
---|
407 | if( a->ic ) |
---|
408 | { |
---|
409 | irc_usermsg( irc, "Account already online" ); |
---|
410 | return; |
---|
411 | } |
---|
412 | else |
---|
413 | { |
---|
414 | account_on( irc->b, a ); |
---|
415 | } |
---|
416 | } |
---|
417 | else |
---|
418 | { |
---|
419 | irc_usermsg( irc, "Invalid account" ); |
---|
420 | return; |
---|
421 | } |
---|
422 | } |
---|
423 | else |
---|
424 | { |
---|
425 | if ( irc->b->accounts ) |
---|
426 | { |
---|
427 | irc_usermsg( irc, "Trying to get all accounts connected..." ); |
---|
428 | |
---|
429 | for( a = irc->b->accounts; a; a = a->next ) |
---|
430 | if( !a->ic && a->auto_connect ) |
---|
431 | account_on( irc->b, a ); |
---|
432 | } |
---|
433 | else |
---|
434 | { |
---|
435 | irc_usermsg( irc, "No accounts known. Use `account add' to add one." ); |
---|
436 | } |
---|
437 | } |
---|
438 | } |
---|
439 | else if( g_strcasecmp( cmd[1], "off" ) == 0 ) |
---|
440 | { |
---|
441 | if( !cmd[2] ) |
---|
442 | { |
---|
443 | irc_usermsg( irc, "Deactivating all active (re)connections..." ); |
---|
444 | |
---|
445 | for( a = irc->b->accounts; a; a = a->next ) |
---|
446 | { |
---|
447 | if( a->ic ) |
---|
448 | account_off( irc->b, a ); |
---|
449 | else if( a->reconnect ) |
---|
450 | cancel_auto_reconnect( a ); |
---|
451 | } |
---|
452 | } |
---|
453 | else if( ( a = account_get( irc->b, cmd[2] ) ) ) |
---|
454 | { |
---|
455 | if( a->ic ) |
---|
456 | { |
---|
457 | account_off( irc->b, a ); |
---|
458 | } |
---|
459 | else if( a->reconnect ) |
---|
460 | { |
---|
461 | cancel_auto_reconnect( a ); |
---|
462 | irc_usermsg( irc, "Reconnect cancelled" ); |
---|
463 | } |
---|
464 | else |
---|
465 | { |
---|
466 | irc_usermsg( irc, "Account already offline" ); |
---|
467 | return; |
---|
468 | } |
---|
469 | } |
---|
470 | else |
---|
471 | { |
---|
472 | irc_usermsg( irc, "Invalid account" ); |
---|
473 | return; |
---|
474 | } |
---|
475 | } |
---|
476 | else if( g_strcasecmp( cmd[1], "set" ) == 0 ) |
---|
477 | { |
---|
478 | MIN_ARGS( 2 ); |
---|
479 | |
---|
480 | cmd_set_real( irc, cmd + 1, cmd_account_set_findhead, cmd_account_set_checkflags ); |
---|
481 | } |
---|
482 | else |
---|
483 | { |
---|
484 | irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[1] ); |
---|
485 | } |
---|
486 | } |
---|
487 | |
---|
488 | static set_t **cmd_channel_set_findhead( irc_t *irc, char *id ) |
---|
489 | { |
---|
490 | irc_channel_t *ic; |
---|
491 | |
---|
492 | if( ( ic = irc_channel_by_name( irc, id ) ) ) |
---|
493 | return &ic->set; |
---|
494 | else |
---|
495 | return NULL; |
---|
496 | } |
---|
497 | |
---|
498 | static void cmd_channel( irc_t *irc, char **cmd ) |
---|
499 | { |
---|
500 | if( g_strcasecmp( cmd[1], "set" ) == 0 ) |
---|
501 | { |
---|
502 | MIN_ARGS( 2 ); |
---|
503 | |
---|
504 | cmd_set_real( irc, cmd + 1, cmd_channel_set_findhead, NULL ); |
---|
505 | } |
---|
506 | else |
---|
507 | { |
---|
508 | irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] ); |
---|
509 | } |
---|
510 | } |
---|
511 | |
---|
512 | static void cmd_add( irc_t *irc, char **cmd ) |
---|
513 | { |
---|
514 | account_t *a; |
---|
515 | int add_on_server = 1; |
---|
516 | |
---|
517 | if( g_strcasecmp( cmd[1], "-tmp" ) == 0 ) |
---|
518 | { |
---|
519 | MIN_ARGS( 3 ); |
---|
520 | add_on_server = 0; |
---|
521 | cmd ++; |
---|
522 | } |
---|
523 | |
---|
524 | if( !( a = account_get( irc->b, cmd[1] ) ) ) |
---|
525 | { |
---|
526 | irc_usermsg( irc, "Invalid account" ); |
---|
527 | return; |
---|
528 | } |
---|
529 | else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) ) |
---|
530 | { |
---|
531 | irc_usermsg( irc, "That account is not on-line" ); |
---|
532 | return; |
---|
533 | } |
---|
534 | |
---|
535 | if( cmd[3] ) |
---|
536 | { |
---|
537 | if( !nick_ok( cmd[3] ) ) |
---|
538 | { |
---|
539 | irc_usermsg( irc, "The requested nick `%s' is invalid", cmd[3] ); |
---|
540 | return; |
---|
541 | } |
---|
542 | else if( irc_user_by_name( irc, cmd[3] ) ) |
---|
543 | { |
---|
544 | irc_usermsg( irc, "The requested nick `%s' already exists", cmd[3] ); |
---|
545 | return; |
---|
546 | } |
---|
547 | else |
---|
548 | { |
---|
549 | nick_set( a, cmd[2], cmd[3] ); |
---|
550 | } |
---|
551 | } |
---|
552 | |
---|
553 | if( add_on_server ) |
---|
554 | a->ic->acc->prpl->add_buddy( a->ic, cmd[2], NULL ); |
---|
555 | else |
---|
556 | /* Only for add -tmp. For regular adds, this callback will |
---|
557 | be called once the IM server confirms. */ |
---|
558 | bee_user_new( irc->b, a->ic, cmd[2], BEE_USER_LOCAL ); |
---|
559 | |
---|
560 | irc_usermsg( irc, "Adding `%s' to your contact list", cmd[2] ); |
---|
561 | } |
---|
562 | |
---|
563 | static void cmd_remove( irc_t *irc, char **cmd ) |
---|
564 | { |
---|
565 | irc_user_t *iu; |
---|
566 | bee_user_t *bu; |
---|
567 | char *s; |
---|
568 | |
---|
569 | if( !( iu = irc_user_by_name( irc, cmd[1] ) ) || !( bu = iu->bu ) ) |
---|
570 | { |
---|
571 | irc_usermsg( irc, "Buddy `%s' not found", cmd[1] ); |
---|
572 | return; |
---|
573 | } |
---|
574 | s = g_strdup( bu->handle ); |
---|
575 | |
---|
576 | bu->ic->acc->prpl->remove_buddy( bu->ic, bu->handle, NULL ); |
---|
577 | nick_del( bu->ic->acc, bu->handle ); |
---|
578 | //TODO(wilmer): bee_user_free() and/or let the IM mod do it? irc_user_free( irc, cmd[1] ); |
---|
579 | |
---|
580 | irc_usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] ); |
---|
581 | g_free( s ); |
---|
582 | |
---|
583 | return; |
---|
584 | } |
---|
585 | |
---|
586 | static void cmd_info( irc_t *irc, char **cmd ) |
---|
587 | { |
---|
588 | struct im_connection *ic; |
---|
589 | account_t *a; |
---|
590 | |
---|
591 | if( !cmd[2] ) |
---|
592 | { |
---|
593 | irc_user_t *iu = irc_user_by_name( irc, cmd[1] ); |
---|
594 | if( !iu || !iu->bu ) |
---|
595 | { |
---|
596 | irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); |
---|
597 | return; |
---|
598 | } |
---|
599 | ic = iu->bu->ic; |
---|
600 | cmd[2] = iu->bu->handle; |
---|
601 | } |
---|
602 | else if( !( a = account_get( irc->b, cmd[1] ) ) ) |
---|
603 | { |
---|
604 | irc_usermsg( irc, "Invalid account" ); |
---|
605 | return; |
---|
606 | } |
---|
607 | else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) |
---|
608 | { |
---|
609 | irc_usermsg( irc, "That account is not on-line" ); |
---|
610 | return; |
---|
611 | } |
---|
612 | |
---|
613 | if( !ic->acc->prpl->get_info ) |
---|
614 | { |
---|
615 | irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); |
---|
616 | } |
---|
617 | else |
---|
618 | { |
---|
619 | ic->acc->prpl->get_info( ic, cmd[2] ); |
---|
620 | } |
---|
621 | } |
---|
622 | |
---|
623 | static void cmd_rename( irc_t *irc, char **cmd ) |
---|
624 | { |
---|
625 | irc_user_t *iu; |
---|
626 | |
---|
627 | iu = irc_user_by_name( irc, cmd[1] ); |
---|
628 | |
---|
629 | if( iu == NULL ) |
---|
630 | { |
---|
631 | irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); |
---|
632 | } |
---|
633 | else if( iu == irc->user ) |
---|
634 | { |
---|
635 | irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] ); |
---|
636 | } |
---|
637 | else if( !nick_ok( cmd[2] ) ) |
---|
638 | { |
---|
639 | irc_usermsg( irc, "Nick `%s' is invalid", cmd[2] ); |
---|
640 | } |
---|
641 | else if( irc_user_by_name( irc, cmd[2] ) ) |
---|
642 | { |
---|
643 | irc_usermsg( irc, "Nick `%s' already exists", cmd[2] ); |
---|
644 | } |
---|
645 | else |
---|
646 | { |
---|
647 | if( !irc_user_set_nick( iu, cmd[2] ) ) |
---|
648 | { |
---|
649 | irc_usermsg( irc, "Error while changing nick" ); |
---|
650 | return; |
---|
651 | } |
---|
652 | |
---|
653 | if( iu == irc->root ) |
---|
654 | { |
---|
655 | /* If we're called internally (user did "set root_nick"), |
---|
656 | let's not go O(INF). :-) */ |
---|
657 | if( strcmp( cmd[0], "set_rename" ) != 0 ) |
---|
658 | set_setstr( &irc->b->set, "root_nick", cmd[2] ); |
---|
659 | } |
---|
660 | else if( iu->bu ) |
---|
661 | { |
---|
662 | nick_set( iu->bu->ic->acc, iu->bu->handle, cmd[2] ); |
---|
663 | } |
---|
664 | |
---|
665 | irc_usermsg( irc, "Nick successfully changed" ); |
---|
666 | } |
---|
667 | } |
---|
668 | |
---|
669 | #if 0 |
---|
670 | char *set_eval_root_nick( set_t *set, char *new_nick ) |
---|
671 | { |
---|
672 | irc_t *irc = set->data; |
---|
673 | |
---|
674 | if( strcmp( irc->mynick, new_nick ) != 0 ) |
---|
675 | { |
---|
676 | char *cmd[] = { "set_rename", irc->mynick, new_nick, NULL }; |
---|
677 | |
---|
678 | cmd_rename( irc, cmd ); |
---|
679 | } |
---|
680 | |
---|
681 | return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : SET_INVALID; |
---|
682 | } |
---|
683 | #endif |
---|
684 | |
---|
685 | static void cmd_block( irc_t *irc, char **cmd ) |
---|
686 | { |
---|
687 | struct im_connection *ic; |
---|
688 | account_t *a; |
---|
689 | |
---|
690 | if( !cmd[2] && ( a = account_get( irc->b, cmd[1] ) ) && a->ic ) |
---|
691 | { |
---|
692 | char *format; |
---|
693 | GSList *l; |
---|
694 | |
---|
695 | if( strchr( irc->umode, 'b' ) != NULL ) |
---|
696 | format = "%s\t%s"; |
---|
697 | else |
---|
698 | format = "%-32.32s %-16.16s"; |
---|
699 | |
---|
700 | irc_usermsg( irc, format, "Handle", "Nickname" ); |
---|
701 | for( l = a->ic->deny; l; l = l->next ) |
---|
702 | { |
---|
703 | bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data ); |
---|
704 | irc_user_t *iu = bu ? bu->ui_data : NULL; |
---|
705 | irc_usermsg( irc, format, l->data, iu ? iu->nick : "(none)" ); |
---|
706 | } |
---|
707 | irc_usermsg( irc, "End of list." ); |
---|
708 | |
---|
709 | return; |
---|
710 | } |
---|
711 | else if( !cmd[2] ) |
---|
712 | { |
---|
713 | irc_user_t *iu = irc_user_by_name( irc, cmd[1] ); |
---|
714 | if( !iu || !iu->bu ) |
---|
715 | { |
---|
716 | irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); |
---|
717 | return; |
---|
718 | } |
---|
719 | ic = iu->bu->ic; |
---|
720 | cmd[2] = iu->bu->handle; |
---|
721 | } |
---|
722 | else if( !( a = account_get( irc->b, cmd[1] ) ) ) |
---|
723 | { |
---|
724 | irc_usermsg( irc, "Invalid account" ); |
---|
725 | return; |
---|
726 | } |
---|
727 | else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) |
---|
728 | { |
---|
729 | irc_usermsg( irc, "That account is not on-line" ); |
---|
730 | return; |
---|
731 | } |
---|
732 | |
---|
733 | if( !ic->acc->prpl->add_deny || !ic->acc->prpl->rem_permit ) |
---|
734 | { |
---|
735 | irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); |
---|
736 | } |
---|
737 | else |
---|
738 | { |
---|
739 | imc_rem_allow( ic, cmd[2] ); |
---|
740 | imc_add_block( ic, cmd[2] ); |
---|
741 | irc_usermsg( irc, "Buddy `%s' moved from your allow- to your block-list", cmd[2] ); |
---|
742 | } |
---|
743 | } |
---|
744 | |
---|
745 | static void cmd_allow( irc_t *irc, char **cmd ) |
---|
746 | { |
---|
747 | struct im_connection *ic; |
---|
748 | account_t *a; |
---|
749 | |
---|
750 | if( !cmd[2] && ( a = account_get( irc->b, cmd[1] ) ) && a->ic ) |
---|
751 | { |
---|
752 | char *format; |
---|
753 | GSList *l; |
---|
754 | |
---|
755 | if( strchr( irc->umode, 'b' ) != NULL ) |
---|
756 | format = "%s\t%s"; |
---|
757 | else |
---|
758 | format = "%-32.32s %-16.16s"; |
---|
759 | |
---|
760 | irc_usermsg( irc, format, "Handle", "Nickname" ); |
---|
761 | for( l = a->ic->permit; l; l = l->next ) |
---|
762 | { |
---|
763 | bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data ); |
---|
764 | irc_user_t *iu = bu ? bu->ui_data : NULL; |
---|
765 | irc_usermsg( irc, format, l->data, iu ? iu->nick : "(none)" ); |
---|
766 | } |
---|
767 | irc_usermsg( irc, "End of list." ); |
---|
768 | |
---|
769 | return; |
---|
770 | } |
---|
771 | else if( !cmd[2] ) |
---|
772 | { |
---|
773 | irc_user_t *iu = irc_user_by_name( irc, cmd[1] ); |
---|
774 | if( !iu || !iu->bu ) |
---|
775 | { |
---|
776 | irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); |
---|
777 | return; |
---|
778 | } |
---|
779 | ic = iu->bu->ic; |
---|
780 | cmd[2] = iu->bu->handle; |
---|
781 | } |
---|
782 | else if( !( a = account_get( irc->b, cmd[1] ) ) ) |
---|
783 | { |
---|
784 | irc_usermsg( irc, "Invalid account" ); |
---|
785 | return; |
---|
786 | } |
---|
787 | else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) ) |
---|
788 | { |
---|
789 | irc_usermsg( irc, "That account is not on-line" ); |
---|
790 | return; |
---|
791 | } |
---|
792 | |
---|
793 | if( !ic->acc->prpl->rem_deny || !ic->acc->prpl->add_permit ) |
---|
794 | { |
---|
795 | irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] ); |
---|
796 | } |
---|
797 | else |
---|
798 | { |
---|
799 | imc_rem_block( ic, cmd[2] ); |
---|
800 | imc_add_allow( ic, cmd[2] ); |
---|
801 | |
---|
802 | irc_usermsg( irc, "Buddy `%s' moved from your block- to your allow-list", cmd[2] ); |
---|
803 | } |
---|
804 | } |
---|
805 | |
---|
806 | static void cmd_yesno( irc_t *irc, char **cmd ) |
---|
807 | { |
---|
808 | query_t *q = NULL; |
---|
809 | int numq = 0; |
---|
810 | |
---|
811 | if( irc->queries == NULL ) |
---|
812 | { |
---|
813 | irc_usermsg( irc, "Did I ask you something?" ); |
---|
814 | return; |
---|
815 | } |
---|
816 | |
---|
817 | /* If there's an argument, the user seems to want to answer another question than the |
---|
818 | first/last (depending on the query_order setting) one. */ |
---|
819 | if( cmd[1] ) |
---|
820 | { |
---|
821 | if( sscanf( cmd[1], "%d", &numq ) != 1 ) |
---|
822 | { |
---|
823 | irc_usermsg( irc, "Invalid query number" ); |
---|
824 | return; |
---|
825 | } |
---|
826 | |
---|
827 | for( q = irc->queries; q; q = q->next, numq -- ) |
---|
828 | if( numq == 0 ) |
---|
829 | break; |
---|
830 | |
---|
831 | if( !q ) |
---|
832 | { |
---|
833 | irc_usermsg( irc, "Uhm, I never asked you something like that..." ); |
---|
834 | return; |
---|
835 | } |
---|
836 | } |
---|
837 | |
---|
838 | if( g_strcasecmp( cmd[0], "yes" ) == 0 ) |
---|
839 | query_answer( irc, q, 1 ); |
---|
840 | else if( g_strcasecmp( cmd[0], "no" ) == 0 ) |
---|
841 | query_answer( irc, q, 0 ); |
---|
842 | } |
---|
843 | |
---|
844 | static void cmd_set( irc_t *irc, char **cmd ) |
---|
845 | { |
---|
846 | cmd_set_real( irc, cmd, NULL, NULL ); |
---|
847 | } |
---|
848 | |
---|
849 | static void cmd_blist( irc_t *irc, char **cmd ) |
---|
850 | { |
---|
851 | int online = 0, away = 0, offline = 0; |
---|
852 | GSList *l; |
---|
853 | char s[256]; |
---|
854 | char *format; |
---|
855 | int n_online = 0, n_away = 0, n_offline = 0; |
---|
856 | |
---|
857 | if( cmd[1] && g_strcasecmp( cmd[1], "all" ) == 0 ) |
---|
858 | online = offline = away = 1; |
---|
859 | else if( cmd[1] && g_strcasecmp( cmd[1], "offline" ) == 0 ) |
---|
860 | offline = 1; |
---|
861 | else if( cmd[1] && g_strcasecmp( cmd[1], "away" ) == 0 ) |
---|
862 | away = 1; |
---|
863 | else if( cmd[1] && g_strcasecmp( cmd[1], "online" ) == 0 ) |
---|
864 | online = 1; |
---|
865 | else |
---|
866 | online = away = 1; |
---|
867 | |
---|
868 | if( strchr( irc->umode, 'b' ) != NULL ) |
---|
869 | format = "%s\t%s\t%s"; |
---|
870 | else |
---|
871 | format = "%-16.16s %-40.40s %s"; |
---|
872 | |
---|
873 | irc_usermsg( irc, format, "Nick", "Handle/Account", "Status" ); |
---|
874 | |
---|
875 | for( l = irc->users; l; l = l->next ) |
---|
876 | { |
---|
877 | irc_user_t *iu = l->data; |
---|
878 | bee_user_t *bu = iu->bu; |
---|
879 | |
---|
880 | if( !bu || ( bu->flags & ( BEE_USER_ONLINE | BEE_USER_AWAY ) ) != BEE_USER_ONLINE ) |
---|
881 | continue; |
---|
882 | |
---|
883 | if( online == 1 ) |
---|
884 | { |
---|
885 | char st[256] = "Online"; |
---|
886 | |
---|
887 | if( bu->status_msg ) |
---|
888 | g_snprintf( st, sizeof( st ) - 1, "Online (%s)", bu->status_msg ); |
---|
889 | |
---|
890 | g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user ); |
---|
891 | irc_usermsg( irc, format, iu->nick, s, st ); |
---|
892 | } |
---|
893 | |
---|
894 | n_online ++; |
---|
895 | } |
---|
896 | |
---|
897 | for( l = irc->users; l; l = l->next ) |
---|
898 | { |
---|
899 | irc_user_t *iu = l->data; |
---|
900 | bee_user_t *bu = iu->bu; |
---|
901 | |
---|
902 | if( !bu || !( bu->flags & BEE_USER_ONLINE ) || !( bu->flags & BEE_USER_AWAY ) ) |
---|
903 | continue; |
---|
904 | |
---|
905 | if( away == 1 ) |
---|
906 | { |
---|
907 | g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user ); |
---|
908 | irc_usermsg( irc, format, iu->nick, s, irc_user_get_away( iu ) ); |
---|
909 | } |
---|
910 | n_away ++; |
---|
911 | } |
---|
912 | |
---|
913 | for( l = irc->users; l; l = l->next ) |
---|
914 | { |
---|
915 | irc_user_t *iu = l->data; |
---|
916 | bee_user_t *bu = iu->bu; |
---|
917 | |
---|
918 | if( !bu || bu->flags & BEE_USER_ONLINE ) |
---|
919 | continue; |
---|
920 | |
---|
921 | if( offline == 1 ) |
---|
922 | { |
---|
923 | g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user ); |
---|
924 | irc_usermsg( irc, format, iu->nick, s, "Offline" ); |
---|
925 | } |
---|
926 | n_offline ++; |
---|
927 | } |
---|
928 | |
---|
929 | irc_usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline ); |
---|
930 | } |
---|
931 | |
---|
932 | static void cmd_qlist( irc_t *irc, char **cmd ) |
---|
933 | { |
---|
934 | query_t *q = irc->queries; |
---|
935 | int num; |
---|
936 | |
---|
937 | if( !q ) |
---|
938 | { |
---|
939 | irc_usermsg( irc, "There are no pending questions." ); |
---|
940 | return; |
---|
941 | } |
---|
942 | |
---|
943 | irc_usermsg( irc, "Pending queries:" ); |
---|
944 | |
---|
945 | for( num = 0; q; q = q->next, num ++ ) |
---|
946 | if( q->ic ) /* Not necessary yet, but it might come later */ |
---|
947 | irc_usermsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->acc->user, q->question ); |
---|
948 | else |
---|
949 | irc_usermsg( irc, "%d, BitlBee: %s", num, q->question ); |
---|
950 | } |
---|
951 | |
---|
952 | static void cmd_chat( irc_t *irc, char **cmd ) |
---|
953 | { |
---|
954 | account_t *acc; |
---|
955 | |
---|
956 | if( g_strcasecmp( cmd[1], "add" ) == 0 ) |
---|
957 | { |
---|
958 | char *channel, *s; |
---|
959 | struct irc_channel *ic; |
---|
960 | |
---|
961 | MIN_ARGS( 3 ); |
---|
962 | |
---|
963 | if( !( acc = account_get( irc->b, cmd[2] ) ) ) |
---|
964 | { |
---|
965 | irc_usermsg( irc, "Invalid account" ); |
---|
966 | return; |
---|
967 | } |
---|
968 | else if( !acc->prpl->chat_join ) |
---|
969 | { |
---|
970 | irc_usermsg( irc, "Named chatrooms not supported on that account." ); |
---|
971 | return; |
---|
972 | } |
---|
973 | |
---|
974 | if( cmd[4] == NULL ) |
---|
975 | { |
---|
976 | channel = g_strdup( cmd[3] ); |
---|
977 | if( ( s = strchr( channel, '@' ) ) ) |
---|
978 | *s = 0; |
---|
979 | } |
---|
980 | else |
---|
981 | { |
---|
982 | channel = g_strdup( cmd[4] ); |
---|
983 | } |
---|
984 | |
---|
985 | if( strchr( CTYPES, channel[0] ) == NULL ) |
---|
986 | { |
---|
987 | s = g_strdup_printf( "#%s", channel ); |
---|
988 | g_free( channel ); |
---|
989 | channel = s; |
---|
990 | } |
---|
991 | |
---|
992 | if( ( ic = irc_channel_new( irc, channel ) ) && |
---|
993 | set_setstr( &ic->set, "chat_type", "room" ) && |
---|
994 | set_setstr( &ic->set, "account", cmd[2] ) && |
---|
995 | set_setstr( &ic->set, "room", cmd[3] ) ) |
---|
996 | { |
---|
997 | irc_usermsg( irc, "Chatroom successfully added." ); |
---|
998 | } |
---|
999 | else |
---|
1000 | { |
---|
1001 | if( ic ) |
---|
1002 | irc_channel_free( ic ); |
---|
1003 | |
---|
1004 | irc_usermsg( irc, "Could not add chatroom." ); |
---|
1005 | } |
---|
1006 | } |
---|
1007 | else if( g_strcasecmp( cmd[1], "with" ) == 0 ) |
---|
1008 | { |
---|
1009 | irc_user_t *iu; |
---|
1010 | |
---|
1011 | MIN_ARGS( 2 ); |
---|
1012 | |
---|
1013 | if( ( iu = irc_user_by_name( irc, cmd[2] ) ) && |
---|
1014 | iu->bu && iu->bu->ic->acc->prpl->chat_with ) |
---|
1015 | { |
---|
1016 | if( !iu->bu->ic->acc->prpl->chat_with( iu->bu->ic, iu->bu->handle ) ) |
---|
1017 | { |
---|
1018 | irc_usermsg( irc, "(Possible) failure while trying to open " |
---|
1019 | "a groupchat with %s.", iu->nick ); |
---|
1020 | } |
---|
1021 | } |
---|
1022 | else |
---|
1023 | { |
---|
1024 | irc_usermsg( irc, "Can't open a groupchat with %s.", cmd[2] ); |
---|
1025 | } |
---|
1026 | } |
---|
1027 | else |
---|
1028 | { |
---|
1029 | irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] ); |
---|
1030 | } |
---|
1031 | } |
---|
1032 | |
---|
1033 | static void cmd_transfer( irc_t *irc, char **cmd ) |
---|
1034 | { |
---|
1035 | GSList *files = irc->file_transfers; |
---|
1036 | enum { LIST, REJECT, CANCEL }; |
---|
1037 | int subcmd = LIST; |
---|
1038 | int fid; |
---|
1039 | |
---|
1040 | if( !files ) |
---|
1041 | { |
---|
1042 | irc_usermsg( irc, "No pending transfers" ); |
---|
1043 | return; |
---|
1044 | } |
---|
1045 | |
---|
1046 | if( cmd[1] && ( strcmp( cmd[1], "reject" ) == 0 ) ) |
---|
1047 | { |
---|
1048 | subcmd = REJECT; |
---|
1049 | } |
---|
1050 | else if( cmd[1] && ( strcmp( cmd[1], "cancel" ) == 0 ) && |
---|
1051 | cmd[2] && ( sscanf( cmd[2], "%d", &fid ) == 1 ) ) |
---|
1052 | { |
---|
1053 | subcmd = CANCEL; |
---|
1054 | } |
---|
1055 | |
---|
1056 | for( ; files; files = g_slist_next( files ) ) |
---|
1057 | { |
---|
1058 | file_transfer_t *file = files->data; |
---|
1059 | |
---|
1060 | switch( subcmd ) { |
---|
1061 | case LIST: |
---|
1062 | if ( file->status == FT_STATUS_LISTENING ) |
---|
1063 | irc_usermsg( irc, |
---|
1064 | "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name); |
---|
1065 | else |
---|
1066 | { |
---|
1067 | int kb_per_s = 0; |
---|
1068 | time_t diff = time( NULL ) - file->started ? : 1; |
---|
1069 | if ( ( file->started > 0 ) && ( file->bytes_transferred > 0 ) ) |
---|
1070 | kb_per_s = file->bytes_transferred / 1024 / diff; |
---|
1071 | |
---|
1072 | irc_usermsg( irc, |
---|
1073 | "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name, |
---|
1074 | file->bytes_transferred/1024, file->file_size/1024, kb_per_s); |
---|
1075 | } |
---|
1076 | break; |
---|
1077 | case REJECT: |
---|
1078 | if( file->status == FT_STATUS_LISTENING ) |
---|
1079 | { |
---|
1080 | irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name ); |
---|
1081 | imcb_file_canceled( file->ic, file, "Denied by user" ); |
---|
1082 | } |
---|
1083 | break; |
---|
1084 | case CANCEL: |
---|
1085 | if( file->local_id == fid ) |
---|
1086 | { |
---|
1087 | irc_usermsg( irc, "Canceling file transfer for %s", file->file_name ); |
---|
1088 | imcb_file_canceled( file->ic, file, "Canceled by user" ); |
---|
1089 | } |
---|
1090 | break; |
---|
1091 | } |
---|
1092 | } |
---|
1093 | } |
---|
1094 | |
---|
1095 | /* IMPORTANT: Keep this list sorted! The short command logic needs that. */ |
---|
1096 | const command_t commands[] = { |
---|
1097 | { "account", 1, cmd_account, 0 }, |
---|
1098 | { "add", 2, cmd_add, 0 }, |
---|
1099 | { "allow", 1, cmd_allow, 0 }, |
---|
1100 | { "blist", 0, cmd_blist, 0 }, |
---|
1101 | { "block", 1, cmd_block, 0 }, |
---|
1102 | { "channel", 1, cmd_channel, 0 }, |
---|
1103 | { "chat", 1, cmd_chat, 0 }, |
---|
1104 | { "drop", 1, cmd_drop, 0 }, |
---|
1105 | { "ft", 0, cmd_transfer, 0 }, |
---|
1106 | { "help", 0, cmd_help, 0 }, |
---|
1107 | { "identify", 1, cmd_identify, 0 }, |
---|
1108 | { "info", 1, cmd_info, 0 }, |
---|
1109 | { "no", 0, cmd_yesno, 0 }, |
---|
1110 | { "qlist", 0, cmd_qlist, 0 }, |
---|
1111 | { "register", 1, cmd_register, 0 }, |
---|
1112 | { "remove", 1, cmd_remove, 0 }, |
---|
1113 | { "rename", 2, cmd_rename, 0 }, |
---|
1114 | { "save", 0, cmd_save, 0 }, |
---|
1115 | { "set", 0, cmd_set, 0 }, |
---|
1116 | { "transfer", 0, cmd_transfer, 0 }, |
---|
1117 | { "yes", 0, cmd_yesno, 0 }, |
---|
1118 | { NULL } |
---|
1119 | }; |
---|