| 1 |
From 5301dbbea1db1a7ca8f780cc377df27e5ce515e9 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Andrew Freeman <[email protected]> |
| 3 |
Date: Mon, 7 Nov 2011 14:16:12 -0500 |
| 4 |
Subject: GTalk support by github/freemandrew |
| 5 |
|
| 6 |
This patch is a merge of the following commits from |
| 7 |
https://github.com/freemandrew/irssi-xmpp: |
| 8 |
|
| 9 |
- simple gtalk chatroom fix (a1935b7dd0279df7c3cde71e34e524391b610831) |
| 10 |
- more presence changes to interop with gtalk (f7c4611d6ce90856a89d74c00abda2bd2225df32) |
| 11 |
- test (6a7ffd9aaf5e56f353b3624a5f4a44218c37590f) |
| 12 |
- the "lm_message_node_get_child(parent, ..." hunk from "works with some stuff now but not others, awesome" (e96a1a9850ad7ed33aa89b96bcfa78352b2d82c5) |
| 13 |
- missed one! (a968ecf495e0e41ac30c1aa30ef6d391764d00f1) |
| 14 |
|
| 15 |
Support for GTalk |
| 16 |
============== |
| 17 |
|
| 18 |
I'm new to github so I hope this note suffices for now. I updated this plugin |
| 19 |
mainly to get IRSSI working with GTalk. In group chats, I've recently started |
| 20 |
to get segfaults but haven't had the time to track down the issue. For the most |
| 21 |
part, it works... |
| 22 |
|
| 23 |
Author: Andrew Freeman <[email protected]> |
| 24 |
--- |
| 25 |
src/core/xep/muc-events.c | 46 +++++++++++++++++++++++++++------------------- |
| 26 |
1 file changed, 27 insertions(+), 19 deletions(-) |
| 27 |
|
| 28 |
--- a/src/core/xep/muc-events.c |
| 29 |
+++ b/src/core/xep/muc-events.c |
| 30 |
@@ -305,15 +305,15 @@ |
| 31 |
item_affiliation = item_role = status = NULL; |
| 32 |
item_jid = item_nick = NULL; |
| 33 |
/* <x xmlns='http://jabber.org/protocol/muc#user'> */ |
| 34 |
- if ((node = lm_find_node(lmsg->node, "x", XMLNS, |
| 35 |
- XMLNS_MUC_USER)) == NULL) |
| 36 |
+ if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user", XMLNS_MUC_USER)) == NULL && |
| 37 |
+ (node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER)) == NULL) |
| 38 |
return; |
| 39 |
/* <status code='110'/> */ |
| 40 |
- own = lm_find_node(node, "status", "code", "110") != NULL; |
| 41 |
+ own = lm_find_node(node, "status", "code", "110") != NULL || lm_find_node(node, "user:status", "code", "110") != NULL ; |
| 42 |
/* <status code='210'/> */ |
| 43 |
- forced = lm_find_node(node, "status", "code", "210") != NULL; |
| 44 |
+ forced = lm_find_node(node, "status", "code", "210") != NULL || lm_find_node(node, "user:status", "code", "210") != NULL; |
| 45 |
/* <status code='201'/> */ |
| 46 |
- created = lm_find_node(node, "status", "code", "201") != NULL; |
| 47 |
+ created = lm_find_node(node, "status", "code", "201") != NULL || lm_find_node(node, "user:status", "code", "201") != NULL; |
| 48 |
if (created) { |
| 49 |
char str[MAX_LONG_STRLEN], *data, *recoded; |
| 50 |
LmMessage *lmsg; |
| 51 |
@@ -339,7 +339,9 @@ |
| 52 |
signal_emit("event 329", 2, channel->server, data); |
| 53 |
g_free(data); |
| 54 |
} |
| 55 |
- if ((node = lm_message_node_get_child(node, "item")) == NULL) |
| 56 |
+ LmMessageNode *parent = node; |
| 57 |
+ if ((node = lm_message_node_get_child(parent, "user:item")) == NULL && |
| 58 |
+ (node = lm_message_node_get_child(parent, "item")) == NULL) |
| 59 |
return; |
| 60 |
/* <item affiliation='item_affiliation' |
| 61 |
* role='item_role' |
| 62 |
@@ -358,8 +360,8 @@ |
| 63 |
else |
| 64 |
nick_event(channel, nick, item_jid, item_affiliation, item_role); |
| 65 |
/* <status>text</status> */ |
| 66 |
- node = lm_message_node_get_child(lmsg->node, "status"); |
| 67 |
- if (node != NULL) |
| 68 |
+ if ((node = lm_message_node_get_child(lmsg->node, "user:status")) != NULL || |
| 69 |
+ (node = lm_message_node_get_child(lmsg->node, "status")) != NULL) |
| 70 |
status = xmpp_recode_in(node->value); |
| 71 |
/* <show>show</show> */ |
| 72 |
node = lm_message_node_get_child(lmsg->node, "show"); |
| 73 |
@@ -379,16 +381,20 @@ |
| 74 |
status_code = NULL; |
| 75 |
reason = actor = item_nick = status = NULL; |
| 76 |
/* <x xmlns='http://jabber.org/protocol/muc#user'> */ |
| 77 |
- node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER); |
| 78 |
- if (node != NULL) { |
| 79 |
+ if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user", |
| 80 |
+ XMLNS_MUC_USER)) != NULL || |
| 81 |
+ (node = lm_find_node(lmsg->node, "x", XMLNS, |
| 82 |
+ XMLNS_MUC_USER)) != NULL) |
| 83 |
+ { |
| 84 |
/* <status code='status_code'/> */ |
| 85 |
- child = lm_message_node_get_child(node, "status"); |
| 86 |
- if (child != NULL) |
| 87 |
+ if ((child = lm_message_node_get_child(node, "user:status")) != NULL || |
| 88 |
+ (child = lm_message_node_get_child(node, "status")) != NULL) |
| 89 |
status_code = |
| 90 |
lm_message_node_get_attribute(child, "code"); |
| 91 |
/* <item nick='item_nick'> */ |
| 92 |
- node = lm_message_node_get_child(node, "item"); |
| 93 |
- if (node != NULL) { |
| 94 |
+ LmMessageNode *parent = node; |
| 95 |
+ if ((node = lm_message_node_get_child(parent, "user:item")) != NULL || |
| 96 |
+ (node = lm_message_node_get_child(parent, "item")) != NULL) { |
| 97 |
item_nick = xmpp_recode_in( |
| 98 |
lm_message_node_get_attribute(node, "nick")); |
| 99 |
/* <reason>reason</reason> */ |
| 100 |
@@ -416,8 +422,8 @@ |
| 101 |
} |
| 102 |
} else { |
| 103 |
/* <status>text</status> */ |
| 104 |
- node = lm_message_node_get_child(lmsg->node, "status"); |
| 105 |
- if (node != NULL) |
| 106 |
+ if ((node = lm_message_node_get_child(lmsg->node, "user:status")) != NULL || |
| 107 |
+ (node = lm_message_node_get_child(lmsg->node, "status")) != NULL) |
| 108 |
status = xmpp_recode_in(node->value); |
| 109 |
nick_part(channel, nick, status); |
| 110 |
g_free(status); |
| 111 |
@@ -507,8 +513,10 @@ |
| 112 |
if ((channel = get_muc(server, from)) == NULL) { |
| 113 |
/* Not a joined channel, search the MUC namespace */ |
| 114 |
/* <x xmlns='http://jabber.org/protocol/muc#user'> */ |
| 115 |
- node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER); |
| 116 |
- if (node == NULL) |
| 117 |
+ if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user", |
| 118 |
+ XMLNS_MUC_USER)) == NULL && |
| 119 |
+ (node = lm_find_node(lmsg->node, "x", XMLNS, |
| 120 |
+ XMLNS_MUC_USER)) == NULL) |
| 121 |
return; |
| 122 |
switch (type) { |
| 123 |
case LM_MESSAGE_SUB_TYPE_NOT_SET: |