Merged 0.7.99 irssi.
[crypto.git] / apps / irssi / src / core / expandos.h
1 #ifndef __EXPANDOS_H
2 #define __EXPANDOS_H
3
4 #include "signals.h"
5
6 /* first argument of signal must match to active .. */
7 typedef enum {
8         EXPANDO_ARG_NONE = 1,
9         EXPANDO_ARG_SERVER,
10         EXPANDO_ARG_WINDOW,
11         EXPANDO_ARG_WINDOW_ITEM,
12
13         EXPANDO_NEVER /* special: expando never changes */
14 } ExpandoArg;
15
16 typedef char* (*EXPANDO_FUNC)
17         (SERVER_REC *server, void *item, int *free_ret);
18
19 /* Create expando - overrides any existing ones.
20    ... = signal, type, ..., NULL - list of signals that might change the
21    value of this expando */
22 void expando_create(const char *key, EXPANDO_FUNC func, ...);
23 /* Add new signal to expando */
24 void expando_add_signal(const char *key, const char *signal, ExpandoArg arg);
25 /* Destroy expando */
26 void expando_destroy(const char *key, EXPANDO_FUNC func);
27
28 void expando_bind(const char *key, int funccount, SIGNAL_FUNC *funcs);
29 void expando_unbind(const char *key, int funccount, SIGNAL_FUNC *funcs);
30
31 /* Returns [<signal id>, EXPANDO_ARG_xxx, <signal id>, ..., -1] */
32 int *expando_get_signals(const char *key);
33
34 /* internal: */
35 EXPANDO_FUNC expando_find_char(char chr);
36 EXPANDO_FUNC expando_find_long(const char *key);
37
38 void expandos_init(void);
39 void expandos_deinit(void);
40
41 #endif