Menu

#1 V1.0.0.6 Email Dates are missing

v1.0_(example)
closed-fixed
nobody
5
2008-09-16
2008-09-06
No

... for some mails. I send a demo mbox file as attachment containing two mails which both are displayed without date.

Discussion

  • Andre Herbst

    Andre Herbst - 2008-09-06
     
  • Andre Herbst

    Andre Herbst - 2008-09-07

    Logged In: YES
    user_id=917543
    Originator: YES

    I have looked around in the source code (of the wxWidgets-version since I dont have the MFC headers):

    The reason why the date is missing:
    you are reading the fields one by one of every email and if you find the date in either the "Received: " or "Date: " fields you read in from there and set a boolean value to false so that this date does not get overwritten again in the memory...

    ( mail.cpp:153 )
    There is a problem in the way you read the date from the "Received: " field... you assume that it is stored completely in only one line without line break. These mails where the date is not being displayed do all have linebreaks in the date representations :D

    "with SMTP id H559LF00.OQK for <Testuser@compuserve.de>; Wed, 6
    Nov 2002 08:46:27 +0100 "

    So you could at least check if the date was read properly before you set the bDate variable to false so that it can never be replaced by another field containing easier readable date representations :D

     
  • Andre Herbst

    Andre Herbst - 2008-09-07

    Logged In: YES
    user_id=917543
    Originator: YES

    btw:

    date.cpp:189
    date = tm.Format("%d/%m/%y %H:%I"); <- this format shows 24-hours:12-hours instead of 24-hours:minutes :D

    -> date = tm.Format("%d/%m/%y %H:%M");

     
  • Andre Herbst

    Andre Herbst - 2008-09-07

    Logged In: YES
    user_id=917543
    Originator: YES

    ... the same at date.cpp:209

     
  • Andre Herbst

    Andre Herbst - 2008-09-07

    Logged In: YES
    user_id=917543
    Originator: YES

    I finally did fix it... i changed mail.cpp beginning at line 160. If the Received: filed is broken into several lines like this:

    Received: bla bla ...
    field info goes on
    and on
    until this line
    NextField: 123
    ...

    Then the lines beginning with at least one space or tab are read in and treated as one single line... the tabs and spaces at the beginning are being substituded with one single space. The Received: field always seems to end with the date so the last linebreak or the field is the end marker of the date string:

    line 160: char *el;

                el = p1;
    
                do
                \{
                    el++;
                    el = strchr\(el, '\n'\);
                \}
                while \(\*el == '\n' && \(\*\(el+1\) == ' ' || \*\(el+1\) == 't'\)\);
    
                while\( g\_tu.IsSpace\(\*el\) \)
                    el--;
                el++;
                char \*d = date.GetWriteBuf\(el-p1+1\);
    
                //old method; does not strip off multiple spaces or tabs: strncpy\(d, p1, el-p1\);
    
                // strip off multiple \t and spaces while copying into \*d
                char \*pWr = d;
                int spc = 0;
                for \(int i=0;i&lt;\(el-p1\);i++\)
                \{
                    if \(\*\(p1+i\) == ' ' || \*\(p1+1\) == '\t'\)
                    \{
                        if \(spc &lt; 1\)
                        \{
                            \*pWr = ' ';
                            pWr++;
                            spc++;
                        \}
                    \}
                    else if \(\*\(p1+i\) \!= 0x0D && \*\(p1+i\) \!= 0x0A\)
                    \{
                        \*pWr = \*\(p1+i\);
                        pWr++;
                        spc=0;
                    \}
                    else
                        spc=0;
                \}
                \*pWr = 0;
    
                // now the date stored in d can be parsed
                // ...
    

    Now you just need to copy and paste it :D

     
  • eneam

    eneam - 2008-09-16
    • status: open --> open-fixed
     
  • eneam

    eneam - 2008-09-16

    Thanks for the bugfixes
    I have updated the sources and binaries even though I have not had the chance to test the wx sources

     
  • eneam

    eneam - 2008-09-16
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB