annotate libpurple/protocols/jabber/presence.c @ 26863:0c1983abe991

Don't crash when a broken server sends us an occupant's presence with an empty resource. Refs #8361.
author Paul Aurich <paul@darkrain42.org>
date Sat, 02 May 2009 20:54:10 +0000
parents 5c4a4a0f5929
children 33f98d662db8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
2 * purple - Jabber Protocol Plugin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * 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
7 * 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
8 * 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
9 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * 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
12 * 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
13 * 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
14 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * 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
17 * 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: 19195
diff changeset
18 * 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
19 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22
15891
87ea711b9781 Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
23 #include "account.h"
87ea711b9781 Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
24 #include "conversation.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include "debug.h"
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 "server.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "status.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "util.h"
15891
87ea711b9781 Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents: 15823
diff changeset
31 #include "xmlnode.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "buddy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "chat.h"
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
35 #include "google.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "presence.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "iq.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "jutil.h"
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
39 #include "adhoccommands.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
41 #include "usertune.h"
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 static void chats_send_presence_foreach(gpointer key, gpointer val,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 JabberChat *chat = val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 xmlnode *presence = user_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 char *chat_full_jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
23262
5793bcea224c Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23105
diff changeset
51 if(!chat->conv || chat->left)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 chat_full_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
55 chat->handle);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 xmlnode_set_attrib(presence, "to", chat_full_jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 jabber_send(chat->js, presence);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 g_free(chat_full_jid);
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
62 void jabber_presence_fake_to_self(JabberStream *js, const PurpleStatus *gstatus) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 char *my_base_jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 if(!js->user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 my_base_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
69 if(purple_find_buddy(js->gc->account, my_base_jid)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 JabberBuddyResource *jbr;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 if((jb = jabber_buddy_find(js, my_base_jid, TRUE))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 JabberBuddyState state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 int priority;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
77 purple_status_to_jabber(gstatus, &state, &msg, &priority);
15374
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 (state == JABBER_BUDDY_STATE_UNAVAILABLE || state == JABBER_BUDDY_STATE_UNKNOWN) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 jabber_buddy_remove_resource(jb, js->user->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 jabber_buddy_track_resource(jb, js->user->resource, priority, state, msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 if((jbr = jabber_buddy_find_resource(jb, NULL))) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
85 purple_prpl_got_user_status(js->gc->account, my_base_jid, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
87 purple_prpl_got_user_status(js->gc->account, my_base_jid, "offline", msg ? "message" : NULL, msg, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 g_free(msg);
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 g_free(my_base_jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
96 void jabber_set_status(PurpleAccount *account, PurpleStatus *status)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 {
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
98 PurpleConnection *gc;
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
99 JabberStream *js;
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
100
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
101 if (!purple_account_is_connected(account))
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
102 return;
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
103
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
104 if (!purple_status_is_active(status))
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
105 return;
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
106
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
107 if (purple_status_is_exclusive(status) && !purple_status_is_active(status)) {
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
108 /* An exclusive status can't be deactivated. You should just
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
109 * activate some other exclusive status. */
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
110 return;
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
111 }
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
112
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
113 gc = purple_account_get_connection(account);
25987
c4fd9222dda1 propagate from branch 'im.pidgin.pidgin' (head 303af74a38e7b313d4fb0be4d4054a16cb13d819)
Paul Aurich <paul@darkrain42.org>
parents: 25443 25807
diff changeset
114 js = purple_connection_get_protocol_data(gc);
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
115 jabber_presence_send(js, FALSE);
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
116 }
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
117
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
118 void jabber_presence_send(JabberStream *js, gboolean force)
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
119 {
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
120 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 xmlnode *presence, *x, *photo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 char *stripped = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 JabberBuddyState state;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 int priority;
20570
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
125 const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL;
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
126 int length = -1;
17617
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
127 gboolean allowBuzz;
21629
6636546aeacf We need to work with the exclusive status.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21602
diff changeset
128 PurplePresence *p;
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
129 PurpleStatus *status, *tune;
18123
ca965dfd3875 kill some code duplication when sending current presence
Nathan Walp <nwalp@pidgin.im>
parents: 17841
diff changeset
130
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
131 account = purple_connection_get_account(js->gc);
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
132 p = purple_account_get_presence(account);
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
133 status = purple_presence_get_active_status(p);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134
18154
08e639dbac99 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18123
diff changeset
135 /* we don't want to send presence before we've gotten our roster */
08e639dbac99 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18123
diff changeset
136 if(!js->roster_parsed) {
08e639dbac99 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18123
diff changeset
137 purple_debug_info("jabber", "attempt to send presence before roster retrieved\n");
08e639dbac99 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18123
diff changeset
138 return;
08e639dbac99 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18123
diff changeset
139 }
08e639dbac99 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18123
diff changeset
140
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
141 purple_status_to_jabber(status, &state, &stripped, &priority);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
142
17617
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
143 /* check for buzz support */
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
144 allowBuzz = purple_status_get_attr_boolean(status,"buzz");
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
145 /* changing the buzz state has to trigger a re-broadcasting of the presence for caps */
23431
146d16459cda make googletalk tune hack work, previously it's not doing anything unless
Ka-Hing Cheung <khc@hxbc.us>
parents: 23262
diff changeset
146
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
147 tune = purple_presence_get_status(p, "tune");
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
148 if (js->googletalk && !stripped && purple_status_is_active(tune)) {
23431
146d16459cda make googletalk tune hack work, previously it's not doing anything unless
Ka-Hing Cheung <khc@hxbc.us>
parents: 23262
diff changeset
149 stripped = jabber_google_presence_outgoing(tune);
146d16459cda make googletalk tune hack work, previously it's not doing anything unless
Ka-Hing Cheung <khc@hxbc.us>
parents: 23262
diff changeset
150 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
151
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
152 #define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
153 (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b)))
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
154 /* check if there are any differences to the <presence> and send them in that case */
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
155 if (force || allowBuzz != js->allowBuzz || js->old_state != state ||
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
156 CHANGED(js->old_msg, stripped) || js->old_priority != priority ||
26817
3912f55a1633 propagate from branch 'im.pidgin.pidgin' (head fbb4fe5da444943eecc76bdcd6c8ba967790b6c8)
Paul Aurich <paul@darkrain42.org>
parents: 26569 26789
diff changeset
157 CHANGED(js->old_avatarhash, js->avatar_hash) || js->old_idle != js->idle) {
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
158 /* Need to update allowBuzz before creating the presence (with caps) */
17617
935005186312 Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17609
diff changeset
159 js->allowBuzz = allowBuzz;
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
160
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
161 presence = jabber_presence_create_js(js, state, stripped, priority);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162
25831
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
163 /* Per XEP-0153 4.1, we must always send the <x> */
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
164 x = xmlnode_new_child(presence, "x");
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
165 xmlnode_set_namespace(x, "vcard-temp:x:update");
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
166 /*
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
167 * FIXME: Per XEP-0153 4.3.2 bullet 2, we must not publish our
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
168 * image hash if another resource has logged in and updated the
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
169 * vcard avatar. Requires changes in jabber_presence_parse.
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
170 */
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
171 if (js->vcard_fetched) {
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
172 /* Always publish a <photo>; it's empty if we have no image. */
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
173 photo = xmlnode_new_child(x, "photo");
25831
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
174 if (js->avatar_hash)
0fa91206cf5a Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents: 24672
diff changeset
175 xmlnode_insert_data(photo, js->avatar_hash, -1);
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
176 }
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
177
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
178 jabber_send(js, presence);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
180 g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
181 xmlnode_free(presence);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
182
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
183 /* update old values */
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
184
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
185 if(js->old_msg)
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
186 g_free(js->old_msg);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
187 if(js->old_avatarhash)
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
188 g_free(js->old_avatarhash);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
189 js->old_msg = g_strdup(stripped);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
190 js->old_avatarhash = g_strdup(js->avatar_hash);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
191 js->old_state = state;
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
192 js->old_priority = priority;
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
193 js->old_idle = js->idle;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 }
23432
74960bf43dae let's not leak if nothing is changed
Ka-Hing Cheung <khc@hxbc.us>
parents: 23431
diff changeset
195 g_free(stripped);
74960bf43dae let's not leak if nothing is changed
Ka-Hing Cheung <khc@hxbc.us>
parents: 23431
diff changeset
196
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
197 /* next, check if there are any changes to the tune values */
25743
6d6e10476c52 Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents: 25742
diff changeset
198 if (purple_status_is_active(tune)) {
20570
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
199 artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
200 title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
201 source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
202 uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
203 track = purple_status_get_attr_string(tune, PURPLE_TUNE_TRACK);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
204 length = (!purple_status_get_attr_value(tune, PURPLE_TUNE_TIME)) ? -1 :
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
205 purple_status_get_attr_int(tune, PURPLE_TUNE_TIME);
5913725cbcd6 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20058
diff changeset
206 }
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
207
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
208 if(CHANGED(artist, js->old_artist) || CHANGED(title, js->old_title) || CHANGED(source, js->old_source) ||
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
209 CHANGED(uri, js->old_uri) || CHANGED(track, js->old_track) || (length != js->old_length)) {
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
210 PurpleJabberTuneInfo tuneinfo = {
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
211 (char*)artist,
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
212 (char*)title,
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
213 (char*)source,
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
214 (char*)track,
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
215 length,
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
216 (char*)uri
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
217 };
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
218 jabber_tune_set(js->gc, &tuneinfo);
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
219
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
220 /* update old values */
20058
5103485b4b26 Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19698
diff changeset
221 g_free(js->old_artist);
5103485b4b26 Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19698
diff changeset
222 g_free(js->old_title);
5103485b4b26 Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19698
diff changeset
223 g_free(js->old_source);
5103485b4b26 Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19698
diff changeset
224 g_free(js->old_uri);
5103485b4b26 Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19698
diff changeset
225 g_free(js->old_track);
17593
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
226 js->old_artist = g_strdup(artist);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
227 js->old_title = g_strdup(title);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
228 js->old_source = g_strdup(source);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
229 js->old_uri = g_strdup(uri);
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
230 js->old_length = length;
759cd72bd2ff Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17576
diff changeset
231 js->old_track = g_strdup(track);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
19698
680a3aea5eb6 Various warning fixes for the xmpp prpl.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19696
diff changeset
234 #undef CHANGED
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 jabber_presence_fake_to_self(js, status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 {
17563
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17439
diff changeset
241 return jabber_presence_create_js(NULL, state, msg, priority);
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17439
diff changeset
242 }
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17439
diff changeset
243
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17439
diff changeset
244 xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority)
95affacf6f82 Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents: 17439
diff changeset
245 {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 xmlnode *show, *status, *presence, *pri, *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 const char *show_string = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 presence = xmlnode_new("presence");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 if(state == JABBER_BUDDY_STATE_UNAVAILABLE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 xmlnode_set_attrib(presence, "type", "unavailable");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 else if(state != JABBER_BUDDY_STATE_ONLINE &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 state != JABBER_BUDDY_STATE_UNKNOWN &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 state != JABBER_BUDDY_STATE_ERROR)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 show_string = jabber_buddy_state_get_show(state);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 if(show_string) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 show = xmlnode_new_child(presence, "show");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 xmlnode_insert_data(show, show_string, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 if(msg) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 status = xmlnode_new_child(presence, "status");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 xmlnode_insert_data(status, msg, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 if(priority) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 char *pstr = g_strdup_printf("%d", priority);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 pri = xmlnode_new_child(presence, "priority");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 xmlnode_insert_data(pri, pstr, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 g_free(pstr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
275 /* if we are idle and not offline, include idle */
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
276 if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) {
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
277 xmlnode *query = xmlnode_new_child(presence, "query");
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
278 gchar seconds[10];
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
279 g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle));
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
280
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
281 xmlnode_set_namespace(query, "jabber:iq:last");
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
282 xmlnode_set_attrib(query, "seconds", seconds);
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
283 }
26817
3912f55a1633 propagate from branch 'im.pidgin.pidgin' (head fbb4fe5da444943eecc76bdcd6c8ba967790b6c8)
Paul Aurich <paul@darkrain42.org>
parents: 26569 26789
diff changeset
284
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 /* JEP-0115 */
25584
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25580
diff changeset
286 /* calculate hash */
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25580
diff changeset
287 jabber_caps_calculate_own_hash(js);
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25580
diff changeset
288 /* create xml */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 c = xmlnode_new_child(presence, "c");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 xmlnode_set_namespace(c, "http://jabber.org/protocol/caps");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 xmlnode_set_attrib(c, "node", CAPS0115_NODE);
25575
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23262
diff changeset
292 xmlnode_set_attrib(c, "hash", "sha-1");
25742
4040da08a733 Entity Capabilities must be per-JabberStream
Paul Aurich <paul@darkrain42.org>
parents: 25716
diff changeset
293 xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash(js));
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
294
26539
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
295 #ifdef USE_VV
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
296 /*
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
297 * MASSIVE HUGE DISGUSTING HACK
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
298 * This is a huge hack. As far as I can tell, Google Talk's gmail client
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
299 * doesn't bother to check the actual features we advertise; they
26545
b01e8e76c59d Make my comment parse correctly.
Paul Aurich <paul@darkrain42.org>
parents: 26539
diff changeset
300 * just assume that if we specify a 'voice-v1' ext (ignoring that
b01e8e76c59d Make my comment parse correctly.
Paul Aurich <paul@darkrain42.org>
parents: 26539
diff changeset
301 * these are to be assigned no semantic value), we support receiving voice
b01e8e76c59d Make my comment parse correctly.
Paul Aurich <paul@darkrain42.org>
parents: 26539
diff changeset
302 * calls.
26539
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
303 */
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
304 if (jabber_audio_enabled(js, NULL /* unused */))
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
305 xmlnode_set_attrib(c, "ext", "voice-v1");
20743d9bd62d Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents: 26528
diff changeset
306 #endif
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24672
diff changeset
307
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 return presence;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 struct _jabber_add_permit {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
312 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 char *who;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18739
diff changeset
317 static void authorize_add_cb(gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 {
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18739
diff changeset
319 struct _jabber_add_permit *jap = data;
21602
53fee49ce1c5 Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
320 if(PURPLE_CONNECTION_IS_VALID(jap->gc))
53fee49ce1c5 Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
321 jabber_presence_subscription_set(jap->gc->proto_data,
53fee49ce1c5 Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
322 jap->who, "subscribed");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 g_free(jap->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 g_free(jap);
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
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18739
diff changeset
327 static void deny_add_cb(gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 {
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18739
diff changeset
329 struct _jabber_add_permit *jap = data;
21602
53fee49ce1c5 Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
330 if(PURPLE_CONNECTION_IS_VALID(jap->gc))
53fee49ce1c5 Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
331 jabber_presence_subscription_set(jap->gc->proto_data,
53fee49ce1c5 Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21560
diff changeset
332 jap->who, "unsubscribed");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 g_free(jap->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 g_free(jap);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
336
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
337 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
338 jabber_vcard_parse_avatar(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
339 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
340 xmlnode *packet, gpointer blah)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 JabberBuddy *jb = NULL;
26862
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
343 xmlnode *vcard, *photo, *binval, *fn, *nick;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 char *text;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 if(!from)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 jb = jabber_buddy_find(js, from, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 js->pending_avatar_requests = g_slist_remove(js->pending_avatar_requests, jb);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 if((vcard = xmlnode_get_child(packet, "vCard")) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) {
26862
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
355 /* The logic here regarding the nickname and full name is copied from
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
356 * buddy.c:jabber_vcard_parse. */
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
357 gchar *nickname = NULL;
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
358 if ((fn = xmlnode_get_child(vcard, "FN")))
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
359 nickname = xmlnode_get_data(fn);
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
360
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
361 if ((nick = xmlnode_get_child(vcard, "NICKNAME"))) {
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
362 char *tmp = xmlnode_get_data(nick);
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
363 char *bare_jid = jabber_get_bare_jid(from);
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
364 if (strstr(bare_jid, tmp) == NULL) {
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
365 g_free(nickname);
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
366 nickname = tmp;
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
367 } else
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
368 g_free(tmp);
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
369
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
370 g_free(bare_jid);
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
371 }
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
372
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
373 if (nickname) {
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
374 serv_got_alias(js->gc, from, nickname);
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
375 g_free(nickname);
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
376 }
5c4a4a0f5929 When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents: 26856
diff changeset
377
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 if((photo = xmlnode_get_child(vcard, "PHOTO")) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 (( (binval = xmlnode_get_child(photo, "BINVAL")) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 (text = xmlnode_get_data(binval))) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 (text = xmlnode_get_data(photo)))) {
26789
8953034dae88 Use jabber_calculate_data_sha1sum in one more place.
Paul Aurich <paul@darkrain42.org>
parents: 26787
diff changeset
382 guchar *data;
8953034dae88 Use jabber_calculate_data_sha1sum in one more place.
Paul Aurich <paul@darkrain42.org>
parents: 26787
diff changeset
383 gchar *hash;
8953034dae88 Use jabber_calculate_data_sha1sum in one more place.
Paul Aurich <paul@darkrain42.org>
parents: 26787
diff changeset
384 gsize size;
16386
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 15957
diff changeset
385
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
386 data = purple_base64_decode(text, &size);
26789
8953034dae88 Use jabber_calculate_data_sha1sum in one more place.
Paul Aurich <paul@darkrain42.org>
parents: 26787
diff changeset
387 hash = jabber_calculate_data_sha1sum(data, size);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388
16386
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 15957
diff changeset
389 purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash);
26789
8953034dae88 Use jabber_calculate_data_sha1sum in one more place.
Paul Aurich <paul@darkrain42.org>
parents: 26787
diff changeset
390 g_free(hash);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 g_free(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
396 typedef struct _JabberPresenceCapabilities {
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
397 JabberStream *js;
22757
2404b13940e9 Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents: 22475
diff changeset
398 JabberBuddy *jb;
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
399 char *from;
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
400 } JabberPresenceCapabilities;
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
401
25784
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
402 static void
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
403 jabber_presence_set_capabilities(JabberCapsClientInfo *info, GList *exts,
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
404 JabberPresenceCapabilities *userdata)
25745
416ff3d65c16 Rewrite jabber_presence_set_capabilities a little
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
405 {
22757
2404b13940e9 Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents: 22475
diff changeset
406 JabberBuddyResource *jbr;
25745
416ff3d65c16 Rewrite jabber_presence_set_capabilities a little
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
407 char *resource = g_utf8_strrchr(userdata->from, -1, '/');
416ff3d65c16 Rewrite jabber_presence_set_capabilities a little
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
408 resource += 1;
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21629
diff changeset
409
25745
416ff3d65c16 Rewrite jabber_presence_set_capabilities a little
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
410 jbr = jabber_buddy_find_resource(userdata->jb, resource);
416ff3d65c16 Rewrite jabber_presence_set_capabilities a little
Paul Aurich <paul@darkrain42.org>
parents: 25743
diff changeset
411 if (!jbr) {
22757
2404b13940e9 Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents: 22475
diff changeset
412 g_free(userdata->from);
2404b13940e9 Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents: 22475
diff changeset
413 g_free(userdata);
25784
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
414 if (exts) {
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
415 g_list_foreach(exts, (GFunc)g_free, NULL);
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
416 g_list_free(exts);
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
417 }
22757
2404b13940e9 Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents: 22475
diff changeset
418 return;
2404b13940e9 Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents: 22475
diff changeset
419 }
2404b13940e9 Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents: 22475
diff changeset
420
25786
5ad14a53e266 Partial disapproval of b8fdbd255c614e7305f835b843a3414675a86a19
Paul Aurich <paul@darkrain42.org>
parents: 25784
diff changeset
421 /* Any old jbr->caps.info is owned by the caps code */
25784
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
422 if (jbr->caps.exts) {
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
423 g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL);
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
424 g_list_free(jbr->caps.exts);
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
425 }
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21629
diff changeset
426
25784
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
427 jbr->caps.info = info;
05693f6885a4 Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents: 25782
diff changeset
428 jbr->caps.exts = exts;
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21629
diff changeset
429
25770
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25764
diff changeset
430 if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) {
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25764
diff changeset
431 JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25764
diff changeset
432 xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", "http://jabber.org/protocol/disco#items");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25764
diff changeset
433 xmlnode_set_attrib(iq->node, "to", userdata->from);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25764
diff changeset
434 xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands");
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25764
diff changeset
435 jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL);
b1b1b75a922e Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents: 25764
diff changeset
436 jabber_iq_send(iq);
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
437 }
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21629
diff changeset
438
20318
bbfe52e817cf applied changes from d50ecf4dc52f25cbd219d6c19846436dec5a8853
Luke Schierer <lschiere@pidgin.im>
parents: 20058
diff changeset
439 g_free(userdata->from);
bbfe52e817cf applied changes from d50ecf4dc52f25cbd219d6c19846436dec5a8853
Luke Schierer <lschiere@pidgin.im>
parents: 20058
diff changeset
440 g_free(userdata);
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
441 }
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
442
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 void jabber_presence_parse(JabberStream *js, xmlnode *packet)
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 const char *from = xmlnode_get_attrib(packet, "from");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 const char *type = xmlnode_get_attrib(packet, "type");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 const char *real_jid = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 const char *affiliation = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 const char *role = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 char *status = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 int priority = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 JabberID *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 JabberChat *chat;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 JabberBuddy *jb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 JabberBuddyResource *jbr = NULL, *found_jbr = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
456 PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 gboolean delayed = FALSE;
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
458 const gchar *stamp = NULL; /* from <delayed/> element */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
459 PurpleBuddy *b = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 char *buddy_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 JabberBuddyState state = JABBER_BUDDY_STATE_UNKNOWN;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 xmlnode *y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 gboolean muc = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 char *avatar_hash = NULL;
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
465 xmlnode *caps = NULL;
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
466 int idle = 0;
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
467 gchar *nickname = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 if(!(jb = jabber_buddy_find(js, from, TRUE)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 if(!(jid = jabber_id_new(from)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 if(jb->error_msg) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 g_free(jb->error_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 jb->error_msg = NULL;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 if(type && !strcmp(type, "error")) {
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20318
diff changeset
481 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
482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 state = JABBER_BUDDY_STATE_ERROR;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 } else if(type && !strcmp(type, "subscribe")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 gboolean onlist = FALSE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
488 PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 JabberBuddy *jb = NULL;
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
490 xmlnode *nick;
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
491
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
492 nick = xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick");
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
493 if (nick)
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
494 nickname = xmlnode_get_data(nick);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 if (buddy) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 jb = jabber_buddy_find(js, from, TRUE);
24427
39841a84c944 A fix from Paul Aurich for a long-standing XMPP issue with duplicate buddies. Fixes #479.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23432
diff changeset
498 if ((jb->subscription & (JABBER_SUB_TO | JABBER_SUB_PENDING)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 onlist = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 }
15957
84bf0f949b0b fix prompting to add a buddy after authorization if they're already on our list
Nathan Walp <nwalp@pidgin.im>
parents: 15891
diff changeset
501
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 jap->gc = js->gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 jap->who = g_strdup(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 jap->js = js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
506 purple_account_request_authorization(purple_connection_get_account(js->gc), from, NULL, nickname, NULL, onlist,
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18739
diff changeset
507 authorize_add_cb, deny_add_cb, jap);
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
508 g_free(nickname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 } else if(type && !strcmp(type, "subscribed")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 /* we've been allowed to see their presence, but we don't care */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 } else if(type && !strcmp(type, "unsubscribe")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 /* XXX I'm not sure this is the right way to handle this, it
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 * might be better to add "unsubscribe" to the presence status
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 * if lower down, but I'm not sure. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 /* they are unsubscribing from our presence, we don't care */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 /* Well, maybe just a little, we might want/need to start
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 * acknowledging this (and the others) at some point. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 if((y = xmlnode_get_child(packet, "show"))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 char *show = xmlnode_get_data(y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 state = jabber_buddy_show_get_state(show);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 g_free(show);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 state = JABBER_BUDDY_STATE_ONLINE;
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 }
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 for(y = packet->child; y; y = y->next) {
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
536 const char *xmlns;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 if(y->type != XMLNODE_TYPE_TAG)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 continue;
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
539 xmlns = xmlnode_get_namespace(y);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 if(!strcmp(y->name, "status")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 g_free(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 status = xmlnode_get_data(y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 } else if(!strcmp(y->name, "priority")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 char *p = xmlnode_get_data(y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 if(p) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 priority = atoi(p);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 g_free(p);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 }
24672
bba38f03085d Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24641
diff changeset
550 } else if(xmlns == NULL) {
bba38f03085d Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24641
diff changeset
551 /* The rest of the cases used to check xmlns individually. */
bba38f03085d Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24641
diff changeset
552 continue;
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
553 } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, "urn:xmpp:delay")) {
17605
3399dd1c258d Forgot to implement XEP-0203 for presence packets, too.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17594
diff changeset
554 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */
3399dd1c258d Forgot to implement XEP-0203 for presence packets, too.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17594
diff changeset
555 delayed = TRUE;
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
556 stamp = xmlnode_get_attrib(y, "stamp");
24672
bba38f03085d Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24641
diff changeset
557 } else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) {
17609
f88b3a093cba Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents: 17605
diff changeset
558 caps = y; /* store for later, when creating buddy resource */
26855
e816444c1a01 Handle User Nick notifications via <presence/> stanzas (receive-only). Refs #864.
Paul Aurich <paul@darkrain42.org>
parents: 26835
diff changeset
559 } else if (g_str_equal(y->name, "nick") && g_str_equal(xmlns, "http://jabber.org/protocol/nick")) {
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
560 nickname = xmlnode_get_data(y);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 } else if(!strcmp(y->name, "x")) {
24672
bba38f03085d Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24641
diff changeset
562 if(!strcmp(xmlns, "jabber:x:delay")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 delayed = TRUE;
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
565 stamp = xmlnode_get_attrib(y, "stamp");
24672
bba38f03085d Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24641
diff changeset
566 } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 xmlnode *z;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 muc = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 if((z = xmlnode_get_child(y, "status"))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 const char *code = xmlnode_get_attrib(z, "code");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 if(code && !strcmp(code, "201")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 if((chat = jabber_chat_find(js, jid->node, jid->domain))) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
574 chat->config_dialog_type = PURPLE_REQUEST_ACTION;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 chat->config_dialog_handle =
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
576 purple_request_action(js->gc,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 _("Create New Room"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 _("Create New Room"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 _("You are creating a new room. Would"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 " you like to configure it, or"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 " accept the default settings?"),
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: 15957
diff changeset
582 /* Default Action */ 1,
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: 15957
diff changeset
583 purple_connection_get_account(js->gc), NULL, chat->conv,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
584 chat, 2,
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: 15957
diff changeset
585 _("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure),
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: 15957
diff changeset
586 _("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 }
18672
8f9c62a370fb Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <pidgin@unreliablesource.net>
parents: 18324
diff changeset
588 } else if(code && !strcmp(code, "210")) {
8f9c62a370fb Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <pidgin@unreliablesource.net>
parents: 18324
diff changeset
589 /* server rewrote room-nick */
8f9c62a370fb Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <pidgin@unreliablesource.net>
parents: 18324
diff changeset
590 if((chat = jabber_chat_find(js, jid->node, jid->domain))) {
8f9c62a370fb Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <pidgin@unreliablesource.net>
parents: 18324
diff changeset
591 g_free(chat->handle);
8f9c62a370fb Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <pidgin@unreliablesource.net>
parents: 18324
diff changeset
592 chat->handle = g_strdup(jid->resource);
8f9c62a370fb Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <pidgin@unreliablesource.net>
parents: 18324
diff changeset
593 }
15374
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 if((z = xmlnode_get_child(y, "item"))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 real_jid = xmlnode_get_attrib(z, "jid");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 affiliation = xmlnode_get_attrib(z, "affiliation");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 role = xmlnode_get_attrib(z, "role");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 if(affiliation != NULL && !strcmp(affiliation, "owner"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
601 flags |= PURPLE_CBFLAGS_FOUNDER;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 if (role != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 if (!strcmp(role, "moderator"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
604 flags |= PURPLE_CBFLAGS_OP;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 else if (!strcmp(role, "participant"))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
606 flags |= PURPLE_CBFLAGS_VOICE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 }
24672
bba38f03085d Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24641
diff changeset
609 } else if(!strcmp(xmlns, "vcard-temp:x:update")) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 xmlnode *photo = xmlnode_get_child(y, "photo");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 if(photo) {
17840
6e0961356343 Don't check for null before calling free. I can't help but get rid
Mark Doliner <mark@kingant.net>
parents: 17814
diff changeset
612 g_free(avatar_hash);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 avatar_hash = xmlnode_get_data(photo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 }
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
616 } else if (!strcmp(y->name, "query") &&
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
617 !strcmp(xmlnode_get_namespace(y), "jabber:iq:last")) {
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
618 /* resource has specified idle */
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
619 const gchar *seconds = xmlnode_get_attrib(y, "seconds");
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
620 if (seconds) {
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
621 /* we may need to take "delayed" into account here */
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
622 idle = atoi(seconds);
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
623 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 }
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
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
627 if (idle && delayed && stamp) {
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
628 /* if we have a delayed presence, we need to add the delay to the idle
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
629 value */
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
630 time_t offset = time(NULL) - purple_str_to_time(stamp, TRUE, NULL, NULL,
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
631 NULL);
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
632 purple_debug_info("jabber", "got delay %s yielding %ld s offset\n",
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
633 stamp, offset);
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
634 idle += offset;
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
635 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 if(jid->node && (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
638 static int i = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639
17004
d5293baaed11 chat error fix from sadrul
Nathan Walp <nwalp@pidgin.im>
parents: 16483
diff changeset
640 if(state == JABBER_BUDDY_STATE_ERROR) {
20814
bde477ec6a71 Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents: 20318
diff changeset
641 char *title, *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
642
23262
5793bcea224c Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23105
diff changeset
643 if (!chat->conv) {
5793bcea224c Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23105
diff changeset
644 title = g_strdup_printf(_("Error joining chat %s"), from);
5793bcea224c Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23105
diff changeset
645 purple_serv_got_join_chat_failed(js->gc, chat->components);
5793bcea224c Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23105
diff changeset
646 } else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 title = g_strdup_printf(_("Error in chat %s"), from);
18739
f29794be0163 applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents: 18734
diff changeset
648 if (g_hash_table_size(chat->members) == 0)
f29794be0163 applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents: 18734
diff changeset
649 serv_got_chat_left(js->gc, chat->id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
651 purple_notify_error(js->gc, title, title, msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 g_free(title);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654
18739
f29794be0163 applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents: 18734
diff changeset
655 if (g_hash_table_size(chat->members) == 0)
f29794be0163 applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents: 18734
diff changeset
656 /* Only destroy the chat if the error happened while joining */
f29794be0163 applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents: 18734
diff changeset
657 jabber_chat_destroy(chat);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 g_free(status);
17840
6e0961356343 Don't check for null before calling free. I can't help but get rid
Mark Doliner <mark@kingant.net>
parents: 17814
diff changeset
660 g_free(avatar_hash);
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
661 g_free(nickname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 if(type && !strcmp(type, "unavailable")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 gboolean nick_change = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668
26863
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
669 /* If the chat nick is invalid, we haven't yet joined, or we've
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
670 * already left (it was probably us leaving after we closed the
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
671 * chat), we don't care.
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
672 */
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
673 if (!jid->resource || !chat->conv || chat->left) {
23262
5793bcea224c Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23105
diff changeset
674 if (chat->left &&
5793bcea224c Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23105
diff changeset
675 jid->resource && chat->handle && !strcmp(jid->resource, chat->handle))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676 jabber_chat_destroy(chat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
677 jabber_id_free(jid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 g_free(status);
17840
6e0961356343 Don't check for null before calling free. I can't help but get rid
Mark Doliner <mark@kingant.net>
parents: 17814
diff changeset
679 g_free(avatar_hash);
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
680 g_free(nickname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 jabber_buddy_remove_resource(jb, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 if(chat->muc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 xmlnode *x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 for(x = xmlnode_get_child(packet, "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
688 const char *xmlns, *nick, *code;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 xmlnode *stat, *item;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690 if(!(xmlns = xmlnode_get_namespace(x)) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 strcmp(xmlns, "http://jabber.org/protocol/muc#user"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 if(!(stat = xmlnode_get_child(x, "status")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 if(!(code = xmlnode_get_attrib(stat, "code")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697 if(!strcmp(code, "301")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 /* XXX: we got banned */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 } else if(!strcmp(code, "303")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 if(!(item = xmlnode_get_child(x, "item")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 if(!(nick = xmlnode_get_attrib(item, "nick")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 nick_change = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 if(!strcmp(jid->resource, chat->handle)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 g_free(chat->handle);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 chat->handle = g_strdup(nick);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
709 purple_conv_chat_rename_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, nick);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 jabber_chat_remove_handle(chat, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 } else if(!strcmp(code, "307")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 /* XXX: we got kicked */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 } else if(!strcmp(code, "321")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 /* XXX: removed due to an affiliation change */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 } else if(!strcmp(code, "322")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 /* XXX: removed because room is now members-only */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 } else if(!strcmp(code, "332")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 /* XXX: removed due to system shutdown */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 if(!nick_change) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 if(!g_utf8_collate(jid->resource, chat->handle)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 serv_got_chat_left(js->gc, chat->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 jabber_chat_destroy(chat);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
728 purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), jid->resource,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 jabber_chat_remove_handle(chat, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 } else {
26863
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
734 /*
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
735 * XEP-0045 mandates the presence to include a resource (which is
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
736 * treated as the chat nick). Some non-compliant servers allow
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
737 * joining without a nick.
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
738 */
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
739 if (!jid->resource) {
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
740 jabber_id_free(jid);
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
741 g_free(avatar_hash);
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
742 g_free(nickname);
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
743 g_free(status);
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
744 return;
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
745 }
0c1983abe991 Don't crash when a broken server sends us an occupant's presence with an
Paul Aurich <paul@darkrain42.org>
parents: 26862
diff changeset
746
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 if(!chat->conv) {
26834
50db9eb2499a tighter scoping++
Paul Aurich <paul@darkrain42.org>
parents: 26817
diff changeset
748 char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 chat->id = i++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 chat->muc = muc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
752 purple_conv_chat_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle);
15374
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 jabber_chat_disco_traffic(chat);
26834
50db9eb2499a tighter scoping++
Paul Aurich <paul@darkrain42.org>
parents: 26817
diff changeset
755 g_free(room_jid);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758 jabber_buddy_track_resource(jb, jid->resource, priority, state,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 jabber_chat_track_handle(chat, jid->resource, real_jid, affiliation, role);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 if(!jabber_chat_find_buddy(chat->conv, jid->resource))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
764 purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat->conv), jid->resource,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 real_jid, flags, !delayed);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
767 purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(chat->conv), jid->resource,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768 flags);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
18691
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
772 jid->node ? "@" : "", jid->domain);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
773 if((b = purple_find_buddy(js->gc->account, buddy_name)) == NULL) {
18691
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
774 if(!jid->node || strcmp(jid->node,js->user->node) || strcmp(jid->domain,js->user->domain)) {
22475
3225c99785b8 Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents: 21688
diff changeset
775 purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%p)\n",
18691
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
776 buddy_name, purple_account_get_username(js->gc->account), js->gc->account);
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
777 jabber_id_free(jid);
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
778 g_free(avatar_hash);
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
779 g_free(buddy_name);
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
780 g_free(nickname);
18691
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
781 g_free(status);
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
782 return;
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
783 } else {
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
784 /* this is a different resource of our own account. Resume even when this account isn't on our blist */
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
785 }
15374
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
18691
54a5fbeadd7c Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <pidgin@monitzer.com>
parents: 18684
diff changeset
788 if(b && avatar_hash) {
16386
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 15957
diff changeset
789 const char *avatar_hash2 = purple_buddy_icons_get_checksum_for_user(b);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
790 if(!avatar_hash2 || strcmp(avatar_hash, avatar_hash2)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 JabberIq *iq;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 xmlnode *vcard;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794 /* XXX this is a crappy way of trying to prevent
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795 * someone from spamming us with presence packets
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 * and causing us to DoS ourselves...what we really
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 * need is a queue system that can throttle itself,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 * but i'm too tired to write that right now */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 if(!g_slist_find(js->pending_avatar_requests, jb)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 js->pending_avatar_requests = g_slist_prepend(js->pending_avatar_requests, jb);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 iq = jabber_iq_new(js, JABBER_IQ_GET);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 xmlnode_set_attrib(iq->node, "to", buddy_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 vcard = xmlnode_new_child(iq->node, "vCard");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 xmlnode_set_namespace(vcard, "vcard-temp");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 jabber_iq_set_callback(iq, jabber_vcard_parse_avatar, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 jabber_iq_send(iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 if(state == JABBER_BUDDY_STATE_ERROR ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 (type && (!strcmp(type, "unavailable") ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 !strcmp(type, "unsubscribed")))) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
817 PurpleConversation *conv;
15374
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 jabber_buddy_remove_resource(jb, jid->resource);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 if((conv = jabber_find_unnormalized_conv(from, js->gc->account)))
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
821 purple_conversation_set_name(conv, buddy_name);
15374
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 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 jbr = jabber_buddy_track_resource(jb, jid->resource, priority,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 state, status);
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
826 if (idle) {
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
827 jbr->idle = time(NULL) - idle;
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
828 } else {
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
829 jbr->idle = 0;
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
830 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
20571
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
834 jabber_google_presence_incoming(js, buddy_name, found_jbr);
c97e3ab9ef11 Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents: 20570
diff changeset
835 purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL);
25805
6fed1bb3b02e Fix merge
Marcus Lundblad <ml@update.uu.se>
parents: 25804
diff changeset
836 purple_prpl_got_user_idle(js->gc->account, buddy_name, found_jbr->idle, found_jbr->idle);
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
837 if (nickname)
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
838 serv_got_alias(js->gc, buddy_name, nickname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
840 purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
15374
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 g_free(buddy_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 }
26835
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
844
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
845 if (caps && (!type || g_str_equal(type, "available"))) {
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
846 /* handle Entity Capabilities (XEP-0115) */
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
847 const char *node = xmlnode_get_attrib(caps, "node");
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
848 const char *ver = xmlnode_get_attrib(caps, "ver");
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
849 const char *hash = xmlnode_get_attrib(caps, "hash");
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
850 const char *ext = xmlnode_get_attrib(caps, "ext");
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
851
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
852 /* v1.3 uses: node, ver, and optionally ext.
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
853 * v1.5 uses: node, ver, and hash. */
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
854 if (node && *node && ver && *ver) {
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
855 JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1);
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
856 userdata->js = js;
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
857 userdata->jb = jb;
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
858 userdata->from = g_strdup(from);
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
859 jabber_caps_get_info(js, from, node, ver, hash, ext,
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
860 (jabber_caps_get_info_cb)jabber_presence_set_capabilities,
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
861 userdata);
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
862 }
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
863 }
09dc63a697e1 Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents: 26834
diff changeset
864
26856
867e231bffbc A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents: 26855
diff changeset
865 g_free(nickname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
866 g_free(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
867 jabber_id_free(jid);
17840
6e0961356343 Don't check for null before calling free. I can't help but get rid
Mark Doliner <mark@kingant.net>
parents: 17814
diff changeset
868 g_free(avatar_hash);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
869 }
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 void jabber_presence_subscription_set(JabberStream *js, const char *who, const char *type)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
873 xmlnode *presence = xmlnode_new("presence");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
874
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
875 xmlnode_set_attrib(presence, "to", who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
876 xmlnode_set_attrib(presence, "type", type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
878 jabber_send(js, presence);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 xmlnode_free(presence);
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
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
882 void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884 const char *status_id = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 const char *formatted_msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887 if(state) *state = JABBER_BUDDY_STATE_UNKNOWN;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 if(msg) *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889 if(priority) *priority = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 if(!status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 if(state) *state = JABBER_BUDDY_STATE_UNAVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 if(state) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
895 status_id = purple_status_get_id(status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 *state = jabber_buddy_status_id_get_state(status_id);
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 if(msg) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
900 formatted_msg = purple_status_get_attr_string(status, "message");
15374
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 /* if the message is blank, then there really isn't a message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 if(formatted_msg && !*formatted_msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 formatted_msg = NULL;
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 if(formatted_msg)
17814
d495103dcf88 Two questions:
Mark Doliner <mark@kingant.net>
parents: 17439
diff changeset
907 *msg = purple_markup_strip_html(formatted_msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 if(priority)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15747
diff changeset
911 *priority = purple_status_get_attr_int(status, "priority");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 }