Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/chat.c @ 30018:7ed0ddbdd2a8
Use an inline RC style to get rid of some other padding to make the small
buttons even smaller, as suggested by Paradox on trac, and nicked from
nautilus.
Refs #8727.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 20 Mar 2010 06:22:53 +0000 |
parents | c8b407fec879 |
children | a0d6b85e9c42 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple - Jabber Protocol Plugin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
28398
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28225
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28225
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28225
diff
changeset
|
6 * source distribution. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19676
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "prpl.h" /* for proto_chat_entry */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "roomlist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "chat.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "message.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "presence.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "xdata.h" |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23262
diff
changeset
|
36 #include "data.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
15823 | 38 GList *jabber_chat_info(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 GList *m = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 struct proto_chat_entry *pce; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 pce = g_new0(struct proto_chat_entry, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 pce->label = _("_Room:"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 pce->identifier = "room"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 pce->required = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 m = g_list_append(m, pce); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 pce = g_new0(struct proto_chat_entry, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 pce->label = _("_Server:"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 pce->identifier = "server"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 pce->required = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 m = g_list_append(m, pce); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 pce = g_new0(struct proto_chat_entry, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 pce->label = _("_Handle:"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 pce->identifier = "handle"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 pce->required = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 m = g_list_append(m, pce); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 pce = g_new0(struct proto_chat_entry, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 pce->label = _("_Password:"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 pce->identifier = "password"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 pce->secret = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 m = g_list_append(m, pce); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
15823 | 70 GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 GHashTable *defaults; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 g_hash_table_insert(defaults, "handle", g_strdup(js->user->node)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 if (js->chat_servers) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 g_hash_table_insert(defaults, "server", g_strdup(js->chat_servers->data)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 if (chat_name != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 JabberID *jid = jabber_id_new(chat_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 if(jid) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 g_hash_table_insert(defaults, "room", g_strdup(jid->node)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 if(jid->domain) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 g_hash_table_replace(defaults, "server", g_strdup(jid->domain)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 if(jid->resource) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 g_hash_table_replace(defaults, "handle", g_strdup(jid->resource)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 return defaults; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 JabberChat *jabber_chat_find(JabberStream *js, const char *room, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 const char *server) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 JabberChat *chat = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 |
28659
c42d5c23a9e8
jabber: Don't crash when adding a buddy without a node (no '@'). Closes #10261.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
102 g_return_val_if_fail(room != NULL, NULL); |
c42d5c23a9e8
jabber: Don't crash when adding a buddy without a node (no '@'). Closes #10261.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
103 g_return_val_if_fail(server != NULL, NULL); |
c42d5c23a9e8
jabber: Don't crash when adding a buddy without a node (no '@'). Closes #10261.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
104 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 if(NULL != js->chats) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 { |
22921
1003f1736be1
Close up scope of a variable, I'm just cleaning up my tree some.
Etan Reisner <pidgin@unreliablesource.net>
parents:
22753
diff
changeset
|
107 char *room_jid = g_strdup_printf("%s@%s", room, server); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 |
28756
08ffa726aea2
jabber: Remove useless jabber_normalize calls now that the data in the hash table
Paul Aurich <paul@darkrain42.org>
parents:
28752
diff
changeset
|
109 chat = g_hash_table_lookup(js->chats, room_jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 return chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 struct _find_by_id_data { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 int id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 JabberChat *chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 static void find_by_id_foreach_cb(gpointer key, gpointer value, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 JabberChat *chat = value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 struct _find_by_id_data *fbid = user_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 if(chat->id == fbid->id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 fbid->chat = chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 JabberChat *jabber_chat_find_by_id(JabberStream *js, int id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 JabberChat *chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 struct _find_by_id_data *fbid = g_new0(struct _find_by_id_data, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 fbid->id = id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 g_hash_table_foreach(js->chats, find_by_id_foreach_cb, fbid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 chat = fbid->chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 g_free(fbid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 return chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 |
15823 | 141 JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 { |
15823 | 143 PurpleAccount *account = purple_conversation_get_account(conv); |
144 PurpleConnection *gc = purple_account_get_connection(account); | |
22644
d14294a40d74
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
145 JabberStream *js; |
d14294a40d74
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
146 int id; |
d14294a40d74
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
147 if (!gc) |
d14294a40d74
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
148 return NULL; |
d14294a40d74
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
149 js = gc->proto_data; |
d14294a40d74
Do not crash from commands in a disconnected chat. Fixes #5208
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21560
diff
changeset
|
150 id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 return jabber_chat_find_by_id(js, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
15823 | 154 void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 const char *name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 JabberChat *chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 xmlnode *message, *body, *x, *invite; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 chat = jabber_chat_find_by_id(js, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 message = xmlnode_new("message"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 if(chat->muc) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 xmlnode_set_attrib(message, "to", room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 x = xmlnode_new_child(message, "x"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 invite = xmlnode_new_child(x, "invite"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 xmlnode_set_attrib(invite, "to", name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 body = xmlnode_new_child(invite, "reason"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 xmlnode_insert_data(body, msg, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 xmlnode_set_attrib(message, "to", name); |
28775
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
180 /* |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
181 * Putting the reason into the body was an 'undocumented protocol, |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
182 * ...not part of "groupchat 1.0"'. |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
183 * http://xmpp.org/extensions/attic/jep-0045-1.16.html#invite |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
184 * |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
185 * Left here for compatibility. |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
186 */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 body = xmlnode_new_child(message, "body"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 xmlnode_insert_data(body, msg, -1); |
28775
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
189 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 x = xmlnode_new_child(message, "x"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 xmlnode_set_attrib(x, "jid", room_jid); |
28775
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
192 |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
193 /* The better place for it! XEP-0249 style. */ |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
194 xmlnode_set_attrib(x, "reason", msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 xmlnode_set_namespace(x, "jabber:x:conference"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 jabber_send(js, message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 xmlnode_free(message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 void jabber_chat_member_free(JabberChatMember *jcm); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 char *jabber_get_chat_name(GHashTable *data) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 char *room, *server, *chat_name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 room = g_hash_table_lookup(data, "room"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 server = g_hash_table_lookup(data, "server"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 if (room && server) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 chat_name = g_strdup_printf("%s@%s", room, server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 return chat_name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 |
23108
568a0957e835
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 <evan.s@dreskin.net>
parents:
23105
diff
changeset
|
217 static void insert_in_hash_table(gpointer key, gpointer value, gpointer user_data) |
568a0957e835
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 <evan.s@dreskin.net>
parents:
23105
diff
changeset
|
218 { |
568a0957e835
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 <evan.s@dreskin.net>
parents:
23105
diff
changeset
|
219 GHashTable *hash_table = (GHashTable *)user_data; |
23110
53bf3c21b79d
The key and value need to be g_stdup()'d before adding to the hash table
Evan Schoenberg <evan.s@dreskin.net>
parents:
23108
diff
changeset
|
220 g_hash_table_insert(hash_table, g_strdup(key), g_strdup(value)); |
23108
568a0957e835
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 <evan.s@dreskin.net>
parents:
23105
diff
changeset
|
221 } |
568a0957e835
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 <evan.s@dreskin.net>
parents:
23105
diff
changeset
|
222 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
223 static JabberChat *jabber_chat_new(JabberStream *js, const char *room, |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
224 const char *server, const char *handle, |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
225 const char *password, GHashTable *data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 JabberChat *chat; |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
228 char *jid; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
229 |
28752
ef513141e960
jabber: Reduce these from assertions to checks.
Paul Aurich <paul@darkrain42.org>
parents:
28742
diff
changeset
|
230 if (jabber_chat_find(js, room, server) != NULL) |
ef513141e960
jabber: Reduce these from assertions to checks.
Paul Aurich <paul@darkrain42.org>
parents:
28742
diff
changeset
|
231 return NULL; |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
232 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
233 chat = g_new0(JabberChat, 1); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
234 chat->js = js; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
235 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
236 chat->room = g_strdup(room); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
237 chat->server = g_strdup(server); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
238 chat->handle = g_strdup(handle); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
239 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
240 /* Copy the data hash table to chat->components */ |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
241 chat->components = g_hash_table_new_full(g_str_hash, g_str_equal, |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
242 g_free, g_free); |
28742
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
243 if (data == NULL) { |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
244 g_hash_table_insert(chat->components, g_strdup("handle"), g_strdup(handle)); |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
245 g_hash_table_insert(chat->components, g_strdup("room"), g_strdup(room)); |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
246 g_hash_table_insert(chat->components, g_strdup("server"), g_strdup(server)); |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
247 /* g_hash_table_insert(chat->components, g_strdup("password"), g_strdup(server)); */ |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
248 } else { |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
249 g_hash_table_foreach(data, insert_in_hash_table, chat->components); |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
250 } |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
251 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
252 chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
253 (GDestroyNotify)jabber_chat_member_free); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
254 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
255 jid = g_strdup_printf("%s@%s", room, server); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
256 g_hash_table_insert(js->chats, jid, chat); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
257 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
258 return chat; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
259 } |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
260 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
261 JabberChat *jabber_join_chat(JabberStream *js, const char *room, |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
262 const char *server, const char *handle, |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
263 const char *password, GHashTable *data) |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
264 { |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
265 JabberChat *chat; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
266 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
267 PurpleConnection *gc; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
268 PurpleAccount *account; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
269 PurpleStatus *status; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
270 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 xmlnode *presence, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 JabberBuddyState state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 int priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
276 char *jid; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
277 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
278 chat = jabber_chat_new(js, room, server, handle, password, data); |
28752
ef513141e960
jabber: Reduce these from assertions to checks.
Paul Aurich <paul@darkrain42.org>
parents:
28742
diff
changeset
|
279 if (chat == NULL) |
ef513141e960
jabber: Reduce these from assertions to checks.
Paul Aurich <paul@darkrain42.org>
parents:
28742
diff
changeset
|
280 return NULL; |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
281 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
282 gc = js->gc; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
283 account = purple_connection_get_account(gc); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
284 status = purple_account_get_active_status(account); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
285 purple_status_to_jabber(status, &state, &msg, &priority); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
286 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
287 presence = jabber_presence_create_js(js, state, msg, priority); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
288 g_free(msg); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
289 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
290 jid = g_strdup_printf("%s@%s/%s", room, server, handle); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
291 xmlnode_set_attrib(presence, "to", jid); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
292 g_free(jid); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
293 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
294 x = xmlnode_new_child(presence, "x"); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
295 xmlnode_set_namespace(x, "http://jabber.org/protocol/muc"); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
296 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
297 if (password && *password) { |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
298 xmlnode *p = xmlnode_new_child(x, "password"); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
299 xmlnode_insert_data(p, password, -1); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
300 } |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
301 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
302 jabber_send(js, presence); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
303 xmlnode_free(presence); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
304 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
305 return chat; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
306 } |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
307 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
308 void jabber_chat_join(PurpleConnection *gc, GHashTable *data) |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
309 { |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
310 char *room, *server, *handle, *passwd; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
311 JabberID *jid; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
312 JabberStream *js = gc->proto_data; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
313 char *tmp; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
314 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 room = g_hash_table_lookup(data, "room"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 server = g_hash_table_lookup(data, "server"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 handle = g_hash_table_lookup(data, "handle"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 passwd = g_hash_table_lookup(data, "password"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 if(!room || !server) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 if(!handle) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 handle = js->user->node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 if(!jabber_nodeprep_validate(room)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 char *buf = g_strdup_printf(_("%s is not a valid room name"), room); |
15823 | 328 purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 buf); |
23105
591ef3693345
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evan.s@dreskin.net>
parents:
22891
diff
changeset
|
330 purple_serv_got_join_chat_failed(gc, data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 return; |
27546
e90fa379fcec
Validate IPv6 identifiers in the domain portion of a JID.
Paul Aurich <paul@darkrain42.org>
parents:
27014
diff
changeset
|
333 } else if(!jabber_domain_validate(server)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 char *buf = g_strdup_printf(_("%s is not a valid server name"), server); |
15823 | 335 purple_notify_error(gc, _("Invalid Server Name"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 _("Invalid Server Name"), buf); |
23105
591ef3693345
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evan.s@dreskin.net>
parents:
22891
diff
changeset
|
337 purple_serv_got_join_chat_failed(gc, data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 } else if(!jabber_resourceprep_validate(handle)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); |
15823 | 342 purple_notify_error(gc, _("Invalid Room Handle"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 _("Invalid Room Handle"), buf); |
23105
591ef3693345
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evan.s@dreskin.net>
parents:
22891
diff
changeset
|
344 purple_serv_got_join_chat_failed(gc, data); |
22737
8c3f6126759c
Fix a small memory leak when failing to join a jabber conference
Mark Doliner <mark@kingant.net>
parents:
22644
diff
changeset
|
345 g_free(buf); |
8c3f6126759c
Fix a small memory leak when failing to join a jabber conference
Mark Doliner <mark@kingant.net>
parents:
22644
diff
changeset
|
346 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
349 /* Normalize the room and server parameters */ |
23105
591ef3693345
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evan.s@dreskin.net>
parents:
22891
diff
changeset
|
350 tmp = g_strdup_printf("%s@%s", room, server); |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
351 jid = jabber_id_new(tmp); |
23105
591ef3693345
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evan.s@dreskin.net>
parents:
22891
diff
changeset
|
352 g_free(tmp); |
591ef3693345
As discussed on the devel list, purple_serv_got_join_chat_failed() and the
Evan Schoenberg <evan.s@dreskin.net>
parents:
22891
diff
changeset
|
353 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
354 if (jid == NULL) { |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
355 /* TODO: Error message */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
357 g_return_if_reached(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
360 /* |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
361 * Now that we've done all that nice core-interface stuff, let's join |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
362 * this room! |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
363 */ |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
364 jabber_join_chat(js, jid->node, jid->domain, handle, passwd, data); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
365 jabber_id_free(jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 |
15823 | 368 void jabber_chat_leave(PurpleConnection *gc, int id) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 JabberChat *chat = jabber_chat_find_by_id(js, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 jabber_chat_part(chat, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 |
23262
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23161
diff
changeset
|
379 chat->left = TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 void jabber_chat_destroy(JabberChat *chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 JabberStream *js = chat->js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 char *room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 |
28756
08ffa726aea2
jabber: Remove useless jabber_normalize calls now that the data in the hash table
Paul Aurich <paul@darkrain42.org>
parents:
28752
diff
changeset
|
387 g_hash_table_remove(js->chats, room_jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 void jabber_chat_free(JabberChat *chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 if(chat->config_dialog_handle) |
15823 | 394 purple_request_close(chat->config_dialog_type, chat->config_dialog_handle); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 g_free(chat->room); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 g_free(chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 g_free(chat->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 g_hash_table_destroy(chat->members); |
23108
568a0957e835
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 <evan.s@dreskin.net>
parents:
23105
diff
changeset
|
400 g_hash_table_destroy(chat->components); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 g_free(chat); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
15823 | 404 gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 { |
15823 | 406 return purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 |
15823 | 409 char *jabber_chat_buddy_real_name(PurpleConnection *gc, int id, const char *who) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 JabberChat *chat; |
23358
1be3301fa2a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23262
diff
changeset
|
413 JabberChatMember *jcm; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 chat = jabber_chat_find_by_id(js, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 |
23358
1be3301fa2a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23262
diff
changeset
|
420 jcm = g_hash_table_lookup(chat->members, who); |
1be3301fa2a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23262
diff
changeset
|
421 if (jcm != NULL && jcm->jid) |
1be3301fa2a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23262
diff
changeset
|
422 return g_strdup(jcm->jid); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23988
diff
changeset
|
423 |
23358
1be3301fa2a3
Return the real JID (if available) from the xmpp get_cb_real_name function.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23262
diff
changeset
|
424 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 return g_strdup_printf("%s@%s/%s", chat->room, chat->server, who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 static void jabber_chat_room_configure_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 JabberChat *chat = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 char *to = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "http://jabber.org/protocol/muc#owner"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 g_free(to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
446 static void jabber_chat_room_configure_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
447 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
448 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 JabberChat *chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
455 if (!from) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
458 if (type == JABBER_IQ_RESULT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 jid = jabber_id_new(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 if(!jid) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 chat = jabber_chat_find(js, jid->node, jid->domain); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 const char *xmlns; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 if(!(xmlns = xmlnode_get_namespace(x))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 if(!strcmp(xmlns, "jabber:x:data")) { |
15823 | 479 chat->config_dialog_type = PURPLE_REQUEST_FIELDS; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 chat->config_dialog_handle = jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 } |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
484 } else if (type == JABBER_IQ_ERROR) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
485 char *msg = jabber_parse_error(js, packet, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 |
15823 | 487 purple_notify_error(js->gc, _("Configuration error"), _("Configuration error"), msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 if(msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 msg = g_strdup_printf("Unable to configure room %s", from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 |
15823 | 496 purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 void jabber_chat_request_room_configure(JabberChat *chat) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 chat->config_dialog_handle = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 if(!chat->muc) { |
15823 | 511 purple_notify_error(chat->js->gc, _("Room Configuration Error"), _("Room Configuration Error"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 _("This room is not capable of being configured")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 "http://jabber.org/protocol/muc#owner"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 xmlnode_set_attrib(iq->node, "to", room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 jabber_iq_set_callback(iq, jabber_chat_room_configure_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 void jabber_chat_create_instant_room(JabberChat *chat) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 chat->config_dialog_handle = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 "http://jabber.org/protocol/muc#owner"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 x = xmlnode_new_child(query, "x"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 xmlnode_set_attrib(iq->node, "to", room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 xmlnode_set_namespace(x, "jabber:x:data"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 xmlnode_set_attrib(x, "type", "submit"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
554 static void |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
555 jabber_chat_register_x_data_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
556 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
557 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
559 if (type == JABBER_IQ_ERROR) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
560 char *msg = jabber_parse_error(js, packet, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 |
15823 | 562 purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 if(msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 static void jabber_chat_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 JabberChat *chat = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 char *to = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 g_free(to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 jabber_iq_set_callback(iq, jabber_chat_register_x_data_result_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
590 static void jabber_chat_register_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
591 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
592 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 JabberChat *chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
599 if (!from) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
602 if (type == JABBER_IQ_RESULT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 jid = jabber_id_new(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 if(!jid) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 chat = jabber_chat_find(js, jid->node, jid->domain); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 const char *xmlns; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 if(!(xmlns = xmlnode_get_namespace(x))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 if(!strcmp(xmlns, "jabber:x:data")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 jabber_x_data_request(js, x, jabber_chat_register_x_data_cb, chat); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 } |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
628 } else if (type == JABBER_IQ_ERROR) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
629 char *msg = jabber_parse_error(js, packet, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 |
15823 | 631 purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 if(msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 msg = g_strdup_printf("Unable to configure room %s", from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 |
15823 | 640 purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 void jabber_chat_register(JabberChat *chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, "jabber:iq:register"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 xmlnode_set_attrib(iq->node, "to", room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 jabber_iq_set_callback(iq, jabber_chat_register_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 /* merge this with the function below when we get everyone on the same page wrt /commands */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 void jabber_chat_change_topic(JabberChat *chat, const char *topic) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 { |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
667 JabberMessage *jm; |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
668 |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
669 jm = g_new0(JabberMessage, 1); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
670 jm->js = chat->js; |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
671 jm->type = JABBER_MESSAGE_GROUPCHAT; |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
672 jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
674 if (topic && *topic) |
28196
fdf1f64de3a0
Set XMPP chat topic when it contains a < followed by a character. Closes #5712.
Paul Aurich <paul@darkrain42.org>
parents:
27546
diff
changeset
|
675 jm->subject = g_strdup(topic); |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
676 else |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
677 jm->subject = g_strdup(""); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
679 jabber_message_send(jm); |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
680 jabber_message_free(jm); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 |
15823 | 683 void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 { |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
685 JabberStream *js = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 JabberChat *chat = jabber_chat_find_by_id(js, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 jabber_chat_change_topic(chat, topic); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
695 gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 xmlnode *presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 char *full_jid; |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
699 PurpleAccount *account; |
15823 | 700 PurpleStatus *status; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 JabberBuddyState state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 int priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 if(!chat->muc) { |
15823 | 706 purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 _("Nick changing not supported in non-MUC chatrooms"), |
15823 | 708 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
709 return FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
712 account = purple_connection_get_account(chat->js->gc); |
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
713 status = purple_account_get_active_status(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 |
15823 | 715 purple_status_to_jabber(status, &state, &msg, &priority); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 |
17563
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
16962
diff
changeset
|
717 presence = jabber_presence_create_js(chat->js, state, msg, priority); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, nick); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 xmlnode_set_attrib(presence, "to", full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 g_free(full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 jabber_send(chat->js, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 xmlnode_free(presence); |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
725 |
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
726 return TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 void jabber_chat_part(JabberChat *chat, const char *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 xmlnode *presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 room_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 chat->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 presence = xmlnode_new("presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 xmlnode_set_attrib(presence, "to", room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 xmlnode_set_attrib(presence, "type", "unavailable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 if(msg) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 xmlnode *status = xmlnode_new_child(presence, "status"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 xmlnode_insert_data(status, msg, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 jabber_send(chat->js, presence); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23988
diff
changeset
|
744 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 xmlnode_free(presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
749 static void roomlist_disco_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
750 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
751 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 xmlnode *item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 if(!js->roomlist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
759 if (type == JABBER_IQ_ERROR) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
760 char *err = jabber_parse_error(js, packet, NULL); |
15823 | 761 purple_notify_error(js->gc, _("Error"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 _("Error retrieving room list"), err); |
15823 | 763 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
764 purple_roomlist_unref(js->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 js->roomlist = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 g_free(err); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 if(!(query = xmlnode_get_child(packet, "query"))) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
19696
diff
changeset
|
771 char *err = jabber_parse_error(js, packet, NULL); |
15823 | 772 purple_notify_error(js->gc, _("Error"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 _("Error retrieving room list"), err); |
15823 | 774 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
775 purple_roomlist_unref(js->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 js->roomlist = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 g_free(err); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 for(item = xmlnode_get_child(query, "item"); item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 item = xmlnode_get_next_twin(item)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 const char *name; |
15823 | 784 PurpleRoomlistRoom *room; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 if(!(jid = jabber_id_new(xmlnode_get_attrib(item, "jid")))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 name = xmlnode_get_attrib(item, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 |
15823 | 792 room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, jid->node, NULL); |
793 purple_roomlist_room_add_field(js->roomlist, room, jid->node); | |
794 purple_roomlist_room_add_field(js->roomlist, room, jid->domain); | |
795 purple_roomlist_room_add_field(js->roomlist, room, name ? name : ""); | |
796 purple_roomlist_room_add(js->roomlist, room); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 } |
15823 | 800 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
801 purple_roomlist_unref(js->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 js->roomlist = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 static void roomlist_cancel_cb(JabberStream *js, const char *server) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 if(js->roomlist) { |
15823 | 807 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
808 purple_roomlist_unref(js->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 js->roomlist = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 static void roomlist_ok_cb(JabberStream *js, const char *server) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 if(!js->roomlist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 if(!server || !*server) { |
15823 | 821 purple_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL); |
28225
22ae131b8a0c
jabber: Fix "Invalid Server" breaking roomlist dialog. Closes #8143.
Paul Aurich <paul@darkrain42.org>
parents:
28196
diff
changeset
|
822 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 |
15823 | 826 purple_roomlist_set_in_progress(js->roomlist, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28793
diff
changeset
|
828 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 xmlnode_set_attrib(iq->node, "to", server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 |
15823 | 837 char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 return g_strdup_printf("%s@%s", (char*)room->fields->data, (char*)room->fields->next->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 |
15823 | 843 PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 GList *fields = NULL; |
15823 | 847 PurpleRoomlistField *f; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 if(js->roomlist) |
15823 | 850 purple_roomlist_unref(js->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 |
15823 | 852 js->roomlist = purple_roomlist_new(purple_connection_get_account(js->gc)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 |
15823 | 854 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 fields = g_list_append(fields, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 |
15823 | 857 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "server", TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 fields = g_list_append(fields, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 |
15823 | 860 f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Description"), "description", FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 fields = g_list_append(fields, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 |
15823 | 863 purple_roomlist_set_fields(js->roomlist, fields); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
866 purple_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 _("Select a conference server to query"), |
16962
88444e60ea95
Removes 'jabber.org' defaults from XMPP. I think we had agreed this was a good idea.
Sean Egan <seanegan@gmail.com>
parents:
16442
diff
changeset
|
868 js->chat_servers ? js->chat_servers->data : NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 FALSE, FALSE, NULL, |
15823 | 870 _("Find Rooms"), PURPLE_CALLBACK(roomlist_ok_cb), |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
871 _("Cancel"), PURPLE_CALLBACK(roomlist_cancel_cb), |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23988
diff
changeset
|
872 purple_connection_get_account(gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
873 js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 return js->roomlist; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 |
15823 | 878 void jabber_roomlist_cancel(PurpleRoomlist *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 { |
15823 | 880 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 |
15823 | 883 gc = purple_account_get_connection(list->account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
884 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 |
15823 | 886 purple_roomlist_set_in_progress(list, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 if (js->roomlist == list) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 js->roomlist = NULL; |
15823 | 890 purple_roomlist_unref(list); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 void jabber_chat_member_free(JabberChatMember *jcm) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 g_free(jcm->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 g_free(jcm->jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 g_free(jcm); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 void jabber_chat_track_handle(JabberChat *chat, const char *handle, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 const char *jid, const char *affiliation, const char *role) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 JabberChatMember *jcm = g_new0(JabberChatMember, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 jcm->handle = g_strdup(handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 jcm->jid = g_strdup(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 g_hash_table_replace(chat->members, jcm->handle, jcm); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 /* XXX: keep track of role and affiliation */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 void jabber_chat_remove_handle(JabberChat *chat, const char *handle) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
916 g_hash_table_remove(chat->members, handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, const char *why) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 { |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
921 JabberChatMember *jcm; |
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
922 const char *jid; |
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
923 char *to; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 xmlnode *query, *item, *reason; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
927 jcm = g_hash_table_lookup(chat->members, who); |
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
928 if (jcm && jcm->jid) |
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
929 jid = jcm->jid; |
29111
4ab6f0479bc5
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <paul@darkrain42.org>
parents:
29031
diff
changeset
|
930 else if (strchr(who, '@') != NULL) |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
931 jid = who; |
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
932 else |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 "http://jabber.org/protocol/muc#admin"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 to = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 g_free(to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
942 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 item = xmlnode_new_child(query, "item"); |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
944 xmlnode_set_attrib(item, "jid", jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 xmlnode_set_attrib(item, "affiliation", "outcast"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 if(why) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 reason = xmlnode_new_child(item, "reason"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
948 xmlnode_insert_data(reason, why, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const char *affiliation) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 { |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
958 JabberChatMember *jcm; |
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
959 const char *jid; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 char *to; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 xmlnode *query, *item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 jcm = g_hash_table_lookup(chat->members, who); |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
965 if (jcm && jcm->jid) |
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
966 jid = jcm->jid; |
29111
4ab6f0479bc5
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <paul@darkrain42.org>
parents:
29031
diff
changeset
|
967 else if (strchr(who, '@') != NULL) |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
968 jid = who; |
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
969 else |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 "http://jabber.org/protocol/muc#admin"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 to = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 g_free(to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 item = xmlnode_new_child(query, "item"); |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
981 xmlnode_set_attrib(item, "jid", jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 xmlnode_set_attrib(item, "affiliation", affiliation); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
989 static void |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
990 jabber_chat_affiliation_list_cb(JabberStream *js, const char *from, |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
991 JabberIqType type, const char *id, |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
992 xmlnode *packet, gpointer data) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
993 { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
994 JabberChat *chat; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
995 xmlnode *query, *item; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
996 int chat_id = GPOINTER_TO_INT(data); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
997 GString *buf; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
998 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
999 if(!(chat = jabber_chat_find_by_id(js, chat_id))) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1000 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1001 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1002 if (type == JABBER_IQ_ERROR) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1003 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1004 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1005 if(!(query = xmlnode_get_child(packet, "query"))) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1006 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1007 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1008 buf = g_string_new(_("Affiliations:")); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1009 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1010 item = xmlnode_get_child(query, "item"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1011 if (item) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1012 for( ; item; item = xmlnode_get_next_twin(item)) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1013 const char *jid = xmlnode_get_attrib(item, "jid"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1014 const char *affiliation = xmlnode_get_attrib(item, "affiliation"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1015 if (jid && affiliation) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1016 g_string_append_printf(buf, "\n%s %s", jid, affiliation); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1017 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1018 } else { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1019 buf = g_string_append_c(buf, '\n'); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1020 buf = g_string_append_len(buf, _("No users found"), -1); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1021 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1022 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1023 purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", buf->str, |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1024 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1025 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1026 g_string_free(buf, TRUE); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1027 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1028 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1029 gboolean jabber_chat_affiliation_list(JabberChat *chat, const char *affiliation) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1030 { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1031 JabberIq *iq; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1032 char *room_jid; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1033 xmlnode *query, *item; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1034 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1035 iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1036 "http://jabber.org/protocol/muc#admin"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1037 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1038 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1039 xmlnode_set_attrib(iq->node, "to", room_jid); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1040 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1041 query = xmlnode_get_child(iq->node, "query"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1042 item = xmlnode_new_child(query, "item"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1043 xmlnode_set_attrib(item, "affiliation", affiliation); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1044 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1045 jabber_iq_set_callback(iq, jabber_chat_affiliation_list_cb, GINT_TO_POINTER(chat->id)); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1046 jabber_iq_send(iq); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1047 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1048 return TRUE; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1049 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1050 |
29464
c8b407fec879
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <paul@darkrain42.org>
parents:
29111
diff
changeset
|
1051 gboolean jabber_chat_role_user(JabberChat *chat, const char *who, |
c8b407fec879
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <paul@darkrain42.org>
parents:
29111
diff
changeset
|
1052 const char *role, const char *why) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 char *to; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 xmlnode *query, *item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 JabberChatMember *jcm; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 jcm = g_hash_table_lookup(chat->members, who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 if (!jcm || !jcm->handle) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 "http://jabber.org/protocol/muc#admin"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 to = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 g_free(to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 item = xmlnode_new_child(query, "item"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 xmlnode_set_attrib(item, "nick", jcm->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 xmlnode_set_attrib(item, "role", role); |
29464
c8b407fec879
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <paul@darkrain42.org>
parents:
29111
diff
changeset
|
1075 if (why) { |
c8b407fec879
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <paul@darkrain42.org>
parents:
29111
diff
changeset
|
1076 xmlnode *reason = xmlnode_new_child(item, "reason"); |
c8b407fec879
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <paul@darkrain42.org>
parents:
29111
diff
changeset
|
1077 xmlnode_insert_data(reason, why, -1); |
c8b407fec879
jabber: Kick by in-room nick, not JID. Reduces code, but is still in-spec (and seems to be the preferred method)
Paul Aurich <paul@darkrain42.org>
parents:
29111
diff
changeset
|
1078 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1079 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1085 static void jabber_chat_role_list_cb(JabberStream *js, const char *from, |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1086 JabberIqType type, const char *id, |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1087 xmlnode *packet, gpointer data) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1088 { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1089 JabberChat *chat; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1090 xmlnode *query, *item; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1091 int chat_id = GPOINTER_TO_INT(data); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1092 GString *buf; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1093 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1094 if(!(chat = jabber_chat_find_by_id(js, chat_id))) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1095 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1096 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1097 if (type == JABBER_IQ_ERROR) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1098 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1099 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1100 if(!(query = xmlnode_get_child(packet, "query"))) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1101 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1102 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1103 buf = g_string_new(_("Roles:")); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1104 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1105 item = xmlnode_get_child(query, "item"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1106 if (item) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1107 for( ; item; item = xmlnode_get_next_twin(item)) { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1108 const char *jid = xmlnode_get_attrib(item, "jid"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1109 const char *role = xmlnode_get_attrib(item, "role"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1110 if (jid && role) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1111 g_string_append_printf(buf, "\n%s %s", jid, role); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1112 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1113 } else { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1114 buf = g_string_append_c(buf, '\n'); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1115 buf = g_string_append_len(buf, _("No users found"), -1); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1116 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1117 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1118 purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", buf->str, |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1119 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1120 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1121 g_string_free(buf, TRUE); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1122 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1123 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1124 gboolean jabber_chat_role_list(JabberChat *chat, const char *role) |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1125 { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1126 JabberIq *iq; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1127 char *room_jid; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1128 xmlnode *query, *item; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1129 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1130 iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1131 "http://jabber.org/protocol/muc#admin"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1132 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1133 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1134 xmlnode_set_attrib(iq->node, "to", room_jid); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1135 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1136 query = xmlnode_get_child(iq->node, "query"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1137 item = xmlnode_new_child(query, "item"); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1138 xmlnode_set_attrib(item, "role", role); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1139 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1140 jabber_iq_set_callback(iq, jabber_chat_role_list_cb, GINT_TO_POINTER(chat->id)); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1141 jabber_iq_send(iq); |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1142 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1143 return TRUE; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1144 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1145 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1146 static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1147 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1148 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 JabberChat *chat; |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1151 #if 0 |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1152 xmlnode *query, *x; |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1153 #endif |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1154 int chat_id = GPOINTER_TO_INT(data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1156 if(!(chat = jabber_chat_find_by_id(js, chat_id))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 /* defaults, in case the conference server doesn't |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1160 * support this request */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1161 chat->xhtml = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 |
20333
53afc5cce143
applied changes from d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
Luke Schierer <lschiere@pidgin.im>
parents:
19696
diff
changeset
|
1163 /* disabling this until more MUC servers support |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1164 * announcing this */ |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1165 #if 0 |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1166 if (type == JABBER_IQ_ERROR) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1170 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 chat->xhtml = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1174 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 for(x = xmlnode_get_child(query, "feature"); x; x = xmlnode_get_next_twin(x)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 const char *var = xmlnode_get_attrib(x, "var"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28793
diff
changeset
|
1178 if(var && !strcmp(var, NS_XHTML_IM)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 chat->xhtml = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1181 } |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
1182 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 void jabber_chat_disco_traffic(JabberChat *chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1186 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1187 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1188 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1190 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28793
diff
changeset
|
1193 iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, NS_DISCO_INFO); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23988
diff
changeset
|
1195 xmlnode_set_attrib(iq->node, "to", room_jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/muc#traffic"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1200 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 jabber_iq_set_callback(iq, jabber_chat_disco_traffic_cb, GINT_TO_POINTER(chat->id)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1202 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 |
26956
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1208 typedef struct { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1209 const gchar *cap; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1210 gboolean *all_support; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1211 JabberBuddy *jb; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1212 } JabberChatCapsData; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1213 |
26956
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1214 static void |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1215 jabber_chat_all_participants_have_capability_foreach(gpointer key, |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1216 gpointer value, |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1217 gpointer user_data) |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1218 { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1219 const gchar *cap = ((JabberChatCapsData *) user_data)->cap; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1220 gboolean *all_support = ((JabberChatCapsData *) user_data)->all_support; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1221 JabberBuddy *jb = ((JabberChatCapsData *) user_data)->jb; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1222 JabberChatMember *member = (JabberChatMember *) value; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1223 const gchar *resource = member->handle; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1224 JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 |
26956
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1226 if (jbr) { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1227 *all_support &= jabber_resource_has_capability(jbr, cap); |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1228 } else { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1229 *all_support = FALSE; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1230 } |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1231 } |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1232 |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1233 gboolean |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1234 jabber_chat_all_participants_have_capability(const JabberChat *chat, |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1235 const gchar *cap) |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1236 { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1237 gchar *chat_jid = NULL; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1238 JabberBuddy *jb = NULL; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1239 gboolean all_support = TRUE; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1240 JabberChatCapsData data; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1241 |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1242 chat_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1243 jb = jabber_buddy_find(chat->js, chat_jid, FALSE); |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1244 |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1245 if (jb) { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1246 data.cap = cap; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1247 data.all_support = &all_support; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1248 data.jb = jb; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1249 |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26956
diff
changeset
|
1250 g_hash_table_foreach(chat->members, |
26956
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1251 jabber_chat_all_participants_have_capability_foreach, &data); |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1252 } else { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1253 all_support = FALSE; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1254 } |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1255 g_free(chat_jid); |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1256 return all_support; |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1257 } |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1258 |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1259 guint |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1260 jabber_chat_get_num_participants(const JabberChat *chat) |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1261 { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1262 return g_hash_table_size(chat->members); |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1263 } |