author | zautrix <zautrix> | 2004-09-12 13:11:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-12 13:11:10 (UTC) |
commit | b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26 (patch) (side-by-side diff) | |
tree | a25dbba0cac09b7a7892405b11eb08c7d02e6b6b /gammu/emb/common/service | |
parent | 3c954091cb8d90c185403c68a8bbbb2a961f67fe (diff) | |
download | kdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.zip kdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.tar.gz kdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.tar.bz2 |
many phonesync fixes
-rw-r--r-- | gammu/emb/common/service/gsmcal.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c index 598292c..ddf9790 100644 --- a/gammu/emb/common/service/gsmcal.c +++ b/gammu/emb/common/service/gsmcal.c @@ -17,257 +17,257 @@ bool IsCalendarNoteFromThePast(GSM_CalendarEntry *note) switch (note->Entries[i].EntryType) { case CAL_RECURRANCE: Past = false; break; case CAL_START_DATETIME : if (note->Entries[i].Date.Year > DT.Year) Past = false; if (note->Entries[i].Date.Year == DT.Year && note->Entries[i].Date.Month > DT.Month) Past = false; if (note->Entries[i].Date.Year == DT.Year && note->Entries[i].Date.Month == DT.Month && note->Entries[i].Date.Day > DT.Day) Past = false; break; default: break; } if (!Past) break; } switch (note->Type) { case GSM_CAL_BIRTHDAY: Past = false; break; default: break; } return Past; } void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entry, int *Text, int *Time, int *Alarm, int *Phone, int *Recurrance, int *EndTime, int *Location) { int i; *Text = -1; *Time = -1; *Alarm = -1; *Phone = -1; *Recurrance = -1; *EndTime = -1; *Location = -1; for (i = 0; i < entry->EntriesNum; i++) { switch (entry->Entries[i].EntryType) { case CAL_START_DATETIME : if (*Time == -1) *Time = i; break; case CAL_END_DATETIME : if (*EndTime == -1) *EndTime = i; break; case CAL_ALARM_DATETIME : case CAL_SILENT_ALARM_DATETIME: if (*Alarm == -1) *Alarm = i; break; case CAL_RECURRANCE: if (*Recurrance == -1) *Recurrance = i; break; case CAL_TEXT: if (*Text == -1) *Text = i; break; case CAL_PHONE: if (*Phone == -1) *Phone = i; break; case CAL_LOCATION: if (*Location == -1) *Location = i; break; default: break; } } } GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version) { int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; char buffer[2000]; GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); if (header) { *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); } *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); break; case GSM_CAL_MEMO: *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); break; case GSM_CAL_CALL: *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); break; case GSM_CAL_MEETING: default: *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); if (Text != -1) { if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); } SaveVCALText(Buffer, Length, buffer, "SUMMARY"); } else { SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); } if (note->Type == GSM_CAL_MEETING && Location != -1) { SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); } if (Time == -1) return ERR_UNKNOWN; SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); if (EndTime != -1) { SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); } if (Alarm != -1) { if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); } else { - SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); + SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); } } /* Birthday is known to be recurranced */ if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { switch(note->Entries[Recurrance].Number/24) { case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break; case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1 #0%c%c",13,10); break; } } } 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); break; case GSM_CAL_CALL: *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); break; case GSM_CAL_BIRTHDAY: *Length+=sprintf(Buffer+(*Length), "Anniversary%c%c",13,10); break; case GSM_CAL_MEMO: default: *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); break; } if (Time == -1) return ERR_UNKNOWN; SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); if (Alarm != -1) { SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); } if (Recurrance != -1) { switch(note->Entries[Recurrance].Number/24) { case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10); break; case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10); break; case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10); break; case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%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); if (Text != -1) { if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); } SaveVCALText(Buffer, Length, buffer, "DESCRIPTION"); } else { 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); break; case GSM_CAL_REMINDER: *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10); break; case GSM_CAL_TRAVEL: *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10); break; case GSM_CAL_VACATION: *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); break; case GSM_CAL_BIRTHDAY: *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10); break; case GSM_CAL_MEMO: default: *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); break; } if (Time == -1) return ERR_UNKNOWN; SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); if (EndTime != -1) { SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); } if (Alarm != -1) { SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); } SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); 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; } void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone) { int i; *Text = -1; *EndTime = -1; *Alarm = -1; *Completed = -1; *Phone = -1; for (i = 0; i < entry->EntriesNum; i++) { switch (entry->Entries[i].EntryType) { case TODO_END_DATETIME : if (*EndTime == -1) *EndTime = i; break; case TODO_ALARM_DATETIME : case TODO_SILENT_ALARM_DATETIME: if (*Alarm == -1) *Alarm = i; break; case TODO_TEXT: if (*Text == -1) *Text = i; break; |