annotate mcabber/mcabber/hooks.h @ 2223:965e0282c128

Backed out changeset fa516ef22145 Turns out that in this hash the value pointer is the same as the key pointer, so there's no need to free both the key and the value.
author Mikael Berthe <mikael@lilotux.net>
date Fri, 06 Nov 2015 22:31:40 +0100
parents ee3a40ffcd8b
children
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"
2141
e702073612de Add "hook-mdr-received" hook
Mikael Berthe <mikael@lilotux.net>
parents: 1906
diff changeset
20 #define HOOK_MDR_RECEIVED "hook-mdr-received"
1795
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
21 #define HOOK_STATUS_CHANGE "hook-status-change"
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
22 #define HOOK_MY_STATUS_CHANGE "hook-my-status-change"
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
23 #define HOOK_POST_CONNECT "hook-post-connect"
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
24 #define HOOK_PRE_DISCONNECT "hook-pre-disconnect"
1806
9daf6b3f30d6 Add hook-unread-list-change
Mikael Berthe <mikael@lilotux.net>
parents: 1797
diff changeset
25 #define HOOK_UNREAD_LIST_CHANGE "hook-unread-list-change"
1906
5d37cee8c6c6 Add "hook-subscription" hook and hk_subscription()
Mikael Berthe <mikael@lilotux.net>
parents: 1816
diff changeset
26 #define HOOK_SUBSCRIPTION "hook-subscription"
1795
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
27
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
28 typedef enum {
1813
1c3efa9bc422 s/HOOK_HANDLER_RESULT_ALLOW_MORE_HOOKS/HOOK_HANDLER_RESULT_ALLOW_MORE_HANDLERS
Mikael Berthe <mikael@lilotux.net>
parents: 1812
diff changeset
29 HOOK_HANDLER_RESULT_ALLOW_MORE_HANDLERS = 0,
1816
6ac5718f8d25 Update handler return code defines (take #2)
Mikael Berthe <mikael@lilotux.net>
parents: 1813
diff changeset
30 HOOK_HANDLER_RESULT_NO_MORE_HANDLER,
6ac5718f8d25 Update handler return code defines (take #2)
Mikael Berthe <mikael@lilotux.net>
parents: 1813
diff changeset
31 HOOK_HANDLER_RESULT_NO_MORE_HANDLER_DROP_DATA,
1795
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
32 } hk_handler_result;
1623
b008ac166b91 Flags for hook handlers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1607
diff changeset
33
1607
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
34 typedef struct {
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
35 const char *name;
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
36 const char *value;
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
37 } hk_arg_t;
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 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
40 gpointer userdata);
1607
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
41
1795
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
42 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
43 gint priority, gpointer userdata);
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
44 void hk_del_handler(const gchar *hookname, guint hid);
47699a09ceb3 Rework the hook system
Mikael Berthe <mikael@lilotux.net>
parents: 1784
diff changeset
45 guint hk_run_handlers(const gchar *hookname, hk_arg_t *args);
1607
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
46 #endif
14690e624e9d Add modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
47
1398
f8321420ed7a Remove useless inline's
Mikael Berthe <mikael@lilotux.net>
parents: 1352
diff changeset
48 void hk_message_in(const char *bjid, const char *resname,
1598
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1484
diff changeset
49 time_t timestamp, const char *msg, LmMessageSubType type,
2156
a54c084af4d6 Add a "carbon" parameter to the hook-{pre,post}-message-in hooks
Mikael Berthe <mikael@lilotux.net>
parents: 2141
diff changeset
50 guint encrypted, gboolean carbon);
1398
f8321420ed7a Remove useless inline's
Mikael Berthe <mikael@lilotux.net>
parents: 1352
diff changeset
51 void hk_message_out(const char *bjid, const char *nickname,
1602
f4a2c6f767d1 Message Receipts support (XEP-0184)
franky
parents: 1598
diff changeset
52 time_t timestamp, const char *msg,
2190
ee3a40ffcd8b New option: 'clear_unread_on_carbon'
Holger Weiß <holger@zedat.fu-berlin.de>
parents: 2156
diff changeset
53 guint encrypted, gboolean carbon, gpointer xep184);
1398
f8321420ed7a Remove useless inline's
Mikael Berthe <mikael@lilotux.net>
parents: 1352
diff changeset
54 void hk_statuschange(const char *bjid, const char *resname, gchar prio,
1598
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1484
diff changeset
55 time_t timestamp, enum imstatus status,
a087125d8fc8 Replace libjabber with loudmouth
franky
parents: 1484
diff changeset
56 char const *status_msg);
1398
f8321420ed7a Remove useless inline's
Mikael Berthe <mikael@lilotux.net>
parents: 1352
diff changeset
57 void hk_mystatuschange(time_t timestamp,
1784
250ad919f03f Small code cleanup in hooks.[ch]
Mikael Berthe <mikael@lilotux.net>
parents: 1683
diff changeset
58 enum imstatus old_status, enum imstatus new_status,
250ad919f03f Small code cleanup in hooks.[ch]
Mikael Berthe <mikael@lilotux.net>
parents: 1683
diff changeset
59 const char *msg);
113
8ac67e951eab [/trunk] Changeset 127 by mikael
mikael
parents:
diff changeset
60
1683
b09f82f61745 Split HOOK_INTERNAL
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1668
diff changeset
61 void hk_postconnect(void);
b09f82f61745 Split HOOK_INTERNAL
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1668
diff changeset
62 void hk_predisconnect(void);
1352
61a54e172010 Add internal hooks support
Mikael Berthe <mikael@lilotux.net>
parents: 1058
diff changeset
63
1812
5dbb3ebbc466 Add hk_unread_list_change()
Mikael Berthe <mikael@lilotux.net>
parents: 1811
diff changeset
64 void hk_unread_list_change(guint unread_count, guint attention_count,
5dbb3ebbc466 Add hk_unread_list_change()
Mikael Berthe <mikael@lilotux.net>
parents: 1811
diff changeset
65 guint muc_unread, guint muc_attention);
5dbb3ebbc466 Add hk_unread_list_change()
Mikael Berthe <mikael@lilotux.net>
parents: 1811
diff changeset
66
1906
5d37cee8c6c6 Add "hook-subscription" hook and hk_subscription()
Mikael Berthe <mikael@lilotux.net>
parents: 1816
diff changeset
67 guint hk_subscription(LmMessageSubType mstype, const gchar *bjid,
5d37cee8c6c6 Add "hook-subscription" hook and hk_subscription()
Mikael Berthe <mikael@lilotux.net>
parents: 1816
diff changeset
68 const gchar *msg);
5d37cee8c6c6 Add "hook-subscription" hook and hk_subscription()
Mikael Berthe <mikael@lilotux.net>
parents: 1816
diff changeset
69
281
f562b9af2de7 Add "const" specifier in prototypes
Mikael Berthe <mikael@lilotux.net>
parents: 221
diff changeset
70 void hk_ext_cmd_init(const char *command);
1058
c0d44a9a99bc Code cleanup
Mikael Berthe <mikael@lilotux.net>
parents: 1055
diff changeset
71 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
72
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1658
diff changeset
73 #endif /* __MCABBER_HOOKS_H__ */
576
8b3db0b555a1 Add Vim modelines
Mikael Berthe <mikael@lilotux.net>
parents: 484
diff changeset
74
1811
e6d355e50d7a Update Vim modelines
Mikael Berthe <mikael@lilotux.net>
parents: 1806
diff changeset
75 /* vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2: For Vim users... */