apoint_recur_s2apoint_s() added, appoint_check_next() and apoint_delete_bynum() updated
This commit is contained in:
parent
d438fa15d9
commit
c52da6cace
24
src/apoint.c
24
src/apoint.c
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: apoint.c,v 1.3 2006/09/12 14:57:06 culot Exp $ */
|
/* $calcurse: apoint.c,v 1.4 2006/09/14 15:08:08 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -38,6 +38,7 @@
|
|||||||
#include "custom.h"
|
#include "custom.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "notify.h"
|
#include "notify.h"
|
||||||
|
#include "recur.h"
|
||||||
|
|
||||||
apoint_llist_t *alist_p;
|
apoint_llist_t *alist_p;
|
||||||
|
|
||||||
@ -160,6 +161,7 @@ apoint_llist_node_t *apoint_scan(FILE * f, struct tm start, struct tm end)
|
|||||||
void apoint_delete_bynum(long start, unsigned num)
|
void apoint_delete_bynum(long start, unsigned num)
|
||||||
{
|
{
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
int need_check_notify = 0;
|
||||||
apoint_llist_node_t *i, **iptr;
|
apoint_llist_node_t *i, **iptr;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
@ -169,10 +171,12 @@ void apoint_delete_bynum(long start, unsigned num)
|
|||||||
for (i = alist_p->root; i != 0; i = i->next) {
|
for (i = alist_p->root; i != 0; i = i->next) {
|
||||||
if (apoint_inday(i, start)) {
|
if (apoint_inday(i, start)) {
|
||||||
if (n == num) {
|
if (n == num) {
|
||||||
|
need_check_notify = notify_same_item(i->start);
|
||||||
*iptr = i->next;
|
*iptr = i->next;
|
||||||
free(i->mesg);
|
free(i->mesg);
|
||||||
free(i);
|
free(i);
|
||||||
pthread_mutex_unlock(&(alist_p->mutex));
|
pthread_mutex_unlock(&(alist_p->mutex));
|
||||||
|
if (need_check_notify) notify_check_next_app();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
@ -279,6 +283,7 @@ struct notify_app_s *apoint_check_next(struct notify_app_s *app, long start)
|
|||||||
NOTIFY_FIELD_LENGTH-3);
|
NOTIFY_FIELD_LENGTH-3);
|
||||||
strncat(app->txt, "..", 2);
|
strncat(app->txt, "..", 2);
|
||||||
}
|
}
|
||||||
|
app->got_app = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,3 +291,20 @@ struct notify_app_s *apoint_check_next(struct notify_app_s *app, long start)
|
|||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a structure of type aopint_llist_t given a structure of type
|
||||||
|
* recur_apoint_s
|
||||||
|
*/
|
||||||
|
apoint_llist_node_t *apoint_recur_s2apoint_s(
|
||||||
|
recur_apoint_llist_node_t *p)
|
||||||
|
{
|
||||||
|
apoint_llist_node_t *a;
|
||||||
|
|
||||||
|
a = (apoint_llist_node_t *) malloc(sizeof(apoint_llist_node_t));
|
||||||
|
a->mesg = (char *) malloc(strlen(p->mesg) + 1);
|
||||||
|
a->start = p->start;
|
||||||
|
a->dur = p->dur;
|
||||||
|
a->mesg = p->mesg;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user