Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/chat.c @ 31679:ba6a4a0f8f50
jabber: Treat the presence storm on joining a room as not new arrivals.
This helps in Adium, where otherwise all of those joins end up printed out.
Fixes #7501, #a14527
committer: Paul Aurich <paul@darkrain42.org>
author | thijs@adium.im |
---|---|
date | Sun, 20 Feb 2011 02:25:23 +0000 |
parents | a0d6b85e9c42 |
children | f178a7df417a |
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); |
30745
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
176 if (msg) { |
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
177 body = xmlnode_new_child(invite, "reason"); |
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
178 xmlnode_insert_data(body, msg, -1); |
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
179 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 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
|
182 /* |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
183 * 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
|
184 * ...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
|
185 * 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
|
186 * |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
187 * 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
|
188 */ |
30745
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
189 if (msg) { |
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
190 body = xmlnode_new_child(message, "body"); |
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
191 xmlnode_insert_data(body, msg, -1); |
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
192 } |
28775
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
193 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 x = xmlnode_new_child(message, "x"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 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
|
196 |
41992511531f
jabber: Improved support for XEP-0249 (and document the legacy stuff).
Paul Aurich <paul@darkrain42.org>
parents:
28756
diff
changeset
|
197 /* The better place for it! XEP-0249 style. */ |
30745
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
198 if (msg) |
a0d6b85e9c42
jabber: Avoid an assertion warning
Paul Aurich <paul@darkrain42.org>
parents:
29464
diff
changeset
|
199 xmlnode_set_attrib(x, "reason", msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 xmlnode_set_namespace(x, "jabber:x:conference"); |
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 jabber_send(js, message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 xmlnode_free(message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 } |
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 void jabber_chat_member_free(JabberChatMember *jcm); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 char *jabber_get_chat_name(GHashTable *data) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 char *room, *server, *chat_name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 room = g_hash_table_lookup(data, "room"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 server = g_hash_table_lookup(data, "server"); |
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 if (room && server) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 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
|
218 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 return chat_name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 |
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
|
222 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
|
223 { |
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
|
224 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
|
225 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
|
226 } |
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
|
227 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
228 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
|
229 const char *server, const char *handle, |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
230 const char *password, GHashTable *data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 JabberChat *chat; |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
233 char *jid; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
234 |
28752
ef513141e960
jabber: Reduce these from assertions to checks.
Paul Aurich <paul@darkrain42.org>
parents:
28742
diff
changeset
|
235 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
|
236 return NULL; |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
237 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
238 chat = g_new0(JabberChat, 1); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
239 chat->js = js; |
31679
ba6a4a0f8f50
jabber: Treat the presence storm on joining a room as not new arrivals.
thijs@adium.im
parents:
30745
diff
changeset
|
240 chat->joined = 0; |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
241 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
242 chat->room = g_strdup(room); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
243 chat->server = g_strdup(server); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
244 chat->handle = g_strdup(handle); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
245 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
246 /* Copy the data hash table to chat->components */ |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
247 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
|
248 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
|
249 if (data == NULL) { |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
250 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
|
251 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
|
252 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
|
253 /* 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
|
254 } else { |
63dc67b32577
jabber: Use the newly refactored code to simplify "Initiate Chat".
Paul Aurich <paul@darkrain42.org>
parents:
28741
diff
changeset
|
255 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
|
256 } |
28741
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 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
|
259 (GDestroyNotify)jabber_chat_member_free); |
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 jid = g_strdup_printf("%s@%s", room, server); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
262 g_hash_table_insert(js->chats, jid, chat); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
263 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
264 return chat; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
265 } |
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 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
|
268 const char *server, const char *handle, |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
269 const char *password, GHashTable *data) |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
270 { |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
271 JabberChat *chat; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
272 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
273 PurpleConnection *gc; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
274 PurpleAccount *account; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
275 PurpleStatus *status; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
276 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 xmlnode *presence, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 JabberBuddyState state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 int priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
282 char *jid; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
283 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
284 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
|
285 if (chat == NULL) |
ef513141e960
jabber: Reduce these from assertions to checks.
Paul Aurich <paul@darkrain42.org>
parents:
28742
diff
changeset
|
286 return NULL; |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
287 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
288 gc = js->gc; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
289 account = purple_connection_get_account(gc); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
290 status = purple_account_get_active_status(account); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
291 purple_status_to_jabber(status, &state, &msg, &priority); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
292 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
293 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
|
294 g_free(msg); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
295 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
296 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
|
297 xmlnode_set_attrib(presence, "to", jid); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
298 g_free(jid); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
299 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
300 x = xmlnode_new_child(presence, "x"); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
301 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
|
302 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
303 if (password && *password) { |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
304 xmlnode *p = xmlnode_new_child(x, "password"); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
305 xmlnode_insert_data(p, password, -1); |
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 jabber_send(js, presence); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
309 xmlnode_free(presence); |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
310 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
311 return chat; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
312 } |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
313 |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
314 void jabber_chat_join(PurpleConnection *gc, GHashTable *data) |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
315 { |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
316 char *room, *server, *handle, *passwd; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
317 JabberID *jid; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
318 JabberStream *js = gc->proto_data; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
319 char *tmp; |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
320 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 room = g_hash_table_lookup(data, "room"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 server = g_hash_table_lookup(data, "server"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 handle = g_hash_table_lookup(data, "handle"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 passwd = g_hash_table_lookup(data, "password"); |
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(!room || !server) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 if(!handle) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 handle = js->user->node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 if(!jabber_nodeprep_validate(room)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 char *buf = g_strdup_printf(_("%s is not a valid room name"), room); |
15823 | 334 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
|
335 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
|
336 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
|
337 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 return; |
27546
e90fa379fcec
Validate IPv6 identifiers in the domain portion of a JID.
Paul Aurich <paul@darkrain42.org>
parents:
27014
diff
changeset
|
339 } else if(!jabber_domain_validate(server)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 char *buf = g_strdup_printf(_("%s is not a valid server name"), server); |
15823 | 341 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
|
342 _("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
|
343 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
|
344 g_free(buf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 } else if(!jabber_resourceprep_validate(handle)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); |
15823 | 348 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
|
349 _("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
|
350 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
|
351 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
|
352 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
355 /* 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
|
356 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
|
357 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
|
358 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
|
359 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
360 if (jid == NULL) { |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
361 /* TODO: Error message */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
363 g_return_if_reached(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 |
28741
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
366 /* |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
367 * 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
|
368 * this room! |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
369 */ |
724e77faee1a
jabber: Refactor the chat-joining code
Paul Aurich <paul@darkrain42.org>
parents:
28659
diff
changeset
|
370 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
|
371 jabber_id_free(jid); |
15374
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 |
15823 | 374 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
|
375 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 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
|
378 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 jabber_chat_part(chat, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 |
23262
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23161
diff
changeset
|
385 chat->left = TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 void jabber_chat_destroy(JabberChat *chat) |
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 JabberStream *js = chat->js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 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
|
392 |
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
|
393 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
|
394 g_free(room_jid); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 void jabber_chat_free(JabberChat *chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 if(chat->config_dialog_handle) |
15823 | 400 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
|
401 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 g_free(chat->room); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 g_free(chat->server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 g_free(chat->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 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
|
406 g_hash_table_destroy(chat->components); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 g_free(chat); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 |
15823 | 410 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
|
411 { |
15823 | 412 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
|
413 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
15823 | 415 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
|
416 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 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
|
419 JabberChatMember *jcm; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 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
|
422 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 |
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
|
426 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
|
427 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
|
428 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
|
429 |
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
|
430 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 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
|
432 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 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
|
435 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 JabberChat *chat = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 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
|
440 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 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
|
442 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 g_free(to); |
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 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 |
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
|
452 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
|
453 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
|
454 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 JabberChat *chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 |
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
|
461 if (!from) |
15374
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 |
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
|
464 if (type == JABBER_IQ_RESULT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 jid = jabber_id_new(from); |
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(!jid) |
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 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
|
471 jabber_id_free(jid); |
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 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 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
|
480 const char *xmlns; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 if(!(xmlns = xmlnode_get_namespace(x))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 if(!strcmp(xmlns, "jabber:x:data")) { |
15823 | 485 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
|
486 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
|
487 return; |
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 } |
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
|
490 } 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
|
491 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
|
492 |
15823 | 493 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
|
494 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 if(msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 return; |
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 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
|
501 |
15823 | 502 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
|
503 g_free(msg); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 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
|
508 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 chat->config_dialog_handle = NULL; |
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 if(!chat->muc) { |
15823 | 517 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
|
518 _("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
|
519 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 } |
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 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
|
523 "http://jabber.org/protocol/muc#owner"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 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
|
525 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 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
|
527 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 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
|
529 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 g_free(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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 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
|
536 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 chat->config_dialog_handle = NULL; |
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 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
|
546 "http://jabber.org/protocol/muc#owner"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 x = xmlnode_new_child(query, "x"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 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
|
550 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 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
|
552 xmlnode_set_namespace(x, "jabber:x:data"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 xmlnode_set_attrib(x, "type", "submit"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 |
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
|
560 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
|
561 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
|
562 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
|
563 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 { |
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
|
565 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
|
566 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
|
567 |
15823 | 568 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
|
569 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 if(msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 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
|
577 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 JabberChat *chat = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 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
|
582 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 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
|
584 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 g_free(to); |
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 query = xmlnode_get_child(iq->node, "query"); |
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 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 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
|
592 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 |
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
|
596 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
|
597 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
|
598 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 JabberChat *chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 |
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
|
605 if (!from) |
15374
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 |
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
|
608 if (type == JABBER_IQ_RESULT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 jid = jabber_id_new(from); |
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(!jid) |
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 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
|
615 jabber_id_free(jid); |
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 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 return; |
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(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 return; |
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 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
|
624 const char *xmlns; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 if(!(xmlns = xmlnode_get_namespace(x))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 if(!strcmp(xmlns, "jabber:x:data")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 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
|
631 return; |
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 } |
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
|
634 } 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
|
635 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
|
636 |
15823 | 637 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
|
638 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 if(msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 return; |
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 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
|
645 |
15823 | 646 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
|
647 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 void jabber_chat_register(JabberChat *chat) |
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 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 return; |
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 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
|
660 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 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
|
662 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
|
663 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 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
|
666 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 /* 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
|
671 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
|
672 { |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
673 JabberMessage *jm; |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
674 |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
675 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
|
676 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
|
677 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
|
678 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
|
679 |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
680 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
|
681 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
|
682 else |
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
683 jm->subject = g_strdup(""); |
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 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
|
686 jabber_message_free(jm); |
15374
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 |
15823 | 689 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
|
690 { |
26766
06da00c70eae
Fix XMPP prpl->set_chat_topic with an empty string (or NULL)
Paul Aurich <paul@darkrain42.org>
parents:
26547
diff
changeset
|
691 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
|
692 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
|
693 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 if(!chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 return; |
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 jabber_chat_change_topic(chat, topic); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
701 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
|
702 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 xmlnode *presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 char *full_jid; |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
705 PurpleAccount *account; |
15823 | 706 PurpleStatus *status; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 JabberBuddyState state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 int priority; |
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 if(!chat->muc) { |
15823 | 712 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
|
713 _("Nick changing not supported in non-MUC chatrooms"), |
15823 | 714 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
|
715 return FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
718 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
|
719 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
|
720 |
15823 | 721 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
|
722 |
17563
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
16962
diff
changeset
|
723 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
|
724 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
|
725 xmlnode_set_attrib(presence, "to", full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 g_free(full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 g_free(msg); |
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 jabber_send(chat->js, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 xmlnode_free(presence); |
28793
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
731 |
a335d1bab20e
jabber: Reject invalid chat nicks in /nick command. Fixes #10532.
Paul Aurich <paul@darkrain42.org>
parents:
28775
diff
changeset
|
732 return TRUE; |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 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
|
736 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 char *room_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 xmlnode *presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 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
|
741 chat->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 presence = xmlnode_new("presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 xmlnode_set_attrib(presence, "to", room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 xmlnode_set_attrib(presence, "type", "unavailable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 if(msg) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 xmlnode *status = xmlnode_new_child(presence, "status"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 xmlnode_insert_data(status, msg, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 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
|
750 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 xmlnode_free(presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 |
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
|
755 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
|
756 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
|
757 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 xmlnode *item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 if(!js->roomlist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 |
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
|
765 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
|
766 char *err = jabber_parse_error(js, packet, NULL); |
15823 | 767 purple_notify_error(js->gc, _("Error"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 _("Error retrieving room list"), err); |
15823 | 769 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
770 purple_roomlist_unref(js->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 js->roomlist = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 g_free(err); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 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
|
777 char *err = jabber_parse_error(js, packet, NULL); |
15823 | 778 purple_notify_error(js->gc, _("Error"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 _("Error retrieving room list"), err); |
15823 | 780 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
781 purple_roomlist_unref(js->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 js->roomlist = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 g_free(err); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 } |
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 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
|
788 item = xmlnode_get_next_twin(item)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 const char *name; |
15823 | 790 PurpleRoomlistRoom *room; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 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
|
794 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 name = xmlnode_get_attrib(item, "name"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 |
15823 | 798 room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, jid->node, NULL); |
799 purple_roomlist_room_add_field(js->roomlist, room, jid->node); | |
800 purple_roomlist_room_add_field(js->roomlist, room, jid->domain); | |
801 purple_roomlist_room_add_field(js->roomlist, room, name ? name : ""); | |
802 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
|
803 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 } |
15823 | 806 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
807 purple_roomlist_unref(js->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 js->roomlist = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 } |
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 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
|
812 if(js->roomlist) { |
15823 | 813 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
814 purple_roomlist_unref(js->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 js->roomlist = NULL; |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 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
|
820 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 if(!js->roomlist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 if(!server || !*server) { |
15823 | 827 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
|
828 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
|
829 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 |
15823 | 832 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
|
833 |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28793
diff
changeset
|
834 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
|
835 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 xmlnode_set_attrib(iq->node, "to", server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 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
|
839 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 jabber_iq_send(iq); |
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 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
|
844 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 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
|
847 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 |
15823 | 849 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
|
850 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 GList *fields = NULL; |
15823 | 853 PurpleRoomlistField *f; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 if(js->roomlist) |
15823 | 856 purple_roomlist_unref(js->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 |
15823 | 858 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
|
859 |
15823 | 860 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
|
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 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
|
864 fields = g_list_append(fields, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 |
15823 | 866 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
|
867 fields = g_list_append(fields, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 |
15823 | 869 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
|
870 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
872 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
|
873 _("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
|
874 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
|
875 FALSE, FALSE, NULL, |
15823 | 876 _("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
|
877 _("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
|
878 purple_connection_get_account(gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
879 js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
880 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 return js->roomlist; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
883 |
15823 | 884 void jabber_roomlist_cancel(PurpleRoomlist *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 { |
15823 | 886 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 |
15823 | 889 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
|
890 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 |
15823 | 892 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
|
893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 if (js->roomlist == list) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 js->roomlist = NULL; |
15823 | 896 purple_roomlist_unref(list); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 } |
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 void jabber_chat_member_free(JabberChatMember *jcm) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 g_free(jcm->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 g_free(jcm->jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 g_free(jcm); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 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
|
908 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
|
909 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 JabberChatMember *jcm = g_new0(JabberChatMember, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 jcm->handle = g_strdup(handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 jcm->jid = g_strdup(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 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
|
916 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 /* XXX: keep track of role and affiliation */ |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 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
|
921 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 g_hash_table_remove(chat->members, handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 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
|
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 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
|
928 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
|
929 char *to; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 xmlnode *query, *item, *reason; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
933 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
|
934 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
|
935 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
|
936 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
|
937 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
|
938 else |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 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
|
942 "http://jabber.org/protocol/muc#admin"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 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
|
945 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 g_free(to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
948 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 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
|
950 xmlnode_set_attrib(item, "jid", jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 xmlnode_set_attrib(item, "affiliation", "outcast"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 if(why) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 reason = xmlnode_new_child(item, "reason"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 xmlnode_insert_data(reason, why, -1); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 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
|
963 { |
19676
e68694150fd8
Add the ability to affiliate people in an xmpp chat room even if
Mark Doliner <mark@kingant.net>
parents:
16962
diff
changeset
|
964 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
|
965 const char *jid; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
966 char *to; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
968 xmlnode *query, *item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 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
|
971 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
|
972 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
|
973 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
|
974 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
|
975 else |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 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
|
979 "http://jabber.org/protocol/muc#admin"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 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
|
982 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 g_free(to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 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
|
987 xmlnode_set_attrib(item, "jid", jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 xmlnode_set_attrib(item, "affiliation", affiliation); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
995 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
|
996 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
|
997 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
|
998 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
|
999 { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1000 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
|
1001 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
|
1002 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
|
1003 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
|
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(!(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
|
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 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
|
1009 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1010 |
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(!(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
|
1012 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1013 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1014 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
|
1015 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1016 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
|
1017 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
|
1018 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
|
1019 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
|
1020 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
|
1021 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
|
1022 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
|
1023 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1024 } else { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1025 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
|
1026 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
|
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 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
|
1030 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
|
1031 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1032 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
|
1033 } |
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 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
|
1036 { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1037 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
|
1038 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
|
1039 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
|
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 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
|
1042 "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
|
1043 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1044 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
|
1045 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
|
1046 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1047 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
|
1048 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
|
1049 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
|
1050 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1051 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
|
1052 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
|
1053 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1054 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
|
1055 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1056 |
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
|
1057 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
|
1058 const char *role, const char *why) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 char *to; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 xmlnode *query, *item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 JabberChatMember *jcm; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 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
|
1066 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 if (!jcm || !jcm->handle) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 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
|
1071 "http://jabber.org/protocol/muc#admin"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 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
|
1074 xmlnode_set_attrib(iq->node, "to", to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 g_free(to); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1078 item = xmlnode_new_child(query, "item"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1079 xmlnode_set_attrib(item, "nick", jcm->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 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
|
1081 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
|
1082 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
|
1083 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
|
1084 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 |
26884
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1091 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
|
1092 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
|
1093 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
|
1094 { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1095 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
|
1096 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
|
1097 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
|
1098 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
|
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(!(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
|
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 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
|
1104 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1105 |
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(!(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
|
1107 return; |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1108 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1109 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
|
1110 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1111 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
|
1112 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
|
1113 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
|
1114 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
|
1115 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
|
1116 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
|
1117 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
|
1118 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1119 } else { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1120 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
|
1121 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
|
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 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
|
1125 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
|
1126 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1127 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
|
1128 } |
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 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
|
1131 { |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1132 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
|
1133 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
|
1134 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
|
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 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
|
1137 "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
|
1138 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1139 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
|
1140 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
|
1141 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1142 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
|
1143 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
|
1144 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
|
1145 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1146 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
|
1147 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
|
1148 |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1149 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
|
1150 } |
af2b87aa82ee
Add ability to list roles/affiliations in a chat via slash-commands and
Paul Aurich <paul@darkrain42.org>
parents:
26766
diff
changeset
|
1151 |
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
|
1152 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
|
1153 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
|
1154 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 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
|
1157 #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
|
1158 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
|
1159 #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
|
1160 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
|
1161 |
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
|
1162 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
|
1163 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 /* 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
|
1166 * support this request */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 chat->xhtml = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 |
20333
53afc5cce143
applied changes from d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
Luke Schierer <lschiere@pidgin.im>
parents:
19696
diff
changeset
|
1169 /* 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
|
1170 * 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
|
1171 #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
|
1172 if (type == JABBER_IQ_ERROR) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 return; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 chat->xhtml = FALSE; |
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 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
|
1182 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
|
1183 |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28793
diff
changeset
|
1184 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
|
1185 chat->xhtml = TRUE; |
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 } |
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
|
1188 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 } |
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 void jabber_chat_disco_traffic(JabberChat *chat) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 char *room_jid; |
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 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
|
1198 |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28793
diff
changeset
|
1199 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
|
1200 |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23988
diff
changeset
|
1201 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
|
1202 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 query = xmlnode_get_child(iq->node, "query"); |
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 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
|
1206 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 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
|
1208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1209 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1211 g_free(room_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 } |
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 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
|
1215 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
|
1216 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
|
1217 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
|
1218 } JabberChatCapsData; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1219 |
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
|
1220 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
|
1221 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
|
1222 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
|
1223 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
|
1224 { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1225 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
|
1226 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
|
1227 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
|
1228 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
|
1229 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
|
1230 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
|
1231 |
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
|
1232 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
|
1233 *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
|
1234 } 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
|
1235 *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
|
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 } |
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 |
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 |
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 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
|
1241 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
|
1242 { |
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 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
|
1244 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
|
1245 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
|
1246 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
|
1247 |
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 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
|
1249 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
|
1250 |
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 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
|
1252 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
|
1253 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
|
1254 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
|
1255 |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26956
diff
changeset
|
1256 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
|
1257 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
|
1258 } 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
|
1259 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
|
1260 } |
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 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
|
1262 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
|
1263 } |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1264 |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1265 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
|
1266 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
|
1267 { |
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26884
diff
changeset
|
1268 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
|
1269 } |