aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/message.c
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-11-23 19:09:39 -0300
committerdequis <dx@dxzone.com.ar>2015-12-16 12:35:04 -0300
commitd11ccbf6ea94264bde8b0f525c4bbedf50de0174 (patch)
tree117472f5c00f83d1075bdab41fb1ef2c753544a1 /protocols/jabber/message.c
parent3a620ff93afb90f1b9114bab0faad65cad5dd80e (diff)
hipchat: Implement their own variant of self-messages (not working yet)
Reuses part of the carbons code, but it's not like it at all. To be able to receive these messages at all, a different cap node whitelisted by them is required. I could have used one of the official clients, but let's try to get things done the right way. This will start working once they make that change in their servers, right now this is still in their ticket backlog. I'm merging this now because it's harmless and nice to have as part of the upcoming release.
Diffstat (limited to 'protocols/jabber/message.c')
-rw-r--r--protocols/jabber/message.c12
1 files changed, 12 insertions, 0 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='...'>