diff --git a/src/mpdclient.c b/src/mpdclient.c
index f0076b6047442e4682097da63883a1ae9029a090..c8351d14cb1526365975875ae10d2520179feeb8 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
#include "callbacks.h"
#include "filelist.h"
#include "config.h"
-#include "options.h"
-#include "strfsong.h"
-#include "utils.h"
#include "gidle.h"
#include <mpd/client.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <time.h>
-#include <string.h>
+#include <assert.h>
-#define BUFSIZE 1024
-
-/* sort by song format */
-gint
-compare_filelistentry_format(gconstpointer filelist_entry1,
- gconstpointer filelist_entry2,
- const char *song_format)
+static void
+mpdclient_invoke_error_callback(gcc_unused enum mpd_error error,
+ const char *message)
{
- const struct mpd_entity *e1 =
- ((const struct filelist_entry *)filelist_entry1)->entity;
- const struct mpd_entity *e2 =
- ((const struct filelist_entry *)filelist_entry2)->entity;
-
- int n = 0;
- if (e1 && e2 &&
- mpd_entity_get_type(e1) == MPD_ENTITY_TYPE_SONG &&
- mpd_entity_get_type(e2) == MPD_ENTITY_TYPE_SONG) {
- char key1[BUFSIZE], key2[BUFSIZE];
- strfsong(key1, BUFSIZE, song_format, mpd_entity_get_song(e1));
- strfsong(key2, BUFSIZE, song_format, mpd_entity_get_song(e2));
- n = strcmp(key1,key2);
- }
-
- return n;
+ mpdclient_error_callback(message);
}
-
/****************************************************************************/
/*** mpdclient functions ****************************************************/
/****************************************************************************/
mpdclient_auth_callback(c))
return true;
- mpdclient_error_callback(mpd_connection_get_error_message(c->connection));
+ mpdclient_invoke_error_callback(error,
+ mpd_connection_get_error_message(c->connection));
if (!mpd_connection_clear_error(c->connection))
mpdclient_disconnect(c);