From 9979afe0f76d119e519adfb463ee2d06b89ed486 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 9 Nov 2013 16:13:05 -0700 Subject: [PATCH] Added ability to send email to BBS from ISP's email addy. --- CHANGELOG.TXT | 19 +++++++++++++++ mystic/bbs_user.pas | 50 ++++++++++++++++++++++++++++++++++---- mystic/mis_client_ftp.pas | 2 +- mystic/mis_client_nntp.pas | 2 +- mystic/mis_client_pop3.pas | 2 +- mystic/mis_client_smtp.pas | 31 +++++++++++------------ mystic/mis_common.pas | 6 ++--- mystic/records.pas | 2 +- 8 files changed, 87 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 0692f14..6266f8e 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -13,3 +13,22 @@ Vincent Chapman { Added IPv6 Support } } + +Vincent Chapman { + N1LQJ@COX.NET + 9 NOV 2013 + Modifed { + mis.pas.pas + mis_common.pas + mis_client_pop3.pas + mis_client_smtp.pas + mis_client_nntp.pas + mis_client_ftp.pas + records.pas + bbs_user.pas + bbs_menus.pas + } + Comment { + Added ability to send email to BBS from ISP's email addy. + } +} diff --git a/mystic/bbs_user.pas b/mystic/bbs_user.pas index 671c9f0..c7e9594 100644 --- a/mystic/bbs_user.pas +++ b/mystic/bbs_user.pas @@ -5,6 +5,7 @@ Unit bbs_User; Interface Uses + sysutils, m_FileIO, m_Strings, m_DateTime, @@ -25,6 +26,7 @@ Type Security : RecSecurity; ThisUser : RecUser; TempUser : RecUser; + EmailUsrChk : RecUser; UserNum : LongInt; AcsOkFlag : Boolean; IgnoreGroup : Boolean; @@ -489,13 +491,51 @@ Begin End; Procedure TBBSUser.GetEmail (Edit : Boolean); +Var + Str : String; + DropOut : Boolean; Begin - If Edit Then - Session.io.OutFull (Session.GetPrompt(440)) - Else - Session.io.OutFull (Session.GetPrompt(439)); + DropOut := False; + Str := ''; - ThisUser.EMail := Session.io.GetInput(35, 35, 11, ThisUser.Email); + While True Do Begin + If Edit Then Begin + Session.io.OutFull (Session.GetPrompt(440)); + End Else Begin + Session.io.OutFull (Session.GetPrompt(439)); + End; + + Str := Session.io.GetInput(35, 35, 11, ThisUser.Email); + While (Pos(' ', Str) > 0) Do Begin + Delete (Str, Pos(' ', Str), 1); + End; + + DropOut := True; + + Reset (UserFile); + While Not Eof(UserFile) Do Begin + + Read (UserFile, EmailUsrChk); + + If (strUPPER(str) = strUPPER(EmailUsrChk.Email)) Then Begin + If (EmailUsrChk.PermIdx = ThisUser.PermIdx) Then Begin + Break; + end else begin + Session.io.OutFull (Session.GetPrompt(515)); + DropOut := False; + Break; + End; + End; + End; + If (DropOut = True) Then Begin + Break; + End; + Close (UserFile); + End; + + Close (UserFile); + + ThisUser.EMail := Str; End; Procedure TBBSUser.GetUserNote (Edit : Boolean); diff --git a/mystic/mis_client_ftp.pas b/mystic/mis_client_ftp.pas index 02d677f..747e44e 100644 --- a/mystic/mis_client_ftp.pas +++ b/mystic/mis_client_ftp.pas @@ -589,7 +589,7 @@ Procedure TFTPServer.cmdUSER; Begin ResetSession; - If SearchForUser(Data, User, UserPos) Then + If SearchForUser(Data, User, UserPos, '') Then UserName := Data Else UserPos := -1; diff --git a/mystic/mis_client_nntp.pas b/mystic/mis_client_nntp.pas index 85165ad..e35e3c8 100644 --- a/mystic/mis_client_nntp.pas +++ b/mystic/mis_client_nntp.pas @@ -132,7 +132,7 @@ Begin NewData := Copy(Data, Pos(' ', Data) + 1, 255); If NewCmd = 'USER' Then Begin - If SearchForUser(NewData, User, UserPos) Then Begin + If SearchForUser(NewData, User, UserPos, '') Then Begin ClientWriteLine(re_AuthPass); UserName := NewData; diff --git a/mystic/mis_client_pop3.pas b/mystic/mis_client_pop3.pas index 08e2ea0..249c91a 100644 --- a/mystic/mis_client_pop3.pas +++ b/mystic/mis_client_pop3.pas @@ -295,7 +295,7 @@ Procedure TPOP3Server.cmdUSER; Begin ResetSession; - If SearchForUser(Data, User, UserPos) Then Begin + If SearchForUser(Data, User, UserPos, '') Then Begin Client.WriteLine(re_SendUserPass); UserName := Data; End Else diff --git a/mystic/mis_client_smtp.pas b/mystic/mis_client_smtp.pas index 61e56c8..0a78428 100644 --- a/mystic/mis_client_smtp.pas +++ b/mystic/mis_client_smtp.pas @@ -79,26 +79,27 @@ End; Function TSMTPServer.ValidateNameAndDomain (IsFrom: Boolean) : Boolean; Var - InName : String; - InDomain : String; + InName : String; + InDomain : String; Begin - Result := False; + Result := False; - InName := strReplace(Copy(Data, Pos('<', Data) + 1, Pos('@', Data) - Pos('<', Data) - 1), '_', ' '); - InDomain := Copy(Data, Pos('@', Data) + 1, Pos('>', Data) - Pos('@', Data) - 1); + InName := strReplace(Copy(Data, Pos('<', Data) + 1, Pos('@', Data) - Pos('<', Data) - 1), '_', ' '); + InDomain := Copy(Data, Pos('@', Data) + 1, Pos('>', Data) - Pos('@', Data) - 1); - If IsFrom Then - Server.Status(ProcessID, 'User: ' + InName + ' Domain: ' + InDomain); + If IsFrom Then + Server.Status(ProcessID, 'User: ' + InName + ' Domain: ' + InDomain); - If InDomain <> bbsCfg.iNetDomain Then Begin - Server.Status(ProcessID, 'Refused by domain: ' + InName + '@' + InDomain); - Exit; - End; + Result := SearchForUser(InName, User, UserPos, InName + '@' + InDomain); + + If (InDomain <> bbsCfg.iNetDomain) and (Result = False) Then Begin + Server.Status(ProcessID, 'Refused by domain: ' + InName + '@' + InDomain); + Exit; + End; - Result := SearchForUser(InName, User, UserPos); - - If Not Result Then - Server.Status(ProcessID, 'Refused by name: ' + InName + '@' + InDomain); + If Not Result Then Begin + Server.Status(ProcessID, 'Refused by name: ' + InName + '@' + InDomain); + End; End; Procedure TSMTPServer.ResetSession; diff --git a/mystic/mis_common.pas b/mystic/mis_common.pas index 0085972..d83d4b8 100644 --- a/mystic/mis_common.pas +++ b/mystic/mis_common.pas @@ -14,7 +14,7 @@ Var TempPath : String; // Term : TTermAnsi; -Function SearchForUser (UN: String; Var Rec: RecUser; Var RecPos: LongInt) : Boolean; +Function SearchForUser (UN: String; Var Rec: RecUser; Var RecPos: LongInt; Email: String) : Boolean; Function CheckAccess (User: RecUser; IgnoreGroup: Boolean; Str: String) : Boolean; Function GetSecurityLevel (Level: Byte; SecLevel: RecSecurity) : Boolean; @@ -25,7 +25,7 @@ Uses m_DateTime, m_Strings; -Function SearchForUser (UN: String; Var Rec: RecUser; Var RecPos: LongInt) : Boolean; +Function SearchForUser (UN: String; Var Rec: RecUser; Var RecPos: LongInt; Email: String) : Boolean; Var UserFile : TFileBuffer; Begin @@ -42,7 +42,7 @@ Begin If Rec.Flags AND UserDeleted <> 0 Then Continue; - If (UN = strUpper(Rec.RealName)) or (UN = strUpper(Rec.Handle)) Then Begin + If (UN = strUpper(Rec.RealName)) or (UN = strUpper(Rec.Handle)) or (((strUpper(Email) = strUpper(Rec.Email)) and (Email <> ''))) Then Begin RecPos := UserFile.FilePosRecord; Result := True; Break; diff --git a/mystic/records.pas b/mystic/records.pas index c295e7c..13a74e3 100644 --- a/mystic/records.pas +++ b/mystic/records.pas @@ -69,7 +69,7 @@ Const mysMaxMenuCmds = 25; // Max menu commands per item mysMaxMenuInput = 12; mysMaxMenuStack = 8; - mysMaxThemeText = 514; + mysMaxThemeText = 515; fn_SemFileEchoOut = 'echomail.out'; fn_SemFileEchoIn = 'echomail.in';