summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common
authorzautrix <zautrix>2004-09-12 15:24:11 (UTC)
committer zautrix <zautrix>2004-09-12 15:24:11 (UTC)
commita222c2f7369eeefd19454c973c0cc48300f72bec (patch) (side-by-side diff)
tree6f01a5922ea622add6960f3fad703e8e8f099caa /gammu/emb/common
parentb2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26 (diff)
downloadkdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.zip
kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.tar.gz
kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.tar.bz2
many phone sync fixes
Diffstat (limited to 'gammu/emb/common') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c
index ddf9790..0ea8e06 100644
--- a/gammu/emb/common/service/gsmcal.c
+++ b/gammu/emb/common/service/gsmcal.c
@@ -349,164 +349,164 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h
if (header) {
*Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10);
}
return ERR_NONE;
}
GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer)
{
unsigned char Line[2000],Buff[2000];
int Level = 0;
Calendar->EntriesNum = 0;
ToDo->EntriesNum = 0;
while (1) {
MyGetLine(Buffer, Pos, Line, strlen(Buffer));
if (strlen(Line) == 0) break;
switch (Level) {
case 0:
if (strstr(Line,"BEGIN:VEVENT")) {
Calendar->Type = GSM_CAL_MEMO;
Level = 1;
}
if (strstr(Line,"BEGIN:VTODO")) {
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;
}
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"))) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
Calendar->Entries[Calendar->EntriesNum].Number = 7*24;
Calendar->EntriesNum++;
}
if (strstr(Line,"RRULE:W2")) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
Calendar->Entries[Calendar->EntriesNum].Number = 14*24;
Calendar->EntriesNum++;
}
if (strstr(Line,"RRULE:MD1")) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
Calendar->Entries[Calendar->EntriesNum].Number = 30*24;
Calendar->EntriesNum++;
}
if (strstr(Line,"RRULE:YD1")) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
Calendar->Entries[Calendar->EntriesNum].Number = 365*24;
Calendar->EntriesNum++;
}
if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT;
CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
Calendar->EntriesNum++;
}
if (ReadVCALText(Line, "LOCATION", Buff)) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION;
CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
Calendar->EntriesNum++;
}
if (ReadVCALText(Line, "DTSTART", Buff)) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME;
ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
Calendar->EntriesNum++;
}
if (ReadVCALText(Line, "DTEND", Buff)) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME;
ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
Calendar->EntriesNum++;
}
if (ReadVCALText(Line, "DALARM", Buff)) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME;
ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
Calendar->EntriesNum++;
}
if (ReadVCALText(Line, "AALARM", Buff)) {
Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME;
ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
Calendar->EntriesNum++;
}
break;
case 2: /* ToDo note */
if (strstr(Line,"END:VTODO")) {
if (ToDo->EntriesNum == 0) return ERR_EMPTY;
return ERR_NONE;
}
if (ReadVCALText(Line, "DUE", Buff)) {
ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME;
ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
ToDo->EntriesNum++;
}
if (ReadVCALText(Line, "DALARM", Buff)) {
ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME;
ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
ToDo->EntriesNum++;
}
if (ReadVCALText(Line, "AALARM", Buff)) {
ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME;
ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
ToDo->EntriesNum++;
}
if (ReadVCALText(Line, "SUMMARY", Buff)) {
ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT;
CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff);
ToDo->EntriesNum++;
}
if (ReadVCALText(Line, "PRIORITY", Buff)) {
if (ToDoVer == SonyEricsson_VToDo) {
- ToDo->Priority = GSM_Priority_Low;
+ ToDo->Priority = GSM_Priority_Medium;
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;
+ ToDo->Priority = GSM_Priority_Medium;
if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low;
if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High;
}
}
if (strstr(Line,"PERCENT-COMPLETE:100")) {
ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED;
ToDo->Entries[ToDo->EntriesNum].Number = 1;
ToDo->EntriesNum++;
}
break;
}
}
if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY;
return ERR_NONE;
}
GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note)
{
*Length+=sprintf(Buffer+(*Length), "BEGIN:VNOTE%c%c",13,10);
*Length+=sprintf(Buffer+(*Length), "VERSION:1.1%c%c",13,10);
SaveVCALText(Buffer, Length, Note->Text, "BODY");
*Length+=sprintf(Buffer+(*Length), "END:VNOTE%c%c",13,10);
return ERR_NONE;
}
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/