5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2002 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
26 #include "servers-setup.h"
27 #include "channels-setup.h"
28 #include "silc-servers.h"
29 #include "silc-channels.h"
30 #include "silc-queries.h"
31 #include "silc-nicklist.h"
33 /* User mode in active server */
35 static char *expando_usermode(SERVER_REC *server, void *item, int *free_ret)
40 /* Expands to your usermode on channel */
42 static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
44 if (IS_CHANNEL(item) && CHANNEL(item)->ownnick) {
45 SILC_NICK_REC *nick = (SILC_NICK_REC *)CHANNEL(item)->ownnick;
46 return (nick->op && nick->founder) ? "*@" :
47 nick->op ? "@" : nick->founder ? "*" : "";
53 static char *expando_cumode_space(SERVER_REC *server, void *item,
56 char *ret = expando_cumode(server, item, free_ret);
57 return *ret == '\0' ? " " : ret;
60 void silc_expandos_init(void)
62 expando_create("usermode", expando_usermode,
63 "window changed", EXPANDO_ARG_NONE,
64 "window server changed", EXPANDO_ARG_WINDOW,
65 "user mode changed", EXPANDO_ARG_SERVER, NULL);
66 expando_create("cumode", expando_cumode,
67 "window changed", EXPANDO_ARG_NONE,
68 "window item changed", EXPANDO_ARG_WINDOW,
69 "nick mode changed", EXPANDO_ARG_WINDOW_ITEM, NULL);
70 expando_create("cumode_space", expando_cumode_space,
71 "window changed", EXPANDO_ARG_NONE,
72 "window item changed", EXPANDO_ARG_WINDOW,
73 "nick mode changed", EXPANDO_ARG_WINDOW_ITEM, NULL);
76 void silc_expandos_deinit(void)
78 expando_destroy("usermode", expando_usermode);
79 expando_destroy("cumode", expando_cumode);
80 expando_destroy("cumode_space", expando_cumode_space);