summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c6
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/schedule.c24
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/schedule.h6
3 files changed, 27 insertions, 9 deletions
diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c
index dbc48ae8..8b7b4880 100644
--- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c
+++ b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c
@@ -3754,7 +3754,8 @@ static int og_dbi_schedule_get(void)
time.am_pm = dbi_result_get_uint(result, "ampm");
time.minutes = dbi_result_get_uint(result, "minutos");
- og_schedule_create(schedule_id, task_id, &time);
+ og_schedule_create(schedule_id, task_id, OG_SCHEDULE_TASK,
+ &time);
}
dbi_result_free(result);
@@ -3971,7 +3972,8 @@ static int og_task_schedule_create(struct og_msg_params *params)
og_dbi_close(dbi);
return -1;
}
- og_schedule_create(schedule_id, atoi(params->task_id), &params->time);
+ og_schedule_create(schedule_id, atoi(params->task_id), OG_SCHEDULE_TASK,
+ &params->time);
og_schedule_refresh(og_loop);
og_dbi_close(dbi);
diff --git a/admin/Sources/Services/ogAdmServer/sources/schedule.c b/admin/Sources/Services/ogAdmServer/sources/schedule.c
index 3d30aadc..d7eb3363 100644
--- a/admin/Sources/Services/ogAdmServer/sources/schedule.c
+++ b/admin/Sources/Services/ogAdmServer/sources/schedule.c
@@ -197,7 +197,8 @@ static void og_schedule_remove_duplicates()
static void og_schedule_create_weekdays(int month, int year,
int *hours, int minutes, int week_days,
- uint32_t task_id, uint32_t schedule_id)
+ uint32_t task_id, uint32_t schedule_id,
+ enum og_schedule_type type)
{
struct og_schedule *schedule;
int month_days[5];
@@ -235,6 +236,7 @@ static void og_schedule_create_weekdays(int month, int year,
schedule->seconds = mktime(&tm);
schedule->task_id = task_id;
schedule->schedule_id = schedule_id;
+ schedule->type = type;
og_schedule_add(schedule);
}
}
@@ -243,7 +245,8 @@ static void og_schedule_create_weekdays(int month, int year,
static void og_schedule_create_weeks(int month, int year,
int *hours, int minutes, int weeks,
- uint32_t task_id, uint32_t schedule_id)
+ uint32_t task_id, uint32_t schedule_id,
+ enum og_schedule_type type)
{
struct og_schedule *schedule;
int month_days[7];
@@ -284,6 +287,7 @@ static void og_schedule_create_weeks(int month, int year,
schedule->seconds = mktime(&tm);
schedule->task_id = task_id;
schedule->schedule_id = schedule_id;
+ schedule->type = type;
og_schedule_add(schedule);
}
}
@@ -292,7 +296,8 @@ static void og_schedule_create_weeks(int month, int year,
static void og_schedule_create_days(int month, int year,
int *hours, int minutes, int *days,
- uint32_t task_id, uint32_t schedule_id)
+ uint32_t task_id, uint32_t schedule_id,
+ enum og_schedule_type type)
{
struct og_schedule *schedule;
struct tm tm;
@@ -315,12 +320,14 @@ static void og_schedule_create_days(int month, int year,
schedule->seconds = mktime(&tm);
schedule->task_id = task_id;
schedule->schedule_id = schedule_id;
+ schedule->type = type;
og_schedule_add(schedule);
}
}
}
void og_schedule_create(unsigned int schedule_id, unsigned int task_id,
+ enum og_schedule_type type,
struct og_schedule_time *time)
{
int year, month, minutes;
@@ -346,21 +353,24 @@ void og_schedule_create(unsigned int schedule_id, unsigned int task_id,
hours, minutes,
time->week_days,
task_id,
- schedule_id);
+ schedule_id,
+ type);
if (time->weeks)
og_schedule_create_weeks(month, year,
hours, minutes,
time->weeks,
task_id,
- schedule_id);
+ schedule_id,
+ type);
if (time->days)
og_schedule_create_days(month, year,
hours, minutes,
days,
task_id,
- schedule_id);
+ schedule_id,
+ type);
}
}
@@ -389,7 +399,7 @@ void og_schedule_update(struct ev_loop *loop, unsigned int schedule_id,
unsigned int task_id, struct og_schedule_time *time)
{
og_schedule_delete(loop, schedule_id);
- og_schedule_create(schedule_id, task_id, time);
+ og_schedule_create(schedule_id, task_id, OG_SCHEDULE_TASK, time);
}
static void og_agent_timer_cb(struct ev_loop *loop, ev_timer *timer, int events)
diff --git a/admin/Sources/Services/ogAdmServer/sources/schedule.h b/admin/Sources/Services/ogAdmServer/sources/schedule.h
index f207afa5..061b5dbc 100644
--- a/admin/Sources/Services/ogAdmServer/sources/schedule.h
+++ b/admin/Sources/Services/ogAdmServer/sources/schedule.h
@@ -17,15 +17,21 @@ struct og_schedule_time {
uint32_t minutes;
};
+enum og_schedule_type {
+ OG_SCHEDULE_TASK,
+};
+
struct og_schedule {
struct list_head list;
struct ev_timer timer;
time_t seconds;
unsigned int task_id;
unsigned int schedule_id;
+ enum og_schedule_type type;
};
void og_schedule_create(unsigned int schedule_id, unsigned int task_id,
+ enum og_schedule_type type,
struct og_schedule_time *time);
void og_schedule_update(struct ev_loop *loop, unsigned int schedule_id,
unsigned int task_id, struct og_schedule_time *time);