Package: irssi-plugin-xmpp / 0.53-1~bpo8+1

GTalk-MUC-support.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
From 5301dbbea1db1a7ca8f780cc377df27e5ce515e9 Mon Sep 17 00:00:00 2001
From: Andrew Freeman <andrewf@freemanity.com>
Date: Mon, 7 Nov 2011 14:16:12 -0500
Subject: GTalk support by github/freemandrew

This patch is a merge of the following commits from
https://github.com/freemandrew/irssi-xmpp:

- simple gtalk chatroom fix (a1935b7dd0279df7c3cde71e34e524391b610831)
- more presence changes to interop with gtalk (f7c4611d6ce90856a89d74c00abda2bd2225df32)
- test (6a7ffd9aaf5e56f353b3624a5f4a44218c37590f)
- the "lm_message_node_get_child(parent, ..." hunk from "works with some stuff now but not others, awesome" (e96a1a9850ad7ed33aa89b96bcfa78352b2d82c5)
- missed one! (a968ecf495e0e41ac30c1aa30ef6d391764d00f1)

Support for GTalk
==============

I'm new to github so I hope this note suffices for now.  I updated this plugin
mainly to get IRSSI working with GTalk.  In group chats, I've recently started
to get segfaults but haven't had the time to track down the issue.  For the most
part, it works...

Author:    Andrew Freeman <andrewf@freemanity.com>
---
 src/core/xep/muc-events.c | 46 +++++++++++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 19 deletions(-)

--- a/src/core/xep/muc-events.c
+++ b/src/core/xep/muc-events.c
@@ -288,15 +288,15 @@
 	item_affiliation = item_role = status = NULL;
 	item_jid = item_nick = NULL;
 	/* <x xmlns='http://jabber.org/protocol/muc#user'> */
-	if ((node = lm_find_node(lmsg->node, "x", XMLNS,
-	    XMLNS_MUC_USER)) == NULL)
+	if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user", XMLNS_MUC_USER)) == NULL &&
+	    (node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER)) == NULL)
 		return;
 	/* <status code='110'/> */
-	own = lm_find_node(node, "status", "code", "110") != NULL;
+	own = lm_find_node(node, "status", "code", "110") != NULL || lm_find_node(node, "user:status", "code", "110") != NULL ;
 	/* <status code='210'/> */
-	forced = lm_find_node(node, "status", "code", "210") != NULL;
+	forced = lm_find_node(node, "status", "code", "210") != NULL || lm_find_node(node, "user:status", "code", "210") != NULL;
 	/* <status code='201'/> */
-	created = lm_find_node(node, "status", "code", "201") != NULL;
+	created = lm_find_node(node, "status", "code", "201") != NULL || lm_find_node(node, "user:status", "code", "201") != NULL;
 	if (created) {
 		char str[MAX_LONG_STRLEN], *data;
 
@@ -306,7 +306,9 @@
 		signal_emit("event 329", 2, channel->server, data);
 		g_free(data);
 	}
-	if ((node = lm_message_node_get_child(node, "item")) == NULL)
+        LmMessageNode *parent = node;
+	if ((node = lm_message_node_get_child(parent, "user:item")) == NULL &&
+	    (node = lm_message_node_get_child(parent, "item")) == NULL)
 		return;
 	/* <item affiliation='item_affiliation'
 	 *     role='item_role'
@@ -322,11 +324,11 @@
 	if (own || strcmp(nick, channel->nick) == 0)
 		own_event(channel, nick, item_jid, item_affiliation, item_role,
 		    forced);
-	else 
+	else
 		nick_event(channel, nick, item_jid, item_affiliation, item_role);
 	/* <status>text</status> */
-	node = lm_message_node_get_child(lmsg->node, "status");
-	if (node != NULL)
+	if ((node = lm_message_node_get_child(lmsg->node, "user:status")) != NULL ||
+	    (node = lm_message_node_get_child(lmsg->node, "status")) != NULL)
 		status = xmpp_recode_in(node->value);
 	/* <show>show</show> */
 	node = lm_message_node_get_child(lmsg->node, "show");
@@ -346,16 +348,20 @@
 	status_code = NULL;
 	reason = actor = item_nick = status = NULL;
 	/* <x xmlns='http://jabber.org/protocol/muc#user'> */
-	node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER);
-	if (node != NULL) {
+    if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user",
+                XMLNS_MUC_USER)) != NULL ||
+        (node = lm_find_node(lmsg->node, "x", XMLNS,
+                XMLNS_MUC_USER)) != NULL)
+    {
 		/* <status code='status_code'/> */
-		child = lm_message_node_get_child(node, "status");
-		if (child != NULL)
+	    if ((child = lm_message_node_get_child(node, "user:status")) != NULL ||
+	        (child = lm_message_node_get_child(node, "status")) != NULL)
 			status_code =
 			    lm_message_node_get_attribute(child, "code");
 		/* <item nick='item_nick'> */
-		node = lm_message_node_get_child(node, "item");
-		if (node != NULL) {
+        LmMessageNode *parent = node;
+	    if ((node = lm_message_node_get_child(parent, "user:item")) != NULL ||
+	        (node = lm_message_node_get_child(parent, "item")) != NULL) {
 			item_nick = xmpp_recode_in(
 			    lm_message_node_get_attribute(node, "nick"));
 			/* <reason>reason</reason> */
@@ -383,8 +389,8 @@
 		}
 	} else {
 		/* <status>text</status> */
-		node = lm_message_node_get_child(lmsg->node, "status");
-		if (node != NULL)
+	    if ((node = lm_message_node_get_child(lmsg->node, "user:status")) != NULL ||
+	        (node = lm_message_node_get_child(lmsg->node, "status")) != NULL)
 			status = xmpp_recode_in(node->value);
 		nick_part(channel, nick, status);
 		g_free(status);
@@ -438,8 +444,10 @@
 	if ((channel = get_muc(server, from)) == NULL) {
 		/* Not a joined channel, search the MUC namespace */
 		/* <x xmlns='http://jabber.org/protocol/muc#user'> */
-		node = lm_find_node(lmsg->node, "x", XMLNS, XMLNS_MUC_USER);
-		if (node == NULL)
+        if ((node = lm_find_node(lmsg->node, "user:x", XMLNS ":user",
+                    XMLNS_MUC_USER)) == NULL &&
+            (node = lm_find_node(lmsg->node, "x", XMLNS,
+                    XMLNS_MUC_USER)) == NULL)
 			return;
 		switch (type) {
 		case LM_MESSAGE_SUB_TYPE_NOT_SET: