23 #include "../misc/misc.h" 27 #include "../misc/coding/coding.h" 29 #include "../../helper/string.h" 34 int start=-1,frequency=-1,dow=-1,day=-1,month=-1,end=-1,Recurrance = 0, Repeat=0, j;
36 time_t t_time1,t_time2;
49 if (start == -1)
return;
51 if (frequency != -1 && dow == -1 && day == -1 && month == -1) {
62 if (frequency != -1 && dow != -1 && day == -1 && month == -1) {
69 if (frequency != -1 && dow != -1 && day == -1 && month == -1) {
76 if (frequency != -1 && dow == -1 && day != -1 && month == -1) {
80 Recurrance = 0xffff-1;
83 if (frequency != -1 && dow == -1 && day != -1 && month != -1) {
92 rec[0] = Recurrance / 256;
93 rec[1] = Recurrance % 256;
95 if (endday == NULL)
return;
100 if (end == -1)
return;
104 if (t_time2 - t_time1 <= 0)
return;
106 switch (Recurrance) {
110 Repeat = (t_time2 - t_time1) / (60*60*Recurrance) + 1;
117 if (DT.
Month == 12) {
131 endday[0] = Repeat/256;
132 endday[1] = Repeat%256;
134 smfprintf(di,
"Repeat number: %i\n",Repeat);
139 int Recurrance,num=-1,i;
141 Recurrance = rec[0]*256 + rec[1];
142 if (Recurrance == 0)
return;
144 if (Recurrance == 0xffff) Recurrance=24*365;
146 if (Recurrance == 0xffff-1) Recurrance=24*30;
147 smfprintf(di,
"Recurrance : %i hours\n",Recurrance);
155 if (num == -1)
return;
157 if (Recurrance == 24 || Recurrance == 24*7 ||
158 Recurrance == 24*30 || Recurrance == 24*365) {
163 if (Recurrance == 24*14) {
168 if (Recurrance == 24*7 || Recurrance == 24*14) {
175 if (Recurrance == 24*30) {
180 if (Recurrance == 24*365) {
188 if (endday == NULL || endday[0]*256+endday[1] == 0)
return;
189 smfprintf(di,
"Repeat : %i times\n",endday[0]*256+endday[1]);
192 switch (Recurrance) {
200 for (i=0;i<endday[0]*256+endday[1]-1;i++) {
215 smfprintf(di,
"End Repeat Time: %04i-%02i-%02i %02i:%02i:%02i\n",
229 char rec[20],endday[20];
261 if (rec[0] != 0 || rec[1] != 0) {
273 if (Repeating && ! RepeatingEnd) {
292 if (*Time == -1) *Time = i;
295 if (*EndTime == -1) *EndTime = i;
299 if (*Alarm == -1) *Alarm = i;
302 if (*Text == -1) *Text = i;
305 if (*Phone == -1) *Phone = i;
308 if (*Location == -1) *Location = i;
323 struct tm talarm, ttime;
326 talarm.tm_mday = Alarm->
Day;
327 talarm.tm_mon = Alarm->
Month-1;
328 talarm.tm_year = Alarm->
Year - 1900;
329 talarm.tm_hour = Alarm->
Hour;
330 talarm.tm_min = Alarm->
Minute;
331 talarm.tm_sec = Alarm->
Second;
334 ttime.tm_mday = Time->
Day;
335 ttime.tm_mon = Time->
Month-1;
336 ttime.tm_year = Time->
Year - 1900;
337 ttime.tm_hour = Time->
Hour;
338 ttime.tm_min = Time->
Minute;
339 ttime.tm_sec = Time->
Second;
342 dt = mktime(&ttime) - mktime(&talarm);
350 delta.Day = dt / 86400 ; dt = dt - delta.Day * 86400;
351 delta.Hour = dt / 3600 ; dt = dt - delta.Hour * 3600;
352 delta.Minute = dt / 60 ; dt = dt - delta.Minute * 60;
356 if (delta.Minute !=0) {
357 delta.Minute = delta.Day * 24*60 + delta.Hour * 60 + delta.Minute;
358 delta.Day=0; delta.Hour=0;
359 }
else if (delta.Hour !=0) {
360 delta.Hour = delta.Day * 24 + delta.Hour;
380 else if (strstr(
string,
"MISCELLANEOUS")) *Type =
GSM_CAL_MEMO;
381 else if (strstr(
string,
"PHONE CALL")) *Type =
GSM_CAL_CALL;
389 else if (strstr(
string,
"Anrufen")) *Type =
GSM_CAL_CALL;
408 strcpy(
string,
"PHONE CALL");
411 strcpy(
string,
"MEETING");
414 strcpy(
string,
"DATE");
417 strcpy(
string,
"TRAVEL");
420 strcpy(
string,
"VACATION");
423 strcpy(
string,
"ANNIVERSARY");
426 strcpy(
string,
"SHOPPING LIST");
430 strcpy(
string,
"MISCELLANEOUS");
445 const char *DaysOfWeek[8] = {
"SU",
"MO",
"TU",
"WE",
"TH",
"FR",
"SA",
"SU"};
447 int repeat_dayofweek = -1;
449 int repeat_dayofyear = -1;
450 int repeat_weekofmonth = -1;
451 int repeat_month = -1;
452 int repeat_count = -1;
453 int repeat_frequency = -1;
520 error =
VC_Store(Buffer, buff_len, Length,
"RRULE:");
521 if (error !=
ERR_NONE)
return error;
524 if (repeat_frequency == -1) {
525 repeat_frequency = 1;
528 if ((repeat_dayofyear != -1) || (Version ==
Siemens_VCalendar && repeat_day != -1 && repeat_month != -1)) {
531 error =
VC_Store(Buffer, buff_len, Length,
"FREQ=YEARLY");
532 if (error !=
ERR_NONE)
return error;
534 error =
VC_Store(Buffer, buff_len, Length,
"YD%d", repeat_frequency);
535 if (error !=
ERR_NONE)
return error;
545 if (error !=
ERR_NONE)
return error;
549 if (error !=
ERR_NONE)
return error;
553 if (error !=
ERR_NONE)
return error;
557 }
else if (repeat_day != -1 && repeat_month != -1) {
560 error =
VC_Store(Buffer, buff_len, Length,
"FREQ=YEARLY");
561 if (error !=
ERR_NONE)
return error;
563 error =
VC_Store(Buffer, buff_len, Length,
"YM%d", repeat_frequency);
564 if (error !=
ERR_NONE)
return error;
574 if (error !=
ERR_NONE)
return error;
578 if (error !=
ERR_NONE)
return error;
582 if (error !=
ERR_NONE)
return error;
586 }
else if (repeat_day != -1) {
589 error =
VC_Store(Buffer, buff_len, Length,
"FREQ=MONTHLY");
590 if (error !=
ERR_NONE)
return error;
592 error =
VC_Store(Buffer, buff_len, Length,
"MD%d", repeat_frequency);
593 if (error !=
ERR_NONE)
return error;
603 if (error !=
ERR_NONE)
return error;
607 if (error !=
ERR_NONE)
return error;
611 if (error !=
ERR_NONE)
return error;
615 }
else if (repeat_dayofweek != -1 && repeat_weekofmonth != -1) {
618 error =
VC_Store(Buffer, buff_len, Length,
"FREQ=MONTHLY");
619 if (error !=
ERR_NONE)
return error;
621 error =
VC_Store(Buffer, buff_len, Length,
"MP%d", repeat_frequency);
622 if (error !=
ERR_NONE)
return error;
630 if (error !=
ERR_NONE)
return error;
634 if (error !=
ERR_NONE)
return error;
645 if (error !=
ERR_NONE)
return error;
649 if (error !=
ERR_NONE)
return error;
658 if (error !=
ERR_NONE)
return error;
662 if (error !=
ERR_NONE)
return error;
667 }
else if (repeat_dayofweek != -1) {
670 error =
VC_Store(Buffer, buff_len, Length,
"FREQ=WEEKLY");
671 if (error !=
ERR_NONE)
return error;
673 error =
VC_Store(Buffer, buff_len, Length,
"W%d", repeat_frequency);
674 if (error !=
ERR_NONE)
return error;
684 if (error !=
ERR_NONE)
return error;
688 if (error !=
ERR_NONE)
return error;
692 if (error !=
ERR_NONE)
return error;
699 error =
VC_Store(Buffer, buff_len, Length,
"FREQ=DAILY");
700 if (error !=
ERR_NONE)
return error;
702 error =
VC_Store(Buffer, buff_len, Length,
"D%d", repeat_frequency);
703 if (error !=
ERR_NONE)
return error;
709 error =
VC_Store(Buffer, buff_len, Length,
";INTERVAL=%d", repeat_frequency);
710 if (error !=
ERR_NONE)
return error;
714 if (repeat_count != -1) {
716 if (repeat_count > 0) {
717 error =
VC_Store(Buffer, buff_len, Length,
";COUNT=%d", repeat_count);
718 if (error !=
ERR_NONE)
return error;
721 error =
VC_Store(Buffer, buff_len, Length,
" #%d", repeat_count);
722 if (error !=
ERR_NONE)
return error;
727 if (repeat_stopdate.
Day != 0) {
729 error =
VC_Store(Buffer, buff_len, Length,
";UNTIL=");
730 if (error !=
ERR_NONE)
return error;
732 error =
VC_StoreDate(Buffer, buff_len, Length, &repeat_stopdate, NULL);
733 if (error !=
ERR_NONE)
return error;
737 if (error !=
ERR_NONE)
return error;
819 int i, alarm_pos = -1, date_pos = -1;
824 error =
VC_StoreLine(Buffer, buff_len, Length,
"BEGIN:VCALENDAR");
825 if (error !=
ERR_NONE)
return error;
827 if (error !=
ERR_NONE)
return error;
829 error =
VC_StoreLine(Buffer, buff_len, Length,
"BEGIN:VEVENT");
830 if (error !=
ERR_NONE)
return error;
835 if (error !=
ERR_NONE)
return error;
836 error =
VC_StoreLine(Buffer, buff_len, Length,
"STATUS:CONFIRMED");
837 if (error !=
ERR_NONE)
return error;
842 error =
VC_StoreLine(Buffer, buff_len, Length,
"CATEGORIES:%s", category);
843 if (error !=
ERR_NONE)
return error;
852 if (error !=
ERR_NONE)
return error;
855 if (error !=
ERR_NONE)
return error;
861 if (error !=
ERR_NONE)
return error;
864 if (error !=
ERR_NONE)
return error;
872 if (error !=
ERR_NONE)
return error;
880 if (error !=
ERR_NONE)
return error;
886 if (error !=
ERR_NONE)
return error;
889 if (error !=
ERR_NONE)
return error;
894 if (error !=
ERR_NONE)
return error;
898 if (error !=
ERR_NONE)
return error;
903 if (error !=
ERR_NONE)
return error;
907 if (error !=
ERR_NONE)
return error;
911 if (error !=
ERR_NONE)
return error;
926 error =
VC_StoreLine(Buffer, buff_len, Length,
"CLASS:PUBLIC");
927 if (error !=
ERR_NONE)
return error;
929 error =
VC_StoreLine(Buffer, buff_len, Length,
"CLASS:PRIVATE");
930 if (error !=
ERR_NONE)
return error;
942 error =
VC_StoreLine(Buffer, buff_len, Length,
"X-MOZILLA-RECUR-DEFAULT-UNITS:years");
943 if (error !=
ERR_NONE)
return error;
945 error =
VC_StoreLine(Buffer, buff_len, Length,
"RRULE:YD1");
946 if (error !=
ERR_NONE)
return error;
948 error =
VC_StoreLine(Buffer, buff_len, Length,
"RRULE:YM1");
949 if (error !=
ERR_NONE)
return error;
961 if (deltatime.
Minute !=0) {
962 error =
VC_StoreLine(Buffer, buff_len, Length,
"X-MOZILLA-ALARM-DEFAULT-UNITS:minutes");
963 if (error !=
ERR_NONE)
return error;
964 error =
VC_StoreLine(Buffer, buff_len, Length,
"X-MOZILLA-ALARM-DEFAULT-LENGTH:%i", deltatime.
Minute);
965 if (error !=
ERR_NONE)
return error;
966 sprintf(dtstr,
"-PT%iM",deltatime.
Minute);
967 }
else if (deltatime.
Hour !=0) {
968 error =
VC_StoreLine(Buffer, buff_len, Length,
"X-MOZILLA-ALARM-DEFAULT-UNITS:hours");
969 if (error !=
ERR_NONE)
return error;
970 error =
VC_StoreLine(Buffer, buff_len, Length,
"X-MOZILLA-ALARM-DEFAULT-LENGTH:%i", deltatime.
Hour);
971 if (error !=
ERR_NONE)
return error;
972 sprintf(dtstr,
"-PT%iH",deltatime.
Hour);
973 }
else if (deltatime.
Day !=0) {
974 error =
VC_StoreLine(Buffer, buff_len, Length,
"X-MOZILLA-ALARM-DEFAULT-UNITS:days");
975 if (error !=
ERR_NONE)
return error;
976 error =
VC_StoreLine(Buffer, buff_len, Length,
"X-MOZILLA-ALARM-DEFAULT-LENGTH:%i", deltatime.
Day);
977 if (error !=
ERR_NONE)
return error;
978 sprintf(dtstr,
"-P%iD",deltatime.
Day);
980 if (dtstr[0] !=
'\0') {
981 error =
VC_StoreLine(Buffer, buff_len, Length,
"BEGIN:VALARM");
982 if (error !=
ERR_NONE)
return error;
983 error =
VC_StoreLine(Buffer, buff_len, Length,
"TRIGGER;VALUE=DURATION");
984 if (error !=
ERR_NONE)
return error;
988 error =
VC_StoreLine(Buffer, buff_len, Length,
" :%s",dtstr);
989 if (error !=
ERR_NONE)
return error;
990 error =
VC_StoreLine(Buffer, buff_len, Length,
"END:VALARM");
991 if (error !=
ERR_NONE)
return error;
995 error =
VC_StoreLine(Buffer, buff_len, Length,
"END:VEVENT");
996 if (error !=
ERR_NONE)
return error;
998 error =
VC_StoreLine(Buffer, buff_len, Length,
"END:VCALENDAR");
999 if (error !=
ERR_NONE)
return error;
1017 if (*EndTime == -1) *EndTime = i;
1021 if (*Alarm == -1) *Alarm = i;
1024 if (*Text == -1) *Text = i;
1027 if (*Completed == -1) *Completed = i;
1030 if (*Phone == -1) *Phone = i;
1046 error =
VC_StoreLine(Buffer, buff_len, Length,
"BEGIN:VCALENDAR");
1047 if (error !=
ERR_NONE)
return error;
1049 if (error !=
ERR_NONE)
return error;
1051 error =
VC_StoreLine(Buffer, buff_len, Length,
"BEGIN:VTODO");
1052 if (error !=
ERR_NONE)
return error;
1057 if (error !=
ERR_NONE)
return error;
1058 error =
VC_StoreLine(Buffer, buff_len, Length,
"STATUS:CONFIRMED");
1059 if (error !=
ERR_NONE)
return error;
1066 error =
VC_StoreLine(Buffer, buff_len, Length,
"PRIORITY:0");
1067 if (error !=
ERR_NONE)
return error;
1070 error =
VC_StoreLine(Buffer, buff_len, Length,
"PRIORITY:1");
1071 if (error !=
ERR_NONE)
return error;
1074 error =
VC_StoreLine(Buffer, buff_len, Length,
"PRIORITY:5");
1075 if (error !=
ERR_NONE)
return error;
1078 error =
VC_StoreLine(Buffer, buff_len, Length,
"PRIORITY:9");
1079 if (error !=
ERR_NONE)
return error;
1086 error =
VC_StoreLine(Buffer, buff_len, Length,
"PRIORITY:0");
1087 if (error !=
ERR_NONE)
return error;
1090 error =
VC_StoreLine(Buffer, buff_len, Length,
"PRIORITY:1");
1091 if (error !=
ERR_NONE)
return error;
1094 error =
VC_StoreLine(Buffer, buff_len, Length,
"PRIORITY:2");
1095 if (error !=
ERR_NONE)
return error;
1098 error =
VC_StoreLine(Buffer, buff_len, Length,
"PRIORITY:3");
1099 if (error !=
ERR_NONE)
return error;
1105 error =
VC_StoreLine(Buffer, buff_len, Length,
"CATEGORIES:%s", category);
1106 if (error !=
ERR_NONE)
return error;
1118 if (error !=
ERR_NONE)
return error;
1125 if (error !=
ERR_NONE)
return error;
1132 if (error !=
ERR_NONE)
return error;
1137 if (error !=
ERR_NONE)
return error;
1141 if (error !=
ERR_NONE)
return error;
1145 if (error !=
ERR_NONE)
return error;
1149 if (error !=
ERR_NONE)
return error;
1153 if (error !=
ERR_NONE)
return error;
1158 if (error !=
ERR_NONE)
return error;
1162 if (error !=
ERR_NONE)
return error;
1166 if (error !=
ERR_NONE)
return error;
1170 error =
VC_StoreLine(Buffer, buff_len, Length,
"CLASS:PUBLIC");
1171 if (error !=
ERR_NONE)
return error;
1173 error =
VC_StoreLine(Buffer, buff_len, Length,
"CLASS:PRIVATE");
1174 if (error !=
ERR_NONE)
return error;
1179 error =
VC_StoreLine(Buffer, buff_len, Length,
"STATUS:COMPLETED");
1180 if (error !=
ERR_NONE)
return error;
1181 error =
VC_StoreLine(Buffer, buff_len, Length,
"PERCENT-COMPLETE:100");
1182 if (error !=
ERR_NONE)
return error;
1184 error =
VC_StoreLine(Buffer, buff_len, Length,
"STATUS:NEEDS ACTION");
1185 if (error !=
ERR_NONE)
return error;
1195 error =
VC_StoreLine(Buffer, buff_len, Length,
"END:VTODO");
1196 if (error !=
ERR_NONE)
return error;
1198 error =
VC_StoreLine(Buffer, buff_len, Length,
"END:VCALENDAR");
1199 if (error !=
ERR_NONE)
return error;
1216 if (Buffer[pos] ==
'+') {
1218 }
else if (Buffer[pos] ==
'-') {
1221 if (Buffer[pos] ==
'P') pos++;
1222 if (Buffer[pos] ==
'T') pos++;
1224 if ( !sscanf(Buffer+pos,
"%i%c",&val,&unit) )
return dt;
1227 case 'D': dt.
Day = sign * val ;
break;
1228 case 'H': dt.
Hour = sign * val ;
break;
1229 case 'M': dt.
Minute = sign * val ;
break;
1230 case 'S': dt.
Second = sign * val ;
break;
1244 for (src=0; src <= *lBuffer; src++) {
1245 if (Buffer[src] ==
'\r') src++;
1246 if (Buffer[src] ==
'\n') {
1247 if (Buffer[src+1] ==
' ' && Buffer[src+2] ==
':' ) src = src + 2;
1248 if (Buffer[src+1] ==
' ' && Buffer[src+2] ==
';' ) src = src + 2;
1251 Buffer[dst] = Buffer[src];
1263 if (toupper((
int)Buffer[0])==
'M' && toupper((
int)Buffer[1]) ==
'O') {
1266 }
else if (toupper((
int)Buffer[0])==
'T' && toupper((
int)Buffer[1]) ==
'U') {
1269 }
else if (toupper((
int)Buffer[0])==
'W' && toupper((
int)Buffer[1]) ==
'E') {
1272 }
else if (toupper((
int)Buffer[0])==
'T' && toupper((
int)Buffer[1]) ==
'H') {
1275 }
else if (toupper((
int)Buffer[0])==
'F' && toupper((
int)Buffer[1]) ==
'R') {
1278 }
else if (toupper((
int)Buffer[0])==
'S' && toupper((
int)Buffer[1]) ==
'A') {
1281 }
else if (toupper((
int)Buffer[0])==
'S' && toupper((
int)Buffer[1]) ==
'U') {
1406 const char *pos = Buffer;
1410 #define NEXT_NOSPACE(terminate) \ 1411 while (isspace((int)*pos) && *pos) pos++; \ 1412 if (terminate && *pos == 0) return ERR_NONE; 1414 #define NEXT_NONUMBER(terminate) \ 1415 while (isdigit((int)*pos) && *pos) pos++; \ 1416 if (terminate && *pos == 0) return ERR_NONE; 1418 #define NEXT_CHAR(terminate) \ 1420 if (terminate && *pos == 0) return ERR_UNKNOWN; 1422 #define NEXT_CHAR_NOERR(terminate) \ 1424 if (terminate && *pos == 0) return ERR_NONE; 1426 #define GET_DOW(type, terminate) \ 1427 Calendar->Entries[Calendar->EntriesNum].EntryType = type; \ 1428 Calendar->Entries[Calendar->EntriesNum].AddError = ERR_NONE; \ 1429 if (GSM_DecodeVCAL_DOW(pos, &(Calendar->Entries[Calendar->EntriesNum].Number)) != ERR_NONE) return ERR_UNKNOWN; \ 1430 Calendar->EntriesNum++; \ 1432 NEXT_CHAR_NOERR(terminate); 1434 #define GET_NUMBER(type, terminate) \ 1435 Calendar->Entries[Calendar->EntriesNum].AddError = ERR_NONE; \ 1436 Calendar->Entries[Calendar->EntriesNum].EntryType = type; \ 1437 Calendar->Entries[Calendar->EntriesNum].Number = atoi(pos); \ 1438 Calendar->EntriesNum++; \ 1439 NEXT_NONUMBER(terminate); 1441 #define GET_FREQUENCY(terminate) \ 1442 GET_NUMBER(CAL_REPEAT_FREQUENCY, terminate); 1445 if (TimePos == -1) {
1466 while (isalpha((
int)*pos)) {
1495 if (isdigit((
int)*pos)) {
1499 }
else if (*pos ==
'-') {
1501 smfprintf(di,
"WARNING: Negative week position not supported!");
1505 while (isalpha((
int)*pos)) {
1538 if (isdigit((
int)*pos)) {
1539 while (isdigit((
int)*pos)) {
1543 }
else if (*pos ==
'-') {
1545 smfprintf(di,
"WARNING: Negative day position not supported!");
1559 smfprintf(di,
"Could not decode recurrency: %s\n", pos);
1581 while (isdigit((
int)*pos)) {
1603 while (isdigit((
int)*pos)) {
1641 smfprintf(di,
"Could not decode recurrency: %s\n", pos);
1646 smfprintf(di,
"Could not decode recurrency: %s\n", pos);
1676 unsigned char Line[2000],Buff[2000];
1695 lBuffer = strlen(Buffer);
1700 if (error !=
ERR_NONE)
return error;
1704 error =
MyGetLine(Buffer, Pos, Line, lBuffer,
sizeof(Line),
TRUE);
1705 if (error !=
ERR_NONE)
return error;
1706 if (strlen(Line) == 0)
break;
1710 if (strstr(Line,
"BEGIN:VEVENT")) {
1717 if (strstr(Line,
"BEGIN:VTODO")) {
1726 if (strstr(Line,
"END:VEVENT")) {
1728 smfprintf(di,
"vCalendar without date!\n");
1731 if (rrule != NULL) {
1747 if (trigger.
Timezone != -999 * 3600) {
1761 smfprintf(di,
"Adjusting DST: %i\n", dstflag);
1763 smfprintf(di,
"Unknown DST flag: %i\n", dstflag);
1769 if (Calendar->
Type == 0) {
1787 if (strstr(Line,
"X-MOZILLA-ALARM-DEFAULT-LENGTH:")) {
1788 if (
ReadVCALInt(Line,
"X-MOZILLA-ALARM-DEFAULT-LENGTH", &deltatime)) {
1793 if (strstr(Line,
"BEGIN:VALARM")) {
1794 error =
MyGetLine(Buffer, Pos, Line, lBuffer,
sizeof(Line),
TRUE);
1795 if (error !=
ERR_NONE)
return error;
1796 if (strlen(Line) == 0)
break;
1805 if (strstr(Line,
"CATEGORIES:")) {
1810 if (strstr(Line,
"RRULE:")) {
1811 if (rrule == NULL) {
1812 rrule = strdup(Line + 6);
1814 smfprintf(di,
"Ignoring second recurrence: %s\n", Line);
1853 if (
ReadVCALDate(Line,
"DTSTART", &Date, &is_date_only)) {
1859 if (!is_date_only) date_only =
FALSE;
1861 if (
ReadVCALDate(Line,
"DTEND", &Date, &is_date_only)) {
1866 if (!is_date_only) date_only =
FALSE;
1868 if (
ReadVCALDate(Line,
"DALARM", &Date, &is_date_only)) {
1878 if (
ReadVCALDate(Line,
"AALARM", &Date, &is_date_only)) {
1884 if (
ReadVCALDate(Line,
"LAST-MODIFIED", &Date, &is_date_only)) {
1890 if (strstr(Line,
"X-SONYERICSSON-DST:")) {
1891 if (
ReadVCALInt(Line,
"X-SONYERICSSON-DST", &dstflag)) {
1898 if (strstr(Line,
"END:VTODO")) {
1908 smfprintf(di,
"Adjusting DST: %i\n", dstflag);
1910 smfprintf(di,
"Unknown DST flag: %i\n", dstflag);
1917 if (strstr(Line,
"CATEGORIES:")) {
1926 if (
ReadVCALInt(Line,
"X-MOZILLA-ALARM-DEFAULT-LENGTH", &deltatime)) {
1929 if (
ReadVCALInt(Line,
"X-SONYERICSSON-DST", &dstflag)) {
1944 if (
ReadVCALDate(Line,
"COMLETED", &Date, &is_date_only)) {
1949 if (
ReadVCALDate(Line,
"DTSTART", &Date, &is_date_only)) {
1954 if (
ReadVCALDate(Line,
"DALARM", &Date, &is_date_only)) {
1959 if (
ReadVCALDate(Line,
"LAST-MODIFIED", &Date, &is_date_only)) {
1964 if (
ReadVCALDate(Line,
"AALARM", &Date, &is_date_only)) {
1998 if (strstr(Line,
"STATUS:COMPLETED")) {
2003 if (strstr(Line,
"STATUS:NEEDS ACTION")) {
2032 unsigned char Line[2000],Buff[2000];
2041 error =
MyGetLine(Buffer, Pos, Line, strlen(Buffer),
sizeof(Line),
TRUE);
2042 if (error !=
ERR_NONE)
return error;
2043 if (strlen(Line) == 0)
break;
2046 if (strstr(Line,
"BEGIN:VNOTE")) Level = 1;
2050 if (strstr(Line,
"END:VNOTE")) {
2070 error =
VC_StoreLine(Buffer, buff_len, Length,
"BEGIN:VNOTE");
2071 if (error !=
ERR_NONE)
return error;
2072 error =
VC_StoreLine(Buffer, buff_len, Length,
"VERSION:1.1");
2073 if (error !=
ERR_NONE)
return error;
2075 if (error !=
ERR_NONE)
return error;
2076 error =
VC_StoreLine(Buffer, buff_len, Length,
"END:VNOTE");
2077 if (error !=
ERR_NONE)
return error;
GSM_Error GSM_EncodeVCALENDAR(char *Buffer, const size_t buff_len, size_t *Length, GSM_CalendarEntry *note, const gboolean header, const GSM_VCalendarVersion Version)
void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone)
int GSM_Make_VCAL_Lines(unsigned char *Buffer, int *lBuffer)
char * DecodeUnicodeString(const unsigned char *src)
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
#define GET_FREQUENCY(terminate)
GSM_ToDo_Priority Priority
GSM_Error GSM_DecodeVCAL_DOW(const char *Buffer, int *Output)
int GetWeekOfMonth(unsigned int year, unsigned int month, unsigned int day)
GSM_Error VC_StoreDateTime(char *Buffer, const size_t buff_len, size_t *Pos, const GSM_DateTime *Date, const char *Start)
GSM_CalendarNoteType Type
void GetTimeDifference(unsigned long diff, GSM_DateTime *DT, gboolean Plus, int multi)
GSM_Error VC_StoreText(char *Buffer, const size_t buff_len, size_t *Pos, const unsigned char *Text, const char *Start, const gboolean UTF8)
int GetDayOfYear(unsigned int year, unsigned int month, unsigned int day)
gboolean mywstrncasecmp(unsigned const char *a, unsigned const char *b, int num)
#define NEXT_NOSPACE(terminate)
void GSM_Calendar_AdjustDate(GSM_CalendarEntry *note, GSM_DeltaTime *delta)
int GetDayOfWeek(unsigned int year, unsigned int month, unsigned int day)
size_t UnicodeLength(const unsigned char *str)
gboolean ReadVCALDate(char *Buffer, const char *Start, GSM_DateTime *Date, gboolean *is_date_only)
void GSM_SetCalendarRecurranceRepeat(GSM_Debug_Info *di, unsigned char *rec, unsigned char *endday, GSM_CalendarEntry *entry)
GSM_Error VC_StoreLine(char *Buffer, const size_t buff_len, size_t *Pos, const char *format,...)
gboolean GSM_IsCalendarNoteFromThePast(GSM_CalendarEntry *note)
void GSM_GetCalendarRecurranceRepeat(GSM_Debug_Info *di, unsigned char *rec, unsigned char *endday, GSM_CalendarEntry *entry)
gboolean ReadVCALDateTime(const char *Buffer, GSM_DateTime *dt)
void GSM_CalendarFindDefaultTextTimeAlarmPhone(GSM_CalendarEntry *entry, int *Text, int *Time, int *Alarm, int *Phone, int *EndTime, int *Location)
#define GET_NUMBER(type, terminate)
GSM_Error VC_Store(char *Buffer, const size_t buff_len, size_t *Pos, const char *format,...)
char Text[(GSM_MAX_NOTE_TEXT_LENGTH+1) *2]
gboolean ReadVCALInt(char *Buffer, const char *Start, int *Value)
GSM_Error GSM_EncodeVCAL_RRULE(char *Buffer, const size_t buff_len, size_t *Length, GSM_CalendarEntry *note, int TimePos UNUSED, GSM_VCalendarVersion Version)
GSM_CalendarNoteType Type
#define NEXT_CHAR(terminate)
GSM_SubToDoEntry Entries[GSM_TODO_ENTRIES]
GSM_DateTime VCALTimeDiff(GSM_DateTime *Alarm, GSM_DateTime *Time)
GSM_Error GSM_EncodeVTODO(char *Buffer, const size_t buff_len, size_t *Length, const GSM_ToDoEntry *note, const gboolean header, const GSM_VToDoVersion Version)
GSM_Error GSM_DecodeVCALENDAR_VTODO(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer)
GSM_CalendarType EntryType
#define GET_DOW(type, terminate)
GSM_Error GSM_EncodeVNTFile(char *Buffer, const size_t buff_len, size_t *Length, GSM_NoteEntry *Note)
void GSM_ToDo_AdjustDate(GSM_ToDoEntry *note, GSM_DeltaTime *delta)
GSM_Error GSM_DecodeVNOTE(char *Buffer, size_t *Pos, GSM_NoteEntry *Note)
gboolean ReadVCALText(char *Buffer, const char *Start, unsigned char *Value, const gboolean UTF8, GSM_EntryLocation *location)
GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES]
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
time_t Fill_Time_T(GSM_DateTime DT)
int smfprintf(GSM_Debug_Info *d, const char *format,...)
GSM_DeltaTime ReadVCALTriggerTime(unsigned char *Buffer)
GSM_DateTime GSM_AddTime(GSM_DateTime DT, GSM_DeltaTime delta)
GSM_Error GSM_Translate_Category_To_VCal(char *string, const GSM_CalendarNoteType Type)
GSM_Error GSM_DecodeVCAL_RRULE(GSM_Debug_Info *di, const char *Buffer, GSM_CalendarEntry *Calendar, int TimePos)
unsigned char Text[(GSM_MAX_TODO_TEXT_LENGTH+1) *2]
GSM_Error MyGetLine(char *Buffer, size_t *Pos, char *OutBuffer, size_t MaxLen, size_t MaxOutLen, gboolean MergeLines)
GSM_Error VC_StoreDate(char *Buffer, const size_t buff_len, size_t *Pos, const GSM_DateTime *Date, const char *Start)
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
GSM_Error GSM_Translate_Category_From_VCal(const char *string, GSM_CalendarNoteType *Type)