summaryrefslogtreecommitdiffabout
path: root/gammu/emb
authorzautrix <zautrix>2004-08-30 07:47:56 (UTC)
committer zautrix <zautrix>2004-08-30 07:47:56 (UTC)
commitb36bcd92b643c87ee5e2bfc39076ea56abf4c7d2 (patch) (unidiff)
tree99223dd8edf0e00a4f060610ea0642f915cf4703 /gammu/emb
parent78f44f13835e3fa501997f485b505b193bd474f5 (diff)
downloadkdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.zip
kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.tar.gz
kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.tar.bz2
Changes in gammu connection
Diffstat (limited to 'gammu/emb') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c85
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
@@ -99,20 +99,20 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
99 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); 99 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
100 switch (note->Type) { 100 switch (note->Type) {
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;
113 case GSM_CAL_MEETING: 113 case GSM_CAL_MEETING:
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;
117 } 117 }
118 if (note->Type == GSM_CAL_CALL) { 118 if (note->Type == GSM_CAL_CALL) {
@@ -159,17 +159,17 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
159 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); 159 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
160 switch (note->Type) { 160 switch (note->Type) {
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;
170 case GSM_CAL_MEMO: 170 case GSM_CAL_MEMO:
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;
174 } 174 }
175 175
@@ -205,23 +205,23 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
205 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); 205 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
206 switch (note->Type) { 206 switch (note->Type) {
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;
222 case GSM_CAL_MEMO: 222 case GSM_CAL_MEMO:
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;
226 } 226 }
227 227
@@ -243,6 +243,7 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
243 } 243 }
244 } 244 }
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);
247 if (header) *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); 248 if (header) *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10);
248 249
@@ -300,15 +301,15 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h
300 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); 301 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY");
301 302
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 }
307 308
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 }
313 314
314 if (EndTime != -1) { 315 if (EndTime != -1) {
@@ -327,14 +328,14 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h
327 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); 328 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY");
328 329
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 }
334 335
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;
339 } 340 }
340 341
@@ -343,6 +344,7 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h
343 } 344 }
344 } 345 }
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);
347 349
348 if (header) { 350 if (header) {
@@ -369,7 +371,7 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
369 Level = 1; 371 Level = 1;
370 } 372 }
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;
374 } 376 }
375 break; 377 break;
@@ -377,17 +379,18 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
377 if (strstr(Line,"END:VEVENT")) { 379 if (strstr(Line,"END:VEVENT")) {
378 if (Calendar->EntriesNum == 0) return ERR_EMPTY; 380 if (Calendar->EntriesNum == 0) return ERR_EMPTY;
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")) {
392 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 395 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
393 Calendar->Entries[Calendar->EntriesNum].Number = 1*24; 396 Calendar->Entries[Calendar->EntriesNum].Number = 1*24;
@@ -472,16 +475,16 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
472 if (ReadVCALText(Line, "PRIORITY", Buff)) { 475 if (ReadVCALText(Line, "PRIORITY", Buff)) {
473 if (ToDoVer == SonyEricsson_VToDo) { 476 if (ToDoVer == SonyEricsson_VToDo) {
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));
478 } else if (ToDoVer == Nokia_VToDo) { 481 } else if (ToDoVer == Nokia_VToDo) {
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;
486 ToDo->Entries[ToDo->EntriesNum].Number = 1; 489 ToDo->Entries[ToDo->EntriesNum].Number = 1;
487 ToDo->EntriesNum++; 490 ToDo->EntriesNum++;