Mercurial > ~mikael > mcabber > hg
diff mcabber/mcabber/xmpp.c @ 1906:5d37cee8c6c6
Add "hook-subscription" hook and hk_subscription()
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 17 Apr 2010 14:03:37 +0200 |
parents | 68a4f8dda3e7 |
children | e2def760c6d0 |
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp.c Sat Apr 17 12:31:35 2010 +0200 +++ b/mcabber/mcabber/xmpp.c Sat Apr 17 14:03:37 2010 +0200 @@ -1521,19 +1521,25 @@ char *r; char *buf; int newbuddy; + LmMessageSubType mstype; + guint hook_result; const char *from = lm_message_get_from(m); - LmMessageSubType mstype; + const char *msg = lm_message_node_get_child_value(m->node, "status"); r = jidtodisp(from); newbuddy = !roster_find(r, jidsearch, 0); mstype = lm_message_get_sub_type(m); + hook_result = hk_subscription(mstype, r, msg); + if (mstype == LM_MESSAGE_SUB_TYPE_SUBSCRIBE) { /* The sender wishes to subscribe to our presence */ - const char *msg; - msg = lm_message_node_get_child_value(m->node, "status"); + if (hook_result) { + g_free(r); + return LM_HANDLER_RESULT_REMOVE_MESSAGE; + } buf = g_strdup_printf("<%s> wants to subscribe to your presence updates", from);