chiark / gitweb /
mention copy-drag track playing in CHANGES
[disorder] / server / schedule.c
index 2e5887d24ccc808a4235c79ca9b59f45a997c83b..f93c0f0677cbe26844722b14acae95906d0259a4 100644 (file)
@@ -95,6 +95,9 @@ static const char *const schedule_required[] = {"when", "who", "action"};
 
 /** @brief Parse a scheduled event key and data
  * @param k Pointer to key
+ * @param d Pointer to data
+ * @param idp Where to store event ID
+ * @param actiondatap Where to store parsed data
  * @param whenp Where to store timestamp
  * @return 0 on success, non-0 on error
  *
@@ -179,7 +182,7 @@ static int schedule_init_tid(ev_source *ev,
     }
     when.tv_usec = 0;
     /* The action might be in the past */
-    if(when.tv_sec < time(0)) {
+    if(when.tv_sec < xtime(0)) {
       const char *priority = kvp_get(actiondata, "priority");
 
       if(priority && !strcmp(priority, "junk")) {
@@ -225,8 +228,9 @@ void schedule_init(ev_source *ev) {
 /******************************************************************************/
 
 /** @brief Create a scheduled event
- * @param ev Event loop
+ * @param id Event ID
  * @param actiondata Action data
+ * @param tid Containing transaction
  */
 static int schedule_add_tid(const char *id,
                            struct kvp *actiondata,
@@ -283,7 +287,7 @@ const char *schedule_add(ev_source *ev,
   when.tv_sec = atoll(kvp_get(actiondata, "when"));
   when.tv_usec = 0;
   /* Reject events in the past */
-  if(when.tv_sec <= time(0)) {
+  if(when.tv_sec <= xtime(0)) {
     error(0, "new scheduled event is in the past");
     return 0;
   }
@@ -370,7 +374,7 @@ static void schedule_play(ev_source *ev,
     return;
   }
   info("scheduled event %s: %s play %s", id,  who, track);
-  q = queue_add(track, who, WHERE_START);
+  q = queue_add(track, who, WHERE_START, NULL, origin_scheduled);
   queue_write();
   if(q == qhead.next && playing)
     prepare(ev, q);
@@ -416,6 +420,7 @@ static struct {
 };
 
 /** @brief Look up a scheduled event
+ * @param id Event ID
  * @param actiondata Event description
  * @return index in schedule_actions[] on success, -1 on error
  *