From b21981f52597d4d5f723f3e051b39e33225b3377 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 13 Oct 2013 10:42:20 -0700 Subject: [PATCH] Fixed date error in POP3 whereas FreePascal wanted dd-mm-yy and BBS provided mm-dd-yy. Software Pop3 client crahed after the 12th day of any given month an failed to send mail. --- mystic/mis_client_pop3.pas | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/mystic/mis_client_pop3.pas b/mystic/mis_client_pop3.pas index eaa9327..08e2ea0 100644 --- a/mystic/mis_client_pop3.pas +++ b/mystic/mis_client_pop3.pas @@ -169,8 +169,31 @@ Var MsgBase : PMsgBaseABS; Function ParseDateTime (Date, Time : String) : String; + Var + YY, MM, DD : Word; + YYS, MMS, DDS : String; + Code : Word; + myfile : TextFile; Begin - DateSeparator := '-'; + YY := 0; + MM := 0; + DD := 0; + + //DateSeparator := '-'; <-- Depreciated + + // http://www.freepascal.org/docs-html/rtl/sysutils/strtodatetime.html + // BBS Stores strings as mm-dd-yy but default format for StrtoDateTime is dd-mm-yy. + + Val(Copy(Date, 1, 2), MM, Code); + Val(Copy(Date, 4, 2), DD, Code); + Val(Copy(Date, 7, 2), YY, Code); + + Str(YY, YYS); + Str(MM, MMS); + Str(DD, DDS); + + Date := DDS + '-' + MMS + '-' + YYS; + ParseDateTime := FormatDateTime('ddd, dd mmm yyyy hh:nn:ss', StrToDateTime(Date + ' ' + Time)); End;