Hello,

I've recently installed dbmail 1.1 on a Debian GNU/Linux machine
(woody), using PostgreSQL 7.2.1. Everything works fine, except that
Outlook 2002 SP2 (aka XP, German localization) shows "Sa 03.11.1979
00:00" "received" date for every single mail when used as an
IMAP client.

When looking at the source I came across the date_sql2imap routine (in
imaputil.c) which expects the SQL server result set using a yyyy-mm-dd
hh:mm:ss timestamp convention; unfortunately, my PostgreSQL deliveres
"dd.mm.yyy hh:mm:ss TZ"

I'm aware of the DATESTYLE option, but AFAIK this option can only be set
system-wide, and since other applications are using the same PostgreSQL
postmaster, I cannot alter the current setting (actually, I'm using
German DATESYTLE as default)

As a quick solution, I hacked pgsql/dbpgsql.c, adding an explicit cast
to the expected timestamp format:

--- ../dbmail-1.1-debian-orig/pgsql/dbpgsql.c   Sat Mar 15 14:30:04 2003
+++ pgsql/dbpgsql.c     Sat Mar 15 14:09:16 2003
@@ -3755,7 +3755,10 @@

    char *row;

-  snprintf(query, DEF_QUERYSIZE, "SELECT internal_date FROM messages
WHERE mailbox_idnr = %llu::bigint "
+  /* [EMAIL PROTECTED]  Added missing to_char because otherwise
date_sql2imap will break */
+  snprintf(query, DEF_QUERYSIZE,
+          "SELECT to_char(internal_date, 'YYYY-MM-DD HH24:MI:SS') "
+            "FROM messages WHERE mailbox_idnr = %llu::bigint "
            "AND message_idnr = %llu::bigint AND unique_id!=''",
mailboxuid, msguid);

    if (db_query(query) == -1)

(please note that I have applied the Debian patches provided by Paul J
Stevens, too)


Can anyone confirm whether my hack is neccessary? If not, what are
the alternatives?  BTW, Mozilla 1.3 doesn't care about internal IMAP
dates, thus everything's just fine there.


Thanks alot,
Thomas




Reply via email to