Permalink
Browse files

moved command list code to list.c

  • Loading branch information...
1 parent 7ab565a commit d01356421dd4188510005d609a57c0ce84c0eb39 @MaxKellermann MaxKellermann committed Jun 18, 2009
Showing with 125 additions and 50 deletions.
  1. +2 −0 Makefile.am
  2. +1 −7 include/mpd/client.h
  3. +44 −0 include/mpd/list.h
  4. +0 −43 src/libmpdclient.c
  5. +78 −0 src/list.c
View
@@ -11,6 +11,7 @@ mpdinclude_HEADERS = \
include/mpd/entity.h \
include/mpd/error.h \
include/mpd/idle.h \
+ include/mpd/list.h \
include/mpd/parser.h \
include/mpd/protocol.h \
include/mpd/response.h \
@@ -42,6 +43,7 @@ src_libmpdclient_la_SOURCES = \
src/pair.c \
src/entity.c \
src/idle.c \
+ src/list.c \
src/parser.c \
src/quote.c src/quote.h \
src/response.c \
@@ -37,6 +37,7 @@
#include <mpd/command.h>
#include <mpd/directory.h>
#include <mpd/entity.h>
+#include <mpd/list.h>
#include <mpd/output.h>
#include <mpd/pair.h>
#include <mpd/response.h>
@@ -61,13 +62,6 @@ extern "C" {
int mpd_sendAddIdCommand(struct mpd_connection *connection, const char *file);
-/* command list stuff, use this to do things like add files very quickly */
-void mpd_sendCommandListBegin(struct mpd_connection *connection);
-
-void mpd_sendCommandListOkBegin(struct mpd_connection *connection);
-
-void mpd_sendCommandListEnd(struct mpd_connection *connection);
-
#ifdef __cplusplus
}
#endif
View
@@ -0,0 +1,44 @@
+/* libmpdclient
+ (c) 2003-2009 The Music Player Daemon Project
+ This project's homepage is: http://www.musicpd.org
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Music Player Daemon nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef MPD_LIST_H
+#define MPD_LIST_H
+
+struct mpd_connection;
+
+void mpd_sendCommandListBegin(struct mpd_connection *connection);
+
+void mpd_sendCommandListOkBegin(struct mpd_connection *connection);
+
+void mpd_sendCommandListEnd(struct mpd_connection *connection);
+
+#endif
View
@@ -66,46 +66,3 @@ mpd_sendAddIdCommand(struct mpd_connection *connection, const char *file)
return retval;
}
-
-void mpd_sendCommandListBegin(struct mpd_connection *connection)
-{
- if (connection->sending_command_list) {
- mpd_error_code(&connection->error, MPD_ERROR_STATE);
- mpd_error_message(&connection->error,
- "already in command list mode");
- return;
- }
-
- connection->sending_command_list = true;
- connection->sending_command_list_ok = false;
- mpd_send_command(connection, "command_list_begin", NULL);
-}
-
-void mpd_sendCommandListOkBegin(struct mpd_connection *connection)
-{
- if (connection->sending_command_list) {
- mpd_error_code(&connection->error, MPD_ERROR_STATE);
- mpd_error_message(&connection->error,
- "already in command list mode");
- return;
- }
-
- connection->sending_command_list = true;
- connection->sending_command_list_ok = true;
- mpd_send_command(connection, "command_list_ok_begin", NULL);
- connection->listOks = 0;
-}
-
-void mpd_sendCommandListEnd(struct mpd_connection *connection)
-{
- if (!connection->sending_command_list) {
- mpd_error_code(&connection->error, MPD_ERROR_STATE);
- mpd_error_message(&connection->error,
- "not in command list mode");
- return;
- }
-
- connection->sending_command_list = false;
- mpd_send_command(connection, "command_list_end", NULL);
-}
-
View
@@ -0,0 +1,78 @@
+/* libmpdclient
+ (c) 2003-2009 The Music Player Daemon Project
+ This project's homepage is: http://www.musicpd.org
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Music Player Daemon nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <mpd/list.h>
+#include <mpd/send.h>
+#include "internal.h"
+
+void mpd_sendCommandListBegin(struct mpd_connection *connection)
+{
+ if (connection->sending_command_list) {
+ mpd_error_code(&connection->error, MPD_ERROR_STATE);
+ mpd_error_message(&connection->error,
+ "already in command list mode");
+ return;
+ }
+
+ connection->sending_command_list = true;
+ connection->sending_command_list_ok = false;
+ mpd_send_command(connection, "command_list_begin", NULL);
+}
+
+void mpd_sendCommandListOkBegin(struct mpd_connection *connection)
+{
+ if (connection->sending_command_list) {
+ mpd_error_code(&connection->error, MPD_ERROR_STATE);
+ mpd_error_message(&connection->error,
+ "already in command list mode");
+ return;
+ }
+
+ connection->sending_command_list = true;
+ connection->sending_command_list_ok = true;
+ mpd_send_command(connection, "command_list_ok_begin", NULL);
+ connection->listOks = 0;
+}
+
+void mpd_sendCommandListEnd(struct mpd_connection *connection)
+{
+ if (!connection->sending_command_list) {
+ mpd_error_code(&connection->error, MPD_ERROR_STATE);
+ mpd_error_message(&connection->error,
+ "not in command list mode");
+ return;
+ }
+
+ connection->sending_command_list = false;
+ mpd_send_command(connection, "command_list_end", NULL);
+}
+

0 comments on commit d013564

Please sign in to comment.