author | zautrix <zautrix> | 2004-08-30 07:47:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-30 07:47:56 (UTC) |
commit | b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2 (patch) (unidiff) | |
tree | 99223dd8edf0e00a4f060610ea0642f915cf4703 /gammu/emb/common | |
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 | 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 | |||
@@ -54,456 +54,459 @@ void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entr | |||
54 | *Location= -1; | 54 | *Location= -1; |
55 | for (i = 0; i < entry->EntriesNum; i++) { | 55 | for (i = 0; i < entry->EntriesNum; i++) { |
56 | switch (entry->Entries[i].EntryType) { | 56 | switch (entry->Entries[i].EntryType) { |
57 | case CAL_START_DATETIME : | 57 | case CAL_START_DATETIME : |
58 | if (*Time == -1) *Time = i; | 58 | if (*Time == -1) *Time = i; |
59 | break; | 59 | break; |
60 | case CAL_END_DATETIME : | 60 | case CAL_END_DATETIME : |
61 | if (*EndTime == -1) *EndTime = i; | 61 | if (*EndTime == -1) *EndTime = i; |
62 | break; | 62 | break; |
63 | case CAL_ALARM_DATETIME : | 63 | case CAL_ALARM_DATETIME : |
64 | case CAL_SILENT_ALARM_DATETIME: | 64 | case CAL_SILENT_ALARM_DATETIME: |
65 | if (*Alarm == -1) *Alarm = i; | 65 | if (*Alarm == -1) *Alarm = i; |
66 | break; | 66 | break; |
67 | case CAL_RECURRANCE: | 67 | case CAL_RECURRANCE: |
68 | if (*Recurrance == -1) *Recurrance = i; | 68 | if (*Recurrance == -1) *Recurrance = i; |
69 | break; | 69 | break; |
70 | case CAL_TEXT: | 70 | case CAL_TEXT: |
71 | if (*Text == -1) *Text = i; | 71 | if (*Text == -1) *Text = i; |
72 | break; | 72 | break; |
73 | case CAL_PHONE: | 73 | case CAL_PHONE: |
74 | if (*Phone == -1) *Phone = i; | 74 | if (*Phone == -1) *Phone = i; |
75 | break; | 75 | break; |
76 | case CAL_LOCATION: | 76 | case CAL_LOCATION: |
77 | if (*Location == -1) *Location = i; | 77 | if (*Location == -1) *Location = i; |
78 | break; | 78 | break; |
79 | default: | 79 | default: |
80 | break; | 80 | break; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version) | 85 | GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version) |
86 | { | 86 | { |
87 | int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; | 87 | int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; |
88 | char buffer[2000]; | 88 | char buffer[2000]; |
89 | 89 | ||
90 | GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); | 90 | GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); |
91 | 91 | ||
92 | if (header) { | 92 | if (header) { |
93 | *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); | 93 | *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); |
94 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); | 94 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); |
95 | } | 95 | } |
96 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VEVENT%c%c",13,10); | 96 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VEVENT%c%c",13,10); |
97 | 97 | ||
98 | if (Version == Nokia_VCalendar) { | 98 | if (Version == Nokia_VCalendar) { |
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) { |
119 | buffer[0] = 0; | 119 | buffer[0] = 0; |
120 | buffer[1] = 0; | 120 | buffer[1] = 0; |
121 | if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); | 121 | if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); |
122 | if (Text != -1) { | 122 | if (Text != -1) { |
123 | if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); | 123 | if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); |
124 | CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); | 124 | CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); |
125 | } | 125 | } |
126 | SaveVCALText(Buffer, Length, buffer, "SUMMARY"); | 126 | SaveVCALText(Buffer, Length, buffer, "SUMMARY"); |
127 | } else { | 127 | } else { |
128 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); | 128 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); |
129 | } | 129 | } |
130 | if (note->Type == GSM_CAL_MEETING && Location != -1) { | 130 | if (note->Type == GSM_CAL_MEETING && Location != -1) { |
131 | SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); | 131 | SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); |
132 | } | 132 | } |
133 | 133 | ||
134 | if (Time == -1) return ERR_UNKNOWN; | 134 | if (Time == -1) return ERR_UNKNOWN; |
135 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); | 135 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); |
136 | 136 | ||
137 | if (EndTime != -1) { | 137 | if (EndTime != -1) { |
138 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); | 138 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); |
139 | } | 139 | } |
140 | 140 | ||
141 | if (Alarm != -1) { | 141 | if (Alarm != -1) { |
142 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { | 142 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { |
143 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); | 143 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
144 | } else { | 144 | } else { |
145 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 145 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | /* Birthday is known to be recurranced */ | 149 | /* Birthday is known to be recurranced */ |
150 | if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { | 150 | if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { |
151 | switch(note->Entries[Recurrance].Number/24) { | 151 | switch(note->Entries[Recurrance].Number/24) { |
152 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; | 152 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; |
153 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; | 153 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; |
154 | case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break; | 154 | case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break; |
155 | case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1 #0%c%c",13,10); break; | 155 | case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1 #0%c%c",13,10); break; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | } else if (Version == Siemens_VCalendar) { | 158 | } else if (Version == Siemens_VCalendar) { |
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 | ||
176 | if (Time == -1) return ERR_UNKNOWN; | 176 | if (Time == -1) return ERR_UNKNOWN; |
177 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); | 177 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); |
178 | 178 | ||
179 | if (Alarm != -1) { | 179 | if (Alarm != -1) { |
180 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); | 180 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
181 | } | 181 | } |
182 | 182 | ||
183 | if (Recurrance != -1) { | 183 | if (Recurrance != -1) { |
184 | switch(note->Entries[Recurrance].Number/24) { | 184 | switch(note->Entries[Recurrance].Number/24) { |
185 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break; | 185 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break; |
186 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break; | 186 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break; |
187 | case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break; | 187 | case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break; |
188 | case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10);break; | 188 | case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10);break; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | if (note->Type == GSM_CAL_CALL) { | 192 | if (note->Type == GSM_CAL_CALL) { |
193 | buffer[0] = 0; | 193 | buffer[0] = 0; |
194 | buffer[1] = 0; | 194 | buffer[1] = 0; |
195 | if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); | 195 | if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); |
196 | if (Text != -1) { | 196 | if (Text != -1) { |
197 | if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); | 197 | if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); |
198 | CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); | 198 | CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); |
199 | } | 199 | } |
200 | SaveVCALText(Buffer, Length, buffer, "DESCRIPTION"); | 200 | SaveVCALText(Buffer, Length, buffer, "DESCRIPTION"); |
201 | } else { | 201 | } else { |
202 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "DESCRIPTION"); | 202 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "DESCRIPTION"); |
203 | } | 203 | } |
204 | } else if (Version == SonyEricsson_VCalendar) { | 204 | } else if (Version == SonyEricsson_VCalendar) { |
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 | ||
228 | if (Time == -1) return ERR_UNKNOWN; | 228 | if (Time == -1) return ERR_UNKNOWN; |
229 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); | 229 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Time].Date, "DTSTART"); |
230 | 230 | ||
231 | if (EndTime != -1) { | 231 | if (EndTime != -1) { |
232 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); | 232 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); |
233 | } | 233 | } |
234 | 234 | ||
235 | if (Alarm != -1) { | 235 | if (Alarm != -1) { |
236 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 236 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); |
237 | } | 237 | } |
238 | 238 | ||
239 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); | 239 | SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); |
240 | 240 | ||
241 | if (Location != -1) { | 241 | if (Location != -1) { |
242 | SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); | 242 | SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION"); |
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 | ||
249 | return ERR_NONE; | 250 | return ERR_NONE; |
250 | } | 251 | } |
251 | 252 | ||
252 | void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone) | 253 | void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone) |
253 | { | 254 | { |
254 | int i; | 255 | int i; |
255 | 256 | ||
256 | *Text = -1; | 257 | *Text = -1; |
257 | *EndTime= -1; | 258 | *EndTime= -1; |
258 | *Alarm = -1; | 259 | *Alarm = -1; |
259 | *Completed= -1; | 260 | *Completed= -1; |
260 | *Phone = -1; | 261 | *Phone = -1; |
261 | for (i = 0; i < entry->EntriesNum; i++) { | 262 | for (i = 0; i < entry->EntriesNum; i++) { |
262 | switch (entry->Entries[i].EntryType) { | 263 | switch (entry->Entries[i].EntryType) { |
263 | case TODO_END_DATETIME : | 264 | case TODO_END_DATETIME : |
264 | if (*EndTime == -1) *EndTime = i; | 265 | if (*EndTime == -1) *EndTime = i; |
265 | break; | 266 | break; |
266 | case TODO_ALARM_DATETIME : | 267 | case TODO_ALARM_DATETIME : |
267 | case TODO_SILENT_ALARM_DATETIME: | 268 | case TODO_SILENT_ALARM_DATETIME: |
268 | if (*Alarm == -1) *Alarm = i; | 269 | if (*Alarm == -1) *Alarm = i; |
269 | break; | 270 | break; |
270 | case TODO_TEXT: | 271 | case TODO_TEXT: |
271 | if (*Text == -1) *Text = i; | 272 | if (*Text == -1) *Text = i; |
272 | break; | 273 | break; |
273 | case TODO_COMPLETED: | 274 | case TODO_COMPLETED: |
274 | if (*Completed == -1) *Completed = i; | 275 | if (*Completed == -1) *Completed = i; |
275 | break; | 276 | break; |
276 | case TODO_PHONE: | 277 | case TODO_PHONE: |
277 | if (*Phone == -1) *Phone = i; | 278 | if (*Phone == -1) *Phone = i; |
278 | break; | 279 | break; |
279 | default: | 280 | default: |
280 | break; | 281 | break; |
281 | } | 282 | } |
282 | } | 283 | } |
283 | } | 284 | } |
284 | 285 | ||
285 | GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool header, GSM_VToDoVersion Version) | 286 | GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool header, GSM_VToDoVersion Version) |
286 | { | 287 | { |
287 | int Text, Alarm, Completed, EndTime, Phone; | 288 | int Text, Alarm, Completed, EndTime, Phone; |
288 | 289 | ||
289 | GSM_ToDoFindDefaultTextTimeAlarmCompleted(note, &Text, &Alarm, &Completed, &EndTime, &Phone); | 290 | GSM_ToDoFindDefaultTextTimeAlarmCompleted(note, &Text, &Alarm, &Completed, &EndTime, &Phone); |
290 | 291 | ||
291 | if (header) { | 292 | if (header) { |
292 | *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); | 293 | *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); |
293 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); | 294 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); |
294 | } | 295 | } |
295 | 296 | ||
296 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VTODO%c%c",13,10); | 297 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VTODO%c%c",13,10); |
297 | 298 | ||
298 | if (Version == Nokia_VToDo) { | 299 | if (Version == Nokia_VToDo) { |
299 | if (Text == -1) return ERR_UNKNOWN; | 300 | if (Text == -1) return ERR_UNKNOWN; |
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) { |
315 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DUE"); | 316 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DUE"); |
316 | } | 317 | } |
317 | 318 | ||
318 | if (Alarm != -1) { | 319 | if (Alarm != -1) { |
319 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { | 320 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { |
320 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); | 321 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
321 | } else { | 322 | } else { |
322 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 323 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); |
323 | } | 324 | } |
324 | } | 325 | } |
325 | } else if (Version == SonyEricsson_VToDo) { | 326 | } else if (Version == SonyEricsson_VToDo) { |
326 | if (Text == -1) return ERR_UNKNOWN; | 327 | if (Text == -1) return ERR_UNKNOWN; |
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 | ||
341 | if (Alarm != -1) { | 342 | if (Alarm != -1) { |
342 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 343 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); |
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) { |
349 | *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); | 351 | *Length+=sprintf(Buffer+(*Length), "END:VCALENDAR%c%c",13,10); |
350 | } | 352 | } |
351 | return ERR_NONE; | 353 | return ERR_NONE; |
352 | } | 354 | } |
353 | 355 | ||
354 | GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer) | 356 | GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer) |
355 | { | 357 | { |
356 | unsigned char Line[2000],Buff[2000]; | 358 | unsigned char Line[2000],Buff[2000]; |
357 | int Level = 0; | 359 | int Level = 0; |
358 | 360 | ||
359 | Calendar->EntriesNum = 0; | 361 | Calendar->EntriesNum = 0; |
360 | ToDo->EntriesNum = 0; | 362 | ToDo->EntriesNum = 0; |
361 | 363 | ||
362 | while (1) { | 364 | while (1) { |
363 | MyGetLine(Buffer, Pos, Line, strlen(Buffer)); | 365 | MyGetLine(Buffer, Pos, Line, strlen(Buffer)); |
364 | if (strlen(Line) == 0) break; | 366 | if (strlen(Line) == 0) break; |
365 | switch (Level) { | 367 | switch (Level) { |
366 | case 0: | 368 | case 0: |
367 | if (strstr(Line,"BEGIN:VEVENT")) { | 369 | if (strstr(Line,"BEGIN:VEVENT")) { |
368 | Calendar->Type = GSM_CAL_MEMO; | 370 | Calendar->Type = GSM_CAL_MEMO; |
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; |
376 | case 1: /* Calendar note */ | 378 | case 1: /* Calendar note */ |
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; |
394 | Calendar->EntriesNum++; | 397 | Calendar->EntriesNum++; |
395 | } | 398 | } |
396 | if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) { | 399 | if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) { |
397 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 400 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
398 | Calendar->Entries[Calendar->EntriesNum].Number = 7*24; | 401 | Calendar->Entries[Calendar->EntriesNum].Number = 7*24; |
399 | Calendar->EntriesNum++; | 402 | Calendar->EntriesNum++; |
400 | } | 403 | } |
401 | if (strstr(Line,"RRULE:W2")) { | 404 | if (strstr(Line,"RRULE:W2")) { |
402 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 405 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
403 | Calendar->Entries[Calendar->EntriesNum].Number = 14*24; | 406 | Calendar->Entries[Calendar->EntriesNum].Number = 14*24; |
404 | Calendar->EntriesNum++; | 407 | Calendar->EntriesNum++; |
405 | } | 408 | } |
406 | if (strstr(Line,"RRULE:MD1")) { | 409 | if (strstr(Line,"RRULE:MD1")) { |
407 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 410 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
408 | Calendar->Entries[Calendar->EntriesNum].Number = 30*24; | 411 | Calendar->Entries[Calendar->EntriesNum].Number = 30*24; |
409 | Calendar->EntriesNum++; | 412 | Calendar->EntriesNum++; |
410 | } | 413 | } |
411 | if (strstr(Line,"RRULE:YD1")) { | 414 | if (strstr(Line,"RRULE:YD1")) { |
412 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; | 415 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; |
413 | Calendar->Entries[Calendar->EntriesNum].Number = 365*24; | 416 | Calendar->Entries[Calendar->EntriesNum].Number = 365*24; |
414 | Calendar->EntriesNum++; | 417 | Calendar->EntriesNum++; |
415 | } | 418 | } |
416 | if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) { | 419 | if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) { |
417 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; | 420 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; |
418 | CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); | 421 | CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); |
419 | Calendar->EntriesNum++; | 422 | Calendar->EntriesNum++; |
420 | } | 423 | } |
421 | if (ReadVCALText(Line, "LOCATION", Buff)) { | 424 | if (ReadVCALText(Line, "LOCATION", Buff)) { |
422 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION; | 425 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION; |
423 | CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); | 426 | CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); |
424 | Calendar->EntriesNum++; | 427 | Calendar->EntriesNum++; |
425 | } | 428 | } |
426 | if (ReadVCALText(Line, "DTSTART", Buff)) { | 429 | if (ReadVCALText(Line, "DTSTART", Buff)) { |
427 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME; | 430 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME; |
428 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); | 431 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); |
429 | Calendar->EntriesNum++; | 432 | Calendar->EntriesNum++; |
430 | } | 433 | } |
431 | if (ReadVCALText(Line, "DTEND", Buff)) { | 434 | if (ReadVCALText(Line, "DTEND", Buff)) { |
432 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME; | 435 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME; |
433 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); | 436 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); |
434 | Calendar->EntriesNum++; | 437 | Calendar->EntriesNum++; |
435 | } | 438 | } |
436 | if (ReadVCALText(Line, "DALARM", Buff)) { | 439 | if (ReadVCALText(Line, "DALARM", Buff)) { |
437 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME; | 440 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME; |
438 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); | 441 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); |
439 | Calendar->EntriesNum++; | 442 | Calendar->EntriesNum++; |
440 | } | 443 | } |
441 | if (ReadVCALText(Line, "AALARM", Buff)) { | 444 | if (ReadVCALText(Line, "AALARM", Buff)) { |
442 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME; | 445 | Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME; |
443 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); | 446 | ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); |
444 | Calendar->EntriesNum++; | 447 | Calendar->EntriesNum++; |
445 | } | 448 | } |
446 | break; | 449 | break; |
447 | case 2: /* ToDo note */ | 450 | case 2: /* ToDo note */ |
448 | if (strstr(Line,"END:VTODO")) { | 451 | if (strstr(Line,"END:VTODO")) { |
449 | if (ToDo->EntriesNum == 0) return ERR_EMPTY; | 452 | if (ToDo->EntriesNum == 0) return ERR_EMPTY; |
450 | return ERR_NONE; | 453 | return ERR_NONE; |
451 | } | 454 | } |
452 | if (ReadVCALText(Line, "DUE", Buff)) { | 455 | if (ReadVCALText(Line, "DUE", Buff)) { |
453 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME; | 456 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME; |
454 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); | 457 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); |
455 | ToDo->EntriesNum++; | 458 | ToDo->EntriesNum++; |
456 | } | 459 | } |
457 | if (ReadVCALText(Line, "DALARM", Buff)) { | 460 | if (ReadVCALText(Line, "DALARM", Buff)) { |
458 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; | 461 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; |
459 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); | 462 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); |
460 | ToDo->EntriesNum++; | 463 | ToDo->EntriesNum++; |
461 | } | 464 | } |
462 | if (ReadVCALText(Line, "AALARM", Buff)) { | 465 | if (ReadVCALText(Line, "AALARM", Buff)) { |
463 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME; | 466 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME; |
464 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); | 467 | ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); |
465 | ToDo->EntriesNum++; | 468 | ToDo->EntriesNum++; |
466 | } | 469 | } |
467 | if (ReadVCALText(Line, "SUMMARY", Buff)) { | 470 | if (ReadVCALText(Line, "SUMMARY", Buff)) { |
468 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT; | 471 | ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT; |
469 | CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); | 472 | CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); |
470 | ToDo->EntriesNum++; | 473 | ToDo->EntriesNum++; |
471 | } | 474 | } |
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++; |
488 | } | 491 | } |
489 | break; | 492 | break; |
490 | } | 493 | } |
491 | } | 494 | } |
492 | 495 | ||
493 | if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY; | 496 | if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY; |
494 | return ERR_NONE; | 497 | return ERR_NONE; |
495 | } | 498 | } |
496 | 499 | ||
497 | GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note) | 500 | GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note) |
498 | { | 501 | { |
499 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VNOTE%c%c",13,10); | 502 | *Length+=sprintf(Buffer+(*Length), "BEGIN:VNOTE%c%c",13,10); |
500 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.1%c%c",13,10); | 503 | *Length+=sprintf(Buffer+(*Length), "VERSION:1.1%c%c",13,10); |
501 | SaveVCALText(Buffer, Length, Note->Text, "BODY"); | 504 | SaveVCALText(Buffer, Length, Note->Text, "BODY"); |
502 | *Length+=sprintf(Buffer+(*Length), "END:VNOTE%c%c",13,10); | 505 | *Length+=sprintf(Buffer+(*Length), "END:VNOTE%c%c",13,10); |
503 | 506 | ||
504 | return ERR_NONE; | 507 | return ERR_NONE; |
505 | } | 508 | } |
506 | 509 | ||
507 | /* How should editor hadle tabs in this file? Add editor commands here. | 510 | /* How should editor hadle tabs in this file? Add editor commands here. |
508 | * vim: noexpandtab sw=8 ts=8 sts=8: | 511 | * vim: noexpandtab sw=8 ts=8 sts=8: |
509 | */ | 512 | */ |