| | 279 | /* first try _received, if that doesn't work, use the Date: header |
|---|
| | 280 | * however, Date: is set by the *sender* so will not be totally |
|---|
| | 281 | * accurate |
|---|
| | 282 | * |
|---|
| | 283 | * NOTE: we ignore the timezone, as the camel function already |
|---|
| | 284 | * returns a UTC-normalized time_t |
|---|
| | 285 | * */ |
|---|
| | 286 | retval = camel_mime_message_get_date_received (me->msg, &tzone); |
|---|
| | 287 | if (retval == CAMEL_MESSAGE_DATE_CURRENT) |
|---|
| | 288 | retval = camel_mime_message_get_date (me->msg, &tzone); |
|---|
| | 289 | |
|---|
| | 290 | /* return 0 if we really cannot find a date */ |
|---|
| | 291 | if (retval == CAMEL_MESSAGE_DATE_CURRENT) |
|---|
| | 292 | return 0; |
|---|
| | 293 | else |
|---|
| | 294 | return retval; |
|---|
| | 295 | } |
|---|
| | 296 | |
|---|
| | 297 | static time_t |
|---|
| | 298 | tny_camel_msg_header_get_date_sent (TnyHeader *self) |
|---|
| | 299 | { |
|---|
| | 300 | TnyCamelMsgHeader *me = TNY_CAMEL_MSG_HEADER (self); |
|---|
| | 301 | time_t retval = 0; |
|---|
| | 302 | int tzone; |
|---|
| | 303 | |
|---|
| | 304 | /* first try _date, if that doesn't work, use received instead |
|---|
| | 305 | * however, that is set by the *receiver* so will not be totally |
|---|
| | 306 | * accurate |
|---|
| | 307 | * |
|---|
| | 308 | * NOTE: we ignore the timezone, as the camel function already |
|---|
| | 309 | * returns a UTC-normalized time_t |
|---|
| | 310 | * */ |
|---|
| 284 | | { |
|---|
| 285 | | time (&retval); |
|---|
| 286 | | tzone = 0; |
|---|
| 287 | | } |
|---|
| 288 | | |
|---|
| 289 | | retval += (tzone / 100) * 60 * 60; |
|---|
| 290 | | retval += (tzone % 100) * 60; |
|---|
| 291 | | |
|---|
| 292 | | return retval; |
|---|
| 293 | | } |
|---|
| 294 | | |
|---|
| 295 | | static time_t |
|---|
| 296 | | tny_camel_msg_header_get_date_sent (TnyHeader *self) |
|---|
| 297 | | { |
|---|
| 298 | | TnyCamelMsgHeader *me = TNY_CAMEL_MSG_HEADER (self); |
|---|
| 299 | | time_t retval = 0; |
|---|
| 300 | | int tzone; |
|---|
| 301 | | |
|---|
| 302 | | retval = camel_mime_message_get_date (me->msg, &tzone); |
|---|
| 303 | | |
|---|
| 304 | | if (retval == CAMEL_MESSAGE_DATE_CURRENT) |
|---|
| 305 | | retval = camel_mime_message_get_date_received (me->msg, &tzone); |
|---|
| 306 | | if (retval == CAMEL_MESSAGE_DATE_CURRENT) |
|---|
| 307 | | { |
|---|
| 308 | | time (&retval); |
|---|
| 309 | | tzone = 0; |
|---|
| 310 | | } |
|---|
| 311 | | |
|---|
| 312 | | retval += (tzone / 100) * 60 * 60; |
|---|
| 313 | | retval += (tzone % 100) * 60; |
|---|
| 314 | | |
|---|
| 315 | | return retval; |
|---|
| | 316 | return 0; |
|---|
| | 317 | else |
|---|
| | 318 | return retval; |
|---|