* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/** @file lib/client-stubs.c
+ * @brief Generated client API implementation
+ */
int disorder_adopt(disorder_client *c, const char *id) {
- return disorder_simple(c, 0, "adopt", id, (char *)0);
+ return disorder_simple(c, NULL, "adopt", id, (char *)NULL);
}
int disorder_adduser(disorder_client *c, const char *user, const char *password, const char *rights) {
- return disorder_simple(c, 0, "adduser", user, password, rights, (char *)0);
+ return disorder_simple(c, NULL, "adduser", user, password, rights, (char *)NULL);
}
int disorder_allfiles(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp) {
- return disorder_simple_list(c, filesp, nfilesp, "allfiles", dir, re, (char *)0);
+ int rc = disorder_simple(c, NULL, "allfiles", dir, re, (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, filesp, nfilesp))
+ return -1;
+ return 0;
}
int disorder_confirm(disorder_client *c, const char *confirmation) {
- char *u;
- int rc;
- if((rc = disorder_simple(c, &u, "confirm", confirmation )))
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "confirm", confirmation, (char *)NULL);
+ if(rc)
return rc;
- c->user = u;
+ c->user = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
int disorder_cookie(disorder_client *c, const char *cookie) {
- char *u;
- int rc;
- if((rc = disorder_simple(c, &u, "cookie", cookie )))
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "cookie", cookie, (char *)NULL);
+ if(rc)
return rc;
- c->user = u;
+ c->user = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
return 0;
}
int disorder_deluser(disorder_client *c, const char *user) {
- return disorder_simple(c, 0, "deluser", user, (char *)0);
+ return disorder_simple(c, NULL, "deluser", user, (char *)NULL);
}
int disorder_dirs(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp) {
- return disorder_simple_list(c, filesp, nfilesp, "dirs", dir, re, (char *)0);
+ int rc = disorder_simple(c, NULL, "dirs", dir, re, (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, filesp, nfilesp))
+ return -1;
+ return 0;
}
int disorder_disable(disorder_client *c) {
- return disorder_simple(c, 0, "disable", (char *)0);
+ return disorder_simple(c, NULL, "disable", (char *)NULL);
}
int disorder_edituser(disorder_client *c, const char *username, const char *property, const char *value) {
- return disorder_simple(c, 0, "edituser", username, property, value, (char *)0);
+ return disorder_simple(c, NULL, "edituser", username, property, value, (char *)NULL);
}
int disorder_enable(disorder_client *c) {
- return disorder_simple(c, 0, "enable", (char *)0);
+ return disorder_simple(c, NULL, "enable", (char *)NULL);
}
int disorder_enabled(disorder_client *c, int *enabledp) {
- char *v;
- int rc;
- if((rc = disorder_simple(c, &v, "enabled", (char *)0)))
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "enabled", (char *)NULL);
+ if(rc)
return rc;
- return boolean("enabled", v, enabledp);
+ if(boolean("enabled", v[0], enabledp))
+ return -1;
+ free_strings(nv, v);
+ return 0;
}
int disorder_exists(disorder_client *c, const char *track, int *existsp) {
- char *v;
- int rc;
- if((rc = disorder_simple(c, &v, "exists", track, (char *)0)))
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "exists", track, (char *)NULL);
+ if(rc)
return rc;
- return boolean("exists", v, existsp);
+ if(boolean("exists", v[0], existsp))
+ return -1;
+ free_strings(nv, v);
+ return 0;
}
int disorder_files(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp) {
- return disorder_simple_list(c, filesp, nfilesp, "files", dir, re, (char *)0);
+ int rc = disorder_simple(c, NULL, "files", dir, re, (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, filesp, nfilesp))
+ return -1;
+ return 0;
}
int disorder_get(disorder_client *c, const char *track, const char *pref, char **valuep) {
- return dequote(disorder_simple(c, valuep, "get", track, pref, (char *)0), valuep);
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "get", track, pref, (char *)NULL);
+ if(rc)
+ return rc;
+ *valuep = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
+ return 0;
}
int disorder_get_global(disorder_client *c, const char *pref, char **valuep) {
- return dequote(disorder_simple(c, valuep, "get-global", pref, (char *)0), valuep);
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "get-global", pref, (char *)NULL);
+ if(rc)
+ return rc;
+ *valuep = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
+ return 0;
}
int disorder_length(disorder_client *c, const char *track, long *lengthp) {
- char *v;
- int rc;
-
- if((rc = disorder_simple(c, &v, "length", track, (char *)0)))
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "length", track, (char *)NULL);
+ if(rc)
return rc;
- *lengthp = atol(v);
- xfree(v);
+ *lengthp = atol(v[0]);
+ free_strings(nv, v);
return 0;
}
int disorder_make_cookie(disorder_client *c, char **cookiep) {
- return dequote(disorder_simple(c, cookiep, "make-cookie", (char *)0), cookiep);
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "make-cookie", (char *)NULL);
+ if(rc)
+ return rc;
+ *cookiep = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
+ return 0;
}
int disorder_move(disorder_client *c, const char *track, long delta) {
- char buf_delta[16];
- byte_snprintf(buf_delta, sizeof buf_delta, "%ld", delta);
- return disorder_simple(c, 0, "move", track, buf_delta, (char *)0);
+ return disorder_simple(c, NULL, "move", track, disorder__integer, delta, (char *)NULL);
}
int disorder_moveafter(disorder_client *c, const char *target, char **ids, int nids) {
- return disorder_simple(c, 0, "moveafter", target, disorder_list, ids, nids, (char *)0);
+ return disorder_simple(c, NULL, "moveafter", target, disorder__list, ids, nids, (char *)NULL);
}
int disorder_new_tracks(disorder_client *c, long max, char ***tracksp, int *ntracksp) {
- char buf_max[16];
- byte_snprintf(buf_max, sizeof buf_max, "%ld", max);
- return disorder_simple_list(c, tracksp, ntracksp, "new", buf_max, (char *)0);
+ int rc = disorder_simple(c, NULL, "new", disorder__integer, max, (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, tracksp, ntracksp))
+ return -1;
+ return 0;
}
int disorder_nop(disorder_client *c) {
- return disorder_simple(c, 0, "nop", (char *)0);
+ return disorder_simple(c, NULL, "nop", (char *)NULL);
}
int disorder_part(disorder_client *c, const char *track, const char *context, const char *part, char **partp) {
- return dequote(disorder_simple(c, partp, "part", track, context, part, (char *)0), partp);
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "part", track, context, part, (char *)NULL);
+ if(rc)
+ return rc;
+ *partp = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
+ return 0;
}
int disorder_pause(disorder_client *c) {
- return disorder_simple(c, 0, "pause", (char *)0);
+ return disorder_simple(c, NULL, "pause", (char *)NULL);
}
int disorder_play(disorder_client *c, const char *track, char **idp) {
- return dequote(disorder_simple(c, idp, "play", track, (char *)0), idp);
+ return disorder_simple(c, idp, "play", track, (char *)NULL);
}
int disorder_playafter(disorder_client *c, const char *target, char **tracks, int ntracks) {
- return disorder_simple(c, 0, "playafter", target, disorder_list, tracks, ntracks, (char *)0);
+ return disorder_simple(c, NULL, "playafter", target, disorder__list, tracks, ntracks, (char *)NULL);
}
int disorder_playing(disorder_client *c, struct queue_entry **playingp) {
}
int disorder_playlist_delete(disorder_client *c, const char *playlist) {
- return disorder_simple(c, 0, "playlist-delete", playlist, (char *)0);
+ return disorder_simple(c, NULL, "playlist-delete", playlist, (char *)NULL);
}
int disorder_playlist_get(disorder_client *c, const char *playlist, char ***tracksp, int *ntracksp) {
- return disorder_simple_list(c, tracksp, ntracksp, "playlist-get", playlist, (char *)0);
+ int rc = disorder_simple(c, NULL, "playlist-get", playlist, (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, tracksp, ntracksp))
+ return -1;
+ return 0;
}
int disorder_playlist_get_share(disorder_client *c, const char *playlist, char **sharep) {
- return dequote(disorder_simple(c, sharep, "playlist-get-share", playlist, (char *)0), sharep);
+ return disorder_simple(c, sharep, "playlist-get-share", playlist, (char *)NULL);
}
int disorder_playlist_lock(disorder_client *c, const char *playlist) {
- return disorder_simple(c, 0, "playlist-lock", playlist, (char *)0);
+ return disorder_simple(c, NULL, "playlist-lock", playlist, (char *)NULL);
}
int disorder_playlist_set(disorder_client *c, const char *playlist, char **tracks, int ntracks) {
- return disorder_simple(c, 0, "playlist-set", playlist, disorder_body, tracks, ntracks, (char *)0);
+ return disorder_simple(c, NULL, "playlist-set", playlist, disorder__body, tracks, ntracks, (char *)NULL);
}
int disorder_playlist_set_share(disorder_client *c, const char *playlist, const char *share) {
- return disorder_simple(c, 0, "playlist-set-share", playlist, share, (char *)0);
+ return disorder_simple(c, NULL, "playlist-set-share", playlist, share, (char *)NULL);
}
int disorder_playlist_unlock(disorder_client *c) {
- return disorder_simple(c, 0, "playlist-unlock", (char *)0);
+ return disorder_simple(c, NULL, "playlist-unlock", (char *)NULL);
}
int disorder_playlists(disorder_client *c, char ***playlistsp, int *nplaylistsp) {
- return disorder_simple_list(c, playlistsp, nplaylistsp, "playlists", (char *)0);
+ int rc = disorder_simple(c, NULL, "playlists", (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, playlistsp, nplaylistsp))
+ return -1;
+ return 0;
}
int disorder_prefs(disorder_client *c, const char *track, struct kvp **prefsp) {
- return pairlist(c, prefsp, "prefs", track, (char *)0);
+ return pairlist(c, prefsp, "prefs", track, (char *)NULL);
}
int disorder_queue(disorder_client *c, struct queue_entry **queuep) {
- return somequeue(c, "queue", queuep);
+ int rc = disorder_simple(c, NULL, "queue", (char *)NULL);
+ if(rc)
+ return rc;
+ if(readqueue(c, queuep))
+ return -1;
+ return 0;
}
int disorder_random_disable(disorder_client *c) {
- return disorder_simple(c, 0, "random-disable", (char *)0);
+ return disorder_simple(c, NULL, "random-disable", (char *)NULL);
}
int disorder_random_enable(disorder_client *c) {
- return disorder_simple(c, 0, "random-enable", (char *)0);
+ return disorder_simple(c, NULL, "random-enable", (char *)NULL);
}
int disorder_random_enabled(disorder_client *c, int *enabledp) {
- char *v;
- int rc;
- if((rc = disorder_simple(c, &v, "random-enabled", (char *)0)))
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "random-enabled", (char *)NULL);
+ if(rc)
return rc;
- return boolean("random-enabled", v, enabledp);
+ if(boolean("random-enabled", v[0], enabledp))
+ return -1;
+ free_strings(nv, v);
+ return 0;
}
int disorder_recent(disorder_client *c, struct queue_entry **recentp) {
- return somequeue(c, "recent", recentp);
+ int rc = disorder_simple(c, NULL, "recent", (char *)NULL);
+ if(rc)
+ return rc;
+ if(readqueue(c, recentp))
+ return -1;
+ return 0;
}
int disorder_reconfigure(disorder_client *c) {
- return disorder_simple(c, 0, "reconfigure", (char *)0);
+ return disorder_simple(c, NULL, "reconfigure", (char *)NULL);
}
int disorder_register(disorder_client *c, const char *username, const char *password, const char *email, char **confirmationp) {
- return dequote(disorder_simple(c, confirmationp, "register", username, password, email, (char *)0), confirmationp);
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "register", username, password, email, (char *)NULL);
+ if(rc)
+ return rc;
+ *confirmationp = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
+ return 0;
}
int disorder_reminder(disorder_client *c, const char *username) {
- return disorder_simple(c, 0, "reminder", username, (char *)0);
+ return disorder_simple(c, NULL, "reminder", username, (char *)NULL);
}
int disorder_remove(disorder_client *c, const char *id) {
- return disorder_simple(c, 0, "remove", id, (char *)0);
+ return disorder_simple(c, NULL, "remove", id, (char *)NULL);
}
int disorder_rescan(disorder_client *c) {
- return disorder_simple(c, 0, "rescan", (char *)0);
+ return disorder_simple(c, NULL, "rescan", (char *)NULL);
}
int disorder_resolve(disorder_client *c, const char *track, char **resolvedp) {
- return dequote(disorder_simple(c, resolvedp, "resolve", track, (char *)0), resolvedp);
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "resolve", track, (char *)NULL);
+ if(rc)
+ return rc;
+ *resolvedp = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
+ return 0;
}
int disorder_resume(disorder_client *c) {
- return disorder_simple(c, 0, "resume", (char *)0);
+ return disorder_simple(c, NULL, "resume", (char *)NULL);
}
int disorder_revoke(disorder_client *c) {
- return disorder_simple(c, 0, "revoke", (char *)0);
+ return disorder_simple(c, NULL, "revoke", (char *)NULL);
+}
+
+int disorder_rtp_address(disorder_client *c, char **addressp, char **portp) {
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 2, "rtp-address", (char *)NULL);
+ if(rc)
+ return rc;
+ *addressp = v[0];
+ v[0] = NULL;
+ *portp = v[1];
+ v[1] = NULL;
+ free_strings(nv, v);
+ return 0;
+}
+
+int disorder_rtp_cancel(disorder_client *c) {
+ return disorder_simple(c, NULL, "rtp-cancel", (char *)NULL);
+}
+
+int disorder_rtp_request(disorder_client *c, const char *address, const char *port) {
+ return disorder_simple(c, NULL, "rtp-request", address, port, (char *)NULL);
}
int disorder_scratch(disorder_client *c, const char *id) {
- return disorder_simple(c, 0, "scratch", id, (char *)0);
+ return disorder_simple(c, NULL, "scratch", id, (char *)NULL);
+}
+
+int disorder_schedule_add_play(disorder_client *c, time_t when, const char *priority, const char *track) {
+ return disorder_simple(c, NULL, "schedule-add", disorder__time, when, priority, "play", track, (char *)NULL);
+}
+
+int disorder_schedule_add_set_global(disorder_client *c, time_t when, const char *priority, const char *pref, const char *value) {
+ return disorder_simple(c, NULL, "schedule-add", disorder__time, when, priority, "set-global", pref, value, (char *)NULL);
+}
+
+int disorder_schedule_add_unset_global(disorder_client *c, time_t when, const char *priority, const char *pref) {
+ return disorder_simple(c, NULL, "schedule-add", disorder__time, when, priority, "set-global", pref, (char *)NULL);
}
int disorder_schedule_del(disorder_client *c, const char *event) {
- return disorder_simple(c, 0, "schedule-del", event, (char *)0);
+ return disorder_simple(c, NULL, "schedule-del", event, (char *)NULL);
}
int disorder_schedule_get(disorder_client *c, const char *id, struct kvp **actiondatap) {
- return pairlist(c, actiondatap, "schedule-get", id, (char *)0);
+ return pairlist(c, actiondatap, "schedule-get", id, (char *)NULL);
}
int disorder_schedule_list(disorder_client *c, char ***idsp, int *nidsp) {
- return disorder_simple_list(c, idsp, nidsp, "schedule-list", (char *)0);
+ int rc = disorder_simple(c, NULL, "schedule-list", (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, idsp, nidsp))
+ return -1;
+ return 0;
}
int disorder_search(disorder_client *c, const char *terms, char ***tracksp, int *ntracksp) {
- return disorder_simple_list(c, tracksp, ntracksp, "search", terms, (char *)0);
+ int rc = disorder_simple(c, NULL, "search", terms, (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, tracksp, ntracksp))
+ return -1;
+ return 0;
}
int disorder_set(disorder_client *c, const char *track, const char *pref, const char *value) {
- return disorder_simple(c, 0, "set", track, pref, value, (char *)0);
+ return disorder_simple(c, NULL, "set", track, pref, value, (char *)NULL);
}
int disorder_set_global(disorder_client *c, const char *pref, const char *value) {
- return disorder_simple(c, 0, "set-global", pref, value, (char *)0);
+ return disorder_simple(c, NULL, "set-global", pref, value, (char *)NULL);
}
int disorder_shutdown(disorder_client *c) {
- return disorder_simple(c, 0, "shutdown", (char *)0);
+ return disorder_simple(c, NULL, "shutdown", (char *)NULL);
}
int disorder_stats(disorder_client *c, char ***statsp, int *nstatsp) {
- return disorder_simple_list(c, statsp, nstatsp, "stats", (char *)0);
+ int rc = disorder_simple(c, NULL, "stats", (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, statsp, nstatsp))
+ return -1;
+ return 0;
}
int disorder_tags(disorder_client *c, char ***tagsp, int *ntagsp) {
- return disorder_simple_list(c, tagsp, ntagsp, "tags", (char *)0);
+ int rc = disorder_simple(c, NULL, "tags", (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, tagsp, ntagsp))
+ return -1;
+ return 0;
}
int disorder_unset(disorder_client *c, const char *track, const char *pref) {
- return disorder_simple(c, 0, "unset", track, pref, (char *)0);
+ return disorder_simple(c, NULL, "unset", track, pref, (char *)NULL);
}
int disorder_unset_global(disorder_client *c, const char *pref) {
- return disorder_simple(c, 0, "unset-global", pref, (char *)0);
+ return disorder_simple(c, NULL, "unset-global", pref, (char *)NULL);
}
int disorder_userinfo(disorder_client *c, const char *username, const char *property, char **valuep) {
- return dequote(disorder_simple(c, valuep, "userinfo", username, property, (char *)0), valuep);
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "userinfo", username, property, (char *)NULL);
+ if(rc)
+ return rc;
+ *valuep = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
+ return 0;
}
int disorder_users(disorder_client *c, char ***usersp, int *nusersp) {
- return disorder_simple_list(c, usersp, nusersp, "users", (char *)0);
+ int rc = disorder_simple(c, NULL, "users", (char *)NULL);
+ if(rc)
+ return rc;
+ if(readlist(c, usersp, nusersp))
+ return -1;
+ return 0;
}
int disorder_version(disorder_client *c, char **versionp) {
- return dequote(disorder_simple(c, versionp, "version", (char *)0), versionp);
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 1, "version", (char *)NULL);
+ if(rc)
+ return rc;
+ *versionp = v[0];
+ v[0] = NULL;
+ free_strings(nv, v);
+ return 0;
+}
+
+int disorder_set_volume(disorder_client *c, long left, long right) {
+ return disorder_simple(c, NULL, "volume", disorder__integer, left, disorder__integer, right, (char *)NULL);
+}
+
+int disorder_get_volume(disorder_client *c, long *leftp, long *rightp) {
+ char **v;
+ int nv, rc = disorder_simple_split(c, &v, &nv, 2, "volume", (char *)NULL);
+ if(rc)
+ return rc;
+ *leftp = atol(v[0]);
+ *rightp = atol(v[1]);
+ free_strings(nv, v);
+ return 0;
}