diff options
| -rw-r--r-- | protocols/jabber/message.c | 12 | ||||
| -rw-r--r-- | protocols/jabber/presence.c | 8 | 
2 files changed, 19 insertions, 1 deletions
| diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index c57e6337..5a271fa8 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -26,6 +26,7 @@  static xt_status jabber_pkt_message_normal(struct xt_node *node, gpointer data, gboolean carbons_sent)  {  	struct im_connection *ic = data; +	struct jabber_data *jd = ic->proto_data;  	char *from = xt_find_attr(node, carbons_sent ? "to" : "from");  	char *type = xt_find_attr(node, "type");  	char *id = xt_find_attr(node, "id"); @@ -38,6 +39,17 @@ static xt_status jabber_pkt_message_normal(struct xt_node *node, gpointer data,  		return XT_HANDLED; /* Consider this packet corrupted. */  	} +	/* try to detect hipchat's own version of self-messages */ +	if (jd->flags & JFLAG_HIPCHAT) { +		struct xt_node *c; + +		if ((c = xt_find_node_by_attr(node->children, "delay", "xmlns", XMLNS_DELAY)) && +		    (s = xt_find_attr(c, "from_jid")) && +		    jabber_compare_jid(s, jd->me)) { +			carbons_sent = TRUE; +		} +	} +  	if (request && id && g_strcmp0(type, "groupchat") != 0 && !carbons_sent) {  		/* Send a message receipt (XEP-0184), looking like this:  		 * <message from='...' id='...' to='...'> diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c index 14060148..6ee9ff0a 100644 --- a/protocols/jabber/presence.c +++ b/protocols/jabber/presence.c @@ -221,7 +221,13 @@ int presence_send_update(struct im_connection *ic)  	   Trillian seem to do this right. */  	cap = xt_new_node("c", NULL, NULL);  	xt_add_attr(cap, "xmlns", XMLNS_CAPS); -	xt_add_attr(cap, "node", "http://bitlbee.org/xmpp/caps"); + +	if (jd->flags & JFLAG_HIPCHAT) { +		/* hipchat specific node, whitelisted by request to receive self-messages */ +		xt_add_attr(cap, "node", "http://bitlbee.org/xmpp/caps/hipchat"); +	} else { +		xt_add_attr(cap, "node", "http://bitlbee.org/xmpp/caps"); +	}  	xt_add_attr(cap, "ver", BITLBEE_VERSION);   /* The XEP wants this hashed, but nobody's doing that. */  	xt_add_child(node, cap); | 
