libpurple/protocols/jabber/usertune.c

Wed, 19 Sep 2007 15:03:59 +0000

author
Will Thompson <resiak@pidgin.im>
date
Wed, 19 Sep 2007 15:03:59 +0000
branch
cpw.resiak.disconnectreason
changeset 20445
c900767c024b
parent 20320
6337e101f6ab
child 21193
e918a1846d03
permissions
-rw-r--r--

Use PurpleDisconnectReasons in prpl-jabber.

17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
1 /*
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
2 * purple - Jabber Protocol Plugin
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
3 *
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
4 * Copyright (C) 2007, Andreas Monitzer <andy@monitzer.com>
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
5 *
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
9 * (at your option) any later version.
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
10 *
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
14 * GNU General Public License for more details.
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
15 *
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
19 *
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
20 */
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
21
19898
218e4bb04853 Fix mingw build of xmpp prpl
Daniel Atallah <datallah@pidgin.im>
parents: 17803
diff changeset
22 #include "internal.h"
218e4bb04853 Fix mingw build of xmpp prpl
Daniel Atallah <datallah@pidgin.im>
parents: 17803
diff changeset
23
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
24 #include "usertune.h"
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
25 #include "pep.h"
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
26 #include <string.h>
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
27 #include "internal.h"
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
28 #include "request.h"
17800
39a0f9ed0e26 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 <am@adiumx.com>
parents: 17797
diff changeset
29 #include "status.h"
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
30
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
31 static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) {
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
32 /* it doesn't make sense to have more than one item here, so let's just pick the first one */
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
33 xmlnode *item = xmlnode_get_child(items, "item");
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
34 JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
35 xmlnode *tuneinfo, *tune;
17800
39a0f9ed0e26 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 <am@adiumx.com>
parents: 17797
diff changeset
36 PurpleJabberTuneInfo tuneinfodata;
17802
eeefef7389a1 Removed some C99-code
Andreas Monitzer <am@adiumx.com>
parents: 17800
diff changeset
37 JabberBuddyResource *resource;
eeefef7389a1 Removed some C99-code
Andreas Monitzer <am@adiumx.com>
parents: 17800
diff changeset
38 const char *status_id;
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
39
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
40 /* ignore the tune of people not on our buddy list */
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
41 if (!buddy || !item)
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
42 return;
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
43
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
44 tuneinfodata.artist = NULL;
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
45 tuneinfodata.title = NULL;
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
46 tuneinfodata.album = NULL;
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
47 tuneinfodata.track = NULL;
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
48 tuneinfodata.time = -1;
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
49 tuneinfodata.url = NULL;
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
50
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
51 tune = xmlnode_get_child_with_namespace(item, "tune", "http://jabber.org/protocol/tune");
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
52 if (!tune)
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
53 return;
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
54 resource = jabber_buddy_find_resource(buddy, NULL);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
55 if(!resource)
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
56 return; /* huh? */
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
57 for (tuneinfo = tune->child; tuneinfo; tuneinfo = tuneinfo->next) {
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
58 if (tuneinfo->type == XMLNODE_TYPE_TAG) {
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
59 if (!strcmp(tuneinfo->name, "artist")) {
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
60 if (tuneinfodata.artist == NULL) /* only pick the first one */
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
61 tuneinfodata.artist = xmlnode_get_data(tuneinfo);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
62 } else if (!strcmp(tuneinfo->name, "length")) {
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
63 if (tuneinfodata.time == -1) {
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
64 char *length = xmlnode_get_data(tuneinfo);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
65 if (length)
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
66 tuneinfodata.time = strtol(length, NULL, 10);
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
67 g_free(length);
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
68 }
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
69 } else if (!strcmp(tuneinfo->name, "source")) {
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
70 if (tuneinfodata.album == NULL) /* only pick the first one */
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
71 tuneinfodata.album = xmlnode_get_data(tuneinfo);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
72 } else if (!strcmp(tuneinfo->name, "title")) {
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
73 if (tuneinfodata.title == NULL) /* only pick the first one */
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
74 tuneinfodata.title = xmlnode_get_data(tuneinfo);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
75 } else if (!strcmp(tuneinfo->name, "track")) {
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
76 if (tuneinfodata.track == NULL) /* only pick the first one */
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
77 tuneinfodata.track = xmlnode_get_data(tuneinfo);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
78 } else if (!strcmp(tuneinfo->name, "uri")) {
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
79 if (tuneinfodata.url == NULL) /* only pick the first one */
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
80 tuneinfodata.url = xmlnode_get_data(tuneinfo);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
81 }
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
82 }
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
83 }
17802
eeefef7389a1 Removed some C99-code
Andreas Monitzer <am@adiumx.com>
parents: 17800
diff changeset
84 status_id = jabber_buddy_state_get_status_id(resource->state);
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
85
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
86 purple_prpl_got_user_status(js->gc->account, from, status_id,
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
87 PURPLE_TUNE_ARTIST, tuneinfodata.artist,
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
88 PURPLE_TUNE_TITLE, tuneinfodata.title,
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
89 PURPLE_TUNE_ALBUM, tuneinfodata.album,
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
90 PURPLE_TUNE_TRACK, tuneinfodata.track,
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
91 PURPLE_TUNE_TIME, tuneinfodata.time,
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
92 PURPLE_TUNE_URL, tuneinfodata.url, NULL);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
93
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
94 g_free(tuneinfodata.artist);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
95 g_free(tuneinfodata.title);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
96 g_free(tuneinfodata.album);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
97 g_free(tuneinfodata.track);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19994
diff changeset
98 g_free(tuneinfodata.url);
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
99 }
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
100
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
101 void jabber_tune_init(void) {
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
102 jabber_add_feature("tune", "http://jabber.org/protocol/tune", jabber_pep_namespace_only_when_pep_enabled_cb);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
103 jabber_pep_register_handler("tunen", "http://jabber.org/protocol/tune", jabber_tune_cb);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
104 }
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
105
17800
39a0f9ed0e26 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 <am@adiumx.com>
parents: 17797
diff changeset
106 void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo) {
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
107 xmlnode *publish, *tunenode;
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
108 JabberStream *js = gc->proto_data;
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
109
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
110 publish = xmlnode_new("publish");
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
111 xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune");
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
112 tunenode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "tune");
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
113 xmlnode_set_namespace(tunenode, "http://jabber.org/protocol/tune");
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
114
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
115 if(tuneinfo) {
17800
39a0f9ed0e26 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 <am@adiumx.com>
parents: 17797
diff changeset
116 if(tuneinfo->artist && tuneinfo->artist[0] != '\0')
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
117 xmlnode_insert_data(xmlnode_new_child(tunenode, "artist"),tuneinfo->artist,-1);
17800
39a0f9ed0e26 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 <am@adiumx.com>
parents: 17797
diff changeset
118 if(tuneinfo->title && tuneinfo->title[0] != '\0')
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
119 xmlnode_insert_data(xmlnode_new_child(tunenode, "title"),tuneinfo->title,-1);
17800
39a0f9ed0e26 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 <am@adiumx.com>
parents: 17797
diff changeset
120 if(tuneinfo->album && tuneinfo->album[0] != '\0')
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
121 xmlnode_insert_data(xmlnode_new_child(tunenode, "source"),tuneinfo->album,-1);
17800
39a0f9ed0e26 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 <am@adiumx.com>
parents: 17797
diff changeset
122 if(tuneinfo->url && tuneinfo->url[0] != '\0')
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
123 xmlnode_insert_data(xmlnode_new_child(tunenode, "uri"),tuneinfo->url,-1);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
124 if(tuneinfo->time >= 0) {
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
125 char *length = g_strdup_printf("%d", tuneinfo->time);
17794
80d7ab0c4652 Minor compilation fixes and corrected some typos on user tune. Added convenience function for setting the user tune.
Andreas Monitzer <am@adiumx.com>
parents: 17791
diff changeset
126 xmlnode_insert_data(xmlnode_new_child(tunenode, "length"),length,-1);
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
127 g_free(length);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
128 }
17800
39a0f9ed0e26 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 <am@adiumx.com>
parents: 17797
diff changeset
129 if(tuneinfo->track && tuneinfo->track[0] != '\0')
17791
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
130 xmlnode_insert_data(xmlnode_new_child(tunenode, "track"),tuneinfo->track,-1);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
131 }
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
132
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
133 jabber_pep_publish(js, publish);
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
134 /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
135 (yay for well-defined memory management rules) */
b947d72db9db Implemented user tune, currently untested.
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
136 }

mercurial