diff options
author | Gary Kramlich <grim@reaperworld.com> | 2023-03-20 21:22:53 -0500 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2023-03-20 21:22:53 -0500 |
commit | e8df893735bca9036f2e03c6f2fc561d85846f8d (patch) | |
tree | ea150196f0a16fa139c4773e6ba68a77268490ee | |
parent | a965b83ba6a3a490e54ba69e9f6bf96c80d776e0 (diff) | |
download | pidgin-e8df893735bca9036f2e03c6f2fc561d85846f8d.tar.gz |
Remove all of the tune api
Testing Done:
Compiled, built `pidgin-pot`, and ran the unit tests.
Reviewed at https://reviews.imfreedom.org/r/2368/
-rw-r--r-- | ChangeLog.API | 1 | ||||
-rw-r--r-- | libpurple/protocols/jabber/jabber.c | 33 | ||||
-rw-r--r-- | libpurple/protocols/jabber/jabber.h | 8 | ||||
-rw-r--r-- | libpurple/protocols/jabber/meson.build | 2 | ||||
-rw-r--r-- | libpurple/protocols/jabber/pep.c | 2 | ||||
-rw-r--r-- | libpurple/protocols/jabber/presence.c | 45 | ||||
-rw-r--r-- | libpurple/protocols/jabber/tests/test_jabber_caps.c | 4 | ||||
-rw-r--r-- | libpurple/protocols/jabber/usertune.c | 145 | ||||
-rw-r--r-- | libpurple/protocols/jabber/usertune.h | 45 | ||||
-rw-r--r-- | libpurple/status.c | 2 | ||||
-rw-r--r-- | libpurple/status.h | 72 | ||||
-rw-r--r-- | libpurple/util.c | 75 | ||||
-rw-r--r-- | libpurple/util.h | 23 | ||||
-rw-r--r-- | pidgin/pidginiconname.c | 1 | ||||
-rw-r--r-- | pidgin/plugins/unity/unity.c | 1 | ||||
-rw-r--r-- | po/POTFILES.in | 1 |
16 files changed, 4 insertions, 456 deletions
diff --git a/ChangeLog.API b/ChangeLog.API index 91ba9191b9..414887ed8f 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -837,6 +837,7 @@ version 3.0.0 (??/??/????): * purple_time_build. Use g_date_time_new* instead. * purple_time_format. Use g_date_time_format instead. * purple_timeout_*. Use g_timeout_* or g_idle_* instead. + * purple_tune and all corresponding apis. * purple_txt_cancel * purple_txt_resolve_account * PurpleType, use GType instead. diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 1b5d016901..f844f175bf 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -863,7 +863,6 @@ jabber_stream_new(PurpleAccount *account) js->chats = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)jabber_chat_free); js->next_id = g_random_int(); - js->old_length = 0; js->keepalive_timeout = 0; js->max_inactivity = DEFAULT_INACTIVITY_TIME; /* Set the default protocol version to 1.0. Overridden in parser.c. */ @@ -1057,11 +1056,6 @@ jabber_close(G_GNUC_UNUSED PurpleProtocol *protocol, PurpleConnection *gc) { g_free(js->certificate_CN); g_free(js->old_msg); g_free(js->old_avatarhash); - g_free(js->old_artist); - g_free(js->old_title); - g_free(js->old_source); - g_free(js->old_uri); - g_free(js->old_track); if (js->keepalive_timeout != 0) g_source_remove(js->keepalive_timeout); @@ -1582,7 +1576,6 @@ jabber_tooltip_text(G_GNUC_UNUSED PurpleProtocolClient *client, PurpleBuddy *b, if(jb) { JabberBuddyResource *jbr = NULL; - PurplePresence *presence = purple_buddy_get_presence(b); const char *sub; GList *l; gboolean multiple_resources = @@ -1605,18 +1598,6 @@ jabber_tooltip_text(G_GNUC_UNUSED PurpleProtocolClient *client, PurpleBuddy *b, } if (full) { - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *tune = purple_presence_get_status(presence, "tune"); - const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - const char *artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); - char *playing = purple_util_format_song_info(title, artist, album); - if (playing) { - purple_notify_user_info_add_pair_html(user_info, _("Now Listening"), playing); - g_free(playing); - } - } - if(jb->subscription & JABBER_SUB_FROM) { if(jb->subscription & JABBER_SUB_TO) sub = _("Both"); @@ -1731,20 +1712,6 @@ jabber_status_types(G_GNUC_UNUSED PurpleProtocol *protocol, NULL); types = g_list_prepend(types, type); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE, - "tune", NULL, FALSE, TRUE, TRUE, - PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(G_TYPE_STRING), - PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(G_TYPE_STRING), - PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(G_TYPE_STRING), - PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(G_TYPE_STRING), - PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(G_TYPE_STRING), - PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(G_TYPE_STRING), - PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(G_TYPE_INT), - PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(G_TYPE_INT), - PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(G_TYPE_STRING), - NULL); - types = g_list_prepend(types, type); - return g_list_reverse(types); } diff --git a/libpurple/protocols/jabber/jabber.h b/libpurple/protocols/jabber/jabber.h index 5cd3f4ebae..5822f4b5e3 100644 --- a/libpurple/protocols/jabber/jabber.h +++ b/libpurple/protocols/jabber/jabber.h @@ -209,14 +209,6 @@ struct _JabberStream int old_priority; char *old_avatarhash; - /* same for user tune */ - char *old_artist; - char *old_title; - char *old_source; - char *old_uri; - int old_length; - char *old_track; - char *certificate_CN; /* A purple timeout tag for the keepalive */ diff --git a/libpurple/protocols/jabber/meson.build b/libpurple/protocols/jabber/meson.build index 3579f14fc6..8fffd25608 100644 --- a/libpurple/protocols/jabber/meson.build +++ b/libpurple/protocols/jabber/meson.build @@ -68,8 +68,6 @@ JABBER_SOURCES = [ 'useravatar.h', 'usernick.c', 'usernick.h', - 'usertune.c', - 'usertune.h', 'xdata.c', 'xdata.h', 'xmpp.c', diff --git a/libpurple/protocols/jabber/pep.c b/libpurple/protocols/jabber/pep.c index 28fcba2320..2e6c03be01 100644 --- a/libpurple/protocols/jabber/pep.c +++ b/libpurple/protocols/jabber/pep.c @@ -28,7 +28,6 @@ #include <string.h> #include "useravatar.h" #include "usernick.h" -#include "usertune.h" static GHashTable *pep_handlers = NULL; @@ -38,7 +37,6 @@ void jabber_pep_init(void) { /* register PEP handlers */ jabber_avatar_init(); - jabber_tune_init(); jabber_nick_init(); } } diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index 4baf4f3e16..02e62376ec 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -31,8 +31,6 @@ #include "jutil.h" #include "adhoccommands.h" -#include "usertune.h" - static GHashTable *presence_handlers = NULL; static const struct { @@ -178,11 +176,9 @@ void jabber_presence_send(JabberStream *js, gboolean force) char *stripped = NULL; JabberBuddyState state; int priority; - const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL; - int length = -1; gboolean allowBuzz; PurplePresence *p; - PurpleStatus *status, *tune; + PurpleStatus *status; account = purple_connection_get_account(js->gc); p = purple_account_get_presence(account); @@ -241,45 +237,6 @@ void jabber_presence_send(JabberStream *js, gboolean force) } g_free(stripped); - /* next, check if there are any changes to the tune values */ - tune = purple_presence_get_status(p, "tune"); - if (purple_status_is_active(tune)) { - artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); - title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); - uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL); - track = purple_status_get_attr_string(tune, PURPLE_TUNE_TRACK); - length = (!purple_status_get_attr_value(tune, PURPLE_TUNE_TIME)) ? -1 : - purple_status_get_attr_int(tune, PURPLE_TUNE_TIME); - } - - if(!purple_strequal(artist, js->old_artist) || !purple_strequal(title, js->old_title) || - !purple_strequal(source, js->old_source) || !purple_strequal(uri, js->old_uri) || - !purple_strequal(track, js->old_track) || (length != js->old_length)) { - PurpleJabberTuneInfo tuneinfo = { - (char*)artist, - (char*)title, - (char*)source, - (char*)track, - length, - (char*)uri - }; - jabber_tune_set(js->gc, &tuneinfo); - - /* update old values */ - g_free(js->old_artist); - g_free(js->old_title); - g_free(js->old_source); - g_free(js->old_uri); - g_free(js->old_track); - js->old_artist = g_strdup(artist); - js->old_title = g_strdup(title); - js->old_source = g_strdup(source); - js->old_uri = g_strdup(uri); - js->old_length = length; - js->old_track = g_strdup(track); - } - #undef CHANGED jabber_presence_fake_to_self(js, status); diff --git a/libpurple/protocols/jabber/tests/test_jabber_caps.c b/libpurple/protocols/jabber/tests/test_jabber_caps.c index 8e07e8463f..aedf1d5c53 100644 --- a/libpurple/protocols/jabber/tests/test_jabber_caps.c +++ b/libpurple/protocols/jabber/tests/test_jabber_caps.c @@ -41,8 +41,8 @@ static void test_jabber_caps_calculate_from_xmlnode(void) { _test_jabber_caps_match( G_CHECKSUM_SHA1, - "<query xmlns='http://jabber.org/protocol/disco#info' node='http://tkabber.jabber.ru/#GNjxthSckUNvAIoCCJFttjl6VL8='><identity category='client' type='pc' name='Tkabber'/><x xmlns='jabber:x:data' type='result'><field var='FORM_TYPE' type='hidden'><value>urn:xmpp:dataforms:softwareinfo</value></field><field var='software'><value>Tkabber</value></field><field var='software_version'><value> ( 8.5.5 )</value></field><field var='os'><value>ATmega640-16AU</value></field><field var='os_version'><value/></field></x><feature var='games:board'/><feature var='http://jabber.org/protocol/activity'/><feature var='http://jabber.org/protocol/bytestreams'/><feature var='http://jabber.org/protocol/chatstates'/><feature var='http://jabber.org/protocol/commands'/><feature var='http://jabber.org/protocol/commands'/><feature var='http://jabber.org/protocol/disco#info'/><feature var='http://jabber.org/protocol/disco#items'/><feature var='http://jabber.org/protocol/feature-neg'/><feature var='http://jabber.org/protocol/geoloc'/><feature var='http://jabber.org/protocol/ibb'/><feature var='http://jabber.org/protocol/iqibb'/><feature var='http://jabber.org/protocol/muc'/><feature var='http://jabber.org/protocol/mute#ancestor'/><feature var='http://jabber.org/protocol/mute#editor'/><feature var='http://jabber.org/protocol/rosterx'/><feature var='http://jabber.org/protocol/si'/><feature var='http://jabber.org/protocol/si/profile/file-transfer'/><feature var='http://jabber.org/protocol/tune'/><feature var='jabber:iq:avatar'/><feature var='jabber:iq:browse'/><feature var='jabber:iq:dtcp'/><feature var='jabber:iq:filexfer'/><feature var='jabber:iq:ibb'/><feature var='jabber:iq:inband'/><feature var='jabber:iq:jidlink'/><feature var='jabber:iq:last'/><feature var='jabber:iq:oob'/><feature var='jabber:iq:privacy'/><feature var='jabber:iq:time'/><feature var='jabber:iq:version'/><feature var='jabber:x:data'/><feature var='jabber:x:event'/><feature var='jabber:x:oob'/><feature var='urn:xmpp:ping'/><feature var='urn:xmpp:receipts'/><feature var='urn:xmpp:time'/></query>", - "MxSGNsM12KCe/2hYIySOX+CpY9U=" + "<query xmlns='http://jabber.org/protocol/disco#info' node='http://tkabber.jabber.ru/#GNjxthSckUNvAIoCCJFttjl6VL8='><identity category='client' type='pc' name='Tkabber'/><x xmlns='jabber:x:data' type='result'><field var='FORM_TYPE' type='hidden'><value>urn:xmpp:dataforms:softwareinfo</value></field><field var='software'><value>Tkabber</value></field><field var='software_version'><value> ( 8.5.5 )</value></field><field var='os'><value>ATmega640-16AU</value></field><field var='os_version'><value/></field></x><feature var='games:board'/><feature var='http://jabber.org/protocol/activity'/><feature var='http://jabber.org/protocol/bytestreams'/><feature var='http://jabber.org/protocol/chatstates'/><feature var='http://jabber.org/protocol/commands'/><feature var='http://jabber.org/protocol/commands'/><feature var='http://jabber.org/protocol/disco#info'/><feature var='http://jabber.org/protocol/disco#items'/><feature var='http://jabber.org/protocol/feature-neg'/><feature var='http://jabber.org/protocol/geoloc'/><feature var='http://jabber.org/protocol/ibb'/><feature var='http://jabber.org/protocol/iqibb'/><feature var='http://jabber.org/protocol/muc'/><feature var='http://jabber.org/protocol/mute#ancestor'/><feature var='http://jabber.org/protocol/mute#editor'/><feature var='http://jabber.org/protocol/rosterx'/><feature var='http://jabber.org/protocol/si'/><feature var='http://jabber.org/protocol/si/profile/file-transfer'/><feature var='jabber:iq:avatar'/><feature var='jabber:iq:browse'/><feature var='jabber:iq:dtcp'/><feature var='jabber:iq:filexfer'/><feature var='jabber:iq:ibb'/><feature var='jabber:iq:inband'/><feature var='jabber:iq:jidlink'/><feature var='jabber:iq:last'/><feature var='jabber:iq:oob'/><feature var='jabber:iq:privacy'/><feature var='jabber:iq:time'/><feature var='jabber:iq:version'/><feature var='jabber:x:data'/><feature var='jabber:x:event'/><feature var='jabber:x:oob'/><feature var='urn:xmpp:ping'/><feature var='urn:xmpp:receipts'/><feature var='urn:xmpp:time'/></query>", + "sVNUrcvQ2ryBm4L+NRhXrRnd71c=" ); } diff --git a/libpurple/protocols/jabber/usertune.c b/libpurple/protocols/jabber/usertune.c deleted file mode 100644 index c37e7c9543..0000000000 --- a/libpurple/protocols/jabber/usertune.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include <purple.h> - -#include "usertune.h" -#include "pep.h" -#include <string.h> - -static void jabber_tune_cb(JabberStream *js, const char *from, PurpleXmlNode *items) { - /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - PurpleXmlNode *item = purple_xmlnode_get_child(items, "item"); - JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - PurpleXmlNode *tuneinfo, *tune; - PurpleJabberTuneInfo tuneinfodata; - JabberBuddyResource *resource; - gboolean valid = FALSE; - - /* ignore the tune of people not on our buddy list */ - if (!buddy || !item) - return; - - tuneinfodata.artist = NULL; - tuneinfodata.title = NULL; - tuneinfodata.album = NULL; - tuneinfodata.track = NULL; - tuneinfodata.time = -1; - tuneinfodata.url = NULL; - - tune = purple_xmlnode_get_child_with_namespace(item, "tune", "http://jabber.org/protocol/tune"); - if (!tune) - return; - resource = jabber_buddy_find_resource(buddy, NULL); - if(!resource) - return; /* huh? */ - for (tuneinfo = tune->child; tuneinfo; tuneinfo = tuneinfo->next) { - if (tuneinfo->type == PURPLE_XMLNODE_TYPE_TAG) { - if (purple_strequal(tuneinfo->name, "artist")) { - if (tuneinfodata.artist == NULL) /* only pick the first one */ - tuneinfodata.artist = purple_xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (purple_strequal(tuneinfo->name, "length")) { - if (tuneinfodata.time == -1) { - char *length = purple_xmlnode_get_data(tuneinfo); - if (length) - tuneinfodata.time = strtol(length, NULL, 10); - g_free(length); - if (tuneinfodata.time > 0) - valid = TRUE; - } - } else if (purple_strequal(tuneinfo->name, "source")) { - if (tuneinfodata.album == NULL) /* only pick the first one */ - tuneinfodata.album = purple_xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (purple_strequal(tuneinfo->name, "title")) { - if (tuneinfodata.title == NULL) /* only pick the first one */ - tuneinfodata.title = purple_xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (purple_strequal(tuneinfo->name, "track")) { - if (tuneinfodata.track == NULL) /* only pick the first one */ - tuneinfodata.track = purple_xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (purple_strequal(tuneinfo->name, "uri")) { - if (tuneinfodata.url == NULL) /* only pick the first one */ - tuneinfodata.url = purple_xmlnode_get_data(tuneinfo); - valid = TRUE; - } - } - } - - if (valid) { - purple_protocol_got_user_status(purple_connection_get_account(js->gc), from, "tune", - PURPLE_TUNE_ARTIST, tuneinfodata.artist, - PURPLE_TUNE_TITLE, tuneinfodata.title, - PURPLE_TUNE_ALBUM, tuneinfodata.album, - PURPLE_TUNE_TRACK, tuneinfodata.track, - PURPLE_TUNE_TIME, tuneinfodata.time, - PURPLE_TUNE_URL, tuneinfodata.url, NULL); - } else { - purple_protocol_got_user_status_deactive(purple_connection_get_account(js->gc), from, "tune"); - } - - g_free(tuneinfodata.artist); - g_free(tuneinfodata.title); - g_free(tuneinfodata.album); - g_free(tuneinfodata.track); - g_free(tuneinfodata.url); -} - -void jabber_tune_init(void) { - jabber_add_feature("http://jabber.org/protocol/tune", jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_pep_register_handler("http://jabber.org/protocol/tune", jabber_tune_cb); -} - -void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo) { - PurpleXmlNode *publish, *tunenode; - JabberStream *js = purple_connection_get_protocol_data(gc); - - publish = purple_xmlnode_new("publish"); - purple_xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune"); - tunenode = purple_xmlnode_new_child(purple_xmlnode_new_child(publish, "item"), "tune"); - purple_xmlnode_set_namespace(tunenode, "http://jabber.org/protocol/tune"); - - if(tuneinfo) { - if(tuneinfo->artist && tuneinfo->artist[0] != '\0') - purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "artist"),tuneinfo->artist,-1); - if(tuneinfo->title && tuneinfo->title[0] != '\0') - purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "title"),tuneinfo->title,-1); - if(tuneinfo->album && tuneinfo->album[0] != '\0') - purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "source"),tuneinfo->album,-1); - if(tuneinfo->url && tuneinfo->url[0] != '\0') - purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "uri"),tuneinfo->url,-1); - if(tuneinfo->time > 0) { - char *length = g_strdup_printf("%d", tuneinfo->time); - purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "length"),length,-1); - g_free(length); - } - if(tuneinfo->track && tuneinfo->track[0] != '\0') - purple_xmlnode_insert_data(purple_xmlnode_new_child(tunenode, "track"),tuneinfo->track,-1); - } - - jabber_pep_publish(js, publish); - /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free - (yay for well-defined memory management rules) */ -} diff --git a/libpurple/protocols/jabber/usertune.h b/libpurple/protocols/jabber/usertune.h deleted file mode 100644 index 8d6051dd37..0000000000 --- a/libpurple/protocols/jabber/usertune.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_USERTUNE_H -#define PURPLE_JABBER_USERTUNE_H - -#include "jabber.h" - -/* Implementation of XEP-0118 */ - -typedef struct _PurpleJabberTuneInfo PurpleJabberTuneInfo; -struct _PurpleJabberTuneInfo { - char *artist; - char *title; - char *album; - char *track; /* either the index of the track in the album or the URL for a stream */ - int time; /* in seconds, -1 for unknown */ - char *url; -}; - -void jabber_tune_init(void); - -void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo); - -#endif /* PURPLE_JABBER_USERTUNE_H */ diff --git a/libpurple/status.c b/libpurple/status.c index fbcdeb460c..21c96f6c4e 100644 --- a/libpurple/status.c +++ b/libpurple/status.c @@ -109,7 +109,6 @@ static int primitive_scores[] = -100, /* away */ -200, /* extended away */ -400, /* mobile */ - 0, /* tune */ -10, /* idle, special case. */ -5, /* idle time, special case. */ 10 /* Offline messageable */ @@ -138,7 +137,6 @@ static struct PurpleStatusPrimitiveMap { PURPLE_STATUS_AWAY, "away", N_("Away") }, { PURPLE_STATUS_EXTENDED_AWAY, "extended_away", N_("Extended away") }, { PURPLE_STATUS_MOBILE, "mobile", N_("Mobile") }, - { PURPLE_STATUS_TUNE, "tune", N_("Listening to music"), }, }; int * diff --git a/libpurple/status.h b/libpurple/status.h index 70c95723e3..90802608dc 100644 --- a/libpurple/status.h +++ b/libpurple/status.h @@ -91,7 +91,6 @@ typedef struct _PurpleStatusAttribute PurpleStatusAttribute; * @PURPLE_STATUS_AWAY: The status is away * @PURPLE_STATUS_EXTENDED_AWAY: The status is extended away/do not disturb * @PURPLE_STATUS_MOBILE: The status is mobile - * @PURPLE_STATUS_TUNE: The status includes a song title * @PURPLE_STATUS_NUM_PRIMITIVES: The number of #PurpleStatusPrimitive<!-- -->s * * A primitive defining the basic structure of a status type. @@ -110,83 +109,12 @@ typedef enum PURPLE_STATUS_AWAY, PURPLE_STATUS_EXTENDED_AWAY, PURPLE_STATUS_MOBILE, - PURPLE_STATUS_TUNE, PURPLE_STATUS_NUM_PRIMITIVES, /*< skip >*/ } PurpleStatusPrimitive; #include "purplepresence.h" -/** - * PURPLE_TUNE_ALBUM: - * - * A constant for a status attribute that represents the album of a song. - */ -#define PURPLE_TUNE_ALBUM "tune_album" - -/** - * PURPLE_TUNE_ARTIST: - * - * A constant for a status attribute that represents the artists of a song. - */ -#define PURPLE_TUNE_ARTIST "tune_artist" - -/** - * PURPLE_TUNE_COMMENT: - * - * A constant for a status attribute that represents the comment of a song. - */ -#define PURPLE_TUNE_COMMENT "tune_comment" - -/** - * PURPLE_TUNE_FULL: - * - * A constant for a status attribute that represents the full details of a song. - */ -#define PURPLE_TUNE_FULL "tune_full" - -/** - * PURPLE_TUNE_GENRE: - * - * A constant for a status attribute that represents the genre of a song. - */ -#define PURPLE_TUNE_GENRE "tune_genre" - -/** - * PURPLE_TUNE_TIME: - * - * A constant for a status attribute that represents the duration of a song. - */ -#define PURPLE_TUNE_TIME "tune_time" - -/** - * PURPLE_TUNE_TITLE: - * - * A constant for a status attribute that represents the title of a song. - */ -#define PURPLE_TUNE_TITLE "tune_title" - -/** - * PURPLE_TUNE_TRACK: - * - * A constant for a status attribute that represents the track number of a song. - */ -#define PURPLE_TUNE_TRACK "tune_track" - -/** - * PURPLE_TUNE_URL: - * - * A constant for a status attribute that represents the url of a song. - */ -#define PURPLE_TUNE_URL "tune_url" - -/** - * PURPLE_TUNE_YEAR: - * - * A constant for a status attribute that represents the release year of a song. - */ -#define PURPLE_TUNE_YEAR "tune_year" - G_BEGIN_DECLS /**************************************************************************/ diff --git a/libpurple/util.c b/libpurple/util.c index c4c7660dad..51801c667d 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -993,81 +993,6 @@ purple_escape_filename(const char *str) return buf; } -void purple_util_set_current_song(const char *title, const char *artist, const char *album) -{ - GListModel *manager_model = NULL; - guint n_items = 0; - - manager_model = purple_account_manager_get_default_as_model(); - n_items = g_list_model_get_n_items(manager_model); - for(guint index = 0; index < n_items; index++) { - PurpleAccount *account = g_list_model_get_item(manager_model, index); - PurplePresence *presence; - PurpleStatus *tune; - - if (!purple_account_get_enabled(account)) { - g_object_unref(account); - continue; - } - - presence = purple_account_get_presence(account); - tune = purple_presence_get_status(presence, "tune"); - if (!tune) { - g_object_unref(account); - continue; - } - if (title) { - GHashTable *attributes = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(attributes, PURPLE_TUNE_TITLE, - (gpointer)title); - g_hash_table_insert(attributes, PURPLE_TUNE_ARTIST, - (gpointer)artist); - g_hash_table_insert(attributes, PURPLE_TUNE_TITLE, - (gpointer)album); - - purple_status_set_active_with_attributes(tune, TRUE, attributes); - - g_hash_table_destroy(attributes); - } else { - purple_status_set_active(tune, FALSE); - } - - g_object_unref(account); - } -} - -char * -purple_util_format_song_info(const char *title, const char *artist, - const char *album) -{ - GString *string; - char *esc; - - if (!title || !*title) { - return NULL; - } - - esc = g_markup_escape_text(title, -1); - string = g_string_new(""); - g_string_append_printf(string, "%s", esc); - g_free(esc); - - if (artist && *artist) { - esc = g_markup_escape_text(artist, -1); - g_string_append_printf(string, _(" - %s"), esc); - g_free(esc); - } - - if (album && *album) { - esc = g_markup_escape_text(album, -1); - g_string_append_printf(string, _(" (%s)"), esc); - g_free(esc); - } - - return g_string_free(string, FALSE); -} - GValue * purple_value_new(GType type) { diff --git a/libpurple/util.h b/libpurple/util.h index 00058c5ea1..68b916a82e 100644 --- a/libpurple/util.h +++ b/libpurple/util.h @@ -39,29 +39,6 @@ G_BEGIN_DECLS -/** - * purple_util_set_current_song: - * @title: The title of the song, %NULL to unset the value. - * @artist: The artist of the song, can be %NULL. - * @album: The album of the song, can be %NULL. - * - * Set the appropriate presence values for the currently playing song. - */ -void purple_util_set_current_song(const char *title, const char *artist, - const char *album); - -/** - * purple_util_format_song_info: - * @title: The title of the song, %NULL to unset the value. - * @artist: The artist of the song, can be %NULL. - * @album: The album of the song, can be %NULL. - * - * Format song information. - * - * Returns: The formatted string. The caller must g_free the returned string. - */ -char *purple_util_format_song_info(const char *title, const char *artist, const char *album); - /**************************************************************************/ /* Utility Subsystem */ /**************************************************************************/ diff --git a/pidgin/pidginiconname.c b/pidgin/pidginiconname.c index 9de9067f7e..7e8c58f828 100644 --- a/pidgin/pidginiconname.c +++ b/pidgin/pidginiconname.c @@ -49,7 +49,6 @@ pidgin_icon_name_from_status_primitive(PurpleStatusPrimitive primitive, return "pidgin-user-extended-away"; break; case PURPLE_STATUS_MOBILE: - case PURPLE_STATUS_TUNE: case PURPLE_STATUS_UNSET: default: break; diff --git a/pidgin/plugins/unity/unity.c b/pidgin/plugins/unity/unity.c index 538ca5f3fb..2f903a37f0 100644 --- a/pidgin/plugins/unity/unity.c +++ b/pidgin/plugins/unity/unity.c @@ -349,7 +349,6 @@ status_changed_cb(PurpleSavedStatus *saved_status) switch (purple_savedstatus_get_primitive_type(saved_status)) { case PURPLE_STATUS_AVAILABLE: - case PURPLE_STATUS_TUNE: case PURPLE_STATUS_UNSET: status = MESSAGING_MENU_STATUS_AVAILABLE; break; diff --git a/po/POTFILES.in b/po/POTFILES.in index 61c6e5a50b..f8b546f066 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -153,7 +153,6 @@ libpurple/protocols/jabber/tests/test_jabber_jutil.c libpurple/protocols/jabber/tests/test_jabber_scram.c libpurple/protocols/jabber/useravatar.c libpurple/protocols/jabber/usernick.c -libpurple/protocols/jabber/usertune.c libpurple/protocols/jabber/xdata.c libpurple/protocols/jabber/xmpp.c libpurple/proxy.c |