home *** CD-ROM | disk | FTP | other *** search
Wrap
'T:MAILEXT.EBS for CIX ' VA 4.52 release 'Add file to import queue Declare Function AddToDoList16 Pascal Lib "addons.dll" Alias "AddToDoList" (ByVal szService As String, ByVal szFileName As String, ByVal szMailname As String, ByVal iFlags As Long) As Integer Declare Function AddToDoList32 Pascal Lib "addons32.dll" Alias "AddToDoList" (ByVal szService As String, ByVal szFileName As String, ByVal szMailname As String, ByVal iFlags As Long) As Long Declare Sub AddToMsgFile(SourceFileName as String) Declare Function QueueFile(service As String, sfilename As String, queueflags As Long) As Boolean Declare Function QueueFileList(service As String, sfilename As String, topic As String) As Boolean Declare Sub LoadAddonLibraries Declare Function AddFileToMessageBase(topic As String, subject As String, filename As String) Declare Function MyDate$ Declare Function FileUrl(fn As String) As String 'T:iFlags for CIX (constant) Const IM_DELETE = 2048 ' Delete scratchpad file afterwards? Public Success As Boolean 'Whether command succeeded Public Failure As String 'Reason command failed (CIX error message) 'T:Binmail (subroutine) (CIX) Sub BinMail(id As String, person As String, filename As String) Dim t As Tracker Dim cixfilename As String cixfilename = FileName$(filename) EnterMail "binmail " + person + " " + cixfilename + "\r" TrackFailure "File*not found" Set t = CreateTracker("sctrack2", "User*unknown", "FailureMatched", False, True) WaitForMainPrompt t.delete ReportSuccessFlag id & " : Send Binmail of " & filename & " to " & person EatExtraPrompts End Sub 'T:EraseMailFile (subroutine) (CIX) Sub EraseMailFile(id As String, filename As String) filename = FileName$(filename) EnterMail "era " + filename + "\r" TrackFailure "File*not found" Trackers("YES").active = True WaitForMainPrompt Trackers("YES").active = False ReportSuccessFlag id & " : Erased " & filename & " from mail" EatExtraPrompts End Sub 'T:RenameMailFile (subroutine) (CIX) Sub RenameMailFile(id As String, filename As String, newname As String) EnterMail "ren " + filename + " " + newname + "\r" TrackFailure "File*not found" WaitForMainPrompt ReportSuccessFlag id & " : Renamed " & filename & " to " & newname & " in mail" EatExtraPrompts End Sub 'T:ExportMailFile (subroutine) (CIX) Sub ExportMailFile(id As String, topic As String, filename As String) If Not JoinConference(id, topic) Then Exit Sub Terminal.Status "Exporting " & filename & "from mail to " & topic EnterMail "export " + filename + "\r" TrackFailure "You don't have such a file in your subdir." WaitForMainPrompt If Not Success Then Failure = "File '" + filename + "' not in your mail directory" ReportSuccessFlag id & " : Exported " & filename & " from mail to " & topic EatExtraPrompts Terminal.Status "" End Sub 'T:SendFileViaMail (subroutine) (CIX) Sub SendFileViaMail(id As String, filename As String, user As String, _ subject As String) GotoArea "Main" Comms.Send "killscratch\r" WaitForMainPrompt Comms.Send "upload\r" WaitFor "X)" FileUpload PROT_ZMODEM, filename,, True WaitForMainPrompt Comms.Send "mail to " + user + "\r" WaitFor "subject:" Comms.SendLiteral subject Comms.Send "\r" WaitForPrompt "PromptEdit" Comms.Send "q\r" WaitForPrompt "PromptSend" TrackFailure "-->*<--\n*\n" Comms.Send "send\r" WaitForMainPrompt ReportSuccessFlag id & " : Sent " & filename & " to " & user & " as a mail message" EatExtraPrompts End Sub 'T:MarkMailUnread (subroutine) (CIX) Sub MarkMailUnread(id As String, message As String) Dim IniCounter as Integer Dim MailLine as String Dim ListIni as String If message="All Mail in Inbasket" then ReadMailBasket id, "Inbasket" 'updates list.ini with all the unread mail ListIni$ = Session.ServicePath+"list.ini" IniCounter = 2 MailLine = ReadIni$("Mail Messages", CStr(IniCounter), ListIni) Comms.Send "mail\r" WaitForPrompt "Prompt" Do While Instr(MailLine,":") <> 0 MailLine = Trim$(Left$(MailLine, Instr(MailLine, ":")-1)) Comms.Send "markunread " + MailLine + "\r" WaitForPrompt "Prompt" IniCounter = IniCounter +1 MailLine = ReadIni$("Mail Messages", CStr(IniCounter), ListIni) Loop ReportSuccess id & " : Marked All message in mail inbox as unread" EatExtraPrompts Else If Instr(message, ":") then message = Trim$(Left$(message, Instr(message, ":")-1)) End If EnterMail "markunread " + message + "\r" WaitForMainPrompt ReportSuccess id & " : Marked #" & message & " as unread in mail" EatExtraPrompts End If End Sub 'T:ReadMailBasket (subroutine) (CIX) Sub ReadMailBasket(id As String, basket As String) Dim fname As String Dim ListIni$ Dim InFileNum% Dim ALine$ Dim IniNumCounter% Dim LineToWrite$ On Error Goto ReadMailBasket_error GotoArea "Main" Comms.Send "file time\r" WaitForMainPrompt If Mid$(basket, 1, 1)="S" Then EnterMail "file status\r" ElseIf Mid$(basket, 1, 1)="I" Then EnterMail "file in\r" ElseIf Mid$(basket, 1, 1)="O" Then EnterMail "file out\r" End If WaitForMainPrompt Comms.Send "file echo ----------\r" WaitForMainPrompt fname = UniqueFileName$() If Not DownloadScratchpad(id, fname) Then Exit Sub If Mid$(basket, 1, 1) <> "O" then 'Write the inifile stuff ListIni$ = Session.ServicePath+"list.ini" WriteIni "Mail Messages", "", "", ListIni WriteIni "Mail Messages", "1", "All Mail in Inbasket", ListIni$ InFileNum% = FreeFile Open fname for Input Access Read Shared as #InFileNum% ALine$ = "" While Eof(InFileNum%)=False And (Left$(ALine$,4) <> "From") 'Read and look for the "From" Line Input #InFileNum%, ALine$ Wend If Left$(ALine$, 4) <> "From" Then Close #InFileNum% Exit Sub End If Line Input #InFileNum%, ALine$ IniNumCounter% = 1 While Eof(InFileNum%)=False And (Left$(ALine$,4) <> "----") If Len(ALine$) > 17 Then IniNumCounter% = IniNumCounter% +1 LineToWrite = Mid$(ALine$,17,6) & " : " & Left$(ALine$, 16) & " : " & Right$(Aline$, 30) WriteIni "Mail Messages", Trim$(Str$(IniNumCounter%)), LineToWrite$, ListIni$ End If Line Input #InFileNum%, ALine$ Wend Close #InFileNum% End If If AddFileToMessageBase("mail/baskets", "Mail " + basket + " " + MyDate$, fname) Then ReportSuccess id & " : Collected information about mail " & basket Else ReportFailure id, Error$ & " " & Err & " " & Erl '" : Mail baskets information not collected/processed" End If EatExtraPrompts Exit Sub ReadMailBasket_error: Close #InFileNum% ReportFailure id, Error$ & " : Mail baskets not collected/processed" EatExtraPrompts End Sub 'T:DeleteMail (subroutine) (CIX) Sub DeleteMail(id As String, message As String) EnterMail "delete " + message + "\r" Trackers("YES").active = True WaitForMainPrompt Trackers("YES").active = False ReportSuccess id & " : Erased message #" & message & " in mail" EatExtraPrompts End Sub 'T:RefreshMailDir (subroutine) (CIX) Sub RefreshMailDir(id As String) Dim fname As String GotoArea "Main" EnterMail "file dir\r" WaitForMainPrompt fname = UniqueFileName$() If Not DownloadScratchpad(id, fname) Then Exit Sub If QueueFileList(Session.Service, fname, "mail/directory")=True Then ReportSuccess id & " : Refresh mail directory" SetLastUpdated "Refresh Mail Directory" Else ReportFailure id, "Empty scratchpad or download failure" End If End Sub 'T:ClearMail (subroutine) (CIX) Sub ClearMail(id As String) EnterMail "clear in quick clear out quick\r" WaitForMainPrompt ReportSuccess id & " : Cleared read mail on CIX" SetLastUpdated "Clear Read Mail" EatExtraPrompts End Sub