Commit 7a982169 authored by Max Kellermann's avatar Max Kellermann

Client: rename the struct client to class Client

parent f2510d60
...@@ -58,16 +58,16 @@ struct command { ...@@ -58,16 +58,16 @@ struct command {
unsigned permission; unsigned permission;
int min; int min;
int max; int max;
enum command_return (*handler)(struct client *client, int argc, char **argv); enum command_return (*handler)(Client *client, int argc, char **argv);
}; };
/* don't be fooled, this is the command handler for "commands" command */ /* don't be fooled, this is the command handler for "commands" command */
static enum command_return static enum command_return
handle_commands(struct client *client, handle_commands(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]); G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]);
static enum command_return static enum command_return
handle_not_commands(struct client *client, handle_not_commands(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]); G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]);
/** /**
...@@ -182,7 +182,7 @@ command_available(G_GNUC_UNUSED const struct command *cmd) ...@@ -182,7 +182,7 @@ command_available(G_GNUC_UNUSED const struct command *cmd)
/* don't be fooled, this is the command handler for "commands" command */ /* don't be fooled, this is the command handler for "commands" command */
static enum command_return static enum command_return
handle_commands(struct client *client, handle_commands(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
const unsigned permission = client_get_permission(client); const unsigned permission = client_get_permission(client);
...@@ -200,7 +200,7 @@ handle_commands(struct client *client, ...@@ -200,7 +200,7 @@ handle_commands(struct client *client,
} }
static enum command_return static enum command_return
handle_not_commands(struct client *client, handle_not_commands(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
const unsigned permission = client_get_permission(client); const unsigned permission = client_get_permission(client);
...@@ -252,7 +252,7 @@ command_lookup(const char *name) ...@@ -252,7 +252,7 @@ command_lookup(const char *name)
} }
static bool static bool
command_check_request(const struct command *cmd, struct client *client, command_check_request(const struct command *cmd, Client *client,
unsigned permission, int argc, char *argv[]) unsigned permission, int argc, char *argv[])
{ {
int min = cmd->min + 1; int min = cmd->min + 1;
...@@ -290,7 +290,7 @@ command_check_request(const struct command *cmd, struct client *client, ...@@ -290,7 +290,7 @@ command_check_request(const struct command *cmd, struct client *client,
} }
static const struct command * static const struct command *
command_checked_lookup(struct client *client, unsigned permission, command_checked_lookup(Client *client, unsigned permission,
int argc, char *argv[]) int argc, char *argv[])
{ {
const struct command *cmd; const struct command *cmd;
...@@ -317,7 +317,7 @@ command_checked_lookup(struct client *client, unsigned permission, ...@@ -317,7 +317,7 @@ command_checked_lookup(struct client *client, unsigned permission,
} }
enum command_return enum command_return
command_process(struct client *client, unsigned num, char *line) command_process(Client *client, unsigned num, char *line)
{ {
GError *error = NULL; GError *error = NULL;
int argc; int argc;
......
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
#include "command.h" #include "command.h"
struct client; class Client;
void command_init(void); void command_init(void);
void command_finish(void); void command_finish(void);
enum command_return enum command_return
command_process(struct client *client, unsigned num, char *line); command_process(Client *client, unsigned num, char *line);
#endif #endif
...@@ -20,22 +20,22 @@ ...@@ -20,22 +20,22 @@
#include "config.h" #include "config.h"
#include "ClientInternal.hxx" #include "ClientInternal.hxx"
bool client_is_expired(const struct client *client) bool client_is_expired(const Client *client)
{ {
return client->channel == NULL; return client->channel == NULL;
} }
int client_get_uid(const struct client *client) int client_get_uid(const Client *client)
{ {
return client->uid; return client->uid;
} }
unsigned client_get_permission(const struct client *client) unsigned client_get_permission(const Client *client)
{ {
return client->permission; return client->permission;
} }
void client_set_permission(struct client *client, unsigned permission) void client_set_permission(Client *client, unsigned permission)
{ {
client->permission = permission; client->permission = permission;
} }
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
#include <stddef.h> #include <stddef.h>
#include <stdarg.h> #include <stdarg.h>
struct client;
struct sockaddr; struct sockaddr;
struct player_control; struct player_control;
class Client;
void client_manager_init(void); void client_manager_init(void);
void client_manager_deinit(void); void client_manager_deinit(void);
...@@ -37,14 +37,14 @@ void client_new(struct player_control *player_control, ...@@ -37,14 +37,14 @@ void client_new(struct player_control *player_control,
int fd, const struct sockaddr *sa, size_t sa_length, int uid); int fd, const struct sockaddr *sa, size_t sa_length, int uid);
gcc_pure gcc_pure
bool client_is_expired(const struct client *client); bool client_is_expired(const Client *client);
/** /**
* returns the uid of the client process, or a negative value if the * returns the uid of the client process, or a negative value if the
* uid is unknown * uid is unknown
*/ */
gcc_pure gcc_pure
int client_get_uid(const struct client *client); int client_get_uid(const Client *client);
/** /**
* Is this client running on the same machine, connected with a local * Is this client running on the same machine, connected with a local
...@@ -52,31 +52,31 @@ int client_get_uid(const struct client *client); ...@@ -52,31 +52,31 @@ int client_get_uid(const struct client *client);
*/ */
gcc_pure gcc_pure
static inline bool static inline bool
client_is_local(const struct client *client) client_is_local(const Client *client)
{ {
return client_get_uid(client) > 0; return client_get_uid(client) > 0;
} }
gcc_pure gcc_pure
unsigned client_get_permission(const struct client *client); unsigned client_get_permission(const Client *client);
void client_set_permission(struct client *client, unsigned permission); void client_set_permission(Client *client, unsigned permission);
/** /**
* Write a C string to the client. * Write a C string to the client.
*/ */
void client_puts(struct client *client, const char *s); void client_puts(Client *client, const char *s);
/** /**
* Write a printf-like formatted string to the client. * Write a printf-like formatted string to the client.
*/ */
void client_vprintf(struct client *client, const char *fmt, va_list args); void client_vprintf(Client *client, const char *fmt, va_list args);
/** /**
* Write a printf-like formatted string to the client. * Write a printf-like formatted string to the client.
*/ */
gcc_fprintf gcc_fprintf
void void
client_printf(struct client *client, const char *fmt, ...); client_printf(Client *client, const char *fmt, ...);
#endif #endif
...@@ -27,7 +27,7 @@ static gboolean ...@@ -27,7 +27,7 @@ static gboolean
client_out_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition, client_out_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition,
gpointer data) gpointer data)
{ {
struct client *client = (struct client *)data; Client *client = (Client *)data;
assert(!client_is_expired(client)); assert(!client_is_expired(client));
...@@ -62,7 +62,7 @@ gboolean ...@@ -62,7 +62,7 @@ gboolean
client_in_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition, client_in_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition,
gpointer data) gpointer data)
{ {
struct client *client = (struct client *)data; Client *client = (Client *)data;
enum command_return ret; enum command_return ret;
assert(!client_is_expired(client)); assert(!client_is_expired(client));
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
static guint expire_source_id; static guint expire_source_id;
void void
client_set_expired(struct client *client) client_set_expired(Client *client)
{ {
if (!client_is_expired(client)) if (!client_is_expired(client))
client_schedule_expire(); client_schedule_expire();
...@@ -42,7 +42,7 @@ client_set_expired(struct client *client) ...@@ -42,7 +42,7 @@ client_set_expired(struct client *client)
static void static void
client_check_expired_callback(gpointer data, G_GNUC_UNUSED gpointer user_data) client_check_expired_callback(gpointer data, G_GNUC_UNUSED gpointer user_data)
{ {
struct client *client = (struct client *)data; Client *client = (Client *)data;
if (client_is_expired(client)) { if (client_is_expired(client)) {
g_debug("[%u] expired", client->num); g_debug("[%u] expired", client->num);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <unistd.h> #include <unistd.h>
bool bool
client_allow_file(const struct client *client, const char *path_fs, client_allow_file(const Client *client, const char *path_fs,
GError **error_r) GError **error_r)
{ {
#ifdef WIN32 #ifdef WIN32
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <stdbool.h> #include <stdbool.h>
struct client; class Client;
/** /**
* Is this client allowed to use the specified local file? * Is this client allowed to use the specified local file?
...@@ -37,7 +37,7 @@ struct client; ...@@ -37,7 +37,7 @@ struct client;
* @return true if access is allowed * @return true if access is allowed
*/ */
bool bool
client_allow_file(const struct client *client, const char *path_fs, client_allow_file(const Client *client, const char *path_fs,
GError **error_r); GError **error_r);
#endif #endif
...@@ -58,7 +58,7 @@ void client_manager_init(void) ...@@ -58,7 +58,7 @@ void client_manager_init(void)
static void client_close_all(void) static void client_close_all(void)
{ {
while (!client_list_is_empty()) { while (!client_list_is_empty()) {
struct client *client = client_list_get_first(); Client *client = client_list_get_first();
client_close(client); client_close(client);
} }
......
...@@ -31,7 +31,7 @@ extern "C" { ...@@ -31,7 +31,7 @@ extern "C" {
* Send "idle" response to this client. * Send "idle" response to this client.
*/ */
static void static void
client_idle_notify(struct client *client) client_idle_notify(Client *client)
{ {
unsigned flags, i; unsigned flags, i;
const char *const* idle_names; const char *const* idle_names;
...@@ -55,7 +55,7 @@ client_idle_notify(struct client *client) ...@@ -55,7 +55,7 @@ client_idle_notify(struct client *client)
} }
void void
client_idle_add(struct client *client, unsigned flags) client_idle_add(Client *client, unsigned flags)
{ {
if (client_is_expired(client)) if (client_is_expired(client))
return; return;
...@@ -71,7 +71,7 @@ client_idle_add(struct client *client, unsigned flags) ...@@ -71,7 +71,7 @@ client_idle_add(struct client *client, unsigned flags)
static void static void
client_idle_callback(gpointer data, gpointer user_data) client_idle_callback(gpointer data, gpointer user_data)
{ {
struct client *client = (struct client *)data; Client *client = (Client *)data;
unsigned flags = GPOINTER_TO_UINT(user_data); unsigned flags = GPOINTER_TO_UINT(user_data);
client_idle_add(client, flags); client_idle_add(client, flags);
...@@ -84,7 +84,7 @@ void client_manager_idle_add(unsigned flags) ...@@ -84,7 +84,7 @@ void client_manager_idle_add(unsigned flags)
client_list_foreach(client_idle_callback, GUINT_TO_POINTER(flags)); client_list_foreach(client_idle_callback, GUINT_TO_POINTER(flags));
} }
bool client_idle_wait(struct client *client, unsigned flags) bool client_idle_wait(Client *client, unsigned flags)
{ {
assert(!client->idle_waiting); assert(!client->idle_waiting);
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
#ifndef MPD_CLIENT_IDLE_HXX #ifndef MPD_CLIENT_IDLE_HXX
#define MPD_CLIENT_IDLE_HXX #define MPD_CLIENT_IDLE_HXX
struct client; class Client;
void void
client_idle_add(struct client *client, unsigned flags); client_idle_add(Client *client, unsigned flags);
/** /**
* Adds the specified idle flags to all clients and immediately sends * Adds the specified idle flags to all clients and immediately sends
...@@ -38,6 +38,6 @@ client_manager_idle_add(unsigned flags); ...@@ -38,6 +38,6 @@ client_manager_idle_add(unsigned flags);
* client into waiting mode and returns false. * client into waiting mode and returns false.
*/ */
bool bool
client_idle_wait(struct client *client, unsigned flags); client_idle_wait(Client *client, unsigned flags);
#endif #endif
...@@ -39,7 +39,8 @@ struct deferred_buffer { ...@@ -39,7 +39,8 @@ struct deferred_buffer {
char data[sizeof(long)]; char data[sizeof(long)];
}; };
struct client { class Client {
public:
struct player_control *player_control; struct player_control *player_control;
GIOChannel *channel; GIOChannel *channel;
...@@ -112,23 +113,23 @@ client_list_is_empty(void); ...@@ -112,23 +113,23 @@ client_list_is_empty(void);
bool bool
client_list_is_full(void); client_list_is_full(void);
struct client * Client *
client_list_get_first(void); client_list_get_first(void);
void void
client_list_add(struct client *client); client_list_add(Client *client);
void void
client_list_foreach(GFunc func, gpointer user_data); client_list_foreach(GFunc func, gpointer user_data);
void void
client_list_remove(struct client *client); client_list_remove(Client *client);
void void
client_close(struct client *client); client_close(Client *client);
static inline void static inline void
new_cmd_list_ptr(struct client *client, const char *s) new_cmd_list_ptr(Client *client, const char *s)
{ {
client->cmd_list = g_slist_prepend(client->cmd_list, g_strdup(s)); client->cmd_list = g_slist_prepend(client->cmd_list, g_strdup(s));
} }
...@@ -143,7 +144,7 @@ free_cmd_list(GSList *list) ...@@ -143,7 +144,7 @@ free_cmd_list(GSList *list)
} }
void void
client_set_expired(struct client *client); client_set_expired(Client *client);
/** /**
* Schedule an "expired" check for all clients: permanently delete * Schedule an "expired" check for all clients: permanently delete
...@@ -159,16 +160,16 @@ void ...@@ -159,16 +160,16 @@ void
client_deinit_expire(void); client_deinit_expire(void);
enum command_return enum command_return
client_read(struct client *client); client_read(Client *client);
enum command_return enum command_return
client_process_line(struct client *client, char *line); client_process_line(Client *client, char *line);
void void
client_write_deferred(struct client *client); client_write_deferred(Client *client);
void void
client_write_output(struct client *client); client_write_output(Client *client);
gboolean gboolean
client_in_event(GIOChannel *source, GIOCondition condition, client_in_event(GIOChannel *source, GIOCondition condition,
......
...@@ -37,16 +37,16 @@ client_list_is_full(void) ...@@ -37,16 +37,16 @@ client_list_is_full(void)
return num_clients >= client_max_connections; return num_clients >= client_max_connections;
} }
struct client * Client *
client_list_get_first(void) client_list_get_first(void)
{ {
assert(clients != NULL); assert(clients != NULL);
return (struct client *)clients->data; return (Client *)clients->data;
} }
void void
client_list_add(struct client *client) client_list_add(Client *client)
{ {
clients = g_list_prepend(clients, client); clients = g_list_prepend(clients, client);
++num_clients; ++num_clients;
...@@ -59,7 +59,7 @@ client_list_foreach(GFunc func, gpointer user_data) ...@@ -59,7 +59,7 @@ client_list_foreach(GFunc func, gpointer user_data)
} }
void void
client_list_remove(struct client *client) client_list_remove(Client *client)
{ {
assert(num_clients > 0); assert(num_clients > 0);
assert(clients != NULL); assert(clients != NULL);
......
...@@ -50,7 +50,7 @@ client_new(struct player_control *player_control, ...@@ -50,7 +50,7 @@ client_new(struct player_control *player_control,
int fd, const struct sockaddr *sa, size_t sa_length, int uid) int fd, const struct sockaddr *sa, size_t sa_length, int uid)
{ {
static unsigned int next_client_num; static unsigned int next_client_num;
struct client *client; Client *client;
char *remote; char *remote;
assert(player_control != NULL); assert(player_control != NULL);
...@@ -87,7 +87,7 @@ client_new(struct player_control *player_control, ...@@ -87,7 +87,7 @@ client_new(struct player_control *player_control,
return; return;
} }
client = g_new0(struct client, 1); client = g_new0(Client, 1);
client->player_control = player_control; client->player_control = player_control;
client->channel = g_io_channel_new_socket(fd); client->channel = g_io_channel_new_socket(fd);
...@@ -143,7 +143,7 @@ deferred_buffer_free(gpointer data, G_GNUC_UNUSED gpointer user_data) ...@@ -143,7 +143,7 @@ deferred_buffer_free(gpointer data, G_GNUC_UNUSED gpointer user_data)
} }
void void
client_close(struct client *client) client_close(Client *client)
{ {
client_list_remove(client); client_list_remove(client);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define CLIENT_LIST_MODE_END "command_list_end" #define CLIENT_LIST_MODE_END "command_list_end"
static enum command_return static enum command_return
client_process_command_list(struct client *client, bool list_ok, GSList *list) client_process_command_list(Client *client, bool list_ok, GSList *list)
{ {
enum command_return ret = COMMAND_RETURN_OK; enum command_return ret = COMMAND_RETURN_OK;
unsigned num = 0; unsigned num = 0;
...@@ -51,7 +51,7 @@ client_process_command_list(struct client *client, bool list_ok, GSList *list) ...@@ -51,7 +51,7 @@ client_process_command_list(struct client *client, bool list_ok, GSList *list)
} }
enum command_return enum command_return
client_process_line(struct client *client, char *line) client_process_line(Client *client, char *line)
{ {
enum command_return ret; enum command_return ret;
......
...@@ -28,7 +28,7 @@ extern "C" { ...@@ -28,7 +28,7 @@ extern "C" {
#include <string.h> #include <string.h>
static char * static char *
client_read_line(struct client *client) client_read_line(Client *client)
{ {
size_t length; size_t length;
const char *p = (const char *)fifo_buffer_read(client->input, &length); const char *p = (const char *)fifo_buffer_read(client->input, &length);
...@@ -46,7 +46,7 @@ client_read_line(struct client *client) ...@@ -46,7 +46,7 @@ client_read_line(struct client *client)
} }
static enum command_return static enum command_return
client_input_received(struct client *client, size_t bytesRead) client_input_received(Client *client, size_t bytesRead)
{ {
char *line; char *line;
...@@ -69,7 +69,7 @@ client_input_received(struct client *client, size_t bytesRead) ...@@ -69,7 +69,7 @@ client_input_received(struct client *client, size_t bytesRead)
} }
enum command_return enum command_return
client_read(struct client *client) client_read(Client *client)
{ {
GError *error = NULL; GError *error = NULL;
GIOStatus status; GIOStatus status;
......
...@@ -29,7 +29,7 @@ extern "C" { ...@@ -29,7 +29,7 @@ extern "C" {
G_GNUC_PURE G_GNUC_PURE
static GSList * static GSList *
client_find_subscription(const struct client *client, const char *channel) client_find_subscription(const Client *client, const char *channel)
{ {
for (GSList *i = client->subscriptions; i != NULL; i = g_slist_next(i)) for (GSList *i = client->subscriptions; i != NULL; i = g_slist_next(i))
if (strcmp((const char *)i->data, channel) == 0) if (strcmp((const char *)i->data, channel) == 0)
...@@ -39,7 +39,7 @@ client_find_subscription(const struct client *client, const char *channel) ...@@ -39,7 +39,7 @@ client_find_subscription(const struct client *client, const char *channel)
} }
enum client_subscribe_result enum client_subscribe_result
client_subscribe(struct client *client, const char *channel) client_subscribe(Client *client, const char *channel)
{ {
assert(client != NULL); assert(client != NULL);
assert(channel != NULL); assert(channel != NULL);
...@@ -63,7 +63,7 @@ client_subscribe(struct client *client, const char *channel) ...@@ -63,7 +63,7 @@ client_subscribe(struct client *client, const char *channel)
} }
bool bool
client_unsubscribe(struct client *client, const char *channel) client_unsubscribe(Client *client, const char *channel)
{ {
GSList *i = client_find_subscription(client, channel); GSList *i = client_find_subscription(client, channel);
if (i == NULL) if (i == NULL)
...@@ -83,7 +83,7 @@ client_unsubscribe(struct client *client, const char *channel) ...@@ -83,7 +83,7 @@ client_unsubscribe(struct client *client, const char *channel)
} }
void void
client_unsubscribe_all(struct client *client) client_unsubscribe_all(Client *client)
{ {
for (GSList *i = client->subscriptions; i != NULL; i = g_slist_next(i)) for (GSList *i = client->subscriptions; i != NULL; i = g_slist_next(i))
g_free(i->data); g_free(i->data);
...@@ -94,7 +94,7 @@ client_unsubscribe_all(struct client *client) ...@@ -94,7 +94,7 @@ client_unsubscribe_all(struct client *client)
} }
bool bool
client_push_message(struct client *client, const struct client_message *msg) client_push_message(Client *client, const struct client_message *msg)
{ {
assert(client != NULL); assert(client != NULL);
assert(msg != NULL); assert(msg != NULL);
...@@ -115,7 +115,7 @@ client_push_message(struct client *client, const struct client_message *msg) ...@@ -115,7 +115,7 @@ client_push_message(struct client *client, const struct client_message *msg)
} }
GSList * GSList *
client_read_messages(struct client *client) client_read_messages(Client *client)
{ {
GSList *messages = g_slist_reverse(client->messages); GSList *messages = g_slist_reverse(client->messages);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "gcc.h" #include "gcc.h"
typedef struct _GSList GSList; typedef struct _GSList GSList;
struct client; class Client;
struct client_message; struct client_message;
enum client_subscribe_result { enum client_subscribe_result {
...@@ -41,19 +41,19 @@ enum client_subscribe_result { ...@@ -41,19 +41,19 @@ enum client_subscribe_result {
}; };
enum client_subscribe_result enum client_subscribe_result
client_subscribe(struct client *client, const char *channel); client_subscribe(Client *client, const char *channel);
bool bool
client_unsubscribe(struct client *client, const char *channel); client_unsubscribe(Client *client, const char *channel);
void void
client_unsubscribe_all(struct client *client); client_unsubscribe_all(Client *client);
bool bool
client_push_message(struct client *client, const struct client_message *msg); client_push_message(Client *client, const struct client_message *msg);
gcc_malloc gcc_malloc
GSList * GSList *
client_read_messages(struct client *client); client_read_messages(Client *client);
#endif #endif
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <stdio.h> #include <stdio.h>
static size_t static size_t
client_write_deferred_buffer(struct client *client, client_write_deferred_buffer(Client *client,
const struct deferred_buffer *buffer) const struct deferred_buffer *buffer)
{ {
GError *error = NULL; GError *error = NULL;
...@@ -67,7 +67,7 @@ client_write_deferred_buffer(struct client *client, ...@@ -67,7 +67,7 @@ client_write_deferred_buffer(struct client *client,
} }
void void
client_write_deferred(struct client *client) client_write_deferred(Client *client)
{ {
size_t ret; size_t ret;
...@@ -109,8 +109,8 @@ client_write_deferred(struct client *client) ...@@ -109,8 +109,8 @@ client_write_deferred(struct client *client)
} }
} }
static void client_defer_output(struct client *client, static void
const void *data, size_t length) client_defer_output(Client *client, const void *data, size_t length)
{ {
size_t alloc; size_t alloc;
struct deferred_buffer *buf; struct deferred_buffer *buf;
...@@ -137,8 +137,8 @@ static void client_defer_output(struct client *client, ...@@ -137,8 +137,8 @@ static void client_defer_output(struct client *client,
g_queue_push_tail(client->deferred_send, buf); g_queue_push_tail(client->deferred_send, buf);
} }
static void client_write_direct(struct client *client, static void
const char *data, size_t length) client_write_direct(Client *client, const char *data, size_t length)
{ {
GError *error = NULL; GError *error = NULL;
GIOStatus status; GIOStatus status;
...@@ -182,7 +182,7 @@ static void client_write_direct(struct client *client, ...@@ -182,7 +182,7 @@ static void client_write_direct(struct client *client,
} }
void void
client_write_output(struct client *client) client_write_output(Client *client)
{ {
if (client_is_expired(client) || !client->send_buf_used) if (client_is_expired(client) || !client->send_buf_used)
return; return;
...@@ -212,7 +212,8 @@ client_write_output(struct client *client) ...@@ -212,7 +212,8 @@ client_write_output(struct client *client)
/** /**
* Write a block of data to the client. * Write a block of data to the client.
*/ */
static void client_write(struct client *client, const char *buffer, size_t buflen) static void
client_write(Client *client, const char *buffer, size_t buflen)
{ {
/* if the client is going to be closed, do nothing */ /* if the client is going to be closed, do nothing */
if (client_is_expired(client)) if (client_is_expired(client))
...@@ -237,12 +238,14 @@ static void client_write(struct client *client, const char *buffer, size_t bufle ...@@ -237,12 +238,14 @@ static void client_write(struct client *client, const char *buffer, size_t bufle
} }
} }
void client_puts(struct client *client, const char *s) void
client_puts(Client *client, const char *s)
{ {
client_write(client, s, strlen(s)); client_write(client, s, strlen(s));
} }
void client_vprintf(struct client *client, const char *fmt, va_list args) void
client_vprintf(Client *client, const char *fmt, va_list args)
{ {
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
va_list tmp; va_list tmp;
...@@ -274,7 +277,9 @@ void client_vprintf(struct client *client, const char *fmt, va_list args) ...@@ -274,7 +277,9 @@ void client_vprintf(struct client *client, const char *fmt, va_list args)
#endif #endif
} }
G_GNUC_PRINTF(2, 3) void client_printf(struct client *client, const char *fmt, ...) G_GNUC_PRINTF(2, 3)
void
client_printf(Client *client, const char *fmt, ...)
{ {
va_list args; va_list args;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <errno.h> #include <errno.h>
enum command_return enum command_return
print_playlist_result(struct client *client, enum playlist_result result) print_playlist_result(Client *client, enum playlist_result result)
{ {
switch (result) { switch (result) {
case PLAYLIST_RESULT_SUCCESS: case PLAYLIST_RESULT_SUCCESS:
...@@ -89,7 +89,7 @@ print_playlist_result(struct client *client, enum playlist_result result) ...@@ -89,7 +89,7 @@ print_playlist_result(struct client *client, enum playlist_result result)
* Send the GError to the client and free the GError. * Send the GError to the client and free the GError.
*/ */
enum command_return enum command_return
print_error(struct client *client, GError *error) print_error(Client *client, GError *error)
{ {
assert(client != NULL); assert(client != NULL);
assert(error != NULL); assert(error != NULL);
......
...@@ -25,13 +25,15 @@ ...@@ -25,13 +25,15 @@
#include <glib.h> #include <glib.h>
class Client;
enum command_return enum command_return
print_playlist_result(struct client *client, enum playlist_result result); print_playlist_result(Client *client, enum playlist_result result);
/** /**
* Send the GError to the client and free the GError. * Send the GError to the client and free the GError.
*/ */
enum command_return enum command_return
print_error(struct client *client, GError *error); print_error(Client *client, GError *error);
#endif #endif
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <string.h> #include <string.h>
enum command_return enum command_return
handle_lsinfo2(struct client *client, int argc, char *argv[]) handle_lsinfo2(Client *client, int argc, char *argv[])
{ {
const char *uri; const char *uri;
...@@ -54,7 +54,7 @@ handle_lsinfo2(struct client *client, int argc, char *argv[]) ...@@ -54,7 +54,7 @@ handle_lsinfo2(struct client *client, int argc, char *argv[])
} }
static enum command_return static enum command_return
handle_match(struct client *client, int argc, char *argv[], bool fold_case) handle_match(Client *client, int argc, char *argv[], bool fold_case)
{ {
SongFilter filter; SongFilter filter;
if (!filter.Parse(argc - 1, argv + 1, fold_case)) { if (!filter.Parse(argc - 1, argv + 1, fold_case)) {
...@@ -71,19 +71,19 @@ handle_match(struct client *client, int argc, char *argv[], bool fold_case) ...@@ -71,19 +71,19 @@ handle_match(struct client *client, int argc, char *argv[], bool fold_case)
} }
enum command_return enum command_return
handle_find(struct client *client, int argc, char *argv[]) handle_find(Client *client, int argc, char *argv[])
{ {
return handle_match(client, argc, argv, false); return handle_match(client, argc, argv, false);
} }
enum command_return enum command_return
handle_search(struct client *client, int argc, char *argv[]) handle_search(Client *client, int argc, char *argv[])
{ {
return handle_match(client, argc, argv, true); return handle_match(client, argc, argv, true);
} }
static enum command_return static enum command_return
handle_match_add(struct client *client, int argc, char *argv[], bool fold_case) handle_match_add(Client *client, int argc, char *argv[], bool fold_case)
{ {
SongFilter filter; SongFilter filter;
if (!filter.Parse(argc - 1, argv + 1, fold_case)) { if (!filter.Parse(argc - 1, argv + 1, fold_case)) {
...@@ -98,19 +98,19 @@ handle_match_add(struct client *client, int argc, char *argv[], bool fold_case) ...@@ -98,19 +98,19 @@ handle_match_add(struct client *client, int argc, char *argv[], bool fold_case)
} }
enum command_return enum command_return
handle_findadd(struct client *client, int argc, char *argv[]) handle_findadd(Client *client, int argc, char *argv[])
{ {
return handle_match_add(client, argc, argv, false); return handle_match_add(client, argc, argv, false);
} }
enum command_return enum command_return
handle_searchadd(struct client *client, int argc, char *argv[]) handle_searchadd(Client *client, int argc, char *argv[])
{ {
return handle_match_add(client, argc, argv, true); return handle_match_add(client, argc, argv, true);
} }
enum command_return enum command_return
handle_searchaddpl(struct client *client, int argc, char *argv[]) handle_searchaddpl(Client *client, int argc, char *argv[])
{ {
const char *playlist = argv[1]; const char *playlist = argv[1];
...@@ -127,7 +127,7 @@ handle_searchaddpl(struct client *client, int argc, char *argv[]) ...@@ -127,7 +127,7 @@ handle_searchaddpl(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_count(struct client *client, int argc, char *argv[]) handle_count(Client *client, int argc, char *argv[])
{ {
SongFilter filter; SongFilter filter;
if (!filter.Parse(argc - 1, argv + 1, false)) { if (!filter.Parse(argc - 1, argv + 1, false)) {
...@@ -142,7 +142,7 @@ handle_count(struct client *client, int argc, char *argv[]) ...@@ -142,7 +142,7 @@ handle_count(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_listall(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_listall(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
const char *directory = ""; const char *directory = "";
...@@ -156,7 +156,7 @@ handle_listall(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -156,7 +156,7 @@ handle_listall(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_list(struct client *client, int argc, char *argv[]) handle_list(Client *client, int argc, char *argv[])
{ {
unsigned tagType = locate_parse_type(argv[1]); unsigned tagType = locate_parse_type(argv[1]);
...@@ -205,7 +205,7 @@ handle_list(struct client *client, int argc, char *argv[]) ...@@ -205,7 +205,7 @@ handle_list(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_listallinfo(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_listallinfo(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
const char *directory = ""; const char *directory = "";
......
...@@ -22,34 +22,36 @@ ...@@ -22,34 +22,36 @@
#include "command.h" #include "command.h"
class Client;
enum command_return enum command_return
handle_lsinfo2(struct client *client, int argc, char *argv[]); handle_lsinfo2(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_find(struct client *client, int argc, char *argv[]); handle_find(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_findadd(struct client *client, int argc, char *argv[]); handle_findadd(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_search(struct client *client, int argc, char *argv[]); handle_search(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_searchadd(struct client *client, int argc, char *argv[]); handle_searchadd(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_searchaddpl(struct client *client, int argc, char *argv[]); handle_searchaddpl(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_count(struct client *client, int argc, char *argv[]); handle_count(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_listall(struct client *client, int argc, char *argv[]); handle_listall(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_list(struct client *client, int argc, char *argv[]); handle_list(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_listallinfo(struct client *client, int argc, char *argv[]); handle_listallinfo(Client *client, int argc, char *argv[]);
#endif #endif
...@@ -38,7 +38,7 @@ extern "C" { ...@@ -38,7 +38,7 @@ extern "C" {
#include <functional> #include <functional>
static bool static bool
PrintDirectory(struct client *client, const Directory &directory) PrintDirectory(Client *client, const Directory &directory)
{ {
if (!directory.IsRoot()) if (!directory.IsRoot())
client_printf(client, "directory: %s\n", directory.GetPath()); client_printf(client, "directory: %s\n", directory.GetPath());
...@@ -47,7 +47,7 @@ PrintDirectory(struct client *client, const Directory &directory) ...@@ -47,7 +47,7 @@ PrintDirectory(struct client *client, const Directory &directory)
} }
static void static void
print_playlist_in_directory(struct client *client, print_playlist_in_directory(Client *client,
const Directory &directory, const Directory &directory,
const char *name_utf8) const char *name_utf8)
{ {
...@@ -59,7 +59,7 @@ print_playlist_in_directory(struct client *client, ...@@ -59,7 +59,7 @@ print_playlist_in_directory(struct client *client,
} }
static bool static bool
PrintSongBrief(struct client *client, song &song) PrintSongBrief(Client *client, song &song)
{ {
assert(song.parent != NULL); assert(song.parent != NULL);
...@@ -73,7 +73,7 @@ PrintSongBrief(struct client *client, song &song) ...@@ -73,7 +73,7 @@ PrintSongBrief(struct client *client, song &song)
} }
static bool static bool
PrintSongFull(struct client *client, song &song) PrintSongFull(Client *client, song &song)
{ {
assert(song.parent != NULL); assert(song.parent != NULL);
...@@ -87,7 +87,7 @@ PrintSongFull(struct client *client, song &song) ...@@ -87,7 +87,7 @@ PrintSongFull(struct client *client, song &song)
} }
static bool static bool
PrintPlaylistBrief(struct client *client, PrintPlaylistBrief(Client *client,
const PlaylistInfo &playlist, const PlaylistInfo &playlist,
const Directory &directory) const Directory &directory)
{ {
...@@ -96,7 +96,7 @@ PrintPlaylistBrief(struct client *client, ...@@ -96,7 +96,7 @@ PrintPlaylistBrief(struct client *client,
} }
static bool static bool
PrintPlaylistFull(struct client *client, PrintPlaylistFull(Client *client,
const PlaylistInfo &playlist, const PlaylistInfo &playlist,
const Directory &directory) const Directory &directory)
{ {
...@@ -109,7 +109,7 @@ PrintPlaylistFull(struct client *client, ...@@ -109,7 +109,7 @@ PrintPlaylistFull(struct client *client,
} }
bool bool
db_selection_print(struct client *client, const DatabaseSelection &selection, db_selection_print(Client *client, const DatabaseSelection &selection,
bool full, GError **error_r) bool full, GError **error_r)
{ {
const Database *db = GetDatabase(error_r); const Database *db = GetDatabase(error_r);
...@@ -135,7 +135,7 @@ struct SearchStats { ...@@ -135,7 +135,7 @@ struct SearchStats {
unsigned long playTime; unsigned long playTime;
}; };
static void printSearchStats(struct client *client, SearchStats *stats) static void printSearchStats(Client *client, SearchStats *stats)
{ {
client_printf(client, "songs: %i\n", stats->numberOfSongs); client_printf(client, "songs: %i\n", stats->numberOfSongs);
client_printf(client, "playtime: %li\n", stats->playTime); client_printf(client, "playtime: %li\n", stats->playTime);
...@@ -151,7 +151,7 @@ stats_visitor_song(SearchStats &stats, song &song) ...@@ -151,7 +151,7 @@ stats_visitor_song(SearchStats &stats, song &song)
} }
bool bool
searchStatsForSongsIn(struct client *client, const char *name, searchStatsForSongsIn(Client *client, const char *name,
const SongFilter *filter, const SongFilter *filter,
GError **error_r) GError **error_r)
{ {
...@@ -176,14 +176,14 @@ searchStatsForSongsIn(struct client *client, const char *name, ...@@ -176,14 +176,14 @@ searchStatsForSongsIn(struct client *client, const char *name,
} }
bool bool
printAllIn(struct client *client, const char *uri_utf8, GError **error_r) printAllIn(Client *client, const char *uri_utf8, GError **error_r)
{ {
const DatabaseSelection selection(uri_utf8, true); const DatabaseSelection selection(uri_utf8, true);
return db_selection_print(client, selection, false, error_r); return db_selection_print(client, selection, false, error_r);
} }
bool bool
printInfoForAllIn(struct client *client, const char *uri_utf8, printInfoForAllIn(Client *client, const char *uri_utf8,
GError **error_r) GError **error_r)
{ {
const DatabaseSelection selection(uri_utf8, true); const DatabaseSelection selection(uri_utf8, true);
...@@ -191,7 +191,7 @@ printInfoForAllIn(struct client *client, const char *uri_utf8, ...@@ -191,7 +191,7 @@ printInfoForAllIn(struct client *client, const char *uri_utf8,
} }
static bool static bool
PrintSongURIVisitor(struct client *client, song &song) PrintSongURIVisitor(Client *client, song &song)
{ {
song_print_uri(client, &song); song_print_uri(client, &song);
...@@ -199,7 +199,7 @@ PrintSongURIVisitor(struct client *client, song &song) ...@@ -199,7 +199,7 @@ PrintSongURIVisitor(struct client *client, song &song)
} }
static bool static bool
PrintUniqueTag(struct client *client, enum tag_type tag_type, PrintUniqueTag(Client *client, enum tag_type tag_type,
const char *value) const char *value)
{ {
client_printf(client, "%s: %s\n", tag_item_names[tag_type], value); client_printf(client, "%s: %s\n", tag_item_names[tag_type], value);
...@@ -207,7 +207,7 @@ PrintUniqueTag(struct client *client, enum tag_type tag_type, ...@@ -207,7 +207,7 @@ PrintUniqueTag(struct client *client, enum tag_type tag_type,
} }
bool bool
listAllUniqueTags(struct client *client, int type, listAllUniqueTags(Client *client, int type,
const SongFilter *filter, const SongFilter *filter,
GError **error_r) GError **error_r)
{ {
......
...@@ -23,34 +23,34 @@ ...@@ -23,34 +23,34 @@
#include "gcc.h" #include "gcc.h"
#include "gerror.h" #include "gerror.h"
struct client;
class SongFilter; class SongFilter;
struct DatabaseSelection; struct DatabaseSelection;
struct db_visitor; struct db_visitor;
class Client;
gcc_nonnull(1) gcc_nonnull(1)
bool bool
db_selection_print(struct client *client, const DatabaseSelection &selection, db_selection_print(Client *client, const DatabaseSelection &selection,
bool full, GError **error_r); bool full, GError **error_r);
gcc_nonnull(1,2) gcc_nonnull(1,2)
bool bool
printAllIn(struct client *client, const char *uri_utf8, GError **error_r); printAllIn(Client *client, const char *uri_utf8, GError **error_r);
gcc_nonnull(1,2) gcc_nonnull(1,2)
bool bool
printInfoForAllIn(struct client *client, const char *uri_utf8, printInfoForAllIn(Client *client, const char *uri_utf8,
GError **error_r); GError **error_r);
gcc_nonnull(1,2) gcc_nonnull(1,2)
bool bool
searchStatsForSongsIn(struct client *client, const char *name, searchStatsForSongsIn(Client *client, const char *name,
const SongFilter *filter, const SongFilter *filter,
GError **error_r); GError **error_r);
gcc_nonnull(1) gcc_nonnull(1)
bool bool
listAllUniqueTags(struct client *client, int type, listAllUniqueTags(Client *client, int type,
const SongFilter *filter, const SongFilter *filter,
GError **error_r); GError **error_r);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <assert.h> #include <assert.h>
static void static void
decoder_plugin_print(struct client *client, decoder_plugin_print(Client *client,
const struct decoder_plugin *plugin) const struct decoder_plugin *plugin)
{ {
const char *const*p; const char *const*p;
...@@ -46,7 +46,7 @@ decoder_plugin_print(struct client *client, ...@@ -46,7 +46,7 @@ decoder_plugin_print(struct client *client,
} }
void void
decoder_list_print(struct client *client) decoder_list_print(Client *client)
{ {
decoder_plugins_for_each_enabled(plugin) decoder_plugins_for_each_enabled(plugin)
decoder_plugin_print(client, plugin); decoder_plugin_print(client, plugin);
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#ifndef MPD_DECODER_PRINT_HXX #ifndef MPD_DECODER_PRINT_HXX
#define MPD_DECODER_PRINT_HXX #define MPD_DECODER_PRINT_HXX
struct client; class Client;
void void
decoder_list_print(struct client *client); decoder_list_print(Client *client);
#endif #endif
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <assert.h> #include <assert.h>
enum command_return enum command_return
handle_subscribe(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_subscribe(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
assert(argc == 2); assert(argc == 2);
...@@ -59,7 +59,7 @@ handle_subscribe(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -59,7 +59,7 @@ handle_subscribe(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_unsubscribe(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_unsubscribe(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
assert(argc == 2); assert(argc == 2);
...@@ -81,7 +81,7 @@ collect_channels(gpointer data, gpointer user_data) ...@@ -81,7 +81,7 @@ collect_channels(gpointer data, gpointer user_data)
{ {
struct channels_context *context = struct channels_context *context =
(struct channels_context *)user_data; (struct channels_context *)user_data;
const struct client *client = (const struct client *)data; const Client *client = (const Client *)data;
for (GSList *i = client->subscriptions; i != NULL; for (GSList *i = client->subscriptions; i != NULL;
i = g_slist_next(i)) { i = g_slist_next(i)) {
...@@ -92,7 +92,7 @@ collect_channels(gpointer data, gpointer user_data) ...@@ -92,7 +92,7 @@ collect_channels(gpointer data, gpointer user_data)
} }
enum command_return enum command_return
handle_channels(struct client *client, handle_channels(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
assert(argc == 1); assert(argc == 1);
...@@ -108,7 +108,7 @@ handle_channels(struct client *client, ...@@ -108,7 +108,7 @@ handle_channels(struct client *client,
} }
enum command_return enum command_return
handle_read_messages(struct client *client, handle_read_messages(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
assert(argc == 1); assert(argc == 1);
...@@ -139,14 +139,14 @@ send_message(gpointer data, gpointer user_data) ...@@ -139,14 +139,14 @@ send_message(gpointer data, gpointer user_data)
{ {
struct send_message_context *context = struct send_message_context *context =
(struct send_message_context *)user_data; (struct send_message_context *)user_data;
struct client *client = (struct client *)data; Client *client = (Client *)data;
if (client_push_message(client, &context->msg)) if (client_push_message(client, &context->msg))
context->sent = true; context->sent = true;
} }
enum command_return enum command_return
handle_send_message(struct client *client, handle_send_message(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
assert(argc == 3); assert(argc == 3);
......
...@@ -22,19 +22,21 @@ ...@@ -22,19 +22,21 @@
#include "command.h" #include "command.h"
class Client;
enum command_return enum command_return
handle_subscribe(struct client *client, int argc, char *argv[]); handle_subscribe(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_unsubscribe(struct client *client, int argc, char *argv[]); handle_unsubscribe(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_channels(struct client *client, int argc, char *argv[]); handle_channels(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_read_messages(struct client *client, int argc, char *argv[]); handle_read_messages(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_send_message(struct client *client, int argc, char *argv[]); handle_send_message(Client *client, int argc, char *argv[]);
#endif #endif
...@@ -57,7 +57,7 @@ extern "C" { ...@@ -57,7 +57,7 @@ extern "C" {
#include <string.h> #include <string.h>
static void static void
print_spl_list(struct client *client, const PlaylistFileList &list) print_spl_list(Client *client, const PlaylistFileList &list)
{ {
for (const auto &i : list) { for (const auto &i : list) {
client_printf(client, "playlist: %s\n", i.name.c_str()); client_printf(client, "playlist: %s\n", i.name.c_str());
...@@ -68,7 +68,7 @@ print_spl_list(struct client *client, const PlaylistFileList &list) ...@@ -68,7 +68,7 @@ print_spl_list(struct client *client, const PlaylistFileList &list)
} }
enum command_return enum command_return
handle_urlhandlers(struct client *client, handle_urlhandlers(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
if (client_is_local(client)) if (client_is_local(client))
...@@ -78,7 +78,7 @@ handle_urlhandlers(struct client *client, ...@@ -78,7 +78,7 @@ handle_urlhandlers(struct client *client,
} }
enum command_return enum command_return
handle_decoders(struct client *client, handle_decoders(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
decoder_list_print(client); decoder_list_print(client);
...@@ -86,7 +86,7 @@ handle_decoders(struct client *client, ...@@ -86,7 +86,7 @@ handle_decoders(struct client *client,
} }
enum command_return enum command_return
handle_tagtypes(struct client *client, handle_tagtypes(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
tag_print_types(client); tag_print_types(client);
...@@ -94,21 +94,21 @@ handle_tagtypes(struct client *client, ...@@ -94,21 +94,21 @@ handle_tagtypes(struct client *client,
} }
enum command_return enum command_return
handle_kill(G_GNUC_UNUSED struct client *client, handle_kill(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
return COMMAND_RETURN_KILL; return COMMAND_RETURN_KILL;
} }
enum command_return enum command_return
handle_close(G_GNUC_UNUSED struct client *client, handle_close(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
return COMMAND_RETURN_CLOSE; return COMMAND_RETURN_CLOSE;
} }
enum command_return enum command_return
handle_lsinfo(struct client *client, int argc, char *argv[]) handle_lsinfo(Client *client, int argc, char *argv[])
{ {
const char *uri; const char *uri;
...@@ -151,7 +151,7 @@ handle_lsinfo(struct client *client, int argc, char *argv[]) ...@@ -151,7 +151,7 @@ handle_lsinfo(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_update(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_update(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
const char *path = NULL; const char *path = NULL;
unsigned ret; unsigned ret;
...@@ -182,7 +182,7 @@ handle_update(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -182,7 +182,7 @@ handle_update(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_rescan(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_rescan(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
const char *path = NULL; const char *path = NULL;
unsigned ret; unsigned ret;
...@@ -210,7 +210,7 @@ handle_rescan(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -210,7 +210,7 @@ handle_rescan(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_setvol(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_setvol(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned level; unsigned level;
bool success; bool success;
...@@ -234,7 +234,7 @@ handle_setvol(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -234,7 +234,7 @@ handle_setvol(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_stats(struct client *client, handle_stats(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
stats_print(client); stats_print(client);
...@@ -242,14 +242,14 @@ handle_stats(struct client *client, ...@@ -242,14 +242,14 @@ handle_stats(struct client *client,
} }
enum command_return enum command_return
handle_ping(G_GNUC_UNUSED struct client *client, handle_ping(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
} }
enum command_return enum command_return
handle_password(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_password(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned permission = 0; unsigned permission = 0;
...@@ -264,7 +264,7 @@ handle_password(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -264,7 +264,7 @@ handle_password(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_config(struct client *client, handle_config(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
if (!client_is_local(client)) { if (!client_is_local(client)) {
...@@ -281,7 +281,7 @@ handle_config(struct client *client, ...@@ -281,7 +281,7 @@ handle_config(struct client *client,
} }
enum command_return enum command_return
handle_idle(struct client *client, handle_idle(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
unsigned flags = 0, j; unsigned flags = 0, j;
......
...@@ -22,46 +22,48 @@ ...@@ -22,46 +22,48 @@
#include "command.h" #include "command.h"
class Client;
enum command_return enum command_return
handle_urlhandlers(struct client *client, int argc, char *argv[]); handle_urlhandlers(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_decoders(struct client *client, int argc, char *argv[]); handle_decoders(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_tagtypes(struct client *client, int argc, char *argv[]); handle_tagtypes(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_kill(struct client *client, int argc, char *argv[]); handle_kill(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_close(struct client *client, int argc, char *argv[]); handle_close(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_lsinfo(struct client *client, int argc, char *argv[]); handle_lsinfo(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_update(struct client *client, int argc, char *argv[]); handle_update(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_rescan(struct client *client, int argc, char *argv[]); handle_rescan(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_setvol(struct client *client, int argc, char *argv[]); handle_setvol(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_stats(struct client *client, int argc, char *argv[]); handle_stats(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_ping(struct client *client, int argc, char *argv[]); handle_ping(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_password(struct client *client, int argc, char *argv[]); handle_password(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_config(struct client *client, int argc, char *argv[]); handle_config(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_idle(struct client *client, int argc, char *argv[]); handle_idle(Client *client, int argc, char *argv[]);
#endif #endif
...@@ -30,7 +30,7 @@ extern "C" { ...@@ -30,7 +30,7 @@ extern "C" {
#include <string.h> #include <string.h>
enum command_return enum command_return
handle_enableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_enableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned device; unsigned device;
bool ret; bool ret;
...@@ -49,7 +49,7 @@ handle_enableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -49,7 +49,7 @@ handle_enableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_disableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_disableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned device; unsigned device;
bool ret; bool ret;
...@@ -68,7 +68,7 @@ handle_disableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[] ...@@ -68,7 +68,7 @@ handle_disableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[]
} }
enum command_return enum command_return
handle_devices(struct client *client, handle_devices(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
printAudioDevices(client); printAudioDevices(client);
......
...@@ -22,13 +22,15 @@ ...@@ -22,13 +22,15 @@
#include "command.h" #include "command.h"
class Client;
enum command_return enum command_return
handle_enableoutput(struct client *client, int argc, char *argv[]); handle_enableoutput(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_disableoutput(struct client *client, int argc, char *argv[]); handle_disableoutput(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_devices(struct client *client, int argc, char *argv[]); handle_devices(Client *client, int argc, char *argv[]);
#endif #endif
...@@ -32,7 +32,7 @@ extern "C" { ...@@ -32,7 +32,7 @@ extern "C" {
} }
void void
printAudioDevices(struct client *client) printAudioDevices(Client *client)
{ {
const unsigned n = audio_output_count(); const unsigned n = audio_output_count();
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
#ifndef MPD_OUTPUT_PRINT_HXX #ifndef MPD_OUTPUT_PRINT_HXX
#define MPD_OUTPUT_PRINT_HXX #define MPD_OUTPUT_PRINT_HXX
struct client; class Client;
void void
printAudioDevices(struct client *client); printAudioDevices(Client *client);
#endif #endif
...@@ -56,7 +56,7 @@ extern "C" { ...@@ -56,7 +56,7 @@ extern "C" {
#define COMMAND_STATUS_UPDATING_DB "updating_db" #define COMMAND_STATUS_UPDATING_DB "updating_db"
enum command_return enum command_return
handle_play(struct client *client, int argc, char *argv[]) handle_play(Client *client, int argc, char *argv[])
{ {
int song = -1; int song = -1;
enum playlist_result result; enum playlist_result result;
...@@ -68,7 +68,7 @@ handle_play(struct client *client, int argc, char *argv[]) ...@@ -68,7 +68,7 @@ handle_play(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_playid(struct client *client, int argc, char *argv[]) handle_playid(Client *client, int argc, char *argv[])
{ {
int id = -1; int id = -1;
enum playlist_result result; enum playlist_result result;
...@@ -81,7 +81,7 @@ handle_playid(struct client *client, int argc, char *argv[]) ...@@ -81,7 +81,7 @@ handle_playid(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_stop(G_GNUC_UNUSED struct client *client, handle_stop(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
playlist_stop(&g_playlist, client->player_control); playlist_stop(&g_playlist, client->player_control);
...@@ -89,7 +89,7 @@ handle_stop(G_GNUC_UNUSED struct client *client, ...@@ -89,7 +89,7 @@ handle_stop(G_GNUC_UNUSED struct client *client,
} }
enum command_return enum command_return
handle_currentsong(struct client *client, handle_currentsong(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
playlist_print_current(client, &g_playlist); playlist_print_current(client, &g_playlist);
...@@ -97,7 +97,7 @@ handle_currentsong(struct client *client, ...@@ -97,7 +97,7 @@ handle_currentsong(struct client *client,
} }
enum command_return enum command_return
handle_pause(struct client *client, handle_pause(Client *client,
int argc, char *argv[]) int argc, char *argv[])
{ {
if (argc == 2) { if (argc == 2) {
...@@ -113,7 +113,7 @@ handle_pause(struct client *client, ...@@ -113,7 +113,7 @@ handle_pause(struct client *client,
} }
enum command_return enum command_return
handle_status(struct client *client, handle_status(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
const char *state = NULL; const char *state = NULL;
...@@ -210,7 +210,7 @@ handle_status(struct client *client, ...@@ -210,7 +210,7 @@ handle_status(struct client *client,
} }
enum command_return enum command_return
handle_next(G_GNUC_UNUSED struct client *client, handle_next(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
/* single mode is not considered when this is user who /* single mode is not considered when this is user who
...@@ -225,7 +225,7 @@ handle_next(G_GNUC_UNUSED struct client *client, ...@@ -225,7 +225,7 @@ handle_next(G_GNUC_UNUSED struct client *client,
} }
enum command_return enum command_return
handle_previous(G_GNUC_UNUSED struct client *client, handle_previous(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
playlist_previous(&g_playlist, client->player_control); playlist_previous(&g_playlist, client->player_control);
...@@ -233,7 +233,7 @@ handle_previous(G_GNUC_UNUSED struct client *client, ...@@ -233,7 +233,7 @@ handle_previous(G_GNUC_UNUSED struct client *client,
} }
enum command_return enum command_return
handle_repeat(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_repeat(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
bool status; bool status;
if (!check_bool(client, &status, argv[1])) if (!check_bool(client, &status, argv[1]))
...@@ -244,7 +244,7 @@ handle_repeat(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -244,7 +244,7 @@ handle_repeat(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_single(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_single(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
bool status; bool status;
if (!check_bool(client, &status, argv[1])) if (!check_bool(client, &status, argv[1]))
...@@ -255,7 +255,7 @@ handle_single(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -255,7 +255,7 @@ handle_single(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_consume(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_consume(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
bool status; bool status;
if (!check_bool(client, &status, argv[1])) if (!check_bool(client, &status, argv[1]))
...@@ -266,7 +266,7 @@ handle_consume(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -266,7 +266,7 @@ handle_consume(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_random(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_random(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
bool status; bool status;
if (!check_bool(client, &status, argv[1])) if (!check_bool(client, &status, argv[1]))
...@@ -277,7 +277,7 @@ handle_random(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -277,7 +277,7 @@ handle_random(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_clearerror(G_GNUC_UNUSED struct client *client, handle_clearerror(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
pc_clear_error(client->player_control); pc_clear_error(client->player_control);
...@@ -285,7 +285,7 @@ handle_clearerror(G_GNUC_UNUSED struct client *client, ...@@ -285,7 +285,7 @@ handle_clearerror(G_GNUC_UNUSED struct client *client,
} }
enum command_return enum command_return
handle_seek(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_seek(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned song, seek_time; unsigned song, seek_time;
enum playlist_result result; enum playlist_result result;
...@@ -301,7 +301,7 @@ handle_seek(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -301,7 +301,7 @@ handle_seek(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_seekid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned id, seek_time; unsigned id, seek_time;
enum playlist_result result; enum playlist_result result;
...@@ -317,7 +317,7 @@ handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -317,7 +317,7 @@ handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_seekcur(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_seekcur(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
const char *p = argv[1]; const char *p = argv[1];
bool relative = *p == '+' || *p == '-'; bool relative = *p == '+' || *p == '-';
...@@ -332,7 +332,7 @@ handle_seekcur(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -332,7 +332,7 @@ handle_seekcur(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_crossfade(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_crossfade(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned xfade_time; unsigned xfade_time;
...@@ -344,7 +344,7 @@ handle_crossfade(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -344,7 +344,7 @@ handle_crossfade(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_mixrampdb(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_mixrampdb(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
float db; float db;
...@@ -356,7 +356,7 @@ handle_mixrampdb(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -356,7 +356,7 @@ handle_mixrampdb(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_mixrampdelay(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_mixrampdelay(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
float delay_secs; float delay_secs;
...@@ -368,7 +368,7 @@ handle_mixrampdelay(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -368,7 +368,7 @@ handle_mixrampdelay(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_replay_gain_mode(struct client *client, handle_replay_gain_mode(Client *client,
G_GNUC_UNUSED int argc, char *argv[]) G_GNUC_UNUSED int argc, char *argv[])
{ {
if (!replay_gain_set_mode_string(argv[1])) { if (!replay_gain_set_mode_string(argv[1])) {
...@@ -381,7 +381,7 @@ handle_replay_gain_mode(struct client *client, ...@@ -381,7 +381,7 @@ handle_replay_gain_mode(struct client *client,
} }
enum command_return enum command_return
handle_replay_gain_status(struct client *client, handle_replay_gain_status(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
client_printf(client, "replay_gain_mode: %s\n", client_printf(client, "replay_gain_mode: %s\n",
......
...@@ -22,67 +22,69 @@ ...@@ -22,67 +22,69 @@
#include "command.h" #include "command.h"
class Client;
enum command_return enum command_return
handle_play(struct client *client, int argc, char *argv[]); handle_play(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playid(struct client *client, int argc, char *argv[]); handle_playid(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_stop(struct client *client, int argc, char *argv[]); handle_stop(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_currentsong(struct client *client, int argc, char *argv[]); handle_currentsong(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_pause(struct client *client, int argc, char *argv[]); handle_pause(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_status(struct client *client, int argc, char *argv[]); handle_status(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_next(struct client *client, int argc, char *argv[]); handle_next(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_previous(struct client *client, int argc, char *avg[]); handle_previous(Client *client, int argc, char *avg[]);
enum command_return enum command_return
handle_repeat(struct client *client, int argc, char *argv[]); handle_repeat(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_single(struct client *client, int argc, char *argv[]); handle_single(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_consume(struct client *client, int argc, char *argv[]); handle_consume(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_random(struct client *client, int argc, char *argv[]); handle_random(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_clearerror(struct client *client, int argc, char *argv[]); handle_clearerror(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_seek(struct client *client, int argc, char *argv[]); handle_seek(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_seekid(struct client *client, int argc, char *argv[]); handle_seekid(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_seekcur(struct client *client, int argc, char *argv[]); handle_seekcur(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_crossfade(struct client *client, int argc, char *argv[]); handle_crossfade(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_mixrampdb(struct client *client, int argc, char *argv[]); handle_mixrampdb(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_mixrampdelay(struct client *client, int argc, char *argv[]); handle_mixrampdelay(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_replay_gain_mode(struct client *client, int argc, char *argv[]); handle_replay_gain_mode(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_replay_gain_status(struct client *client, int argc, char *argv[]); handle_replay_gain_status(Client *client, int argc, char *argv[]);
#endif #endif
...@@ -40,7 +40,7 @@ extern "C" { ...@@ -40,7 +40,7 @@ extern "C" {
#include <stdlib.h> #include <stdlib.h>
static void static void
print_spl_list(struct client *client, const PlaylistFileList &list) print_spl_list(Client *client, const PlaylistFileList &list)
{ {
for (const auto &i : list) { for (const auto &i : list) {
client_printf(client, "playlist: %s\n", i.name.c_str()); client_printf(client, "playlist: %s\n", i.name.c_str());
...@@ -51,7 +51,7 @@ print_spl_list(struct client *client, const PlaylistFileList &list) ...@@ -51,7 +51,7 @@ print_spl_list(struct client *client, const PlaylistFileList &list)
} }
enum command_return enum command_return
handle_save(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_save(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
enum playlist_result result; enum playlist_result result;
...@@ -60,7 +60,7 @@ handle_save(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -60,7 +60,7 @@ handle_save(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_load(struct client *client, int argc, char *argv[]) handle_load(Client *client, int argc, char *argv[])
{ {
unsigned start_index, end_index; unsigned start_index, end_index;
...@@ -97,7 +97,7 @@ handle_load(struct client *client, int argc, char *argv[]) ...@@ -97,7 +97,7 @@ handle_load(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_listplaylist(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_listplaylist(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
if (playlist_file_print(client, argv[1], false)) if (playlist_file_print(client, argv[1], false))
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
...@@ -109,7 +109,7 @@ handle_listplaylist(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -109,7 +109,7 @@ handle_listplaylist(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_listplaylistinfo(struct client *client, handle_listplaylistinfo(Client *client,
G_GNUC_UNUSED int argc, char *argv[]) G_GNUC_UNUSED int argc, char *argv[])
{ {
if (playlist_file_print(client, argv[1], true)) if (playlist_file_print(client, argv[1], true))
...@@ -122,7 +122,7 @@ handle_listplaylistinfo(struct client *client, ...@@ -122,7 +122,7 @@ handle_listplaylistinfo(struct client *client,
} }
enum command_return enum command_return
handle_rm(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_rm(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
return spl_delete(argv[1], &error) return spl_delete(argv[1], &error)
...@@ -131,7 +131,7 @@ handle_rm(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -131,7 +131,7 @@ handle_rm(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_rename(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_rename(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
return spl_rename(argv[1], argv[2], &error) return spl_rename(argv[1], argv[2], &error)
...@@ -140,7 +140,7 @@ handle_rename(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -140,7 +140,7 @@ handle_rename(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_playlistdelete(struct client *client, handle_playlistdelete(Client *client,
G_GNUC_UNUSED int argc, char *argv[]) { G_GNUC_UNUSED int argc, char *argv[]) {
char *playlist = argv[1]; char *playlist = argv[1];
unsigned from; unsigned from;
...@@ -155,7 +155,7 @@ handle_playlistdelete(struct client *client, ...@@ -155,7 +155,7 @@ handle_playlistdelete(struct client *client,
} }
enum command_return enum command_return
handle_playlistmove(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_playlistmove(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
char *playlist = argv[1]; char *playlist = argv[1];
unsigned from, to; unsigned from, to;
...@@ -172,7 +172,7 @@ handle_playlistmove(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -172,7 +172,7 @@ handle_playlistmove(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_playlistclear(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_playlistclear(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
return spl_clear(argv[1], &error) return spl_clear(argv[1], &error)
...@@ -181,7 +181,7 @@ handle_playlistclear(struct client *client, G_GNUC_UNUSED int argc, char *argv[] ...@@ -181,7 +181,7 @@ handle_playlistclear(struct client *client, G_GNUC_UNUSED int argc, char *argv[]
} }
enum command_return enum command_return
handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_playlistadd(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
char *playlist = argv[1]; char *playlist = argv[1];
char *uri = argv[2]; char *uri = argv[2];
...@@ -210,7 +210,7 @@ handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -210,7 +210,7 @@ handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_listplaylists(struct client *client, handle_listplaylists(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
......
...@@ -22,37 +22,39 @@ ...@@ -22,37 +22,39 @@
#include "command.h" #include "command.h"
class Client;
enum command_return enum command_return
handle_save(struct client *client, int argc, char *argv[]); handle_save(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_load(struct client *client, int argc, char *argv[]); handle_load(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_listplaylist(struct client *client, int argc, char *argv[]); handle_listplaylist(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_listplaylistinfo(struct client *client, int argc, char *argv[]); handle_listplaylistinfo(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_rm(struct client *client, int argc, char *argv[]); handle_rm(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_rename(struct client *client, int argc, char *argv[]); handle_rename(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlistdelete(struct client *client, int argc, char *argv[]); handle_playlistdelete(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlistmove(struct client *client, int argc, char *argv[]); handle_playlistmove(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlistclear(struct client *client, int argc, char *argv[]); handle_playlistclear(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlistadd(struct client *client, int argc, char *argv[]); handle_playlistadd(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_listplaylists(struct client *client, int argc, char *argv[]); handle_listplaylists(Client *client, int argc, char *argv[]);
#endif #endif
...@@ -37,7 +37,7 @@ extern "C" { ...@@ -37,7 +37,7 @@ extern "C" {
} }
void void
playlist_print_uris(struct client *client, const struct playlist *playlist) playlist_print_uris(Client *client, const struct playlist *playlist)
{ {
const struct queue *queue = &playlist->queue; const struct queue *queue = &playlist->queue;
...@@ -45,7 +45,7 @@ playlist_print_uris(struct client *client, const struct playlist *playlist) ...@@ -45,7 +45,7 @@ playlist_print_uris(struct client *client, const struct playlist *playlist)
} }
bool bool
playlist_print_info(struct client *client, const struct playlist *playlist, playlist_print_info(Client *client, const struct playlist *playlist,
unsigned start, unsigned end) unsigned start, unsigned end)
{ {
const struct queue *queue = &playlist->queue; const struct queue *queue = &playlist->queue;
...@@ -63,7 +63,7 @@ playlist_print_info(struct client *client, const struct playlist *playlist, ...@@ -63,7 +63,7 @@ playlist_print_info(struct client *client, const struct playlist *playlist,
} }
bool bool
playlist_print_id(struct client *client, const struct playlist *playlist, playlist_print_id(Client *client, const struct playlist *playlist,
unsigned id) unsigned id)
{ {
const struct queue *queue = &playlist->queue; const struct queue *queue = &playlist->queue;
...@@ -78,7 +78,7 @@ playlist_print_id(struct client *client, const struct playlist *playlist, ...@@ -78,7 +78,7 @@ playlist_print_id(struct client *client, const struct playlist *playlist,
} }
bool bool
playlist_print_current(struct client *client, const struct playlist *playlist) playlist_print_current(Client *client, const struct playlist *playlist)
{ {
int current_position = playlist_get_current_song(playlist); int current_position = playlist_get_current_song(playlist);
...@@ -91,14 +91,14 @@ playlist_print_current(struct client *client, const struct playlist *playlist) ...@@ -91,14 +91,14 @@ playlist_print_current(struct client *client, const struct playlist *playlist)
} }
void void
playlist_print_find(struct client *client, const struct playlist *playlist, playlist_print_find(Client *client, const struct playlist *playlist,
const SongFilter &filter) const SongFilter &filter)
{ {
queue_find(client, &playlist->queue, filter); queue_find(client, &playlist->queue, filter);
} }
void void
playlist_print_changes_info(struct client *client, playlist_print_changes_info(Client *client,
const struct playlist *playlist, const struct playlist *playlist,
uint32_t version) uint32_t version)
{ {
...@@ -106,7 +106,7 @@ playlist_print_changes_info(struct client *client, ...@@ -106,7 +106,7 @@ playlist_print_changes_info(struct client *client,
} }
void void
playlist_print_changes_position(struct client *client, playlist_print_changes_position(Client *client,
const struct playlist *playlist, const struct playlist *playlist,
uint32_t version) uint32_t version)
{ {
...@@ -114,7 +114,7 @@ playlist_print_changes_position(struct client *client, ...@@ -114,7 +114,7 @@ playlist_print_changes_position(struct client *client,
} }
static bool static bool
PrintSongDetails(struct client *client, const char *uri_utf8) PrintSongDetails(Client *client, const char *uri_utf8)
{ {
const Database *db = GetDatabase(nullptr); const Database *db = GetDatabase(nullptr);
if (db == nullptr) if (db == nullptr)
...@@ -130,7 +130,7 @@ PrintSongDetails(struct client *client, const char *uri_utf8) ...@@ -130,7 +130,7 @@ PrintSongDetails(struct client *client, const char *uri_utf8)
} }
bool bool
spl_print(struct client *client, const char *name_utf8, bool detail, spl_print(Client *client, const char *name_utf8, bool detail,
GError **error_r) GError **error_r)
{ {
GError *error = NULL; GError *error = NULL;
...@@ -150,7 +150,7 @@ spl_print(struct client *client, const char *name_utf8, bool detail, ...@@ -150,7 +150,7 @@ spl_print(struct client *client, const char *name_utf8, bool detail,
} }
static void static void
playlist_provider_print(struct client *client, const char *uri, playlist_provider_print(Client *client, const char *uri,
struct playlist_provider *playlist, bool detail) struct playlist_provider *playlist, bool detail)
{ {
struct song *song; struct song *song;
...@@ -173,7 +173,7 @@ playlist_provider_print(struct client *client, const char *uri, ...@@ -173,7 +173,7 @@ playlist_provider_print(struct client *client, const char *uri,
} }
bool bool
playlist_file_print(struct client *client, const char *uri, bool detail) playlist_file_print(Client *client, const char *uri, bool detail)
{ {
GMutex *mutex = g_mutex_new(); GMutex *mutex = g_mutex_new();
GCond *cond = g_cond_new(); GCond *cond = g_cond_new();
......
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
#include <glib.h> #include <glib.h>
#include <stdint.h> #include <stdint.h>
struct client;
struct playlist; struct playlist;
class SongFilter; class SongFilter;
class Client;
/** /**
* Sends the whole playlist to the client, song URIs only. * Sends the whole playlist to the client, song URIs only.
*/ */
void void
playlist_print_uris(struct client *client, const struct playlist *playlist); playlist_print_uris(Client *client, const struct playlist *playlist);
/** /**
* Sends a range of the playlist to the client, including all known * Sends a range of the playlist to the client, including all known
...@@ -40,7 +40,7 @@ playlist_print_uris(struct client *client, const struct playlist *playlist); ...@@ -40,7 +40,7 @@ playlist_print_uris(struct client *client, const struct playlist *playlist);
* This function however fails when the start offset is invalid. * This function however fails when the start offset is invalid.
*/ */
bool bool
playlist_print_info(struct client *client, const struct playlist *playlist, playlist_print_info(Client *client, const struct playlist *playlist,
unsigned start, unsigned end); unsigned start, unsigned end);
/** /**
...@@ -49,7 +49,7 @@ playlist_print_info(struct client *client, const struct playlist *playlist, ...@@ -49,7 +49,7 @@ playlist_print_info(struct client *client, const struct playlist *playlist,
* @return true on suite, false if there is no such song * @return true on suite, false if there is no such song
*/ */
bool bool
playlist_print_id(struct client *client, const struct playlist *playlist, playlist_print_id(Client *client, const struct playlist *playlist,
unsigned id); unsigned id);
/** /**
...@@ -58,20 +58,20 @@ playlist_print_id(struct client *client, const struct playlist *playlist, ...@@ -58,20 +58,20 @@ playlist_print_id(struct client *client, const struct playlist *playlist,
* @return true on success, false if there is no current song * @return true on success, false if there is no current song
*/ */
bool bool
playlist_print_current(struct client *client, const struct playlist *playlist); playlist_print_current(Client *client, const struct playlist *playlist);
/** /**
* Find songs in the playlist. * Find songs in the playlist.
*/ */
void void
playlist_print_find(struct client *client, const struct playlist *playlist, playlist_print_find(Client *client, const struct playlist *playlist,
const SongFilter &filter); const SongFilter &filter);
/** /**
* Print detailed changes since the specified playlist version. * Print detailed changes since the specified playlist version.
*/ */
void void
playlist_print_changes_info(struct client *client, playlist_print_changes_info(Client *client,
const struct playlist *playlist, const struct playlist *playlist,
uint32_t version); uint32_t version);
...@@ -79,7 +79,7 @@ playlist_print_changes_info(struct client *client, ...@@ -79,7 +79,7 @@ playlist_print_changes_info(struct client *client,
* Print changes since the specified playlist version, position only. * Print changes since the specified playlist version, position only.
*/ */
void void
playlist_print_changes_position(struct client *client, playlist_print_changes_position(Client *client,
const struct playlist *playlist, const struct playlist *playlist,
uint32_t version); uint32_t version);
...@@ -92,7 +92,7 @@ playlist_print_changes_position(struct client *client, ...@@ -92,7 +92,7 @@ playlist_print_changes_position(struct client *client,
* @return true on success, false if the playlist does not exist * @return true on success, false if the playlist does not exist
*/ */
bool bool
spl_print(struct client *client, const char *name_utf8, bool detail, spl_print(Client *client, const char *name_utf8, bool detail,
GError **error_r); GError **error_r);
/** /**
...@@ -104,6 +104,6 @@ spl_print(struct client *client, const char *name_utf8, bool detail, ...@@ -104,6 +104,6 @@ spl_print(struct client *client, const char *name_utf8, bool detail,
* @return true on success, false if the playlist does not exist * @return true on success, false if the playlist does not exist
*/ */
bool bool
playlist_file_print(struct client *client, const char *uri, bool detail); playlist_file_print(Client *client, const char *uri, bool detail);
#endif #endif
...@@ -37,7 +37,7 @@ extern "C" { ...@@ -37,7 +37,7 @@ extern "C" {
#include <string.h> #include <string.h>
enum command_return enum command_return
handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
char *uri = argv[1]; char *uri = argv[1];
enum playlist_result result; enum playlist_result result;
...@@ -76,7 +76,7 @@ handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -76,7 +76,7 @@ handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_addid(struct client *client, int argc, char *argv[]) handle_addid(Client *client, int argc, char *argv[])
{ {
char *uri = argv[1]; char *uri = argv[1];
unsigned added_id; unsigned added_id;
...@@ -128,7 +128,7 @@ handle_addid(struct client *client, int argc, char *argv[]) ...@@ -128,7 +128,7 @@ handle_addid(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_delete(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_delete(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned start, end; unsigned start, end;
enum playlist_result result; enum playlist_result result;
...@@ -142,7 +142,7 @@ handle_delete(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -142,7 +142,7 @@ handle_delete(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_deleteid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_deleteid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned id; unsigned id;
enum playlist_result result; enum playlist_result result;
...@@ -155,7 +155,7 @@ handle_deleteid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -155,7 +155,7 @@ handle_deleteid(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_playlist(struct client *client, handle_playlist(Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
playlist_print_uris(client, &g_playlist); playlist_print_uris(client, &g_playlist);
...@@ -163,7 +163,7 @@ handle_playlist(struct client *client, ...@@ -163,7 +163,7 @@ handle_playlist(struct client *client,
} }
enum command_return enum command_return
handle_shuffle(G_GNUC_UNUSED struct client *client, handle_shuffle(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
unsigned start = 0, end = queue_length(&g_playlist.queue); unsigned start = 0, end = queue_length(&g_playlist.queue);
...@@ -175,7 +175,7 @@ handle_shuffle(G_GNUC_UNUSED struct client *client, ...@@ -175,7 +175,7 @@ handle_shuffle(G_GNUC_UNUSED struct client *client,
} }
enum command_return enum command_return
handle_clear(G_GNUC_UNUSED struct client *client, handle_clear(G_GNUC_UNUSED Client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
playlist_clear(&g_playlist, client->player_control); playlist_clear(&g_playlist, client->player_control);
...@@ -183,7 +183,7 @@ handle_clear(G_GNUC_UNUSED struct client *client, ...@@ -183,7 +183,7 @@ handle_clear(G_GNUC_UNUSED struct client *client,
} }
enum command_return enum command_return
handle_plchanges(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_plchanges(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
uint32_t version; uint32_t version;
...@@ -195,7 +195,7 @@ handle_plchanges(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -195,7 +195,7 @@ handle_plchanges(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_plchangesposid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_plchangesposid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
uint32_t version; uint32_t version;
...@@ -207,7 +207,7 @@ handle_plchangesposid(struct client *client, G_GNUC_UNUSED int argc, char *argv[ ...@@ -207,7 +207,7 @@ handle_plchangesposid(struct client *client, G_GNUC_UNUSED int argc, char *argv[
} }
enum command_return enum command_return
handle_playlistinfo(struct client *client, int argc, char *argv[]) handle_playlistinfo(Client *client, int argc, char *argv[])
{ {
unsigned start = 0, end = G_MAXUINT; unsigned start = 0, end = G_MAXUINT;
bool ret; bool ret;
...@@ -224,7 +224,7 @@ handle_playlistinfo(struct client *client, int argc, char *argv[]) ...@@ -224,7 +224,7 @@ handle_playlistinfo(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_playlistid(struct client *client, int argc, char *argv[]) handle_playlistid(Client *client, int argc, char *argv[])
{ {
if (argc >= 2) { if (argc >= 2) {
unsigned id; unsigned id;
...@@ -243,7 +243,7 @@ handle_playlistid(struct client *client, int argc, char *argv[]) ...@@ -243,7 +243,7 @@ handle_playlistid(struct client *client, int argc, char *argv[])
} }
static enum command_return static enum command_return
handle_playlist_match(struct client *client, int argc, char *argv[], handle_playlist_match(Client *client, int argc, char *argv[],
bool fold_case) bool fold_case)
{ {
SongFilter filter; SongFilter filter;
...@@ -257,19 +257,19 @@ handle_playlist_match(struct client *client, int argc, char *argv[], ...@@ -257,19 +257,19 @@ handle_playlist_match(struct client *client, int argc, char *argv[],
} }
enum command_return enum command_return
handle_playlistfind(struct client *client, int argc, char *argv[]) handle_playlistfind(Client *client, int argc, char *argv[])
{ {
return handle_playlist_match(client, argc, argv, false); return handle_playlist_match(client, argc, argv, false);
} }
enum command_return enum command_return
handle_playlistsearch(struct client *client, int argc, char *argv[]) handle_playlistsearch(Client *client, int argc, char *argv[])
{ {
return handle_playlist_match(client, argc, argv, true); return handle_playlist_match(client, argc, argv, true);
} }
enum command_return enum command_return
handle_prio(struct client *client, int argc, char *argv[]) handle_prio(Client *client, int argc, char *argv[])
{ {
unsigned priority; unsigned priority;
...@@ -301,7 +301,7 @@ handle_prio(struct client *client, int argc, char *argv[]) ...@@ -301,7 +301,7 @@ handle_prio(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_prioid(struct client *client, int argc, char *argv[]) handle_prioid(Client *client, int argc, char *argv[])
{ {
unsigned priority; unsigned priority;
...@@ -331,7 +331,7 @@ handle_prioid(struct client *client, int argc, char *argv[]) ...@@ -331,7 +331,7 @@ handle_prioid(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_move(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_move(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned start, end; unsigned start, end;
int to; int to;
...@@ -347,7 +347,7 @@ handle_move(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -347,7 +347,7 @@ handle_move(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_moveid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_moveid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned id; unsigned id;
int to; int to;
...@@ -363,7 +363,7 @@ handle_moveid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -363,7 +363,7 @@ handle_moveid(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_swap(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_swap(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned song1, song2; unsigned song1, song2;
enum playlist_result result; enum playlist_result result;
...@@ -378,7 +378,7 @@ handle_swap(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) ...@@ -378,7 +378,7 @@ handle_swap(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
} }
enum command_return enum command_return
handle_swapid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) handle_swapid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{ {
unsigned id1, id2; unsigned id1, id2;
enum playlist_result result; enum playlist_result result;
......
...@@ -22,61 +22,63 @@ ...@@ -22,61 +22,63 @@
#include "command.h" #include "command.h"
class Client;
enum command_return enum command_return
handle_add(struct client *client, int argc, char *argv[]); handle_add(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_addid(struct client *client, int argc, char *argv[]); handle_addid(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_delete(struct client *client, int argc, char *argv[]); handle_delete(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_deleteid(struct client *client, int argc, char *argv[]); handle_deleteid(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlist(struct client *client, int argc, char *argv[]); handle_playlist(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_shuffle(struct client *client, int argc, char *argv[]); handle_shuffle(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_clear(struct client *client, int argc, char *argv[]); handle_clear(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_plchanges(struct client *client, int argc, char *argv[]); handle_plchanges(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_plchangesposid(struct client *client, int argc, char *argv[]); handle_plchangesposid(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlistinfo(struct client *client, int argc, char *argv[]); handle_playlistinfo(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlistid(struct client *client, int argc, char *argv[]); handle_playlistid(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlistfind(struct client *client, int argc, char *argv[]); handle_playlistfind(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_playlistsearch(struct client *client, int argc, char *argv[]); handle_playlistsearch(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_prio(struct client *client, int argc, char *argv[]); handle_prio(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_prioid(struct client *client, int argc, char *argv[]); handle_prioid(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_move(struct client *client, int argc, char *argv[]); handle_move(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_moveid(struct client *client, int argc, char *argv[]); handle_moveid(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_swap(struct client *client, int argc, char *argv[]); handle_swap(Client *client, int argc, char *argv[]);
enum command_return enum command_return
handle_swapid(struct client *client, int argc, char *argv[]); handle_swapid(Client *client, int argc, char *argv[]);
#endif #endif
...@@ -38,7 +38,7 @@ extern "C" { ...@@ -38,7 +38,7 @@ extern "C" {
* @param end the index of the last song (excluding) * @param end the index of the last song (excluding)
*/ */
static void static void
queue_print_song_info(struct client *client, const struct queue *queue, queue_print_song_info(Client *client, const struct queue *queue,
unsigned position) unsigned position)
{ {
song_print_info(client, queue_get(queue, position)); song_print_info(client, queue_get(queue, position));
...@@ -51,7 +51,7 @@ queue_print_song_info(struct client *client, const struct queue *queue, ...@@ -51,7 +51,7 @@ queue_print_song_info(struct client *client, const struct queue *queue,
} }
void void
queue_print_info(struct client *client, const struct queue *queue, queue_print_info(Client *client, const struct queue *queue,
unsigned start, unsigned end) unsigned start, unsigned end)
{ {
assert(start <= end); assert(start <= end);
...@@ -62,7 +62,7 @@ queue_print_info(struct client *client, const struct queue *queue, ...@@ -62,7 +62,7 @@ queue_print_info(struct client *client, const struct queue *queue,
} }
void void
queue_print_uris(struct client *client, const struct queue *queue, queue_print_uris(Client *client, const struct queue *queue,
unsigned start, unsigned end) unsigned start, unsigned end)
{ {
assert(start <= end); assert(start <= end);
...@@ -75,7 +75,7 @@ queue_print_uris(struct client *client, const struct queue *queue, ...@@ -75,7 +75,7 @@ queue_print_uris(struct client *client, const struct queue *queue,
} }
void void
queue_print_changes_info(struct client *client, const struct queue *queue, queue_print_changes_info(Client *client, const struct queue *queue,
uint32_t version) uint32_t version)
{ {
for (unsigned i = 0; i < queue_length(queue); i++) { for (unsigned i = 0; i < queue_length(queue); i++) {
...@@ -85,7 +85,7 @@ queue_print_changes_info(struct client *client, const struct queue *queue, ...@@ -85,7 +85,7 @@ queue_print_changes_info(struct client *client, const struct queue *queue,
} }
void void
queue_print_changes_position(struct client *client, const struct queue *queue, queue_print_changes_position(Client *client, const struct queue *queue,
uint32_t version) uint32_t version)
{ {
for (unsigned i = 0; i < queue_length(queue); i++) for (unsigned i = 0; i < queue_length(queue); i++)
...@@ -95,7 +95,7 @@ queue_print_changes_position(struct client *client, const struct queue *queue, ...@@ -95,7 +95,7 @@ queue_print_changes_position(struct client *client, const struct queue *queue,
} }
void void
queue_find(struct client *client, const struct queue *queue, queue_find(Client *client, const struct queue *queue,
const SongFilter &filter) const SongFilter &filter)
{ {
for (unsigned i = 0; i < queue_length(queue); i++) { for (unsigned i = 0; i < queue_length(queue); i++) {
......
...@@ -27,28 +27,28 @@ ...@@ -27,28 +27,28 @@
#include <stdint.h> #include <stdint.h>
struct client;
struct queue; struct queue;
class SongFilter; class SongFilter;
class Client;
void void
queue_print_info(struct client *client, const struct queue *queue, queue_print_info(Client *client, const struct queue *queue,
unsigned start, unsigned end); unsigned start, unsigned end);
void void
queue_print_uris(struct client *client, const struct queue *queue, queue_print_uris(Client *client, const struct queue *queue,
unsigned start, unsigned end); unsigned start, unsigned end);
void void
queue_print_changes_info(struct client *client, const struct queue *queue, queue_print_changes_info(Client *client, const struct queue *queue,
uint32_t version); uint32_t version);
void void
queue_print_changes_position(struct client *client, const struct queue *queue, queue_print_changes_position(Client *client, const struct queue *queue,
uint32_t version); uint32_t version);
void void
queue_find(struct client *client, const struct queue *queue, queue_find(Client *client, const struct queue *queue,
const SongFilter &filter); const SongFilter &filter);
#endif #endif
...@@ -31,7 +31,7 @@ extern "C" { ...@@ -31,7 +31,7 @@ extern "C" {
} }
void void
song_print_uri(struct client *client, struct song *song) song_print_uri(Client *client, struct song *song)
{ {
if (song_in_database(song) && !song->parent->IsRoot()) { if (song_in_database(song) && !song->parent->IsRoot()) {
client_printf(client, "%s%s/%s\n", SONG_FILE, client_printf(client, "%s%s/%s\n", SONG_FILE,
...@@ -52,7 +52,7 @@ song_print_uri(struct client *client, struct song *song) ...@@ -52,7 +52,7 @@ song_print_uri(struct client *client, struct song *song)
} }
void void
song_print_info(struct client *client, struct song *song) song_print_info(Client *client, struct song *song)
{ {
song_print_uri(client, song); song_print_uri(client, song);
......
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
#ifndef MPD_SONG_PRINT_HXX #ifndef MPD_SONG_PRINT_HXX
#define MPD_SONG_PRINT_HXX #define MPD_SONG_PRINT_HXX
struct client;
struct song; struct song;
class Client;
void void
song_print_info(struct client *client, struct song *song); song_print_info(Client *client, struct song *song);
void void
song_print_uri(struct client *client, struct song *song); song_print_uri(Client *client, struct song *song);
#endif #endif
...@@ -66,7 +66,7 @@ void stats_update(void) ...@@ -66,7 +66,7 @@ void stats_update(void)
} }
void void
stats_print(struct client *client) stats_print(Client *client)
{ {
client_printf(client, client_printf(client,
"artists: %u\n" "artists: %u\n"
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <string.h> #include <string.h>
struct sticker_song_find_data { struct sticker_song_find_data {
struct client *client; Client *client;
const char *name; const char *name;
}; };
...@@ -49,7 +49,7 @@ sticker_song_find_print_cb(struct song *song, const char *value, ...@@ -49,7 +49,7 @@ sticker_song_find_print_cb(struct song *song, const char *value,
} }
static enum command_return static enum command_return
handle_sticker_song(struct client *client, int argc, char *argv[]) handle_sticker_song(Client *client, int argc, char *argv[])
{ {
GError *error = nullptr; GError *error = nullptr;
const Database *db = GetDatabase(&error); const Database *db = GetDatabase(&error);
...@@ -156,7 +156,7 @@ handle_sticker_song(struct client *client, int argc, char *argv[]) ...@@ -156,7 +156,7 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
} }
enum command_return enum command_return
handle_sticker(struct client *client, int argc, char *argv[]) handle_sticker(Client *client, int argc, char *argv[])
{ {
assert(argc >= 4); assert(argc >= 4);
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#include "command.h" #include "command.h"
class Client;
enum command_return enum command_return
handle_sticker(struct client *client, int argc, char *argv[]); handle_sticker(Client *client, int argc, char *argv[]);
#endif #endif
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "Client.hxx" #include "Client.hxx"
void void
sticker_print_value(struct client *client, sticker_print_value(Client *client,
const char *name, const char *value) const char *name, const char *value)
{ {
client_printf(client, "sticker: %s=%s\n", name, value); client_printf(client, "sticker: %s=%s\n", name, value);
...@@ -32,13 +32,13 @@ sticker_print_value(struct client *client, ...@@ -32,13 +32,13 @@ sticker_print_value(struct client *client,
static void static void
print_sticker_cb(const char *name, const char *value, void *data) print_sticker_cb(const char *name, const char *value, void *data)
{ {
struct client *client = (struct client *)data; Client *client = (Client *)data;
sticker_print_value(client, name, value); sticker_print_value(client, name, value);
} }
void void
sticker_print(struct client *client, const struct sticker *sticker) sticker_print(Client *client, const struct sticker *sticker)
{ {
sticker_foreach(sticker, print_sticker_cb, client); sticker_foreach(sticker, print_sticker_cb, client);
} }
...@@ -21,19 +21,18 @@ ...@@ -21,19 +21,18 @@
#define MPD_STICKER_PRINT_HXX #define MPD_STICKER_PRINT_HXX
struct sticker; struct sticker;
struct client; class Client;
/** /**
* Sends one sticker value to the client. * Sends one sticker value to the client.
*/ */
void void
sticker_print_value(struct client *client, sticker_print_value(Client *client, const char *name, const char *value);
const char *name, const char *value);
/** /**
* Sends all sticker values to the client. * Sends all sticker values to the client.
*/ */
void void
sticker_print(struct client *client, const struct sticker *sticker); sticker_print(Client *client, const struct sticker *sticker);
#endif #endif
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "song.h" #include "song.h"
#include "Client.hxx" #include "Client.hxx"
void tag_print_types(struct client *client) void tag_print_types(Client *client)
{ {
int i; int i;
...@@ -35,7 +35,7 @@ void tag_print_types(struct client *client) ...@@ -35,7 +35,7 @@ void tag_print_types(struct client *client)
} }
} }
void tag_print(struct client *client, const struct tag *tag) void tag_print(Client *client, const struct tag *tag)
{ {
if (tag->time >= 0) if (tag->time >= 0)
client_printf(client, SONG_TIME "%i\n", tag->time); client_printf(client, SONG_TIME "%i\n", tag->time);
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
#define MPD_TAG_PRINT_HXX #define MPD_TAG_PRINT_HXX
struct tag; struct tag;
struct client; class Client;
void tag_print_types(struct client *client); void tag_print_types(Client *client);
void tag_print(struct client *client, const struct tag *tag); void tag_print(Client *client, const struct tag *tag);
#endif #endif
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <glib.h> #include <glib.h>
void void
time_print(struct client *client, const char *name, time_t t) time_print(Client *client, const char *name, time_t t)
{ {
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
const struct tm *tm2 = gmtime(&t); const struct tm *tm2 = gmtime(&t);
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
#include <time.h> #include <time.h>
struct client; class Client;
/** /**
* Write a line with a time stamp to the client. * Write a line with a time stamp to the client.
*/ */
void void
time_print(struct client *client, const char *name, time_t t); time_print(Client *client, const char *name, time_t t);
#endif #endif
...@@ -78,7 +78,7 @@ void print_supported_uri_schemes_to_fp(FILE *fp) ...@@ -78,7 +78,7 @@ void print_supported_uri_schemes_to_fp(FILE *fp)
fprintf(fp,"\n"); fprintf(fp,"\n");
} }
void print_supported_uri_schemes(struct client *client) void print_supported_uri_schemes(Client *client)
{ {
const char **prefixes = remoteUrlPrefixes; const char **prefixes = remoteUrlPrefixes;
......
...@@ -20,10 +20,9 @@ ...@@ -20,10 +20,9 @@
#ifndef MPD_LS_HXX #ifndef MPD_LS_HXX
#define MPD_LS_HXX #define MPD_LS_HXX
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
struct client; class Client;
/** /**
* Checks whether the scheme of the specified URI is supported by MPD. * Checks whether the scheme of the specified URI is supported by MPD.
...@@ -36,7 +35,7 @@ bool uri_supported_scheme(const char *url); ...@@ -36,7 +35,7 @@ bool uri_supported_scheme(const char *url);
* Send a list of supported URI schemes to the client. This is the * Send a list of supported URI schemes to the client. This is the
* response to the "urlhandlers" command. * response to the "urlhandlers" command.
*/ */
void print_supported_uri_schemes(struct client *client); void print_supported_uri_schemes(Client *client);
/** /**
* Send a list of supported URI schemes to a file pointer. * Send a list of supported URI schemes to a file pointer.
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
bool bool
check_uint32(struct client *client, uint32_t *dst, const char *s) check_uint32(Client *client, uint32_t *dst, const char *s)
{ {
char *test; char *test;
...@@ -39,7 +39,7 @@ check_uint32(struct client *client, uint32_t *dst, const char *s) ...@@ -39,7 +39,7 @@ check_uint32(struct client *client, uint32_t *dst, const char *s)
} }
bool bool
check_int(struct client *client, int *value_r, const char *s) check_int(Client *client, int *value_r, const char *s)
{ {
char *test; char *test;
long value; long value;
...@@ -64,7 +64,7 @@ check_int(struct client *client, int *value_r, const char *s) ...@@ -64,7 +64,7 @@ check_int(struct client *client, int *value_r, const char *s)
} }
bool bool
check_range(struct client *client, unsigned *value_r1, unsigned *value_r2, check_range(Client *client, unsigned *value_r1, unsigned *value_r2,
const char *s) const char *s)
{ {
char *test, *test2; char *test, *test2;
...@@ -134,7 +134,7 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2, ...@@ -134,7 +134,7 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
} }
bool bool
check_unsigned(struct client *client, unsigned *value_r, const char *s) check_unsigned(Client *client, unsigned *value_r, const char *s)
{ {
unsigned long value; unsigned long value;
char *endptr; char *endptr;
...@@ -157,7 +157,7 @@ check_unsigned(struct client *client, unsigned *value_r, const char *s) ...@@ -157,7 +157,7 @@ check_unsigned(struct client *client, unsigned *value_r, const char *s)
} }
bool bool
check_bool(struct client *client, bool *value_r, const char *s) check_bool(Client *client, bool *value_r, const char *s)
{ {
long value; long value;
char *endptr; char *endptr;
...@@ -174,7 +174,7 @@ check_bool(struct client *client, bool *value_r, const char *s) ...@@ -174,7 +174,7 @@ check_bool(struct client *client, bool *value_r, const char *s)
} }
bool bool
check_float(struct client *client, float *value_r, const char *s) check_float(Client *client, float *value_r, const char *s)
{ {
float value; float value;
char *endptr; char *endptr;
......
...@@ -25,25 +25,25 @@ ...@@ -25,25 +25,25 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
struct client; class Client;
bool bool
check_uint32(struct client *client, uint32_t *dst, const char *s); check_uint32(Client *client, uint32_t *dst, const char *s);
bool bool
check_int(struct client *client, int *value_r, const char *s); check_int(Client *client, int *value_r, const char *s);
bool bool
check_range(struct client *client, unsigned *value_r1, unsigned *value_r2, check_range(Client *client, unsigned *value_r1, unsigned *value_r2,
const char *s); const char *s);
bool bool
check_unsigned(struct client *client, unsigned *value_r, const char *s); check_unsigned(Client *client, unsigned *value_r, const char *s);
bool bool
check_bool(struct client *client, bool *value_r, const char *s); check_bool(Client *client, bool *value_r, const char *s);
bool bool
check_float(struct client *client, float *value_r, const char *s); check_float(Client *client, float *value_r, const char *s);
#endif #endif
...@@ -27,13 +27,13 @@ const char *current_command; ...@@ -27,13 +27,13 @@ const char *current_command;
int command_list_num; int command_list_num;
void void
command_success(struct client *client) command_success(Client *client)
{ {
client_puts(client, "OK\n"); client_puts(client, "OK\n");
} }
void void
command_error_v(struct client *client, enum ack error, command_error_v(Client *client, enum ack error,
const char *fmt, va_list args) const char *fmt, va_list args)
{ {
assert(client != NULL); assert(client != NULL);
...@@ -48,7 +48,7 @@ command_error_v(struct client *client, enum ack error, ...@@ -48,7 +48,7 @@ command_error_v(struct client *client, enum ack error,
} }
void void
command_error(struct client *client, enum ack error, const char *fmt, ...) command_error(Client *client, enum ack error, const char *fmt, ...)
{ {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
......
...@@ -24,20 +24,20 @@ ...@@ -24,20 +24,20 @@
#include "gcc.h" #include "gcc.h"
#include "ack.h" #include "ack.h"
struct client; class Client;
extern const char *current_command; extern const char *current_command;
extern int command_list_num; extern int command_list_num;
void void
command_success(struct client *client); command_success(Client *client);
void void
command_error_v(struct client *client, enum ack error, command_error_v(Client *client, enum ack error,
const char *fmt, va_list args); const char *fmt, va_list args);
gcc_fprintf_ gcc_fprintf_
void void
command_error(struct client *client, enum ack error, const char *fmt, ...); command_error(Client *client, enum ack error, const char *fmt, ...);
#endif #endif
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <glib.h> #include <glib.h>
struct client; class Client;
struct stats { struct stats {
GTimer *timer; GTimer *timer;
...@@ -50,6 +50,6 @@ void stats_global_finish(void); ...@@ -50,6 +50,6 @@ void stats_global_finish(void);
void stats_update(void); void stats_update(void);
void void
stats_print(struct client *client); stats_print(Client *client);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment