chiark / gitweb /
doc/disorder-gstdecode.8.in: Typeset option dashes correctly.
[disorder] / lib / eclient.h
index 6578a759892a08df9e14dea6f7e0047d0c93a13a..876e2c6d3af17c774f8d37f7f5928834fc49a1bb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder.
- * Copyright (C) 2006, 2007 Richard Kettlewell
+ * Copyright (C) 2006-2008 Richard Kettlewell
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
  */
 /** @file lib/eclient.h
  * @brief Client code for event-driven programs
+ *
+ * See @ref lib/eclient-stubs.h for the (generated) per-command entry points.
  */
 
 #ifndef ECLIENT_H
@@ -165,6 +167,21 @@ typedef struct disorder_eclient_log_callbacks {
 
   /** @brief Called when your rights change */
   void (*rights_changed)(void *v, rights_type new_rights);
+
+  /** @brief Called when a track is adopted */
+  void (*adopted)(void *v, const char *id, const char *who);
+
+  /** @brief Called when a new playlist is created */
+  void (*playlist_created)(void *v, const char *playlist, const char *sharing);
+
+  /** @brief Called when a playlist is modified */
+  void (*playlist_modified)(void *v, const char *playlist, const char *sharing);
+
+  /** @brief Called when a new playlist is deleted */
+  void (*playlist_deleted)(void *v, const char *playlist);
+
+  /** @brief Called when a global pref is changed or delete */
+  void (*global_pref)(void *v, const char *pref, const char *value/*or NULL*/);
 } disorder_eclient_log_callbacks;
 
 /* State bits */
@@ -219,7 +236,8 @@ typedef void disorder_eclient_no_response(void *v,
  *
  * @p error will be NULL on success.  In this case @p value will be the result
  * (which might be NULL for disorder_eclient_get(),
- * disorder_eclient_get_global() and disorder_eclient_userinfo()).
+ * disorder_eclient_get_global(), disorder_eclient_userinfo() and
+ * disorder_eclient_playlist_get_share()).
  *
  * @p error will be non-NULL on failure.  In this case @p value is always NULL.
  */
@@ -227,7 +245,7 @@ typedef void disorder_eclient_string_response(void *v,
                                               const char *err,
                                               const char *value);
 
-/** @brief String result completion callback
+/** @brief Integer result completion callback
  * @param v User data
  * @param err Error string or NULL on succes
  * @param value Result or 0
@@ -251,9 +269,9 @@ typedef void disorder_eclient_integer_response(void *v,
  * @p error will be non-NULL on failure.  In this case @p l and @p r are always
  * 0.
  */
-typedef void disorder_eclient_volume_response(void *v,
-                                              const char *err,
-                                              int l, int r);
+typedef void disorder_eclient_pair_integer_response(void *v,
+                                                    const char *err,
+                                                    long l, long r);
 
 /** @brief Queue request completion callback
  * @param v User data
@@ -271,6 +289,8 @@ typedef void disorder_eclient_queue_response(void *v,
                                              const char *err,
                                              struct queue_entry *q);
 
+#define disorder_eclient_playing_response disorder_eclient_queue_response
+
 /** @brief List request completion callback
  * @param v User data
  * @param err Error string or NULL on success
@@ -278,7 +298,8 @@ typedef void disorder_eclient_queue_response(void *v,
  * @param vec Pointer to response list
  *
  * @p error will be NULL on success.  In this case @p nvec and @p vec will give
- * the result.
+ * the result, or be -1 and NULL respectively e.g. from
+ * disorder_eclient_playlist_get() if there is no such playlist.
  *
  * @p error will be non-NULL on failure.  In this case @p nvec and @p vec will
  * be 0 and NULL.
@@ -300,190 +321,26 @@ void disorder_eclient_polled(disorder_eclient *c, unsigned mode);
 /* Should be called when c's FD is readable and/or writable, and in any case
  * from time to time (so that retries work). */
 
-int disorder_eclient_version(disorder_eclient *c,
-                             disorder_eclient_string_response *completed,
-                             void *v);
-/* fetch the server version */
-
-int disorder_eclient_play(disorder_eclient *c,
-                          const char *track,
-                          disorder_eclient_no_response *completed,
-                          void *v);
-/* add a track to the queue */
-
-int disorder_eclient_pause(disorder_eclient *c,
-                           disorder_eclient_no_response *completed,
-                           void *v);
-/* add a track to the queue */
-
-int disorder_eclient_resume(disorder_eclient *c,
-                            disorder_eclient_no_response *completed,
-                            void *v);
-/* add a track to the queue */
-
-int disorder_eclient_scratch(disorder_eclient *c,
-                             const char *id,
-                             disorder_eclient_no_response *completed,
-                             void *v);
-/* scratch a track by ID */
-
 int disorder_eclient_scratch_playing(disorder_eclient *c,
                                      disorder_eclient_no_response *completed,
                                      void *v);
 /* scratch the playing track whatever it is */
 
-int disorder_eclient_remove(disorder_eclient *c,
-                            const char *id,
-                            disorder_eclient_no_response *completed,
-                            void *v);
-/* remove a track from the queue */
-
-int disorder_eclient_moveafter(disorder_eclient *c,
-                               const char *target,
-                               int nids,
-                               const char **ids,
-                               disorder_eclient_no_response *completed,
-                               void *v);
-/* move tracks within the queue */
-
-int disorder_eclient_playing(disorder_eclient *c,
-                             disorder_eclient_queue_response *completed,
-                             void *v);
-/* find the currently playing track (0 for none) */
-
-int disorder_eclient_queue(disorder_eclient *c,
-                           disorder_eclient_queue_response *completed,
-                           void *v);
-/* list recently played tracks */
-
-int disorder_eclient_recent(disorder_eclient *c,
-                            disorder_eclient_queue_response *completed,
-                            void *v);
-/* list recently played tracks */
-
-int disorder_eclient_files(disorder_eclient *c,
-                           disorder_eclient_list_response *completed,
-                           const char *dir,
-                           const char *re,
-                           void *v);
-/* list files in a directory, matching RE if not a null pointer */
-
-int disorder_eclient_dirs(disorder_eclient *c,
-                          disorder_eclient_list_response *completed,
-                          const char *dir,
-                          const char *re,
-                          void *v);
-/* list directories in a directory, matching RE if not a null pointer */
-
-int disorder_eclient_namepart(disorder_eclient *c,
-                              disorder_eclient_string_response *completed,
-                              const char *track,
-                              const char *context,
-                              const char *part,
-                              void *v);
-/* look up a track name part */
-
-int disorder_eclient_length(disorder_eclient *c,
-                            disorder_eclient_integer_response *completed,
-                            const char *track,
-                            void *v);
-/* look up a track name length */
-
-int disorder_eclient_volume(disorder_eclient *c,
-                            disorder_eclient_volume_response *callback,
-                            int l, int r,
-                            void *v);
-/* If L and R are both -ve gets the volume.
- * If neither are -ve then sets the volume.
- * Otherwise asserts!
- */
-
-int disorder_eclient_enable(disorder_eclient *c,
-                            disorder_eclient_no_response *callback,
-                            void *v);
-int disorder_eclient_disable(disorder_eclient *c,
-                             disorder_eclient_no_response *callback,
-                             void *v);
-int disorder_eclient_random_enable(disorder_eclient *c,
-                                   disorder_eclient_no_response *callback,
-                                   void *v);
-int disorder_eclient_random_disable(disorder_eclient *c,
-                                    disorder_eclient_no_response *callback,
-                                    void *v);
-/* Enable/disable play/random play */
-
-int disorder_eclient_resolve(disorder_eclient *c,
-                             disorder_eclient_string_response *completed,
-                             const char *track,
-                             void *v);
-/* Resolve aliases */
-
 int disorder_eclient_log(disorder_eclient *c,
                          const disorder_eclient_log_callbacks *callbacks,
                          void *v);
 /* Make this a log client (forever - it automatically becomes one again upon
  * reconnection) */
 
-int disorder_eclient_get(disorder_eclient *c,
-                         disorder_eclient_string_response *completed,
-                         const char *track, const char *pref,
-                         void *v);
-int disorder_eclient_set(disorder_eclient *c,
-                         disorder_eclient_no_response *completed,
-                         const char *track, const char *pref, 
-                         const char *value,
-                         void *v);
-int disorder_eclient_unset(disorder_eclient *c,
-                           disorder_eclient_no_response *completed,
-                           const char *track, const char *pref, 
-                           void *v);
-/* Get/set preference values */
-
-int disorder_eclient_search(disorder_eclient *c,
-                            disorder_eclient_list_response *completed,
-                            const char *terms,
-                            void *v);
-
-int disorder_eclient_nop(disorder_eclient *c,
-                         disorder_eclient_no_response *completed,
-                         void *v);
-
-int disorder_eclient_new_tracks(disorder_eclient *c,
-                                disorder_eclient_list_response *completed,
-                                int max,
-                                void *v);
-
 int disorder_eclient_rtp_address(disorder_eclient *c,
                                  disorder_eclient_list_response *completed,
                                  void *v);
 
-int disorder_eclient_users(disorder_eclient *c,
-                           disorder_eclient_list_response *completed,
-                           void *v);
-int disorder_eclient_deluser(disorder_eclient *c,
-                             disorder_eclient_no_response *completed,
-                             const char *user,
-                             void *v);
-int disorder_eclient_userinfo(disorder_eclient *c,
-                              disorder_eclient_string_response *completed,
-                              const char *user,
-                              const char *property,
-                              void *v);
-int disorder_eclient_edituser(disorder_eclient *c,
-                              disorder_eclient_no_response *completed,
-                              const char *user,
-                              const char *property,
-                              const char *value,
-                              void *v);
-int disorder_eclient_adduser(disorder_eclient *c,
-                             disorder_eclient_no_response *completed,
-                             const char *user,
-                             const char *password,
-                             const char *rights,
-                             void *v);
 void disorder_eclient_enable_connect(disorder_eclient *c);
 void disorder_eclient_disable_connect(disorder_eclient *c);
-  
+
+#include "eclient-stubs.h"
+
 #endif
 
 /*