annotate mcabber/mcabber/hooks.h @ 1797:246c5d359c97

Add "hook-pre-message-in" hook
author Mikael Berthe <mikael@lilotux.net>
date Sat, 20 Mar 2010 14:57:03 +0100
parents 5e2db25fdb17
children 9daf6b3f30d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1658
diff changeset
1 #ifndef __MCABBER_HOOKS_H__
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1658
diff changeset
2 #define __MCABBER_HOOKS_H__ 1
113
8ac67e951eab [/trunk] Changeset 127 by mikael
mikael
parents:
diff changeset
3
8ac67e951eab [/trunk] Changeset 127 by mikael
mikael
parents:
diff changeset
4 #include <time.h>
1598
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1484
diff changeset
5 #include <loudmouth/loudmouth.h>
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1658
diff changeset
6 #include <mcabber/xmpp.h>
113
8ac67e951eab [/trunk] Changeset 127 by mikael
mikael
parents:
diff changeset
7
1484
7b36b91a4388 New UI message flag (O) when OTR is used
Mikael Berthe <mikael@lilotux.net>
parents: 1425
diff changeset
8 // These two defines are used by hk_message_{in,out} arguments
7b36b91a4388 New UI message flag (O) when OTR is used
Mikael Berthe <mikael@lilotux.net>
parents: 1425
diff changeset
9 #define ENCRYPTED_PGP 1
7b36b91a4388 New UI message flag (O) when OTR is used
Mikael Berthe <mikael@lilotux.net>
parents: 1425
diff changeset
10 #define ENCRYPTED_OTR 2
113
8ac67e951eab [/trunk] Changeset 127 by mikael
mikael
parents:
diff changeset
11
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1658
diff changeset
12 #include <mcabber/config.h>
1607
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
13 #ifdef MODULES_ENABLE
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
14 #include <glib.h>
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
15
1795
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
16 // Core hooks
1797
246c5d359c97 Add "hook-pre-message-in" hook
Mikael Berthe <mikael@lilotux.net>
parents: 1796
diff changeset
17 #define HOOK_PRE_MESSAGE_IN "hook-pre-message-in"
1796
5e2db25fdb17 Rename "hook-message-in" to "hook-post-message-in"
Mikael Berthe <mikael@lilotux.net>
parents: 1795
diff changeset
18 #define HOOK_POST_MESSAGE_IN "hook-post-message-in"
1795
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
19 #define HOOK_MESSAGE_OUT "hook-message-out"
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
20 #define HOOK_STATUS_CHANGE "hook-status-change"
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
21 #define HOOK_MY_STATUS_CHANGE "hook-my-status-change"
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
22 #define HOOK_POST_CONNECT "hook-post-connect"
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
23 #define HOOK_PRE_DISCONNECT "hook-pre-disconnect"
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
24
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
25 typedef enum {
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
26 HOOK_HANDLER_RESULT_ALLOW_MORE_HOOKS = 0,
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
27 HOOK_HANDLER_RESULT_NO_MORE_HOOK,
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
28 HOOK_HANDLER_RESULT_NO_MORE_HOOK_DROP_DATA,
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
29 } hk_handler_result;
1623
b008ac166b91 Flags for hook handlers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1607
diff changeset
30
1607
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
31 typedef struct {
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
32 const char *name;
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
33 const char *value;
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
34 } hk_arg_t;
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
35
1795
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
36 typedef guint (*hk_handler_t) (const gchar *hookname, hk_arg_t *args,
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
37 gpointer userdata);
1607
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
38
1795
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
39 guint hk_add_handler(hk_handler_t handler, const gchar *hookname,
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
40 gint priority, gpointer userdata);
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
41 void hk_del_handler(const gchar *hookname, guint hid);
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
42 guint hk_run_handlers(const gchar *hookname, hk_arg_t *args);
1607
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
43 #endif
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
44
1398
f8321420ed7a Remove useless inline's
Mikael Berthe <mikael@lilotux.net>
parents: 1352
diff changeset
45 void hk_message_in(const char *bjid, const char *resname,
1598
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1484
diff changeset
46 time_t timestamp, const char *msg, LmMessageSubType type,
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1484
diff changeset
47 guint encrypted);
1398
f8321420ed7a Remove useless inline's
Mikael Berthe <mikael@lilotux.net>
parents: 1352
diff changeset
48 void hk_message_out(const char *bjid, const char *nickname,
1602
f4a2c6f767d1 Message Receipts support (XEP-0184)
franky
parents: 1598
diff changeset
49 time_t timestamp, const char *msg,
f4a2c6f767d1 Message Receipts support (XEP-0184)
franky
parents: 1598
diff changeset
50 guint encrypted, gpointer xep184);
1398
f8321420ed7a Remove useless inline's
Mikael Berthe <mikael@lilotux.net>
parents: 1352
diff changeset
51 void hk_statuschange(const char *bjid, const char *resname, gchar prio,
1598
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1484
diff changeset
52 time_t timestamp, enum imstatus status,
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1484
diff changeset
53 char const *status_msg);
1398
f8321420ed7a Remove useless inline's
Mikael Berthe <mikael@lilotux.net>
parents: 1352
diff changeset
54 void hk_mystatuschange(time_t timestamp,
1784
250ad919f03f Small code cleanup in hooks.[ch]
Mikael Berthe <mikael@lilotux.net>
parents: 1683
diff changeset
55 enum imstatus old_status, enum imstatus new_status,
250ad919f03f Small code cleanup in hooks.[ch]
Mikael Berthe <mikael@lilotux.net>
parents: 1683
diff changeset
56 const char *msg);
113
8ac67e951eab [/trunk] Changeset 127 by mikael
mikael
parents:
diff changeset
57
1683
b09f82f61745 Split HOOK_INTERNAL
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1668
diff changeset
58 void hk_postconnect(void);
b09f82f61745 Split HOOK_INTERNAL
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1668
diff changeset
59 void hk_predisconnect(void);
1352
61a54e172010 Add internal hooks support
Mikael Berthe <mikael@lilotux.net>
parents: 1058
diff changeset
60
281
f562b9af2de7 Add "const" specifier in prototypes
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
61 void hk_ext_cmd_init(const char *command);
1058
c0d44a9a99bc Code cleanup
Mikael Berthe <mikael@lilotux.net>
parents: 1055
diff changeset
62 void hk_ext_cmd(const char *bjid, guchar type, guchar info, const char *data);
160
44c6410b4845 [/trunk] Changeset 172 by mikael
mikael
parents: 116
diff changeset
63
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1658
diff changeset
64 #endif /* __MCABBER_HOOKS_H__ */
576
8b3db0b555a1 Add Vim modelines
Mikael Berthe <mikael@lilotux.net>
parents: 484
diff changeset
65
580
fed6d1e4d7a9 Fix modelines
Mikael Berthe <mikael@lilotux.net>
parents: 576
diff changeset
66 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */