337 |
static int |
static int |
338 |
fetch_internaldate (struct fetch_command *command, char **arg ARG_UNUSED) |
fetch_internaldate (struct fetch_command *command, char **arg ARG_UNUSED) |
339 |
{ |
{ |
340 |
char date[128], *p; |
char date[128]; |
341 |
envelope_t env = NULL; |
envelope_t env = NULL; |
342 |
struct tm tm; |
struct tm tm, *tmp = NULL; |
343 |
mu_timezone tz; |
mu_timezone tz; |
344 |
|
|
345 |
message_get_envelope (command->msg, &env); |
message_get_envelope (command->msg, &env); |
346 |
date[0] = '\0'; |
date[0] = '\0'; |
347 |
envelope_date (env, date, sizeof (date), NULL); |
if (envelope_date (env, date, sizeof (date), NULL) == 0) |
348 |
p = date; |
{ |
349 |
mu_parse_ctime_date_time ((const char **) &p, &tm, &tz); |
char *p = date; |
350 |
strftime (date, sizeof (date), "%d-%b-%Y %H:%M:%S", &tm); |
if (mu_parse_ctime_date_time ((const char **) &p, &tm, &tz) == 0) |
351 |
|
tmp = &tm; |
352 |
|
} |
353 |
|
if (!tmp) |
354 |
|
{ |
355 |
|
time_t t = time(NULL); |
356 |
|
tmp = localtime(&t); |
357 |
|
} |
358 |
|
strftime (date, sizeof (date), "%d-%b-%Y %H:%M:%S", tmp); |
359 |
util_send ("%s", command->name); |
util_send ("%s", command->name); |
360 |
util_send (" \"%s +0000\"", date); |
util_send (" \"%s +0000\"", date); |
361 |
return RESP_OK; |
return RESP_OK; |