From: Richard Kettlewell Date: Sat, 13 Dec 2008 15:53:22 +0000 (+0000) Subject: Disobedience notices when tracks are adopted now. X-Git-Tag: 4.3~39 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/9433fabf055fa613117a8ea0b95b00324779c5ca Disobedience notices when tracks are adopted now. --- diff --git a/disobedience/log.c b/disobedience/log.c index d11e7bb..652c4e9 100644 --- a/disobedience/log.c +++ b/disobedience/log.c @@ -41,6 +41,7 @@ static void log_state(void *v, unsigned long state); static void log_volume(void *v, int l, int r); static void log_rescanned(void *v); static void log_rights_changed(void *v, rights_type r); +static void log_adopted(void *v, const char *id, const char *user); /** @brief Callbacks for server state monitoring */ const disorder_eclient_log_callbacks log_callbacks = { @@ -57,7 +58,8 @@ const disorder_eclient_log_callbacks log_callbacks = { .state = log_state, .volume = log_volume, .rescanned = log_rescanned, - .rights_changed = log_rights_changed + .rights_changed = log_rights_changed, + .adopted = log_adopted }; /** @brief Update everything */ @@ -202,6 +204,13 @@ static void log_rights_changed(void attribute((unused)) *v, --suppress_actions; } +/** @brief Called when a track is adopted */ +static void log_adopted(void attribute((unused)) *v, + const char attribute((unused)) *id, + const char attribute((unused)) *who) { + event_raise("queue-changed", 0); +} + /* Local Variables: c-basic-offset:2 diff --git a/lib/eclient.c b/lib/eclient.c index b7b502b..40639f3 100644 --- a/lib/eclient.c +++ b/lib/eclient.c @@ -186,6 +186,7 @@ static void logentry_user_confirm(disorder_eclient *c, int nvec, char **vec); static void logentry_user_delete(disorder_eclient *c, int nvec, char **vec); static void logentry_user_edit(disorder_eclient *c, int nvec, char **vec); static void logentry_rights_changed(disorder_eclient *c, int nvec, char **vec); +static void logentry_adopted(disorder_eclient *c, int nvec, char **vec); /* Tables ********************************************************************/ @@ -202,6 +203,7 @@ struct logentry_handler { /** @brief Table for parsing log entries */ static const struct logentry_handler logentry_handlers[] = { #define LE(X, MIN, MAX) { #X, MIN, MAX, logentry_##X } + LE(adopted, 2, 2), LE(completed, 1, 1), LE(failed, 2, 2), LE(moved, 1, 1), @@ -1692,6 +1694,12 @@ char *disorder_eclient_interpret_state(unsigned long statebits) { return d->vec; } +static void logentry_adopted(disorder_eclient *c, + int attribute((unused)) nvec, char **vec) { + if(c->log_callbacks->adopted) + c->log_callbacks->adopted(c->log_v, vec[0], vec[1]); +} + /* Local Variables: c-basic-offset:2 diff --git a/lib/eclient.h b/lib/eclient.h index 359a71b..ce5c582 100644 --- a/lib/eclient.h +++ b/lib/eclient.h @@ -165,6 +165,9 @@ 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); } disorder_eclient_log_callbacks; /* State bits */