-/** @brief Look up a track name part
- * @param c Client
- * @param partp Where to store result (UTF-8)
- * @param track Track name (UTF-8)
- * @param context Context (usually "sort" or "display") (UTF-8)
- * @param part Track part (UTF-8)
- * @return 0 on success, non-0 on error
- */
-int disorder_part(disorder_client *c, char **partp,
- const char *track, const char *context, const char *part) {
- return dequote(disorder_simple(c, partp, "part",
- track, context, part, (char *)0), partp);
-}
-
-/** @brief Resolve aliases
- * @param c Client
- * @param trackp Where to store canonical name (UTF-8)
- * @param track Track name (UTF-8)
- * @return 0 on success, non-0 on error
- */
-int disorder_resolve(disorder_client *c, char **trackp, const char *track) {
- return dequote(disorder_simple(c, trackp, "resolve", track, (char *)0),
- trackp);
-}
-
-/** @brief Pause the current track
- * @param c Client
- * @return 0 on success, non-0 on error
- */
-int disorder_pause(disorder_client *c) {
- return disorder_simple(c, 0, "pause", (char *)0);
-}
-
-/** @brief Resume the current track
- * @param c Client
- * @return 0 on success, non-0 on error
- */
-int disorder_resume(disorder_client *c) {
- return disorder_simple(c, 0, "resume", (char *)0);
-}
-
-/** @brief List all known tags
- * @param c Client
- * @param vecp Where to store list (UTF-8)
- * @param nvecp Where to store number of items, or NULL
- * @return 0 on success, non-0 on error
- */
-int disorder_tags(disorder_client *c,
- char ***vecp, int *nvecp) {
- return disorder_simple_list(c, vecp, nvecp, "tags", (char *)0);
-}
-
-/** @brief List all known users
- * @param c Client
- * @param vecp Where to store list (UTF-8)
- * @param nvecp Where to store number of items, or NULL
- * @return 0 on success, non-0 on error
- */
-int disorder_users(disorder_client *c,
- char ***vecp, int *nvecp) {
- return disorder_simple_list(c, vecp, nvecp, "users", (char *)0);
-}
-
-/** @brief Get recently added tracks
- * @param c Client
- * @param vecp Where to store pointer to list (UTF-8)
- * @param nvecp Where to store count
- * @param max Maximum tracks to fetch, or 0 for all available
- * @return 0 on success, non-0 on error
- */
-int disorder_new_tracks(disorder_client *c,
- char ***vecp, int *nvecp,
- int max) {
- char limit[32];
-
- sprintf(limit, "%d", max);
- return disorder_simple_list(c, vecp, nvecp, "new", limit, (char *)0);
-}
-
-/** @brief Set a global preference
- * @param c Client
- * @param key Preference name (UTF-8)
- * @param value Preference value (UTF-8)
- * @return 0 on success, non-0 on error
- */
-int disorder_set_global(disorder_client *c,
- const char *key, const char *value) {
- return disorder_simple(c, 0, "set-global", key, value, (char *)0);
-}
-
-/** @brief Unset a global preference
- * @param c Client
- * @param key Preference name (UTF-8)
- * @return 0 on success, non-0 on error
- */
-int disorder_unset_global(disorder_client *c, const char *key) {
- return disorder_simple(c, 0, "unset-global", key, (char *)0);
-}
-
-/** @brief Get a global preference
- * @param c Client
- * @param key Preference name (UTF-8)
- * @param valuep Where to store preference value (UTF-8)
- * @return 0 on success, non-0 on error
- */
-int disorder_get_global(disorder_client *c, const char *key, char **valuep) {
- return dequote(disorder_simple(c, valuep, "get-global", key, (char *)0),
- valuep);
-}
-
-/** @brief Get server's RTP address information
- * @param c Client
- * @param addressp Where to store address (UTF-8)
- * @param portp Where to store port (UTF-8)
- * @return 0 on success, non-0 on error
- */
-int disorder_rtp_address(disorder_client *c, char **addressp, char **portp) {
- char *r;
- int rc, n;
- char **vec;
-
- if((rc = disorder_simple(c, &r, "rtp-address", (char *)0)))
- return rc;
- vec = split(r, &n, SPLIT_QUOTES, 0, 0);
- if(n != 2) {
- c->last = "malformed RTP address";
- error(0, "malformed rtp-address reply");
- return -1;
- }
- *addressp = vec[0];
- *portp = vec[1];
- return 0;
-}
-
-/** @brief Create a user
- * @param c Client
- * @param user Username
- * @param password Password
- * @param rights Initial rights or NULL to use default
- * @return 0 on success, non-0 on error
- */
-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);
-}
-
-/** @brief Delete a user
- * @param c Client
- * @param user Username
- * @return 0 on success, non-0 on error
- */
-int disorder_deluser(disorder_client *c, const char *user) {
- return disorder_simple(c, 0, "deluser", user, (char *)0);
-}
-
-/** @brief Get user information
- * @param c Client
- * @param user Username
- * @param key Property name (UTF-8)
- * @param valuep Where to store value (UTF-8)
- * @return 0 on success, non-0 on error
- */
-int disorder_userinfo(disorder_client *c, const char *user, const char *key,
- char **valuep) {
- return dequote(disorder_simple(c, valuep, "userinfo", user, key, (char *)0),
- valuep);
-}
-
-/** @brief Set user information
- * @param c Client
- * @param user Username
- * @param key Property name (UTF-8)
- * @param value New property value (UTF-8)
- * @return 0 on success, non-0 on error
- */
-int disorder_edituser(disorder_client *c, const char *user,
- const char *key, const char *value) {
- return disorder_simple(c, 0, "edituser", user, key, value, (char *)0);
-}
-
-/** @brief Register a user
- * @param c Client
- * @param user Username
- * @param password Password
- * @param email Email address (UTF-8)
- * @param confirmp Where to store confirmation string
- * @return 0 on success, non-0 on error
- */
-int disorder_register(disorder_client *c, const char *user,
- const char *password, const char *email,
- char **confirmp) {
- return dequote(disorder_simple(c, confirmp, "register",
- user, password, email, (char *)0),
- confirmp);
-}
-
-/** @brief Confirm a user
- * @param c Client
- * @param confirm Confirmation string
- * @return 0 on success, non-0 on error
- */
-int disorder_confirm(disorder_client *c, const char *confirm) {
- char *u;
- int rc;
-
- if(!(rc = dequote(disorder_simple(c, &u, "confirm", confirm, (char *)0),
- &u)))
- c->user = u;
- return rc;
-}
-
-/** @brief Make a cookie for this login
- * @param c Client
- * @param cookiep Where to store cookie string
- * @return 0 on success, non-0 on error
- */
-int disorder_make_cookie(disorder_client *c, char **cookiep) {
- return dequote(disorder_simple(c, cookiep, "make-cookie", (char *)0),
- cookiep);
-}
-
-/** @brief Revoke the cookie used by this session
- * @param c Client
- * @return 0 on success, non-0 on error
- */
-int disorder_revoke(disorder_client *c) {
- return disorder_simple(c, 0, "revoke", (char *)0);
-}
-
-/** @brief Request a password reminder email
- * @param c Client
- * @param user Username
- * @return 0 on success, non-0 on error
- */
-int disorder_reminder(disorder_client *c, const char *user) {
- return disorder_simple(c, 0, "reminder", user, (char *)0);
-}