X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fhcxmpp.git;a=blobdiff_plain;f=xmpp.c;h=b25898466cedd68f375976bc7e93c4d38f41252f;hp=94cd9ab3bfad8638c8ca2bdcb6deab93cb68de6f;hb=HEAD;hpb=8a0e2834ab01c824196aab0e81c713f6b88110cd diff --git a/xmpp.c b/xmpp.c index 94cd9ab..b258984 100644 --- a/xmpp.c +++ b/xmpp.c @@ -39,6 +39,7 @@ hc_xmpp_new (iksStreamHook *hook, char *server, char *user, char *pass) xmpp->sasl = NONE; xmpp->status = HC_XMPP_NONE; xmpp->msghook = NULL; + xmpp->sentmsghook = NULL; xmpp->nshooks = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_insert (xmpp->nshooks, HC_XMPP_NS_BIND, hc_xmpp_hook_bind); g_hash_table_insert (xmpp->nshooks, HC_XMPP_NS_SESSION, hc_xmpp_hook_session); @@ -168,9 +169,48 @@ hc_xmpp_set_msg_hook (hc_xmpp_t *xmpp, hc_xmpp_hook_t hook) xmpp->msghook = hook; } +void +hc_xmpp_set_sent_msg_hook (hc_xmpp_t *xmpp, hc_xmpp_hook_t hook) +{ + xmpp->sentmsghook = hook; +} + +void +hc_xmpp_set_pres_hook (hc_xmpp_t *xmpp, hc_xmpp_hook_t hook) +{ + xmpp->preshook = hook; +} + +void +hc_xmpp_set_sent_pres_hook (hc_xmpp_t *xmpp, hc_xmpp_hook_t hook) +{ + xmpp->sentpreshook = hook; +} + void hc_xmpp_recv_message (hc_xmpp_t *xmpp, iks *stanza) { if (xmpp->msghook) xmpp->msghook (xmpp, stanza); } + +void +hc_xmpp_sent_message (hc_xmpp_t *xmpp, iks *stanza) +{ + if (xmpp->sentmsghook) + xmpp->sentmsghook (xmpp, stanza); +} + +void +hc_xmpp_recv_presence (hc_xmpp_t *xmpp, iks *stanza) +{ + if (xmpp->preshook) + xmpp->preshook (xmpp, stanza); +} + +void +hc_xmpp_sent_presence (hc_xmpp_t *xmpp, iks *stanza) +{ + if (xmpp->sentpreshook) + xmpp->sentpreshook (xmpp, stanza); +}