implemented DTEND
This commit is contained in:
parent
4910d9d7bb
commit
2916e77056
@ -27,12 +27,6 @@ void insert_event(char *file_name) {
|
||||
printf("Is this an all day event? [y/n] ");
|
||||
all_day_event = binary_user_choice();
|
||||
|
||||
if (all_day_event) {
|
||||
printf("this will be an all day event\n");
|
||||
} else {
|
||||
printf("this will not be an all day event\n");
|
||||
}
|
||||
|
||||
printf("SUMMARY: ");
|
||||
fgets (input_buffer, (sizeof(summary_buf)-strlen(summary_buf)), stdin);
|
||||
|
||||
@ -55,7 +49,8 @@ void insert_event(char *file_name) {
|
||||
form_dtstart_string(dtstart_buffer, time_zone);
|
||||
|
||||
get_dtstart_dtend(dtend_buffer, all_day_event, "end");
|
||||
printf ("dtend_buffer: %s\n", dtend_buffer);
|
||||
marshall_date_time(dtend_buffer);
|
||||
form_dtend_string(dtend_buffer, time_zone);
|
||||
|
||||
seek_cal_end(myfd);
|
||||
write(myfd, "BEGIN:VEVENT\r\n", strlen("BEGIN:VEVENT\r\n"));
|
||||
@ -66,6 +61,7 @@ void insert_event(char *file_name) {
|
||||
write(myfd, dtstamp, strlen(dtstamp));
|
||||
write(myfd, "\r\n", strlen("\r\n"));
|
||||
write(myfd, dtstart_buffer, strlen(dtstart_buffer));
|
||||
write(myfd, dtend_buffer, strlen(dtend_buffer));
|
||||
write(myfd, summary_buf, strlen(summary_buf));
|
||||
write(myfd, "END:VCALENDAR\r\n", strlen("END:VCALENDAR\r\n"));
|
||||
|
||||
@ -160,3 +156,21 @@ void form_dtstart_string(char dtstart_buffer[], char time_zone[]) {
|
||||
}
|
||||
strcat(dtstart_buffer, "\r\n");
|
||||
}
|
||||
|
||||
void form_dtend_string(char dtend_buffer[], char time_zone[]) {
|
||||
char dtend_copy[strlen(dtend_buffer)];
|
||||
strcpy(dtend_copy, dtend_buffer);
|
||||
|
||||
// not all day event
|
||||
if (strlen(dtend_buffer) == 15) {
|
||||
strcpy(dtend_buffer, "DTEND;TZID=/freeassociation.sourceforge.net");
|
||||
strcat(dtend_buffer, time_zone);
|
||||
strcat(dtend_buffer, ":\r\n ");
|
||||
strcat(dtend_buffer, dtend_copy);
|
||||
} else {
|
||||
// all day event
|
||||
strcpy(dtend_buffer, "DTEND;VALUE=DATE:");
|
||||
strcat(dtend_buffer, dtend_copy);
|
||||
}
|
||||
strcat(dtend_buffer, "\r\n");
|
||||
}
|
||||
|
@ -5,3 +5,4 @@ void seek_cal_end(int fd);
|
||||
int binary_user_choice();
|
||||
void get_dtstart_dtend(char input_buffer[], int all_day_event, char *start_or_end);
|
||||
void form_dtstart_string(char dtstart_buffer[], char time_zone[]);
|
||||
void form_dtend_string(char dtend_buffer[], char time_zone[]);
|
||||
|
Loading…
Reference in New Issue
Block a user