This is really in reply to Aaron's last email regarding 2.0.5, but I just joined the list 5 seconds ago, so I don't have a copy. =(

Bug 193:
http://www.dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000193

dbmail will not compile on FreeBSD without editing imaputil.c and reverting back to a tm_gmtoff type solution. I manually edited this to compile yesterday, but I am not well-versed in cross platform development and I have no idea if it would compile in Linux, etc.

Here is my interim solution if anyone is interested. Not the prettiest, but it gets the job done.

char *date_sql2imap(const char *sqldate)
{
       time_t temp = time(0);
       struct tm *tms = localtime(&temp);

       long gmt_offset=0;
       struct tm tm_sql_date;
       char *last;

       /* defined by tzset */
       //extern long timezone;
       //timezone=0;
       //tzset();

       last = strptime(sqldate,"%Y-%m-%d %T", &tm_sql_date);
       if ( (last == NULL) || (*last != '\0') ) {
               trace(TRACE_DEBUG, "%s,%s, error parsing date [%s]",
                     __FILE__, __func__, sqldate);
               strcpy(_imapdate, IMAP_STANDARD_DATE);
               return _imapdate;
       }

       gmt_offset = (-tms->tm_gmtoff)/3600;
       if (tm_sql_date.tm_isdst)
               gmt_offset++;

       snprintf(_imapdate,IMAP_INTERNALDATE_LEN,"%s %c%02ld00",
                       sqldate,
                       (gmt_offset >= 0 ? '+': '-'),
                       gmt_offset);
       return _imapdate;
}


Reply via email to