Fixed NNTP date issues
This commit is contained in:
parent
0db8dc5d4f
commit
c62d1c67f5
|
@ -39,6 +39,7 @@ Type
|
||||||
|
|
||||||
Procedure ClientWriteLine (Str: String);
|
Procedure ClientWriteLine (Str: String);
|
||||||
Procedure ResetSession;
|
Procedure ResetSession;
|
||||||
|
Function NNTPDate (DateStr, TimeStr: String) : String;
|
||||||
|
|
||||||
Procedure cmd_ARTICLE;
|
Procedure cmd_ARTICLE;
|
||||||
Procedure cmd_AUTHINFO;
|
Procedure cmd_AUTHINFO;
|
||||||
|
@ -51,6 +52,7 @@ Type
|
||||||
Implementation
|
Implementation
|
||||||
|
|
||||||
Uses
|
Uses
|
||||||
|
Dos,
|
||||||
Classes,
|
Classes,
|
||||||
bbs_MsgBase_ABS,
|
bbs_MsgBase_ABS,
|
||||||
bbs_MsgBase_JAM,
|
bbs_MsgBase_JAM,
|
||||||
|
@ -89,6 +91,26 @@ Begin
|
||||||
Client.WriteLine(Str);
|
Client.WriteLine(Str);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Function TNNTPServer.NNTPDate (DateStr, TimeStr: String) : String;
|
||||||
|
Var
|
||||||
|
TimeStamp : LongInt;
|
||||||
|
TimeZone : String;
|
||||||
|
Month : Byte;
|
||||||
|
Year : Integer;
|
||||||
|
Begin
|
||||||
|
TimeStamp := DateStr2Dos(DateStr);
|
||||||
|
TimeZone := GetENV('TZ');
|
||||||
|
|
||||||
|
If TimeZone = '' Then TimeZone := 'GMT';
|
||||||
|
|
||||||
|
Month := strS2I(Copy(DateStr, 1, 2));
|
||||||
|
Year := strS2I(Copy(DateStr, 7, 2));
|
||||||
|
|
||||||
|
If Year < 80 Then Inc(Year, 2000) Else Inc(Year, 1900);
|
||||||
|
|
||||||
|
Result := DayString[DayOfWeek(TimeStamp)] + ', ' + Copy(DateStr, 4, 2) + ' ' + MonthString[Month] + ' ' + strI2S(Year) + ' ' + TimeStr + ':00 ' + TimeZone;
|
||||||
|
End;
|
||||||
|
|
||||||
Procedure TNNTPServer.ResetSession;
|
Procedure TNNTPServer.ResetSession;
|
||||||
Begin
|
Begin
|
||||||
LoggedIn := False;
|
LoggedIn := False;
|
||||||
|
@ -501,13 +523,13 @@ Begin
|
||||||
|
|
||||||
MsgBase^.MsgTxtStartUp;
|
MsgBase^.MsgTxtStartUp;
|
||||||
|
|
||||||
ClientWriteLine ('220 ' + strI2S(ArticleNum) + ' <0> article retrieved - head and body follow');
|
ClientWriteLine ('220 ' + strI2S(ArticleNum) + ' <' + strI2S(ArticleNum) + '> article retrieved - head and body follow');
|
||||||
// ClientWriteLine('220 0 ' + strI2S(ArticleNum));
|
// ClientWriteLine('220 0 ' + strI2S(ArticleNum));
|
||||||
|
|
||||||
Client.WriteLine('From: ' + MsgBase^.GetFrom);
|
Client.WriteLine('From: ' + MsgBase^.GetFrom);
|
||||||
Client.WriteLine('Newsgroups: ' + MBase.NewsName);
|
Client.WriteLine('Newsgroups: ' + MBase.NewsName);
|
||||||
Client.WriteLine('Subject: ' + MsgBase^.GetSubj);
|
Client.WriteLine('Subject: ' + MsgBase^.GetSubj);
|
||||||
Client.WriteLine('Date: ' + MsgBase^.GetDate);
|
Client.WriteLine('Date: ' + NNTPDate(MsgBase^.GetDate, MsgBase^.GetTime));
|
||||||
Client.WriteLine('');
|
Client.WriteLine('');
|
||||||
|
|
||||||
While Not MsgBase^.EOM Do Begin
|
While Not MsgBase^.EOM Do Begin
|
||||||
|
@ -594,8 +616,8 @@ Begin
|
||||||
Client.WriteStr(strI2S(MsgBase^.GetMsgNum) + #9);
|
Client.WriteStr(strI2S(MsgBase^.GetMsgNum) + #9);
|
||||||
Client.WriteStr(MsgBase^.GetSubj + #9);
|
Client.WriteStr(MsgBase^.GetSubj + #9);
|
||||||
Client.WriteStr(MsgBase^.GetFrom + #9);
|
Client.WriteStr(MsgBase^.GetFrom + #9);
|
||||||
Client.WriteStr(MsgBase^.GetDate + #9);
|
Client.WriteStr(NNTPDate(MsgBase^.GetDate, MsgBase^.GetTime) + #9);
|
||||||
Client.WriteStr(#9); //msgID
|
Client.WriteStr(strI2S(MsgBase^.GetMsgNum) + #9); //msgID
|
||||||
Client.WriteStr(#9); //refs
|
Client.WriteStr(#9); //refs
|
||||||
Client.WriteStr(strI2S(Length(MsgText.Text)) + #9);
|
Client.WriteStr(strI2S(Length(MsgText.Text)) + #9);
|
||||||
Client.WriteStr(strI2S(MsgText.Count) + #13#10);
|
Client.WriteStr(strI2S(MsgText.Count) + #13#10);
|
||||||
|
|
Loading…
Reference in New Issue