static gboolean spotify_poll (gpointer data) { spotify *spotc = (spotify *)data; if (spotify_update_playing (spotc)) { purple_util_set_current_song (spotc->playing.title, spotc->playing.artist, NULL); } else { purple_util_set_current_song (NULL, NULL, NULL); } return TRUE; }
// repeatedly called procedure that polls spotify for the song and modifies the status static gboolean spotify_poll(gpointer data) { if (spotify.refresh()) { // magic UTF8 conversion gchar* artist = g_locale_to_utf8(spotify.Artist.c_str(), spotify.Artist.length(), NULL, NULL, NULL); gchar* title = g_locale_to_utf8(spotify.Title.c_str(), spotify.Title.length(), NULL, NULL, NULL); purple_util_set_current_song(title, artist, NULL); g_free(artist); g_free(title); } else { purple_util_set_current_song(NULL, NULL, NULL); } return TRUE; }
static gboolean plugin_unload (PurplePlugin * plugin) { purple_timeout_remove(spotify_handle); spotify_free(spot); purple_util_set_current_song (NULL, NULL, NULL); return TRUE; }
static gboolean plugin_unload(PurplePlugin * plugin) { purple_timeout_remove(spotify_handle); // clear the currently playing song purple_util_set_current_song (NULL, NULL, NULL); return TRUE; }