-rw-r--r-- | gammu/emb/common/service/gsmcal.c | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c index 950e35e..598292c 100644 --- a/gammu/emb/common/service/gsmcal.c +++ b/gammu/emb/common/service/gsmcal.c | |||
@@ -101,12 +101,12 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
101 | case GSM_CAL_REMINDER: | 101 | case GSM_CAL_REMINDER: |
102 | *Length+=sprintf(Buffer+(*Length), "REMINDER%c%c",13,10); | 102 | *Length+=sprintf(Buffer+(*Length), "Reminder%c%c",13,10); |
103 | break; | 103 | break; |
104 | case GSM_CAL_MEMO: | 104 | case GSM_CAL_MEMO: |
105 | *Length+=sprintf(Buffer+(*Length), "MISCELLANEOUS%c%c",13,10); | 105 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); |
106 | break; | 106 | break; |
107 | case GSM_CAL_CALL: | 107 | case GSM_CAL_CALL: |
108 | *Length+=sprintf(Buffer+(*Length), "PHONE CALL%c%c",13,10); | 108 | *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); |
109 | break; | 109 | break; |
110 | case GSM_CAL_BIRTHDAY: | 110 | case GSM_CAL_BIRTHDAY: |
111 | *Length+=sprintf(Buffer+(*Length), "SPECIAL OCCASION%c%c",13,10); | 111 | *Length+=sprintf(Buffer+(*Length), "Special Occasion%c%c",13,10); |
112 | break; | 112 | break; |
@@ -114,3 +114,3 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
114 | default: | 114 | default: |
115 | *Length+=sprintf(Buffer+(*Length), "MEETING%c%c",13,10); | 115 | *Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10); |
116 | break; | 116 | break; |
@@ -161,9 +161,9 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
161 | case GSM_CAL_MEETING: | 161 | case GSM_CAL_MEETING: |
162 | *Length+=sprintf(Buffer+(*Length), "MEETING%c%c",13,10); | 162 | *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); |
163 | break; | 163 | break; |
164 | case GSM_CAL_CALL: | 164 | case GSM_CAL_CALL: |
165 | *Length+=sprintf(Buffer+(*Length), "PHONE CALL%c%c",13,10); | 165 | *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); |
166 | break; | 166 | break; |
167 | case GSM_CAL_BIRTHDAY: | 167 | case GSM_CAL_BIRTHDAY: |
168 | *Length+=sprintf(Buffer+(*Length), "ANNIVERSARY%c%c",13,10); | 168 | *Length+=sprintf(Buffer+(*Length), "Anniversary%c%c",13,10); |
169 | break; | 169 | break; |
@@ -171,3 +171,3 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
171 | default: | 171 | default: |
172 | *Length+=sprintf(Buffer+(*Length), "MISCELLANEOUS%c%c",13,10); | 172 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); |
173 | break; | 173 | break; |
@@ -207,15 +207,15 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
207 | case GSM_CAL_MEETING: | 207 | case GSM_CAL_MEETING: |
208 | *Length+=sprintf(Buffer+(*Length), "MEETING%c%c",13,10); | 208 | *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); |
209 | break; | 209 | break; |
210 | case GSM_CAL_REMINDER: | 210 | case GSM_CAL_REMINDER: |
211 | *Length+=sprintf(Buffer+(*Length), "DATE%c%c",13,10); | 211 | *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10); |
212 | break; | 212 | break; |
213 | case GSM_CAL_TRAVEL: | 213 | case GSM_CAL_TRAVEL: |
214 | *Length+=sprintf(Buffer+(*Length), "TRAVEL%c%c",13,10); | 214 | *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10); |
215 | break; | 215 | break; |
216 | case GSM_CAL_VACATION: | 216 | case GSM_CAL_VACATION: |
217 | *Length+=sprintf(Buffer+(*Length), "VACATION%c%c",13,10); | 217 | *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); |
218 | break; | 218 | break; |
219 | case GSM_CAL_BIRTHDAY: | 219 | case GSM_CAL_BIRTHDAY: |
220 | *Length+=sprintf(Buffer+(*Length), "ANNIVERSARY%c%c",13,10); | 220 | *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10); |
221 | break; | 221 | break; |
@@ -223,3 +223,3 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
223 | default: | 223 | default: |
224 | *Length+=sprintf(Buffer+(*Length), "MISCELLANEOUS%c%c",13,10); | 224 | *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); |
225 | break; | 225 | break; |
@@ -245,2 +245,3 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
245 | 245 | ||
246 | *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); | ||
246 | *Length+=sprintf(Buffer+(*Length), "END:VEVENT%c%c",13,10); | 247 | *Length+=sprintf(Buffer+(*Length), "END:VEVENT%c%c",13,10); |
@@ -302,5 +303,5 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h | |||
302 | if (Completed == -1) { | 303 | if (Completed == -1) { |
303 | *Length+=sprintf(Buffer+(*Length), "STATUS:NEEDS ACTION%c%c",13,10); | 304 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); |
304 | } else { | 305 | } else { |
305 | *Length+=sprintf(Buffer+(*Length), "STATUS:COMPLETED%c%c",13,10); | 306 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); |
306 | } | 307 | } |
@@ -308,5 +309,5 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h | |||
308 | switch (note->Priority) { | 309 | switch (note->Priority) { |
309 | case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; | 310 | case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; |
310 | case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:2%c%c",13,10); break; | 311 | case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; |
311 | case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; | 312 | case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; |
312 | } | 313 | } |
@@ -329,5 +330,5 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h | |||
329 | if (Completed == -1) { | 330 | if (Completed == -1) { |
330 | *Length+=sprintf(Buffer+(*Length), "STATUS:NEEDS ACTION%c%c",13,10); | 331 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); |
331 | } else { | 332 | } else { |
332 | *Length+=sprintf(Buffer+(*Length), "STATUS:COMPLETED%c%c",13,10); | 333 | *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); |
333 | } | 334 | } |
@@ -335,4 +336,4 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h | |||
335 | switch (note->Priority) { | 336 | switch (note->Priority) { |
336 | case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; | 337 | case GSM_Priority_Low: *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; |
337 | case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:2%c%c",13,10); break; | 338 | case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; |
338 | case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; | 339 | case GSM_Priority_High: *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; |
@@ -345,2 +346,3 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h | |||
345 | 346 | ||
347 | *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); | ||
346 | *Length+=sprintf(Buffer+(*Length), "END:VTODO%c%c",13,10); | 348 | *Length+=sprintf(Buffer+(*Length), "END:VTODO%c%c",13,10); |
@@ -371,3 +373,3 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda | |||
371 | if (strstr(Line,"BEGIN:VTODO")) { | 373 | if (strstr(Line,"BEGIN:VTODO")) { |
372 | ToDo->Priority = GSM_Priority_Low; | 374 | ToDo->Priority = GSM_Priority_Medium; |
373 | Level = 2; | 375 | Level = 2; |
@@ -379,13 +381,14 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda | |||
379 | return ERR_NONE; | 381 | return ERR_NONE; |
380 | } | 382 | } |
381 | if (strstr(Line,"CATEGORIES:REMINDER")) Calendar->Type = GSM_CAL_REMINDER; | 383 | Calendar->Type = GSM_CAL_MEETING; |
382 | if (strstr(Line,"CATEGORIES:DATE")) Calendar->Type = GSM_CAL_REMINDER;//SE | 384 | if (strstr(Line,"CATEGORIES:Reminder")) Calendar->Type = GSM_CAL_REMINDER; |
383 | if (strstr(Line,"CATEGORIES:TRAVEL")) Calendar->Type = GSM_CAL_TRAVEL; //SE | 385 | if (strstr(Line,"CATEGORIES:Date")) Calendar->Type = GSM_CAL_REMINDER;//SE |
384 | if (strstr(Line,"CATEGORIES:VACATION")) Calendar->Type = GSM_CAL_VACATION;//SE | 386 | if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE |
385 | if (strstr(Line,"CATEGORIES:MISCELLANEOUS")) Calendar->Type = GSM_CAL_MEMO; | 387 | if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE |
386 | if (strstr(Line,"CATEGORIES:PHONE CALL")) Calendar->Type = GSM_CAL_CALL; | 388 | if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO; |
387 | if (strstr(Line,"CATEGORIES:SPECIAL OCCASION")) Calendar->Type = GSM_CAL_BIRTHDAY; | 389 | if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL; |
388 | if (strstr(Line,"CATEGORIES:ANNIVERSARY")) Calendar->Type = GSM_CAL_BIRTHDAY; | 390 | if (strstr(Line,"CATEGORIES:Special Occasion")) Calendar->Type = GSM_CAL_BIRTHDAY; |
389 | if (strstr(Line,"CATEGORIES:MEETING")) Calendar->Type = GSM_CAL_MEETING; | 391 | if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY; |
390 | if (strstr(Line,"CATEGORIES:APPOINTMENT")) Calendar->Type = GSM_CAL_MEETING; | 392 | if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING; |
393 | if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING; | ||
391 | if (strstr(Line,"RRULE:D1")) { | 394 | if (strstr(Line,"RRULE:D1")) { |
@@ -474,4 +477,4 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda | |||
474 | ToDo->Priority = GSM_Priority_Low; | 477 | ToDo->Priority = GSM_Priority_Low; |
475 | if (atoi(DecodeUnicodeString(Buff))==2) ToDo->Priority = GSM_Priority_Medium; | 478 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; |
476 | if (atoi(DecodeUnicodeString(Buff))==1) ToDo->Priority = GSM_Priority_High; | 479 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; |
477 | dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff)); | 480 | dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff)); |
@@ -479,7 +482,7 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda | |||
479 | ToDo->Priority = GSM_Priority_Low; | 482 | ToDo->Priority = GSM_Priority_Low; |
480 | if (atoi(DecodeUnicodeString(Buff))==2) ToDo->Priority = GSM_Priority_Medium; | 483 | if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; |
481 | if (atoi(DecodeUnicodeString(Buff))==3) ToDo->Priority = GSM_Priority_High; | 484 | if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; |
482 | } | 485 | } |
483 | } | 486 | } |
484 | if (strstr(Line,"STATUS:COMPLETED")) { | 487 | if (strstr(Line,"PERCENT-COMPLETE:100")) { |
485 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED; | 488 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED; |