Fri, 07 Oct 2022 01:21:28 -0500
xmpp: Remove unused prototypes and code
Many functions are 'public' in that they are in header files, but they don't need to be. The `jabber.c` ones were likely there because of the xmpp/gtalk multi-library thing that's gone now.
This removal is 'naive', in that if a prototype is necessary for now-`static` functions, then that's all I did, instead of any re-ordering.
I also left in some 'unused' `data.c` functions as their use was deleted when removing smileys and they _may_ still be needed.
Testing Done:
Compiled.
Reviewed at https://reviews.imfreedom.org/r/1905/
| 7014 | 1 | /* |
| 15884 | 2 | * purple - Jabber Protocol Plugin |
| 7014 | 3 | * |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28158
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28158
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28158
diff
changeset
|
6 | * source distribution. |
| 7014 | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19854
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7014 | 21 | * |
| 22 | */ | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
24 | |
|
40358
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
38854
diff
changeset
|
25 | #include <purple.h> |
| 7014 | 26 | |
| 27 | #include "chat.h" | |
| 7895 | 28 | #include "iq.h" |
| 7014 | 29 | #include "message.h" |
| 7073 | 30 | #include "presence.h" |
| 7923 | 31 | #include "xdata.h" |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23403
diff
changeset
|
32 | #include "data.h" |
| 7014 | 33 | |
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
34 | GList * |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
35 | jabber_chat_info(PurpleProtocolChat *protocol_chat, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
36 | PurpleConnection *connection) |
| 7014 | 37 | { |
| 38 | GList *m = NULL; | |
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
39 | PurpleProtocolChatEntry *pce; |
| 7014 | 40 | |
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
41 | pce = g_new0(PurpleProtocolChatEntry, 1); |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7400
diff
changeset
|
42 | pce->label = _("_Room:"); |
| 7014 | 43 | pce->identifier = "room"; |
| 10959 | 44 | pce->required = TRUE; |
| 7014 | 45 | m = g_list_append(m, pce); |
| 46 | ||
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
47 | pce = g_new0(PurpleProtocolChatEntry, 1); |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7400
diff
changeset
|
48 | pce->label = _("_Server:"); |
| 7014 | 49 | pce->identifier = "server"; |
| 10959 | 50 | pce->required = TRUE; |
| 7014 | 51 | m = g_list_append(m, pce); |
| 52 | ||
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
53 | pce = g_new0(PurpleProtocolChatEntry, 1); |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7400
diff
changeset
|
54 | pce->label = _("_Handle:"); |
| 7014 | 55 | pce->identifier = "handle"; |
| 10959 | 56 | pce->required = TRUE; |
| 7014 | 57 | m = g_list_append(m, pce); |
| 58 | ||
|
36555
fc17a4351e63
Replaced struct proto_chat_entry with PurpleProtocolChatEntry
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
59 | pce = g_new0(PurpleProtocolChatEntry, 1); |
|
7841
0000a4c68bf8
[gaim-migrate @ 8494]
Mark Doliner <markdoliner@pidgin.im>
parents:
7400
diff
changeset
|
60 | pce->label = _("_Password:"); |
| 7014 | 61 | pce->identifier = "password"; |
| 62 | pce->secret = TRUE; | |
| 63 | m = g_list_append(m, pce); | |
| 64 | ||
| 65 | return m; | |
| 66 | } | |
| 67 | ||
| 15884 | 68 | GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name) |
|
9754
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
69 | { |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
70 | GHashTable *defaults; |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
71 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
9754
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
72 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
73 | defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
74 | |
|
9770
d61fe8dcb6d9
[gaim-migrate @ 10638]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9762
diff
changeset
|
75 | g_hash_table_insert(defaults, "handle", g_strdup(js->user->node)); |
|
d61fe8dcb6d9
[gaim-migrate @ 10638]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9762
diff
changeset
|
76 | |
|
d61fe8dcb6d9
[gaim-migrate @ 10638]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9762
diff
changeset
|
77 | if (js->chat_servers) |
|
d61fe8dcb6d9
[gaim-migrate @ 10638]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9762
diff
changeset
|
78 | g_hash_table_insert(defaults, "server", g_strdup(js->chat_servers->data)); |
|
d61fe8dcb6d9
[gaim-migrate @ 10638]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9762
diff
changeset
|
79 | |
|
9754
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
80 | if (chat_name != NULL) { |
| 9760 | 81 | JabberID *jid = jabber_id_new(chat_name); |
| 82 | if(jid) { | |
| 83 | g_hash_table_insert(defaults, "room", g_strdup(jid->node)); | |
| 84 | if(jid->domain) | |
|
9770
d61fe8dcb6d9
[gaim-migrate @ 10638]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9762
diff
changeset
|
85 | g_hash_table_replace(defaults, "server", g_strdup(jid->domain)); |
| 15185 | 86 | if(jid->resource) |
| 87 | g_hash_table_replace(defaults, "handle", g_strdup(jid->resource)); | |
| 9760 | 88 | jabber_id_free(jid); |
| 89 | } | |
|
9754
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
90 | } |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
91 | |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
92 | return defaults; |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
93 | } |
|
3a17eee239b2
[gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents:
9713
diff
changeset
|
94 | |
| 7014 | 95 | JabberChat *jabber_chat_find(JabberStream *js, const char *room, |
| 96 | const char *server) | |
| 97 | { | |
| 10607 | 98 | JabberChat *chat = NULL; |
| 7014 | 99 | |
|
28584
1226297d1ba9
jabber: Don't crash when adding a buddy without a node (no '@'). Closes #10261.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
100 | g_return_val_if_fail(room != NULL, NULL); |
|
1226297d1ba9
jabber: Don't crash when adding a buddy without a node (no '@'). Closes #10261.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
101 | g_return_val_if_fail(server != NULL, NULL); |
|
1226297d1ba9
jabber: Don't crash when adding a buddy without a node (no '@'). Closes #10261.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
102 | |
| 10607 | 103 | if(NULL != js->chats) |
| 104 | { | |
|
23130
7193be04646f
Close up scope of a variable, I'm just cleaning up my tree some.
Etan Reisner <deryni@pidgin.im>
parents:
22919
diff
changeset
|
105 | char *room_jid = g_strdup_printf("%s@%s", room, server); |
| 7014 | 106 | |
|
28687
9de3f49f3b30
jabber: Remove useless jabber_normalize calls now that the data in the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
28677
diff
changeset
|
107 | chat = g_hash_table_lookup(js->chats, room_jid); |
| 10607 | 108 | g_free(room_jid); |
| 109 | } | |
| 7014 | 110 | |
| 111 | return chat; | |
| 112 | } | |
| 113 | ||
|
40792
c3bfc50abd7c
Drop struct _find_by_id_data
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
114 | static gboolean |
|
c3bfc50abd7c
Drop struct _find_by_id_data
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
115 | find_by_id_cb(gpointer key, gpointer value, gpointer user_data) |
| 7014 | 116 | { |
| 117 | JabberChat *chat = value; | |
| 118 | ||
|
40792
c3bfc50abd7c
Drop struct _find_by_id_data
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
119 | return chat->id == GPOINTER_TO_INT(user_data); |
| 7014 | 120 | } |
| 121 | ||
| 122 | JabberChat *jabber_chat_find_by_id(JabberStream *js, int id) | |
| 123 | { | |
|
40792
c3bfc50abd7c
Drop struct _find_by_id_data
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40697
diff
changeset
|
124 | return g_hash_table_find(js->chats, find_by_id_cb, GINT_TO_POINTER(id)); |
| 7014 | 125 | } |
| 126 | ||
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
127 | JabberChat *jabber_chat_find_by_conv(PurpleChatConversation *conv) |
| 9130 | 128 | { |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
129 | PurpleAccount *account = purple_conversation_get_account(PURPLE_CONVERSATION(conv)); |
| 15884 | 130 | PurpleConnection *gc = purple_account_get_connection(account); |
|
22804
3a3bc5f12e52
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
131 | JabberStream *js; |
|
3a3bc5f12e52
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
132 | int id; |
|
3a3bc5f12e52
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
133 | if (!gc) |
|
3a3bc5f12e52
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
134 | return NULL; |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
135 | js = purple_connection_get_protocol_data(gc); |
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
136 | id = purple_chat_conversation_get_id(conv); |
| 9130 | 137 | return jabber_chat_find_by_id(js, id); |
| 138 | } | |
| 139 | ||
| 15884 | 140 | void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg, |
| 7014 | 141 | const char *name) |
| 142 | { | |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
143 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 7014 | 144 | JabberChat *chat; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
145 | PurpleXmlNode *message, *body, *x, *invite; |
| 7014 | 146 | char *room_jid; |
| 147 | ||
| 148 | chat = jabber_chat_find_by_id(js, id); | |
| 149 | if(!chat) | |
| 150 | return; | |
| 151 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
152 | message = purple_xmlnode_new("message"); |
| 7014 | 153 | |
| 154 | room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
| 155 | ||
| 156 | if(chat->muc) { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
157 | purple_xmlnode_set_attrib(message, "to", room_jid); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
158 | x = purple_xmlnode_new_child(message, "x"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
159 | purple_xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
160 | invite = purple_xmlnode_new_child(x, "invite"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
161 | purple_xmlnode_set_attrib(invite, "to", name); |
|
30581
c63679097d60
jabber: Avoid an assertion warning
Paul Aurich <darkrain42@pidgin.im>
parents:
29400
diff
changeset
|
162 | if (msg) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
163 | body = purple_xmlnode_new_child(invite, "reason"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
164 | purple_xmlnode_insert_data(body, msg, -1); |
|
30581
c63679097d60
jabber: Avoid an assertion warning
Paul Aurich <darkrain42@pidgin.im>
parents:
29400
diff
changeset
|
165 | } |
| 7014 | 166 | } else { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
167 | purple_xmlnode_set_attrib(message, "to", name); |
|
28703
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
168 | /* |
|
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
169 | * Putting the reason into the body was an 'undocumented protocol, |
|
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
170 | * ...not part of "groupchat 1.0"'. |
|
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
171 | * http://xmpp.org/extensions/attic/jep-0045-1.16.html#invite |
|
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
172 | * |
|
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
173 | * Left here for compatibility. |
|
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
174 | */ |
|
30581
c63679097d60
jabber: Avoid an assertion warning
Paul Aurich <darkrain42@pidgin.im>
parents:
29400
diff
changeset
|
175 | if (msg) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
176 | body = purple_xmlnode_new_child(message, "body"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
177 | purple_xmlnode_insert_data(body, msg, -1); |
|
30581
c63679097d60
jabber: Avoid an assertion warning
Paul Aurich <darkrain42@pidgin.im>
parents:
29400
diff
changeset
|
178 | } |
|
28703
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
179 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
180 | x = purple_xmlnode_new_child(message, "x"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
181 | purple_xmlnode_set_attrib(x, "jid", room_jid); |
|
28703
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
182 | |
|
521344e75710
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <darkrain42@pidgin.im>
parents:
28687
diff
changeset
|
183 | /* The better place for it! XEP-0249 style. */ |
|
30581
c63679097d60
jabber: Avoid an assertion warning
Paul Aurich <darkrain42@pidgin.im>
parents:
29400
diff
changeset
|
184 | if (msg) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
185 | purple_xmlnode_set_attrib(x, "reason", msg); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
186 | purple_xmlnode_set_namespace(x, "jabber:x:conference"); |
| 7014 | 187 | } |
| 188 | ||
| 189 | jabber_send(js, message); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
190 | purple_xmlnode_free(message); |
| 7014 | 191 | g_free(room_jid); |
| 192 | } | |
| 193 | ||
| 9152 | 194 | void jabber_chat_member_free(JabberChatMember *jcm); |
| 195 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
196 | gchar * |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
197 | jabber_get_chat_name(PurpleProtocolChat *protocol_chat, GHashTable *data) { |
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
198 | char *room, *server, *chat_name = NULL; |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
199 | |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
200 | room = g_hash_table_lookup(data, "room"); |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
201 | server = g_hash_table_lookup(data, "server"); |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
202 | |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
203 | if (room && server) { |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
204 | chat_name = g_strdup_printf("%s@%s", room, server); |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
205 | } |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
206 | return chat_name; |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
207 | } |
|
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9913
diff
changeset
|
208 | |
|
23273
c42eae02c76e
g_hash_table_ref() / g_hash_table_unref() were added in too recent a glib version per Mark. Copy data to chat->components rather than using those.
Evan Schoenberg <evands@pidgin.im>
parents:
23270
diff
changeset
|
209 | static void insert_in_hash_table(gpointer key, gpointer value, gpointer user_data) |
|
c42eae02c76e
g_hash_table_ref() / g_hash_table_unref() were added in too recent a glib version per Mark. Copy data to chat->components rather than using those.
Evan Schoenberg <evands@pidgin.im>
parents:
23270
diff
changeset
|
210 | { |
|
c42eae02c76e
g_hash_table_ref() / g_hash_table_unref() were added in too recent a glib version per Mark. Copy data to chat->components rather than using those.
Evan Schoenberg <evands@pidgin.im>
parents:
23270
diff
changeset
|
211 | GHashTable *hash_table = (GHashTable *)user_data; |
|
23275
c8599f5dac4c
The key and value need to be g_stdup()'d before adding to the hash table
Evan Schoenberg <evands@pidgin.im>
parents:
23273
diff
changeset
|
212 | g_hash_table_insert(hash_table, g_strdup(key), g_strdup(value)); |
|
23273
c42eae02c76e
g_hash_table_ref() / g_hash_table_unref() were added in too recent a glib version per Mark. Copy data to chat->components rather than using those.
Evan Schoenberg <evands@pidgin.im>
parents:
23270
diff
changeset
|
213 | } |
|
c42eae02c76e
g_hash_table_ref() / g_hash_table_unref() were added in too recent a glib version per Mark. Copy data to chat->components rather than using those.
Evan Schoenberg <evands@pidgin.im>
parents:
23270
diff
changeset
|
214 | |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
215 | static JabberChat *jabber_chat_new(JabberStream *js, const char *room, |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
216 | const char *server, const char *handle, |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
217 | const char *password, GHashTable *data) |
| 7014 | 218 | { |
| 219 | JabberChat *chat; | |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
220 | char *jid; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
221 | |
|
28677
5615313acca3
jabber: Reduce these from assertions to checks.
Paul Aurich <darkrain42@pidgin.im>
parents:
28669
diff
changeset
|
222 | if (jabber_chat_find(js, room, server) != NULL) |
|
5615313acca3
jabber: Reduce these from assertions to checks.
Paul Aurich <darkrain42@pidgin.im>
parents:
28669
diff
changeset
|
223 | return NULL; |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
224 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
225 | chat = g_new0(JabberChat, 1); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
226 | chat->js = js; |
|
31442
fd16ffae2043
jabber: Treat the presence storm on joining a room as not new arrivals.
Thijs Alkemade <thijsalkemade@gmail.com>
parents:
30581
diff
changeset
|
227 | chat->joined = 0; |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
228 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
229 | chat->room = g_strdup(room); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
230 | chat->server = g_strdup(server); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
231 | chat->handle = g_strdup(handle); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
232 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
233 | /* Copy the data hash table to chat->components */ |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
234 | chat->components = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
235 | g_free, g_free); |
|
28669
f67839ca0064
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <darkrain42@pidgin.im>
parents:
28668
diff
changeset
|
236 | if (data == NULL) { |
|
f67839ca0064
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <darkrain42@pidgin.im>
parents:
28668
diff
changeset
|
237 | g_hash_table_insert(chat->components, g_strdup("handle"), g_strdup(handle)); |
|
f67839ca0064
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <darkrain42@pidgin.im>
parents:
28668
diff
changeset
|
238 | g_hash_table_insert(chat->components, g_strdup("room"), g_strdup(room)); |
|
f67839ca0064
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <darkrain42@pidgin.im>
parents:
28668
diff
changeset
|
239 | g_hash_table_insert(chat->components, g_strdup("server"), g_strdup(server)); |
|
f67839ca0064
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <darkrain42@pidgin.im>
parents:
28668
diff
changeset
|
240 | /* g_hash_table_insert(chat->components, g_strdup("password"), g_strdup(server)); */ |
|
f67839ca0064
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <darkrain42@pidgin.im>
parents:
28668
diff
changeset
|
241 | } else { |
|
f67839ca0064
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <darkrain42@pidgin.im>
parents:
28668
diff
changeset
|
242 | g_hash_table_foreach(data, insert_in_hash_table, chat->components); |
|
f67839ca0064
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <darkrain42@pidgin.im>
parents:
28668
diff
changeset
|
243 | } |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
244 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
245 | chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
246 | (GDestroyNotify)jabber_chat_member_free); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
247 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
248 | jid = g_strdup_printf("%s@%s", room, server); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
249 | g_hash_table_insert(js->chats, jid, chat); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
250 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
251 | return chat; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
252 | } |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
253 | |
|
41791
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
254 | /* |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
255 | * jabber_join_chat: |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
256 | * @room: The room to join. This MUST be normalized already. |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
257 | * @server: The server the room is on. This MUST be normalized already. |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
258 | * @password: (nullable): The password (if required) to join the room. |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
259 | * @data: (nullable): The chat hash table. If NULL, it will be generated for |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
260 | * current core<>protocol API interface. |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
261 | * |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
262 | * In-protocol function for joining a chat room. Doesn't require sticking goop |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
263 | * into a hash table. |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
264 | */ |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
265 | static JabberChat * |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
266 | jabber_join_chat(JabberStream *js, const char *room, const char *server, |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
267 | const char *handle, const char *password, GHashTable *data) |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
268 | { |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
269 | JabberChat *chat; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
270 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
271 | PurpleConnection *gc; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
272 | PurpleAccount *account; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
273 | PurpleStatus *status; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
274 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
275 | PurpleXmlNode *presence, *x; |
| 9954 | 276 | JabberBuddyState state; |
| 14525 | 277 | char *msg; |
| 9954 | 278 | int priority; |
| 7014 | 279 | |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
280 | char *jid; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
281 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
282 | chat = jabber_chat_new(js, room, server, handle, password, data); |
|
28677
5615313acca3
jabber: Reduce these from assertions to checks.
Paul Aurich <darkrain42@pidgin.im>
parents:
28669
diff
changeset
|
283 | if (chat == NULL) |
|
5615313acca3
jabber: Reduce these from assertions to checks.
Paul Aurich <darkrain42@pidgin.im>
parents:
28669
diff
changeset
|
284 | return NULL; |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
285 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
286 | gc = js->gc; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
287 | account = purple_connection_get_account(gc); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
288 | status = purple_account_get_active_status(account); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
289 | purple_status_to_jabber(status, &state, &msg, &priority); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
290 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
291 | presence = jabber_presence_create_js(js, state, msg, priority); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
292 | g_free(msg); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
293 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
294 | jid = g_strdup_printf("%s@%s/%s", room, server, handle); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
295 | purple_xmlnode_set_attrib(presence, "to", jid); |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
296 | g_free(jid); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
297 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
298 | x = purple_xmlnode_new_child(presence, "x"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
299 | purple_xmlnode_set_namespace(x, "http://jabber.org/protocol/muc"); |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
300 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
301 | if (password && *password) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
302 | PurpleXmlNode *p = purple_xmlnode_new_child(x, "password"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
303 | purple_xmlnode_insert_data(p, password, -1); |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
304 | } |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
305 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
306 | jabber_send(js, presence); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
307 | purple_xmlnode_free(presence); |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
308 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
309 | return chat; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
310 | } |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
311 | |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
312 | void jabber_chat_join(PurpleConnection *gc, GHashTable *data) |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
313 | { |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
314 | char *room, *server, *handle, *passwd; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
315 | JabberID *jid; |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
316 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
317 | char *tmp; |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
318 | |
| 7014 | 319 | room = g_hash_table_lookup(data, "room"); |
| 320 | server = g_hash_table_lookup(data, "server"); | |
| 321 | handle = g_hash_table_lookup(data, "handle"); | |
| 322 | passwd = g_hash_table_lookup(data, "password"); | |
| 323 | ||
| 8113 | 324 | if(!room || !server) |
| 7014 | 325 | return; |
| 326 | ||
| 8113 | 327 | if(!handle) |
| 328 | handle = js->user->node; | |
| 329 | ||
| 7310 | 330 | if(!jabber_nodeprep_validate(room)) { |
| 331 | char *buf = g_strdup_printf(_("%s is not a valid room name"), room); | |
| 15884 | 332 | purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
333 | buf, purple_request_cpar_from_connection(gc)); |
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
334 | purple_serv_got_join_chat_failed(gc, data); |
| 7310 | 335 | g_free(buf); |
| 336 | return; | |
|
27728
03b2a20ba465
Validate IPv6 identifiers in the domain portion of a JID.
Paul Aurich <darkrain42@pidgin.im>
parents:
27155
diff
changeset
|
337 | } else if(!jabber_domain_validate(server)) { |
| 7310 | 338 | char *buf = g_strdup_printf(_("%s is not a valid server name"), server); |
| 15884 | 339 | purple_notify_error(gc, _("Invalid Server Name"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
340 | _("Invalid Server Name"), buf, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
341 | purple_request_cpar_from_connection(gc)); |
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
342 | purple_serv_got_join_chat_failed(gc, data); |
| 7310 | 343 | g_free(buf); |
| 344 | return; | |
| 345 | } else if(!jabber_resourceprep_validate(handle)) { | |
| 346 | char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); | |
| 15884 | 347 | purple_notify_error(gc, _("Invalid Room Handle"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
348 | _("Invalid Room Handle"), buf, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
349 | purple_request_cpar_from_connection(gc)); |
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
350 | purple_serv_got_join_chat_failed(gc, data); |
|
22902
560976846e56
Fix a small memory leak when failing to join a jabber conference
Mark Doliner <markdoliner@pidgin.im>
parents:
22804
diff
changeset
|
351 | g_free(buf); |
|
560976846e56
Fix a small memory leak when failing to join a jabber conference
Mark Doliner <markdoliner@pidgin.im>
parents:
22804
diff
changeset
|
352 | return; |
| 7310 | 353 | } |
| 354 | ||
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
355 | /* Normalize the room and server parameters */ |
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
356 | tmp = g_strdup_printf("%s@%s", room, server); |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
357 | jid = jabber_id_new(tmp); |
|
23270
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
358 | g_free(tmp); |
|
2b7db16e721a
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evands@pidgin.im>
parents:
22920
diff
changeset
|
359 | |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
360 | if (jid == NULL) { |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
361 | /* TODO: Error message */ |
| 7014 | 362 | |
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
363 | g_return_if_reached(); |
| 7014 | 364 | } |
| 365 | ||
|
28668
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
366 | /* |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
367 | * Now that we've done all that nice core-interface stuff, let's join |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
368 | * this room! |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
369 | */ |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
370 | jabber_join_chat(js, jid->node, jid->domain, handle, passwd, data); |
|
2f7479b4d0c0
jabber: Refactor the chat-joining code
Paul Aurich <darkrain42@pidgin.im>
parents:
28584
diff
changeset
|
371 | jabber_id_free(jid); |
| 7014 | 372 | } |
| 373 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
374 | void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
375 | jabber_chat_leave(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
376 | gint id) |
| 7014 | 377 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
378 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 7014 | 379 | JabberChat *chat = jabber_chat_find_by_id(js, id); |
| 7974 | 380 | |
| 7014 | 381 | if(!chat) |
| 382 | return; | |
| 383 | ||
| 7974 | 384 | jabber_chat_part(chat, NULL); |
| 9152 | 385 | |
|
23403
a8704d47889f
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23302
diff
changeset
|
386 | chat->left = TRUE; |
| 7014 | 387 | } |
| 388 | ||
| 389 | void jabber_chat_destroy(JabberChat *chat) | |
| 390 | { | |
| 391 | JabberStream *js = chat->js; | |
| 392 | char *room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
| 393 | ||
|
28687
9de3f49f3b30
jabber: Remove useless jabber_normalize calls now that the data in the hash table
Paul Aurich <darkrain42@pidgin.im>
parents:
28677
diff
changeset
|
394 | g_hash_table_remove(js->chats, room_jid); |
| 7014 | 395 | g_free(room_jid); |
| 8396 | 396 | } |
| 397 | ||
| 398 | void jabber_chat_free(JabberChat *chat) | |
| 399 | { | |
| 400 | if(chat->config_dialog_handle) | |
| 15884 | 401 | purple_request_close(chat->config_dialog_type, chat->config_dialog_handle); |
| 7014 | 402 | |
| 403 | g_free(chat->room); | |
| 404 | g_free(chat->server); | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10474
diff
changeset
|
405 | g_free(chat->handle); |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10474
diff
changeset
|
406 | g_hash_table_destroy(chat->members); |
|
23273
c42eae02c76e
g_hash_table_ref() / g_hash_table_unref() were added in too recent a glib version per Mark. Copy data to chat->components rather than using those.
Evan Schoenberg <evands@pidgin.im>
parents:
23270
diff
changeset
|
407 | g_hash_table_destroy(chat->components); |
|
41244
5535c6fdd135
Port JabberPresence from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
41238
diff
changeset
|
408 | |
|
5535c6fdd135
Port JabberPresence from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
41238
diff
changeset
|
409 | g_clear_pointer(&chat->joined, g_date_time_unref); |
|
5535c6fdd135
Port JabberPresence from time_t to GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
41238
diff
changeset
|
410 | |
| 7014 | 411 | g_free(chat); |
| 412 | } | |
| 413 | ||
|
34634
90fa70aa7e28
Refactored the jabber protocol to use GObject-based PurpleConversation
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
414 | gboolean jabber_chat_find_buddy(PurpleChatConversation *conv, const char *name) |
| 7014 | 415 | { |
|
34653
88ae47a7d595
Updated protocols for the API changes
Ankit Vani <a@nevitus.org>
parents:
34634
diff
changeset
|
416 | return purple_chat_conversation_has_user(conv, name); |
| 7014 | 417 | } |
| 418 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
419 | gchar * |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
420 | jabber_chat_user_real_name(PurpleProtocolChat *protocol_chat, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
421 | PurpleConnection *gc, gint id, const gchar *who) |
| 7398 | 422 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
423 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 7398 | 424 | JabberChat *chat; |
|
23499
3d18632e27a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <datallah@pidgin.im>
parents:
23403
diff
changeset
|
425 | JabberChatMember *jcm; |
| 7398 | 426 | |
| 427 | chat = jabber_chat_find_by_id(js, id); | |
| 428 | ||
| 429 | if(!chat) | |
| 430 | return NULL; | |
| 431 | ||
|
23499
3d18632e27a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <datallah@pidgin.im>
parents:
23403
diff
changeset
|
432 | jcm = g_hash_table_lookup(chat->members, who); |
|
3d18632e27a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <datallah@pidgin.im>
parents:
23403
diff
changeset
|
433 | if (jcm != NULL && jcm->jid) |
|
3d18632e27a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <datallah@pidgin.im>
parents:
23403
diff
changeset
|
434 | return g_strdup(jcm->jid); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24254
diff
changeset
|
435 | |
|
23499
3d18632e27a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <datallah@pidgin.im>
parents:
23403
diff
changeset
|
436 | |
| 7398 | 437 | return g_strdup_printf("%s@%s/%s", chat->room, chat->server, who); |
| 438 | } | |
| 7895 | 439 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
440 | static void jabber_chat_room_configure_x_data_cb(JabberStream *js, PurpleXmlNode *result, gpointer data) |
| 7923 | 441 | { |
| 442 | JabberChat *chat = data; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
443 | PurpleXmlNode *query; |
| 7923 | 444 | JabberIq *iq; |
| 445 | char *to = g_strdup_printf("%s@%s", chat->room, chat->server); | |
| 446 | ||
| 447 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "http://jabber.org/protocol/muc#owner"); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
448 | purple_xmlnode_set_attrib(iq->node, "to", to); |
| 7923 | 449 | g_free(to); |
| 450 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
451 | query = purple_xmlnode_get_child(iq->node, "query"); |
| 7923 | 452 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
453 | purple_xmlnode_insert_child(query, result); |
| 7923 | 454 | |
| 455 | jabber_iq_send(iq); | |
| 456 | } | |
| 457 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
458 | static void jabber_chat_room_configure_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
459 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
460 | PurpleXmlNode *packet, gpointer data) |
| 7923 | 461 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
462 | PurpleXmlNode *query, *x; |
| 7926 | 463 | char *msg; |
| 7923 | 464 | JabberChat *chat; |
| 465 | JabberID *jid; | |
| 466 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
467 | if (!from) |
| 7923 | 468 | return; |
| 469 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
470 | if (type == JABBER_IQ_RESULT) { |
| 7923 | 471 | jid = jabber_id_new(from); |
| 472 | ||
| 473 | if(!jid) | |
| 474 | return; | |
| 475 | ||
| 476 | chat = jabber_chat_find(js, jid->node, jid->domain); | |
| 477 | jabber_id_free(jid); | |
| 478 | ||
| 479 | if(!chat) | |
| 480 | return; | |
| 481 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
482 | if(!(query = purple_xmlnode_get_child(packet, "query"))) |
| 7923 | 483 | return; |
| 484 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
485 | for(x = purple_xmlnode_get_child(query, "x"); x; x = purple_xmlnode_get_next_twin(x)) { |
| 7923 | 486 | const char *xmlns; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
487 | if(!(xmlns = purple_xmlnode_get_namespace(x))) |
| 7923 | 488 | continue; |
| 489 | ||
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35991
diff
changeset
|
490 | if(purple_strequal(xmlns, "jabber:x:data")) { |
| 15884 | 491 | chat->config_dialog_type = PURPLE_REQUEST_FIELDS; |
| 8396 | 492 | chat->config_dialog_handle = jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat); |
| 7923 | 493 | return; |
| 494 | } | |
| 495 | } | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
496 | } else if (type == JABBER_IQ_ERROR) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
497 | char *msg = jabber_parse_error(js, packet, NULL); |
| 7926 | 498 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
499 | purple_notify_error(js->gc, _("Configuration error"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
500 | _("Configuration error"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
501 | purple_request_cpar_from_connection(js->gc)); |
| 7926 | 502 | |
|
37423
d2f0259aa43f
Remove NULL-checks before free(). No functional change.
Michael McConville <mmcco@mykolab.com>
parents:
37148
diff
changeset
|
503 | g_free(msg); |
| 7926 | 504 | return; |
| 7923 | 505 | } |
| 506 | ||
| 7926 | 507 | msg = g_strdup_printf("Unable to configure room %s", from); |
| 508 | ||
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
509 | purple_notify_info(js->gc, _("Unable to configure"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
510 | _("Unable to configure"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
511 | purple_request_cpar_from_connection(js->gc)); |
| 7926 | 512 | g_free(msg); |
| 7923 | 513 | |
| 514 | } | |
| 515 | ||
| 516 | void jabber_chat_request_room_configure(JabberChat *chat) { | |
| 517 | JabberIq *iq; | |
| 518 | char *room_jid; | |
| 519 | ||
| 7895 | 520 | if(!chat) |
| 521 | return; | |
| 522 | ||
| 8396 | 523 | chat->config_dialog_handle = NULL; |
| 524 | ||
| 7955 | 525 | if(!chat->muc) { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
526 | purple_notify_error(chat->js->gc, _("Room Configuration Error"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
527 | _("Room Configuration Error"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
528 | _("This room is not capable of being configured"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
529 | purple_request_cpar_from_connection(chat->js->gc)); |
| 7955 | 530 | return; |
| 531 | } | |
| 532 | ||
| 10474 | 533 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, |
| 7923 | 534 | "http://jabber.org/protocol/muc#owner"); |
| 535 | room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
| 7895 | 536 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
537 | purple_xmlnode_set_attrib(iq->node, "to", room_jid); |
| 7923 | 538 | |
| 539 | jabber_iq_set_callback(iq, jabber_chat_room_configure_cb, NULL); | |
| 540 | ||
| 541 | jabber_iq_send(iq); | |
| 542 | ||
| 543 | g_free(room_jid); | |
| 7895 | 544 | } |
| 545 | ||
| 546 | void jabber_chat_create_instant_room(JabberChat *chat) { | |
| 547 | JabberIq *iq; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
548 | PurpleXmlNode *query, *x; |
| 7895 | 549 | char *room_jid; |
| 550 | ||
| 551 | if(!chat) | |
| 552 | return; | |
| 553 | ||
| 8396 | 554 | chat->config_dialog_handle = NULL; |
| 555 | ||
| 7895 | 556 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, |
| 557 | "http://jabber.org/protocol/muc#owner"); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
558 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
559 | x = purple_xmlnode_new_child(query, "x"); |
| 7895 | 560 | room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
| 561 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
562 | purple_xmlnode_set_attrib(iq->node, "to", room_jid); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
563 | purple_xmlnode_set_namespace(x, "jabber:x:data"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
564 | purple_xmlnode_set_attrib(x, "type", "submit"); |
| 7895 | 565 | |
| 566 | jabber_iq_send(iq); | |
| 567 | ||
| 568 | g_free(room_jid); | |
| 569 | } | |
| 7955 | 570 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
571 | static void |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
572 | jabber_chat_register_x_data_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
573 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
574 | PurpleXmlNode *packet, gpointer data) |
| 7955 | 575 | { |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
576 | if (type == JABBER_IQ_ERROR) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
577 | char *msg = jabber_parse_error(js, packet, NULL); |
| 8401 | 578 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
579 | purple_notify_error(js->gc, _("Registration error"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
580 | _("Registration error"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
581 | purple_request_cpar_from_connection(js->gc)); |
| 8401 | 582 | |
|
37423
d2f0259aa43f
Remove NULL-checks before free(). No functional change.
Michael McConville <mmcco@mykolab.com>
parents:
37148
diff
changeset
|
583 | g_free(msg); |
| 8401 | 584 | return; |
| 7955 | 585 | } |
| 586 | } | |
| 587 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
588 | static void jabber_chat_register_x_data_cb(JabberStream *js, PurpleXmlNode *result, gpointer data) |
| 7955 | 589 | { |
| 590 | JabberChat *chat = data; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
591 | PurpleXmlNode *query; |
| 7955 | 592 | JabberIq *iq; |
| 593 | char *to = g_strdup_printf("%s@%s", chat->room, chat->server); | |
| 594 | ||
| 595 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
596 | purple_xmlnode_set_attrib(iq->node, "to", to); |
| 7955 | 597 | g_free(to); |
| 598 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
599 | query = purple_xmlnode_get_child(iq->node, "query"); |
| 7955 | 600 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
601 | purple_xmlnode_insert_child(query, result); |
| 7955 | 602 | |
| 603 | jabber_iq_set_callback(iq, jabber_chat_register_x_data_result_cb, NULL); | |
| 604 | ||
| 605 | jabber_iq_send(iq); | |
| 606 | } | |
| 607 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
608 | static void jabber_chat_register_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
609 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
610 | PurpleXmlNode *packet, gpointer data) |
| 7955 | 611 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
612 | PurpleXmlNode *query, *x; |
| 7955 | 613 | char *msg; |
| 614 | JabberChat *chat; | |
| 615 | JabberID *jid; | |
| 616 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
617 | if (!from) |
| 7955 | 618 | return; |
| 619 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
620 | if (type == JABBER_IQ_RESULT) { |
| 7955 | 621 | jid = jabber_id_new(from); |
| 622 | ||
| 623 | if(!jid) | |
| 624 | return; | |
| 625 | ||
| 626 | chat = jabber_chat_find(js, jid->node, jid->domain); | |
| 627 | jabber_id_free(jid); | |
| 628 | ||
| 629 | if(!chat) | |
| 630 | return; | |
| 631 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
632 | if(!(query = purple_xmlnode_get_child(packet, "query"))) |
| 7955 | 633 | return; |
| 634 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
635 | for(x = purple_xmlnode_get_child(query, "x"); x; x = purple_xmlnode_get_next_twin(x)) { |
| 7955 | 636 | const char *xmlns; |
| 637 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
638 | if(!(xmlns = purple_xmlnode_get_namespace(x))) |
| 7955 | 639 | continue; |
| 640 | ||
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35991
diff
changeset
|
641 | if(purple_strequal(xmlns, "jabber:x:data")) { |
| 7955 | 642 | jabber_x_data_request(js, x, jabber_chat_register_x_data_cb, chat); |
| 643 | return; | |
| 644 | } | |
| 645 | } | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
646 | } else if (type == JABBER_IQ_ERROR) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
647 | char *msg = jabber_parse_error(js, packet, NULL); |
| 7955 | 648 | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
649 | purple_notify_error(js->gc, _("Registration error"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
650 | _("Registration error"), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
651 | purple_request_cpar_from_connection(js->gc)); |
| 7955 | 652 | |
|
37423
d2f0259aa43f
Remove NULL-checks before free(). No functional change.
Michael McConville <mmcco@mykolab.com>
parents:
37148
diff
changeset
|
653 | g_free(msg); |
| 7955 | 654 | return; |
| 655 | } | |
| 656 | ||
| 657 | msg = g_strdup_printf("Unable to configure room %s", from); | |
| 658 | ||
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
659 | purple_notify_info(js->gc, _("Unable to configure"), _("Unable to " |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
660 | "configure"), msg, purple_request_cpar_from_connection(js->gc)); |
| 7955 | 661 | g_free(msg); |
| 662 | ||
| 663 | } | |
| 664 | ||
| 665 | void jabber_chat_register(JabberChat *chat) | |
| 666 | { | |
| 667 | JabberIq *iq; | |
| 668 | char *room_jid; | |
| 669 | ||
| 670 | if(!chat) | |
| 671 | return; | |
| 672 | ||
| 673 | room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
| 674 | ||
| 675 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, "jabber:iq:register"); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
676 | purple_xmlnode_set_attrib(iq->node, "to", room_jid); |
| 7955 | 677 | g_free(room_jid); |
| 678 | ||
| 679 | jabber_iq_set_callback(iq, jabber_chat_register_cb, NULL); | |
| 680 | ||
| 681 | jabber_iq_send(iq); | |
| 682 | } | |
| 683 | ||
| 7971 | 684 | /* merge this with the function below when we get everyone on the same page wrt /commands */ |
| 685 | void jabber_chat_change_topic(JabberChat *chat, const char *topic) | |
| 686 | { | |
|
26859
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
687 | JabberMessage *jm; |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
688 | |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
689 | jm = g_new0(JabberMessage, 1); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
690 | jm->js = chat->js; |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
691 | jm->type = JABBER_MESSAGE_GROUPCHAT; |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
692 | jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); |
| 7955 | 693 | |
|
26859
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
694 | if (topic && *topic) |
|
28130
a29344f04ec9
Set XMPP chat topic when it contains a < followed by a character. Closes #5712.
Paul Aurich <darkrain42@pidgin.im>
parents:
27728
diff
changeset
|
695 | jm->subject = g_strdup(topic); |
|
26859
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
696 | else |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
697 | jm->subject = g_strdup(""); |
| 7971 | 698 | |
|
26859
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
699 | jabber_message_send(jm); |
|
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
700 | jabber_message_free(jm); |
| 7971 | 701 | } |
| 702 | ||
|
40697
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
703 | void |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
704 | jabber_chat_set_topic(PurpleProtocolChat *protocol_chat, |
|
81f81f5d2f39
Split PurpleProtocolChat to its own file and clean up the API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
705 | PurpleConnection *gc, gint id, const gchar *topic) |
| 7971 | 706 | { |
|
26859
8175186cf34a
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
707 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 7971 | 708 | JabberChat *chat = jabber_chat_find_by_id(js, id); |
| 709 | ||
| 710 | if(!chat) | |
| 711 | return; | |
| 712 | ||
| 713 | jabber_chat_change_topic(chat, topic); | |
| 714 | } | |
| 715 | ||
| 716 | ||
|
28734
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28703
diff
changeset
|
717 | gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick) |
| 7972 | 718 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
719 | PurpleXmlNode *presence; |
| 7972 | 720 | char *full_jid; |
|
28734
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28703
diff
changeset
|
721 | PurpleAccount *account; |
| 15884 | 722 | PurpleStatus *status; |
| 9954 | 723 | JabberBuddyState state; |
| 14525 | 724 | char *msg; |
| 9954 | 725 | int priority; |
| 7972 | 726 | |
| 727 | if(!chat->muc) { | |
|
36084
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
728 | purple_conversation_write_system_message( |
|
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
729 | PURPLE_CONVERSATION(chat->conv), |
|
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
730 | _("Nick changing not supported in non-MUC chatrooms"), 0); |
|
28734
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28703
diff
changeset
|
731 | return FALSE; |
| 7972 | 732 | } |
| 733 | ||
|
28734
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28703
diff
changeset
|
734 | account = purple_connection_get_account(chat->js->gc); |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28703
diff
changeset
|
735 | status = purple_account_get_active_status(account); |
| 9954 | 736 | |
| 15884 | 737 | purple_status_to_jabber(status, &state, &msg, &priority); |
| 9954 | 738 | |
|
17770
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17007
diff
changeset
|
739 | presence = jabber_presence_create_js(chat->js, state, msg, priority); |
| 7972 | 740 | full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, nick); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
741 | purple_xmlnode_set_attrib(presence, "to", full_jid); |
| 7972 | 742 | g_free(full_jid); |
| 14525 | 743 | g_free(msg); |
| 7972 | 744 | |
| 745 | jabber_send(chat->js, presence); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
746 | purple_xmlnode_free(presence); |
|
28734
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28703
diff
changeset
|
747 | |
|
886d6c5e8f9a
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <darkrain42@pidgin.im>
parents:
28703
diff
changeset
|
748 | return TRUE; |
| 7972 | 749 | } |
| 750 | ||
| 7974 | 751 | void jabber_chat_part(JabberChat *chat, const char *msg) |
| 752 | { | |
| 753 | char *room_jid; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
754 | PurpleXmlNode *presence; |
| 7972 | 755 | |
| 8537 | 756 | room_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, |
| 757 | chat->handle); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
758 | presence = purple_xmlnode_new("presence"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
759 | purple_xmlnode_set_attrib(presence, "to", room_jid); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
760 | purple_xmlnode_set_attrib(presence, "type", "unavailable"); |
| 7974 | 761 | if(msg) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
762 | PurpleXmlNode *status = purple_xmlnode_new_child(presence, "status"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
763 | purple_xmlnode_insert_data(status, msg, -1); |
| 7974 | 764 | } |
| 765 | jabber_send(chat->js, presence); | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24254
diff
changeset
|
766 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
767 | purple_xmlnode_free(presence); |
| 7974 | 768 | g_free(room_jid); |
| 769 | } | |
| 770 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
771 | static void roomlist_disco_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
772 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
773 | PurpleXmlNode *packet, gpointer data) |
| 8113 | 774 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
775 | PurpleXmlNode *query; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
776 | PurpleXmlNode *item; |
| 7974 | 777 | |
| 8113 | 778 | if(!js->roomlist) |
| 779 | return; | |
| 780 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
781 | if (type == JABBER_IQ_ERROR) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
782 | char *err = jabber_parse_error(js, packet, NULL); |
| 15884 | 783 | purple_notify_error(js->gc, _("Error"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
784 | _("Error retrieving room list"), err, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
785 | purple_request_cpar_from_connection(js->gc)); |
| 15884 | 786 | purple_roomlist_set_in_progress(js->roomlist, FALSE); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
787 | g_object_unref(js->roomlist); |
| 8120 | 788 | js->roomlist = NULL; |
| 8401 | 789 | g_free(err); |
| 8113 | 790 | return; |
| 791 | } | |
| 792 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
793 | if(!(query = purple_xmlnode_get_child(packet, "query"))) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
19897
diff
changeset
|
794 | char *err = jabber_parse_error(js, packet, NULL); |
| 15884 | 795 | purple_notify_error(js->gc, _("Error"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
796 | _("Error retrieving room list"), err, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
797 | purple_request_cpar_from_connection(js->gc)); |
| 15884 | 798 | purple_roomlist_set_in_progress(js->roomlist, FALSE); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
799 | g_object_unref(js->roomlist); |
| 8120 | 800 | js->roomlist = NULL; |
| 8401 | 801 | g_free(err); |
| 8113 | 802 | return; |
| 803 | } | |
| 804 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
805 | for(item = purple_xmlnode_get_child(query, "item"); item; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
806 | item = purple_xmlnode_get_next_twin(item)) { |
| 8113 | 807 | const char *name; |
| 15884 | 808 | PurpleRoomlistRoom *room; |
| 8113 | 809 | JabberID *jid; |
| 810 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
811 | if(!(jid = jabber_id_new(purple_xmlnode_get_attrib(item, "jid")))) |
| 8113 | 812 | continue; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
813 | name = purple_xmlnode_get_attrib(item, "name"); |
| 8113 | 814 | |
| 815 | ||
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
816 | room = purple_roomlist_room_new(jid->node, name); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
817 | purple_roomlist_room_add_field(room, "room", g_strdup(jid->node)); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
818 | purple_roomlist_room_add_field(room, "server", g_strdup(jid->domain)); |
| 15884 | 819 | purple_roomlist_room_add(js->roomlist, room); |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
820 | g_object_unref(room); |
| 8113 | 821 | |
| 822 | jabber_id_free(jid); | |
| 823 | } | |
| 15884 | 824 | purple_roomlist_set_in_progress(js->roomlist, FALSE); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
825 | g_object_unref(js->roomlist); |
| 8113 | 826 | js->roomlist = NULL; |
| 827 | } | |
| 828 | ||
| 10045 | 829 | static void roomlist_cancel_cb(JabberStream *js, const char *server) { |
| 830 | if(js->roomlist) { | |
| 15884 | 831 | purple_roomlist_set_in_progress(js->roomlist, FALSE); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
832 | g_object_unref(js->roomlist); |
| 10045 | 833 | js->roomlist = NULL; |
| 834 | } | |
| 835 | } | |
| 836 | ||
| 8113 | 837 | static void roomlist_ok_cb(JabberStream *js, const char *server) |
| 838 | { | |
| 839 | JabberIq *iq; | |
| 10045 | 840 | |
| 841 | if(!js->roomlist) | |
| 842 | return; | |
| 8113 | 843 | |
| 844 | if(!server || !*server) { | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
845 | purple_notify_error(js->gc, _("Invalid Server"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
846 | _("Invalid Server"), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
847 | purple_request_cpar_from_connection(js->gc)); |
|
28158
0ec0690c2741
jabber: Fix "Invalid Server" breaking roomlist dialog. Closes #8143.
Paul Aurich <darkrain42@pidgin.im>
parents:
28130
diff
changeset
|
848 | purple_roomlist_set_in_progress(js->roomlist, FALSE); |
| 8113 | 849 | return; |
| 850 | } | |
| 851 | ||
| 15884 | 852 | purple_roomlist_set_in_progress(js->roomlist, TRUE); |
| 10045 | 853 | |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28734
diff
changeset
|
854 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); |
| 10045 | 855 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
856 | purple_xmlnode_set_attrib(iq->node, "to", server); |
| 10045 | 857 | |
| 858 | jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL); | |
| 859 | ||
| 860 | jabber_iq_send(iq); | |
| 861 | } | |
| 862 | ||
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
863 | PurpleRoomlist * |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
864 | jabber_roomlist_get_list(PurpleProtocolRoomlist *protocol_roomlist, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
865 | PurpleConnection *gc) |
| 10045 | 866 | { |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
867 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 10045 | 868 | |
|
9913
2e773d9ba800
[gaim-migrate @ 10805]
Daniel Atallah <datallah@pidgin.im>
parents:
9770
diff
changeset
|
869 | if(js->roomlist) |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
870 | g_object_unref(js->roomlist); |
|
9913
2e773d9ba800
[gaim-migrate @ 10805]
Daniel Atallah <datallah@pidgin.im>
parents:
9770
diff
changeset
|
871 | |
| 15884 | 872 | js->roomlist = purple_roomlist_new(purple_connection_get_account(js->gc)); |
|
9913
2e773d9ba800
[gaim-migrate @ 10805]
Daniel Atallah <datallah@pidgin.im>
parents:
9770
diff
changeset
|
873 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
874 | purple_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"), |
| 8113 | 875 | _("Select a conference server to query"), |
|
17007
66c0fa6e5e2a
Removes 'jabber.org' defaults from XMPP. I think we had agreed this was a good idea.
Sean Egan <seanegan@pidgin.im>
parents:
16490
diff
changeset
|
876 | js->chat_servers ? js->chat_servers->data : NULL, |
| 8697 | 877 | FALSE, FALSE, NULL, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41244
diff
changeset
|
878 | _("Find Rooms"), G_CALLBACK(roomlist_ok_cb), |
|
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41244
diff
changeset
|
879 | _("Cancel"), G_CALLBACK(roomlist_cancel_cb), |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
32277
diff
changeset
|
880 | purple_request_cpar_from_connection(gc), |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
881 | js); |
| 8113 | 882 | |
| 883 | return js->roomlist; | |
| 884 | } | |
| 885 | ||
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
886 | void |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
887 | jabber_roomlist_cancel(PurpleProtocolRoomlist *protocol_roomlist, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
888 | PurpleRoomlist *list) |
| 8113 | 889 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31511
diff
changeset
|
890 | PurpleAccount *account; |
| 15884 | 891 | PurpleConnection *gc; |
| 8113 | 892 | JabberStream *js; |
| 893 | ||
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31511
diff
changeset
|
894 | account = purple_roomlist_get_account(list); |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31511
diff
changeset
|
895 | gc = purple_account_get_connection(account); |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32218
diff
changeset
|
896 | js = purple_connection_get_protocol_data(gc); |
| 8113 | 897 | |
| 15884 | 898 | purple_roomlist_set_in_progress(list, FALSE); |
| 8113 | 899 | |
| 900 | if (js->roomlist == list) { | |
| 901 | js->roomlist = NULL; | |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
34670
diff
changeset
|
902 | g_object_unref(list); |
| 8113 | 903 | } |
| 904 | } | |
| 905 | ||
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
906 | char * |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
907 | jabber_roomlist_room_serialize(PurpleProtocolRoomlist *protocol_roomlist, |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
908 | PurpleRoomlistRoom *room) |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
909 | { |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
910 | const gchar *room_name = NULL, *server = NULL; |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
911 | |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
912 | room_name = purple_roomlist_room_get_field(room, "room"); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
913 | server = purple_roomlist_room_get_field(room, "server"); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
914 | |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
915 | return g_strdup_printf("%s@%s", room_name, server); |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
916 | } |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40792
diff
changeset
|
917 | |
| 9152 | 918 | void jabber_chat_member_free(JabberChatMember *jcm) |
| 919 | { | |
| 920 | g_free(jcm->handle); | |
| 921 | g_free(jcm->jid); | |
| 922 | g_free(jcm); | |
| 923 | } | |
| 924 | ||
| 925 | void jabber_chat_track_handle(JabberChat *chat, const char *handle, | |
| 926 | const char *jid, const char *affiliation, const char *role) | |
| 927 | { | |
| 928 | JabberChatMember *jcm = g_new0(JabberChatMember, 1); | |
| 929 | ||
| 930 | jcm->handle = g_strdup(handle); | |
| 931 | jcm->jid = g_strdup(jid); | |
| 932 | ||
| 933 | g_hash_table_replace(chat->members, jcm->handle, jcm); | |
| 934 | ||
| 935 | /* XXX: keep track of role and affiliation */ | |
| 936 | } | |
| 937 | ||
| 938 | void jabber_chat_remove_handle(JabberChat *chat, const char *handle) | |
| 939 | { | |
| 940 | g_hash_table_remove(chat->members, handle); | |
| 941 | } | |
| 942 | ||
| 943 | gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, const char *why) | |
| 944 | { | |
|
19854
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
945 | JabberChatMember *jcm; |
|
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
946 | const char *jid; |
|
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
947 | char *to; |
| 9152 | 948 | JabberIq *iq; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
949 | PurpleXmlNode *query, *item, *reason; |
| 9152 | 950 | |
|
19854
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
951 | jcm = g_hash_table_lookup(chat->members, who); |
|
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
952 | if (jcm && jcm->jid) |
|
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
953 | jid = jcm->jid; |
|
29059
8225f2507058
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <darkrain42@pidgin.im>
parents:
28984
diff
changeset
|
954 | else if (strchr(who, '@') != NULL) |
|
19854
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
955 | jid = who; |
|
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
956 | else |
| 9152 | 957 | return FALSE; |
| 958 | ||
| 959 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, | |
| 960 | "http://jabber.org/protocol/muc#admin"); | |
| 961 | ||
| 962 | to = g_strdup_printf("%s@%s", chat->room, chat->server); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
963 | purple_xmlnode_set_attrib(iq->node, "to", to); |
| 9152 | 964 | g_free(to); |
| 965 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
966 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
967 | item = purple_xmlnode_new_child(query, "item"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
968 | purple_xmlnode_set_attrib(item, "jid", jid); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
969 | purple_xmlnode_set_attrib(item, "affiliation", "outcast"); |
| 9152 | 970 | if(why) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
971 | reason = purple_xmlnode_new_child(item, "reason"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
972 | purple_xmlnode_insert_data(reason, why, -1); |
| 9152 | 973 | } |
| 974 | ||
| 975 | jabber_iq_send(iq); | |
| 976 | ||
| 977 | return TRUE; | |
| 978 | } | |
| 8113 | 979 | |
| 11393 | 980 | gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const char *affiliation) |
| 981 | { | |
|
19854
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
982 | JabberChatMember *jcm; |
|
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
983 | const char *jid; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
984 | char *to; |
| 11393 | 985 | JabberIq *iq; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
986 | PurpleXmlNode *query, *item; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
987 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
988 | jcm = g_hash_table_lookup(chat->members, who); |
|
19854
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
989 | if (jcm && jcm->jid) |
|
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
990 | jid = jcm->jid; |
|
29059
8225f2507058
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <darkrain42@pidgin.im>
parents:
28984
diff
changeset
|
991 | else if (strchr(who, '@') != NULL) |
|
19854
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
992 | jid = who; |
|
b7971f8bd19a
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <markdoliner@pidgin.im>
parents:
17007
diff
changeset
|
993 | else |
| 11393 | 994 | return FALSE; |
| 995 | ||
| 996 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, | |
| 997 | "http://jabber.org/protocol/muc#admin"); | |
| 998 | ||
| 999 | to = g_strdup_printf("%s@%s", chat->room, chat->server); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1000 | purple_xmlnode_set_attrib(iq->node, "to", to); |
| 11393 | 1001 | g_free(to); |
| 1002 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1003 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1004 | item = purple_xmlnode_new_child(query, "item"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1005 | purple_xmlnode_set_attrib(item, "jid", jid); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1006 | purple_xmlnode_set_attrib(item, "affiliation", affiliation); |
| 11393 | 1007 | |
| 1008 | jabber_iq_send(iq); | |
| 1009 | ||
| 1010 | return TRUE; | |
| 1011 | } | |
| 8113 | 1012 | |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1013 | static void |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1014 | jabber_chat_affiliation_list_cb(JabberStream *js, const char *from, |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1015 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1016 | PurpleXmlNode *packet, gpointer data) |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1017 | { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1018 | JabberChat *chat; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1019 | PurpleXmlNode *query, *item; |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1020 | int chat_id = GPOINTER_TO_INT(data); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1021 | GString *buf; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1022 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1023 | if(!(chat = jabber_chat_find_by_id(js, chat_id))) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1024 | return; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1025 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1026 | if (type == JABBER_IQ_ERROR) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1027 | return; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1028 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1029 | if(!(query = purple_xmlnode_get_child(packet, "query"))) |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1030 | return; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1031 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1032 | buf = g_string_new(_("Affiliations:")); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1033 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1034 | item = purple_xmlnode_get_child(query, "item"); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1035 | if (item) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1036 | for( ; item; item = purple_xmlnode_get_next_twin(item)) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1037 | const char *jid = purple_xmlnode_get_attrib(item, "jid"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1038 | const char *affiliation = purple_xmlnode_get_attrib(item, "affiliation"); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1039 | if (jid && affiliation) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1040 | g_string_append_printf(buf, "\n%s %s", jid, affiliation); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1041 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1042 | } else { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1043 | buf = g_string_append_c(buf, '\n'); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1044 | buf = g_string_append_len(buf, _("No users found"), -1); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1045 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1046 | |
|
36084
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
1047 | purple_conversation_write_system_message(PURPLE_CONVERSATION(chat->conv), |
|
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
1048 | buf->str, PURPLE_MESSAGE_NO_LOG); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1049 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1050 | g_string_free(buf, TRUE); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1051 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1052 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1053 | gboolean jabber_chat_affiliation_list(JabberChat *chat, const char *affiliation) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1054 | { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1055 | JabberIq *iq; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1056 | char *room_jid; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1057 | PurpleXmlNode *query, *item; |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1058 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1059 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1060 | "http://jabber.org/protocol/muc#admin"); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1061 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1062 | room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1063 | purple_xmlnode_set_attrib(iq->node, "to", room_jid); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1064 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1065 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1066 | item = purple_xmlnode_new_child(query, "item"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1067 | purple_xmlnode_set_attrib(item, "affiliation", affiliation); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1068 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1069 | jabber_iq_set_callback(iq, jabber_chat_affiliation_list_cb, GINT_TO_POINTER(chat->id)); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1070 | jabber_iq_send(iq); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1071 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1072 | return TRUE; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1073 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1074 | |
|
29400
8d8ad40c9c7d
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <darkrain42@pidgin.im>
parents:
29059
diff
changeset
|
1075 | gboolean jabber_chat_role_user(JabberChat *chat, const char *who, |
|
8d8ad40c9c7d
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <darkrain42@pidgin.im>
parents:
29059
diff
changeset
|
1076 | const char *role, const char *why) |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1077 | { |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1078 | char *to; |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1079 | JabberIq *iq; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1080 | PurpleXmlNode *query, *item; |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1081 | JabberChatMember *jcm; |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1082 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1083 | jcm = g_hash_table_lookup(chat->members, who); |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1084 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1085 | if (!jcm || !jcm->handle) |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1086 | return FALSE; |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1087 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1088 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1089 | "http://jabber.org/protocol/muc#admin"); |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1090 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1091 | to = g_strdup_printf("%s@%s", chat->room, chat->server); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1092 | purple_xmlnode_set_attrib(iq->node, "to", to); |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1093 | g_free(to); |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1094 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1095 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1096 | item = purple_xmlnode_new_child(query, "item"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1097 | purple_xmlnode_set_attrib(item, "nick", jcm->handle); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1098 | purple_xmlnode_set_attrib(item, "role", role); |
|
29400
8d8ad40c9c7d
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <darkrain42@pidgin.im>
parents:
29059
diff
changeset
|
1099 | if (why) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1100 | PurpleXmlNode *reason = purple_xmlnode_new_child(item, "reason"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1101 | purple_xmlnode_insert_data(reason, why, -1); |
|
29400
8d8ad40c9c7d
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <darkrain42@pidgin.im>
parents:
29059
diff
changeset
|
1102 | } |
|
13238
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1103 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1104 | jabber_iq_send(iq); |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1105 | |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1106 | return TRUE; |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1107 | } |
|
b98439d90903
[gaim-migrate @ 15603]
Andrej Krivulčík <thefox692@users.sourceforge.net>
parents:
12323
diff
changeset
|
1108 | |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1109 | static void jabber_chat_role_list_cb(JabberStream *js, const char *from, |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1110 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1111 | PurpleXmlNode *packet, gpointer data) |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1112 | { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1113 | JabberChat *chat; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1114 | PurpleXmlNode *query, *item; |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1115 | int chat_id = GPOINTER_TO_INT(data); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1116 | GString *buf; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1117 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1118 | if(!(chat = jabber_chat_find_by_id(js, chat_id))) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1119 | return; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1120 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1121 | if (type == JABBER_IQ_ERROR) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1122 | return; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1123 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1124 | if(!(query = purple_xmlnode_get_child(packet, "query"))) |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1125 | return; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1126 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1127 | buf = g_string_new(_("Roles:")); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1128 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1129 | item = purple_xmlnode_get_child(query, "item"); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1130 | if (item) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1131 | for( ; item; item = purple_xmlnode_get_next_twin(item)) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1132 | const char *jid = purple_xmlnode_get_attrib(item, "jid"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1133 | const char *role = purple_xmlnode_get_attrib(item, "role"); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1134 | if (jid && role) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1135 | g_string_append_printf(buf, "\n%s %s", jid, role); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1136 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1137 | } else { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1138 | buf = g_string_append_c(buf, '\n'); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1139 | buf = g_string_append_len(buf, _("No users found"), -1); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1140 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1141 | |
|
36084
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
1142 | purple_conversation_write_system_message(PURPLE_CONVERSATION(chat->conv), |
|
2172bd6dad3e
Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36002
diff
changeset
|
1143 | buf->str, PURPLE_MESSAGE_NO_LOG); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1144 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1145 | g_string_free(buf, TRUE); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1146 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1147 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1148 | gboolean jabber_chat_role_list(JabberChat *chat, const char *role) |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1149 | { |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1150 | JabberIq *iq; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1151 | char *room_jid; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1152 | PurpleXmlNode *query, *item; |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1153 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1154 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1155 | "http://jabber.org/protocol/muc#admin"); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1156 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1157 | room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1158 | purple_xmlnode_set_attrib(iq->node, "to", room_jid); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1159 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1160 | query = purple_xmlnode_get_child(iq->node, "query"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1161 | item = purple_xmlnode_new_child(query, "item"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1162 | purple_xmlnode_set_attrib(item, "role", role); |
|
27027
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1163 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1164 | jabber_iq_set_callback(iq, jabber_chat_role_list_cb, GINT_TO_POINTER(chat->id)); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1165 | jabber_iq_send(iq); |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1166 | |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1167 | return TRUE; |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1168 | } |
|
f3129efa65ea
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <darkrain42@pidgin.im>
parents:
26859
diff
changeset
|
1169 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
1170 | static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
1171 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1172 | PurpleXmlNode *packet, gpointer data) |
| 10941 | 1173 | { |
| 1174 | JabberChat *chat; | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
1175 | int chat_id = GPOINTER_TO_INT(data); |
| 10941 | 1176 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26042
diff
changeset
|
1177 | if(!(chat = jabber_chat_find_by_id(js, chat_id))) |
| 10941 | 1178 | return; |
| 1179 | ||
|
11392
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1180 | /* defaults, in case the conference server doesn't |
|
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1181 | * support this request */ |
|
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1182 | chat->xhtml = TRUE; |
| 10941 | 1183 | } |
| 1184 | ||
| 1185 | void jabber_chat_disco_traffic(JabberChat *chat) | |
| 1186 | { | |
| 1187 | JabberIq *iq; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1188 | PurpleXmlNode *query; |
|
11392
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1189 | char *room_jid; |
|
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1190 | |
|
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1191 | room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
| 10941 | 1192 | |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28734
diff
changeset
|
1193 | iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, NS_DISCO_INFO); |
| 10941 | 1194 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1195 | purple_xmlnode_set_attrib(iq->node, "to", room_jid); |
|
11392
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1196 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1197 | query = purple_xmlnode_get_child(iq->node, "query"); |
| 10941 | 1198 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
1199 | purple_xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/muc#traffic"); |
| 10941 | 1200 | |
| 1201 | jabber_iq_set_callback(iq, jabber_chat_disco_traffic_cb, GINT_TO_POINTER(chat->id)); | |
| 1202 | ||
| 1203 | jabber_iq_send(iq); | |
|
11392
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1204 | |
|
fcf358e5a309
[gaim-migrate @ 13621]
Zmitrok <zmitrok@users.sourceforge.net>
parents:
10959
diff
changeset
|
1205 | g_free(room_jid); |
| 10941 | 1206 | } |