summaryrefslogtreecommitdiff
path: root/libpurple/protocols
diff options
context:
space:
mode:
authorGary Kramlich <grim@reaperworld.com>2023-03-20 21:22:53 -0500
committerGary Kramlich <grim@reaperworld.com>2023-03-20 21:22:53 -0500
commite8df893735bca9036f2e03c6f2fc561d85846f8d (patch)
treeea150196f0a16fa139c4773e6ba68a77268490ee /libpurple/protocols
parenta965b83ba6a3a490e54ba69e9f6bf96c80d776e0 (diff)
downloadpidgin-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/
Diffstat (limited to 'libpurple/protocols')
-rw-r--r--libpurple/protocols/jabber/jabber.c33
-rw-r--r--libpurple/protocols/jabber/jabber.h8
-rw-r--r--libpurple/protocols/jabber/meson.build2
-rw-r--r--libpurple/protocols/jabber/pep.c2
-rw-r--r--libpurple/protocols/jabber/presence.c45
-rw-r--r--libpurple/protocols/jabber/tests/test_jabber_caps.c4
-rw-r--r--libpurple/protocols/jabber/usertune.c145
-rw-r--r--libpurple/protocols/jabber/usertune.h45
8 files changed, 3 insertions, 281 deletions
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 */