chiark / gitweb /
Synchronize with DisOrder 4.1
[disorder] / disobedience / log.c
index 4dadae73aa8b1f5fa177f95524eb8cfae7457987..6779cbd3cc4c081a64ba8fb4a8c9693d734ef0a1 100644 (file)
@@ -42,6 +42,7 @@ static void log_scratched(void *v, const char *track, const char *user);
 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);
 
 /** @brief Callbacks for server state monitoring */
 const disorder_eclient_log_callbacks log_callbacks = {
@@ -57,7 +58,8 @@ const disorder_eclient_log_callbacks log_callbacks = {
   .scratched = log_scratched,
   .state = log_state,
   .volume = log_volume,
-  .rescanned = log_rescanned
+  .rescanned = log_rescanned,
+  .rights_changed = log_rights_changed
 };
 
 /** @brief Update everything */
@@ -149,6 +151,7 @@ static const struct {
   { DISORDER_RANDOM_ENABLED, "random-changed" },
   { DISORDER_TRACK_PAUSED, "pause-changed" },
   { DISORDER_PLAYING, "playing-changed" },
+  { DISORDER_CONNECTED, "connected-changed" },
 };
 #define NSTATE_EVENTS (sizeof state_events / sizeof *state_events)
 
@@ -192,6 +195,15 @@ static void log_rescanned(void attribute((unused)) *v) {
   event_raise("rescan-complete", 0);
 }
 
+/** @brief Called when our rights change */
+static void log_rights_changed(void attribute((unused)) *v,
+                               rights_type new_rights) {
+  ++suppress_actions;
+  last_rights = new_rights;
+  event_raise("rights-changed", 0);
+  --suppress_actions;
+}
+
 /*
 Local Variables:
 c-basic-offset:2