char tmp[SIZ];
int i;
size_t size, size2;
- struct tm *stamp;
+ struct tm stamp;
if (CC->FirstExpressMessage == NULL) {
return;
end_critical_section(S_SESSION_TABLE);
while (ptr != NULL) {
- stamp = localtime(&(ptr->timestamp));
+ localtime_r(&(ptr->timestamp), &stamp);
size = strlen(ptr->text) + SIZ;
dumpomatic = malloc(size);
strcpy(dumpomatic, "");
strcat(dumpomatic, "Message ");
/* Timestamp. Can this be improved? */
- if (stamp->tm_hour == 0 || stamp->tm_hour == 12)
+ if (stamp.tm_hour == 0 || stamp.tm_hour == 12)
sprintf(tmp, "at 12:%02d%cm",
- stamp->tm_min,
- stamp->tm_hour ? 'p' : 'a');
- else if (stamp->tm_hour > 12) /* pm */
+ stamp.tm_min,
+ stamp.tm_hour ? 'p' : 'a');
+ else if (stamp.tm_hour > 12) /* pm */
sprintf(tmp, "at %d:%02dpm",
- stamp->tm_hour - 12,
- stamp->tm_min);
+ stamp.tm_hour - 12,
+ stamp.tm_min);
else /* am */
sprintf(tmp, "at %d:%02dam",
- stamp->tm_hour, stamp->tm_min);
+ stamp.tm_hour, stamp.tm_min);
strcat(dumpomatic, tmp);
size2 = strlen(dumpomatic);
blksize = literal_length - bytes_transferred;
if (blksize > SIZ) blksize = SIZ;
+ flush_output();
ret = client_read(&IMAP->transmitted_message[bytes_transferred], blksize);
if (ret < 1) {
bytes_transferred = literal_length; /* bail out */
* literal (the message text) is received. This call to
* client_gets() absorbs it.
*/
+ flush_output();
client_gets(buf);
lprintf(CTDL_DEBUG, "Trailing CRLF: %s\n", buf);
}
}
literal_length = stripped_length;
+ IMAP->transmitted_message[literal_length] = 0; /* reterminate it */
lprintf(CTDL_DEBUG, "Converting message format\n");
msg = convert_internet_message(IMAP->transmitted_message);