Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/events.h @ 1685:1342df44c814
Improved events interface
* User can pass additional arguments to event handler
* MUC invitation reject now can be supplied a reason
author | Myhailo Danylenko <isbear@ukrpost.net> |
---|---|
date | Tue, 02 Feb 2010 22:44:18 +0100 |
parents | 41c26b7d2890 |
children | e6d355e50d7a |
comparison
equal
deleted
inserted
replaced
1684:95df4ea512c8 | 1685:1342df44c814 |
---|---|
6 #define EVS_DEFAULT_TIMEOUT 90 | 6 #define EVS_DEFAULT_TIMEOUT 90 |
7 #define EVS_MAX_TIMEOUT 432000 | 7 #define EVS_MAX_TIMEOUT 432000 |
8 | 8 |
9 #define EVS_CONTEXT_TIMEOUT 0U | 9 #define EVS_CONTEXT_TIMEOUT 0U |
10 #define EVS_CONTEXT_CANCEL 1U | 10 #define EVS_CONTEXT_CANCEL 1U |
11 #define EVS_CONTEXT_USER 2U | 11 #define EVS_CONTEXT_ACCEPT 2U |
12 #define EVS_CONTEXT_REJECT 3U | |
13 /* There can be other user-defined contexts */ | |
12 | 14 |
13 typedef enum { | 15 typedef gboolean (*evs_callback_t)(guint context, const char *arg, gpointer userdata); |
14 EVS_TYPE_SUBSCRIPTION = 1, | |
15 EVS_TYPE_INVITATION = 2, | |
16 #ifdef MODULES_ENABLE | |
17 EVS_TYPE_USER = 3, | |
18 #endif | |
19 } evs_type; | |
20 | 16 |
21 /* Common structure for events (evs) and IQ requests (iqs) */ | 17 const char *evs_new(const char *description, const char *id, time_t timeout, evs_callback_t callback, gpointer userdata, GDestroyNotify notify); |
22 typedef struct { | 18 int evs_del(const char *evid); |
23 char *id; | 19 int evs_callback(const char *evid, guint evcontext, const char *arg); |
24 time_t ts_create; | 20 void evs_display_list(void); |
25 time_t ts_expire; | 21 GSList *evs_geteventslist(void); |
26 guint8 type; | 22 void evs_deinit(void); |
27 gpointer data; | |
28 int (*callback)(); | |
29 char *desc; | |
30 } eviqs; | |
31 | |
32 typedef struct { | |
33 char* to; | |
34 char* from; | |
35 char* passwd; | |
36 char* reason; | |
37 } event_muc_invitation; | |
38 | |
39 eviqs *evs_new(guint8 type, time_t timeout); | |
40 int evs_del(const char *evid); | |
41 int evs_callback(const char *evid, guint evcontext); | |
42 gboolean evs_check_timeout(); | |
43 void evs_display_list(void); | |
44 GSList *evs_geteventslist(int forcompl); | |
45 | 23 |
46 #endif /* __MCABBER_EVENTS_H__ */ | 24 #endif /* __MCABBER_EVENTS_H__ */ |
47 | 25 |
48 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ | 26 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |