author | zautrix <zautrix> | 2004-08-30 07:47:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-30 07:47:56 (UTC) |
commit | b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2 (patch) (side-by-side diff) | |
tree | 99223dd8edf0e00a4f060610ea0642f915cf4703 /gammu | |
parent | 78f44f13835e3fa501997f485b505b193bd474f5 (diff) | |
download | kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.zip kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.tar.gz kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.tar.bz2 |
Changes in gammu connection
-rw-r--r-- | gammu/emb/common/service/gsmcal.c | 83 |
1 files changed, 43 insertions, 40 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 @@ -96,26 +96,26 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note *Length+=sprintf(Buffer+(*Length), "BEGIN:VEVENT%c%c",13,10); if (Version == Nokia_VCalendar) { *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); switch (note->Type) { case GSM_CAL_REMINDER: - *Length+=sprintf(Buffer+(*Length), "REMINDER%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Reminder%c%c",13,10); break; case GSM_CAL_MEMO: - *Length+=sprintf(Buffer+(*Length), "MISCELLANEOUS%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); break; case GSM_CAL_CALL: - *Length+=sprintf(Buffer+(*Length), "PHONE CALL%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); break; case GSM_CAL_BIRTHDAY: - *Length+=sprintf(Buffer+(*Length), "SPECIAL OCCASION%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Special Occasion%c%c",13,10); break; case GSM_CAL_MEETING: default: - *Length+=sprintf(Buffer+(*Length), "MEETING%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10); break; } if (note->Type == GSM_CAL_CALL) { buffer[0] = 0; buffer[1] = 0; if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); @@ -156,23 +156,23 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note } } } else if (Version == Siemens_VCalendar) { *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); switch (note->Type) { case GSM_CAL_MEETING: - *Length+=sprintf(Buffer+(*Length), "MEETING%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); break; case GSM_CAL_CALL: - *Length+=sprintf(Buffer+(*Length), "PHONE CALL%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); break; case GSM_CAL_BIRTHDAY: - *Length+=sprintf(Buffer+(*Length), "ANNIVERSARY%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Anniversary%c%c",13,10); break; case GSM_CAL_MEMO: default: - *Length+=sprintf(Buffer+(*Length), "MISCELLANEOUS%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); break; } if (Time == -1) return ERR_UNKNOWN; SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); @@ -202,29 +202,29 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note SaveVCALText(Buffer, Length, note->Entries[Text].Text, "DESCRIPTION"); } } else if (Version == SonyEricsson_VCalendar) { *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); switch (note->Type) { case GSM_CAL_MEETING: - *Length+=sprintf(Buffer+(*Length), "MEETING%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); break; case GSM_CAL_REMINDER: - *Length+=sprintf(Buffer+(*Length), "DATE%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10); break; case GSM_CAL_TRAVEL: - *Length+=sprintf(Buffer+(*Length), "TRAVEL%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10); break; case GSM_CAL_VACATION: - *Length+=sprintf(Buffer+(*Length), "VACATION%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); break; case GSM_CAL_BIRTHDAY: - *Length+=sprintf(Buffer+(*Length), "ANNIVERSARY%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10); break; case GSM_CAL_MEMO: default: - *Length+=sprintf(Buffer+(*Length), "MISCELLANEOUS%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); break; } if (Time == -1) return ERR_UNKNOWN; SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); @@ -240,12 +240,13 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note if (Location != -1) { SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); } } + *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); *Length+=sprintf(Buffer+(*Length), "END:VEVENT%c%c",13,10); if (header) *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); return ERR_NONE; } @@ -297,21 +298,21 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h if (Version == Nokia_VToDo) { if (Text == -1) return ERR_UNKNOWN; SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); if (Completed == -1) { - *Length+=sprintf(Buffer+(*Length), "STATUS:NEEDS ACTION%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); } else { - *Length+=sprintf(Buffer+(*Length), "STATUS:COMPLETED%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); } switch (note->Priority) { - case GSM_Priority_Low : *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; - case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:2%c%c",13,10); break; - case GSM_Priority_High : *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; + case GSM_Priority_Low : *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; + case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; + case GSM_Priority_High : *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; } if (EndTime != -1) { SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DUE"); } @@ -324,28 +325,29 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h } } else if (Version == SonyEricsson_VToDo) { if (Text == -1) return ERR_UNKNOWN; SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); if (Completed == -1) { - *Length+=sprintf(Buffer+(*Length), "STATUS:NEEDS ACTION%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:0%c%c",13,10); } else { - *Length+=sprintf(Buffer+(*Length), "STATUS:COMPLETED%c%c",13,10); + *Length+=sprintf(Buffer+(*Length), "PERCENT-COMPLETE:100%c%c",13,10); } switch (note->Priority) { - case GSM_Priority_Low : *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; - case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:2%c%c",13,10); break; + case GSM_Priority_Low : *Length+=sprintf(Buffer+(*Length), "PRIORITY:5%c%c",13,10); break; + case GSM_Priority_Medium: *Length+=sprintf(Buffer+(*Length), "PRIORITY:3%c%c",13,10); break; case GSM_Priority_High : *Length+=sprintf(Buffer+(*Length), "PRIORITY:1%c%c",13,10); break; } if (Alarm != -1) { SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); } } + *Length+=sprintf(Buffer+(*Length), "X-PILOTID:%d%c%c",note->Location,13,10); *Length+=sprintf(Buffer+(*Length), "END:VTODO%c%c",13,10); if (header) { *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); } return ERR_NONE; @@ -366,31 +368,32 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda case 0: if (strstr(Line,"BEGIN:VEVENT")) { Calendar->Type = GSM_CAL_MEMO; Level = 1; } if (strstr(Line,"BEGIN:VTODO")) { - ToDo->Priority = GSM_Priority_Low; + ToDo->Priority = GSM_Priority_Medium; Level = 2; } break; case 1: /* Calendar note */ if (strstr(Line,"END:VEVENT")) { if (Calendar->EntriesNum == 0) return ERR_EMPTY; return ERR_NONE; } - if (strstr(Line,"CATEGORIES:REMINDER")) Calendar->Type = GSM_CAL_REMINDER; - if (strstr(Line,"CATEGORIES:DATE")) Calendar->Type = GSM_CAL_REMINDER;//SE - if (strstr(Line,"CATEGORIES:TRAVEL")) Calendar->Type = GSM_CAL_TRAVEL; //SE - if (strstr(Line,"CATEGORIES:VACATION")) Calendar->Type = GSM_CAL_VACATION;//SE - if (strstr(Line,"CATEGORIES:MISCELLANEOUS")) Calendar->Type = GSM_CAL_MEMO; - if (strstr(Line,"CATEGORIES:PHONE CALL")) Calendar->Type = GSM_CAL_CALL; - if (strstr(Line,"CATEGORIES:SPECIAL OCCASION")) Calendar->Type = GSM_CAL_BIRTHDAY; - if (strstr(Line,"CATEGORIES:ANNIVERSARY")) Calendar->Type = GSM_CAL_BIRTHDAY; - if (strstr(Line,"CATEGORIES:MEETING")) Calendar->Type = GSM_CAL_MEETING; - if (strstr(Line,"CATEGORIES:APPOINTMENT")) Calendar->Type = GSM_CAL_MEETING; + Calendar->Type = GSM_CAL_MEETING; + if (strstr(Line,"CATEGORIES:Reminder")) Calendar->Type = GSM_CAL_REMINDER; + if (strstr(Line,"CATEGORIES:Date")) Calendar->Type = GSM_CAL_REMINDER;//SE + if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE + if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE + if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO; + if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL; + if (strstr(Line,"CATEGORIES:Special Occasion")) Calendar->Type = GSM_CAL_BIRTHDAY; + if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY; + if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING; + if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING; if (strstr(Line,"RRULE:D1")) { Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; Calendar->Entries[Calendar->EntriesNum].Number = 1*24; Calendar->EntriesNum++; } if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) { @@ -469,22 +472,22 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); ToDo->EntriesNum++; } if (ReadVCALText(Line, "PRIORITY", Buff)) { if (ToDoVer == SonyEricsson_VToDo) { ToDo->Priority = GSM_Priority_Low; - if (atoi(DecodeUnicodeString(Buff))==2) ToDo->Priority = GSM_Priority_Medium; - if (atoi(DecodeUnicodeString(Buff))==1) ToDo->Priority = GSM_Priority_High; + if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; + if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff)); } else if (ToDoVer == Nokia_VToDo) { ToDo->Priority = GSM_Priority_Low; - if (atoi(DecodeUnicodeString(Buff))==2) ToDo->Priority = GSM_Priority_Medium; - if (atoi(DecodeUnicodeString(Buff))==3) ToDo->Priority = GSM_Priority_High; + if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; + if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; } } - if (strstr(Line,"STATUS:COMPLETED")) { + if (strstr(Line,"PERCENT-COMPLETE:100")) { ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED; ToDo->Entries[ToDo->EntriesNum].Number = 1; ToDo->EntriesNum++; } break; } |