home *** CD-ROM | disk | FTP | other *** search
/ .net 1999 December / netCD65.iso / pc / Software / VirtualA / 32bit / vasetup.exe / %MAINDIR% / Lib.ebs < prev    next >
Encoding:
Text File  |  1999-10-06  |  19.1 KB  |  661 lines

  1. 'T:LIBS.EBS (global)
  2. ' VA 4.52
  3.  
  4. 'Add file to import queue 16 bit and 32 bit declares
  5. 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
  6. 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
  7.  
  8. 'T:iFlags Global (constants) 
  9. Const IM_DELETE = 2048        ' Delete scratchpad file afterwards?
  10.  
  11. Const fRECEIPT = 1            ' CIS mail receipt
  12. Const fPRIVATE = 2            ' CIS private forum message
  13. Const fNOFORMAT = 4           ' CIS unformatted message
  14.  
  15. Const BlockSize = 4096
  16.  
  17. Dim uniquefno As Long
  18. Dim workpath As String
  19. Dim RepFilename As String
  20.  
  21. 'T:MakeFilename (subroutine) (global)
  22. ' This takes a directory and filename and returns the full path to the file
  23. ' adding a backslash between them if necessary
  24. Function MakeFilename(directory As String, fname As String) As String
  25.     If Right$(directory, 1) <> "\" Then 
  26.         MakeFilename = directory & "\" & fname
  27.     Else
  28.         MakeFilename = directory & fname
  29.     End If
  30. End Function
  31.  
  32. 'T:SendCR (subroutine) (global)
  33. 'Typical tracker procedure, such as might be used to reply to a "More" prompt
  34. 'Sends a carriage return to the service, and removes the prompt from the capture file
  35. Sub SendCR(t As Tracker)
  36.     Print "Matched:"; t.name; ":Sending <cr>"
  37.     Comms.Send "\r"
  38.     CaptureRewind len(t.Match)
  39.     t.reset
  40. End Sub
  41.  
  42. 'T:SendNo (subroutine) (global)
  43. 'Typical tracker procedure, such as might be used to reply to a "Y/N" prompt
  44. 'Sends an "n" to the service, and removes the prompt from the capture file
  45. Sub SendNo(t As Tracker)
  46.     Print "Matched:"; t.name; ":Sending n<cr>"
  47.     Comms.Send "n\r"
  48.     CaptureRewind len(t.Match)
  49.     t.reset
  50. End Sub
  51.  
  52. 'T:SendYes (subroutine) (global)
  53. 'Typical tracker procedure, such as might be used to reply to a "More" prompt
  54. 'Sends a "y" to the service, and removes the prompt from the capture file
  55. Sub SendYes(t As Tracker)
  56.     Print "Matched:"; t.name; ":Sending y<cr>"
  57.     Comms.Send "y\r"
  58.     CaptureRewind len(t.Match)
  59.     t.reset
  60. End Sub
  61.  
  62. 'T:ParseString (function) (global)
  63. 'Useful library routine to parse a string into individual arguments
  64. 'Each call returns the first argument, and removes it from the string
  65. Function ParseString(args As String, delim As String) As String
  66.     Dim p As integer
  67.  
  68.     p = Instr(args, delim)
  69.     If p Then
  70.         ParseString = Left$(args, p - 1)
  71.         args = Mid$(args, p + Len(delim))
  72.     Else
  73.         ParseString = args
  74.         args = ""
  75.     End If
  76. End Function
  77.  
  78. 'T:DeleteFile (subroutine) (global)
  79. 'Routine to delete a file without giving a Basic error
  80. 'if the file doesn't exist
  81. Sub DeleteFile(filename As String)
  82.     On Error Resume Next
  83.     Kill filename
  84.     On Error Goto 0
  85. End Sub
  86.  
  87. 'T:WaitForTimed (subroutine) (global)
  88. 'Useful routing to wait for a string
  89. 'If any existing tracks are hit, any tracker procedures are called,
  90. 'but trackers without procedures are ignored and reset
  91. 'If the string we wanted doesn't arrive, the Basic error will NOT be trapped
  92. Sub WaitForTimed(s As String, timeout As Integer)
  93.     Dim t As Tracker, t1 As Tracker
  94.  
  95.     Print "WaitForTimed "; s; timeout
  96.     Trackers.Reset
  97.     Set t = CreateTracker("WaitFor", s, "", True)
  98.     Do
  99.         Set t1 = Wait(timeout)
  100.         t1.reset
  101.     Loop Until t1 = t
  102.     t.delete
  103. End Sub
  104.  
  105. 'T:WaitForWithTimeout (function) (global)
  106. 'Useful routine to wait for a string
  107. 'If any existing tracks are hit, any tracker procedure are called,
  108. 'but trackers without procedures are ignored and reset
  109. 'If the string wanted doesn't arrive, then returns False
  110. Function WaitForWithTimeout(s As String, timeout As Integer)
  111.     On Error Goto WaitForWithTimeout_error
  112.     WaitForTimed s, timeout
  113.     WaitForWithTimeout = True
  114.     Print "OK"
  115.     Exit Function
  116. WaitForWithTimeout_error:
  117.     Print "Failed"
  118.     If Err = 1002 Then WaitForWithTimeout = False
  119.     Exit Function
  120. End Function
  121.  
  122. 'T:WaitFor (subroutine) (global) (global)
  123. 'Useful routing to wait for a string for 30 seconds
  124. Sub WaitFor(s As String)
  125.     WaitForTimed s, 300
  126. End Sub
  127.  
  128. 'T:WaitForEitherTimed (subroutine) (global)
  129. 'Useful routing to wait for 2 different strings
  130. 'If any existing tracks are hit, any tracker procedures are called,
  131. 'but trackers without procedures are ignored and reset
  132. 'If the string we wanted doesn't arrive, the Basic error will NOT be trapped
  133. Function WaitForEitherTimed(s1 As String, s2 As String, timeout As Integer) As String
  134.     Dim t As Tracker, t1 As Tracker, t2 As Tracker
  135.  
  136.     Print "WaitForEitherTimed "; s1; s2; timeout
  137.     Trackers.Reset
  138.     Set t1 = CreateTracker("WaitFor1", s1)
  139.     Set t2 = CreateTracker("WaitFor2", s2)
  140.     Do
  141.         Set t = Wait(timeout)
  142.         t.reset
  143.     Loop Until t1 = t Or t2 = t
  144.     If t1=t Then
  145.         WaitForEitherTimed = s1
  146.     Else
  147.         WaitForEitherTimed = s2
  148.     End If
  149.     t1.delete
  150.     t2.delete
  151. End Function
  152.  
  153. 'T:WaitWithKick (function) (global)
  154. 'Useful routine to wait for a string for 30 seconds, and prod the service
  155. 'with another string if it doesn't arrive
  156. Function WaitWithKick(s As String, kick As String)
  157.     Print "WaitWithKick "; s
  158.     On Error Goto WaitWithKick_error
  159.     WaitFor s
  160.     WaitWithKick = True
  161.     Print "OK"
  162.     Exit Function
  163. WaitWithKick_error:
  164.     Print "Failed"
  165.     If Err = 1002 Then Comms.Send kick
  166.     WaitWithKick = False
  167.     Exit Function
  168. End Function
  169.  
  170. 'T:RepeatWaitWithKick (function) (global)
  171. 'Repeatedly calls WaitWithKick until we get a result
  172. Function RepeatWaitWithKick(s As String, kick As String, count As Integer)
  173.     Do
  174.         If WaitWithKick(s, kick) Then
  175.             RepeatWaitWithKick = True
  176.             Exit Function
  177.         End If
  178.     count = count - 1
  179.     Loop While count > 0
  180.     RepeatWithKick = False
  181. End Function
  182.  
  183. 'T:SplitPath (subroutine) (global)
  184. 'Useful routines to split a path up into its components
  185. Sub SplitPath(fullpath As String, pathonly As String, fileonly As String)
  186.     Dim p As Integer, lastp As Integer
  187.  
  188.     lastp = 1
  189.     If Len(fullpath) > 2 Then
  190.         If Mid$(fullpath, 2, 1) = ":" Then
  191.             lastp = 3
  192.         End If
  193.     End If
  194.     Do
  195.         p = Instr(lastp, fullpath, "\")
  196.         If p = 0 Then p = Instr(lastp, fullpath, "/")
  197.         if p Then lastp = p + 1
  198.     Loop While p
  199.     pathonly = Left$(fullpath, lastp - 1)
  200.     fileonly = Mid$(fullpath, lastp)
  201. End Sub
  202.  
  203. 'T:FileName$ (function) (global)
  204. Function FileName$(fullpath As String)
  205.     Dim pathonly As String, fileonly As String
  206.     SplitPath fullpath, pathonly, fileonly
  207.     FileName = fileonly
  208. End Function
  209.  
  210. 'T:MakePath (function) (global)
  211. Function MakePath$(directory As String, file As String)
  212.     Dim path As String
  213.  
  214.     If directory > "" Then
  215.         Select Case Right$(path, 1)
  216.             Case ":", "\", "/"
  217.                 path = directory
  218.             Case Else
  219.                 path = directory + "\"
  220.         End Select
  221.     End If
  222.     MakePath = path + file
  223. End Function
  224.  
  225. 'T:UniqueFileName (function) (global)
  226. 'Generate a unique download filename
  227. Function UniqueFileName$()
  228.     Dim fname As String
  229.  
  230.     ' Make sure we have a workpath
  231.     If workpath="" Then
  232.         uniquefno = 0
  233.         workpath = ReadIni$("Service "+Session.Service, "Work Path", Session.IniFileName)
  234.         If workpath="" Then
  235.             workpath = ReadIni$("Main", "Message Path", Session.IniFileName)
  236.             workpath = MakeFilename(workpath, "temp")
  237.             WriteIni "Service "+Session.Service, "Work Path", MakeFilename(workpath, ""), Session.IniFileName
  238.         End If
  239.         On Error Resume Next
  240.  
  241.         ' Don't call MkDir in 16-bit since it crashes
  242.         If Basic.OS = ebWin32 Then MkDir workpath
  243.     End If
  244.  
  245.     On Error Goto UniqueFileName_gotname
  246.     Do
  247.         uniquefno = uniquefno + 1
  248.         fname = MakeFilename(workpath, "msw" + right$(str$(100000+uniquefno), 5) + ".tmp")
  249.         Open fname For Input Access Read Shared As #1
  250.         Close #1
  251.     Loop
  252. UniqueFileName_gotname:
  253.     On Error Goto 0
  254.     UniqueFileName$ = fname
  255.     Exit Function
  256. End Function
  257.  
  258. 'T:ManualTerminal (subroutine) (global)
  259. 'Manual Terminal
  260. Sub ManualTerminal
  261.     Dim t As Tracker
  262.  
  263.     On Error Goto ManualTerminal_error
  264.     LogResult "Manual terminal mode"
  265.     Trackers.delete
  266.     Do
  267.         Print "W";
  268.         Set t = Wait(0)
  269.         Print "R";
  270.     Loop
  271.     Exit Sub
  272. ManualTerminal_error:
  273.     Print
  274.     Print "Terminal Err"; Err; ":"; Erl; ":"; Error$
  275.     If Err = 1002 Or Err = 1003 Or Err = 1004 Then Resume 0
  276.     Print "Terminal - exiting"
  277.     Exit Sub
  278. End Sub
  279.  
  280. 'T:DialService (function) (global)
  281. 'Dial the numbers in the ashmount.ini file until connected
  282. Function DialService()
  283.     Print "DialService"
  284.     Redials% = Val(ReadIni$(Session.IniSection, "Retries", Session.IniFileName))
  285.     If Redials% <= 0 Then Redials% = 1
  286.     For i% = 1 to Redials%
  287.         NumberList$ = ReadIni$(Session.IniSection, "Phone", Session.IniFileName)
  288.         If NumberList$ = "" Then Goto DialService_nonumber
  289.         Do
  290.             number$ = ParseString(NumberList, ";")
  291.             If Comms.Dial(number$) Then
  292. DialService_nonumber:
  293.                 Terminal.RestartTimer
  294.                 If Session.LoginScript <> "" Then
  295.                     Terminal.Status "Logging in - " + Session.LoginScript
  296.                     If Login() Then
  297.                         DialService = True
  298.                         Terminal.Status "Connected to " + Session.Service
  299.                         Exit Function
  300.                     End If
  301.                 Else
  302.                     DialService = True
  303.                     Exit Function
  304.                 End If
  305.             Else
  306.                 If Err = 1006 Then Exit Do
  307.             End If
  308.             Comms.Hangup
  309.         Loop While NumberList$ <> ""
  310.     Next
  311.     DialService = False
  312. End Function
  313.  
  314. 'T:OpenRepFile (subroutine) (internal)
  315. 'Opens the LogResult report file
  316. Sub OpenRepFile
  317.     If RepFilename = "" Then StartReportFile
  318.     Open RepFilename For Append Access Read Write Shared As #10
  319. End Sub
  320.  
  321. 'T:LogResult (subroutine) (global)
  322. 'Routines to report success or failure of a command
  323. Sub LogResult(result As String)
  324.     Print result
  325.     Terminal.Status result
  326.     OpenRepFile
  327.     Print #10, result
  328.     Close #10
  329. End Sub
  330.  
  331. 'T:ReportSuccess (subroutine) (global)
  332. Sub ReportSuccess(id As String)
  333.     LogResult id + " : Succeeded"
  334.     Open Session.ServicePath + "success.log" For Append Access Read Write Shared As #10
  335.     Print #10, id
  336.     Close #10
  337. End Sub
  338.  
  339. 'T:ReportFailure (subroutine) (global)
  340. Sub ReportFailure(id As String, reason As String)
  341.     LogResult id + " : Failed : " + reason
  342. End Sub
  343.  
  344. 'T:StartReportFile (subroutine) (global)
  345. Sub StartReportFile
  346.     RepFilename = MakeFilename(ReadIni$("Main", "Message Path", Session.IniFileName), Session.Service+".rep")
  347.     Open RepFilename For Append Access Read Write Shared As #10
  348.     Print #10, "!end" ' Just in case something was already there
  349.     Print #10, "!start actions/information Terminal"
  350.     Close #10
  351. End Sub
  352.  
  353. 'T:EndReportFile (subroutine) (global)
  354. Sub EndReportFile
  355.     Dim result As Integer, resultl As Long
  356.  
  357.     OpenRepFile
  358.     Print #10, "!end"
  359.     Close #10
  360.  
  361.     ' Don't add to the import queue - since VA32.EXE does this
  362. End Sub
  363.  
  364. 'T:NoSpaces (function) (global)
  365. ' Converts "PC Week News" -> "PC_Week_News"
  366. Function NoSpaces(s As String) As String
  367.     Dim tmp As String
  368.  
  369.     tmp = ""
  370.     For i = 1 To Len(s)
  371.         If Mid(s, i, 1)=" " Then
  372.             tmp = tmp + "_"
  373.         Else
  374.             tmp = tmp + Mid(s, i, 1)
  375.         End If
  376.     Next
  377.  
  378.     NoSpaces = tmp
  379. End Function
  380.  
  381. 'T:ToSpaces (function) (global)
  382. ' Converts "PC_Week_News" -> "PC Week News"
  383. Function ToSpaces(s As String) As String
  384.     Dim tmp As String
  385.  
  386.     tmp = ""
  387.     For i = 1 To Len(s)
  388.         If Mid(s, i, 1)="_" Then
  389.             tmp = tmp + " "
  390.         Else
  391.             tmp = tmp + Mid(s, i, 1)
  392.         End If
  393.     Next
  394.  
  395.     ToSpaces = tmp
  396. End Function
  397.  
  398. 'T:Pause (subroutine) (global)
  399. Sub Pause(secs As Integer)
  400.     ' should delay for a bit
  401.     Dim fin As Single
  402.  
  403.     fin = Timer()+secs
  404.     Do
  405.         DoEvents
  406.     Loop Until Timer()>=fin
  407. End Sub
  408.  
  409. 'T:QueueFile (function) (Global)
  410. 'Queue a file for adding to the message base
  411. Function QueueFile(service As String, sfilename As String, queueflags As Long) As Boolean
  412.     Dim fname As String
  413.     Dim result As Integer, resultl As Long
  414.  
  415.     On Error Goto QueueFile_error
  416.     If Filelen(sfilename) = 0 Then
  417.         Print "File:"; sfilename; " is empty"
  418.         LogResult "File was empty"
  419.         DeleteFile sfilename
  420.         QueueFile = False
  421.         Exit Function
  422.     End If
  423.     Print "Queueing:"; sfilename
  424.  
  425.     AddToMsgFile sfilename
  426.  
  427.     If Basic.OS = ebWin32 Then
  428.         resultl = AddToDoList32(service, sfilename, "messages", queueflags)
  429.     Else
  430.         result = AddToDoList16(service, sfilename, "messages", queueflags)
  431.     End If
  432.  
  433.     ' Run import if it isn't already running
  434.     If ReadIni$("Main", "Stop Import", Session.inifilename) = "NO" then
  435.         Runimport
  436.     End If
  437.     QueueFile = True
  438.     Exit Function
  439. QueueFile_error:
  440.     Print "File:"; sfilename; " "; Error$
  441.     QueueFile = True
  442.     Exit Function
  443. End Function
  444.  
  445. 'T:QueueFileList (function) (Global)
  446. 'Queue a file for adding to the message base
  447. Function QueueFileList(service As String, sfilename As String, topic As String) As Boolean
  448.     Dim fname As String
  449.     Dim result As Integer, resultl As Long
  450.  
  451.     On Error Goto QueueFileList_error
  452.     If Filelen(sfilename) = 0 Then
  453.         Print "File:"; sfilename; " is empty"
  454.         LogResult "File was empty"
  455.         DeleteFile sfilename
  456.         QueueFileList = False
  457.         Exit Function
  458.     End If
  459.     Print "Queueing:"; sfilename
  460.  
  461.     If Basic.OS = ebWin32 Then
  462.         resultl = AddToDoList32(service, sfilename, topic, IM_DELETE)
  463.     Else
  464.         result = AddToDoList16(service, sfilename, topic, IM_DELETE)
  465.     End If
  466.  
  467.     ' Run import if it isn't already running
  468.     If ReadIni$("Main", "Stop Import", Session.inifilename) = "NO" then
  469.         Runimport
  470.     End If
  471.     QueueFileList = True
  472.     Exit Function
  473. QueueFileList_error:
  474.     Print "File:"; sfilename; " "; Error$
  475.     QueueFileList = True
  476.     Exit Function
  477. End Function
  478.  
  479. 'T:RunImport (subroutine)
  480. 'This routine runs import if it needs to be run
  481. Sub RunImport
  482.     Dim exepath As String, UserName As String
  483.     Dim UserNumber as String, ForgroundImport as String
  484.     Dim SlashUID as Integer, SlashUser as Integer
  485.     Dim VisibleType as Integer
  486.     On Error resume next
  487.  
  488.     'Workout who the user is so I know what USERNAME.ini file to use
  489.     SlashUser = Instr(Command$, "/USER=")
  490.  
  491.     'Workout which user logon (/2 /3 etc) this is as well so I know what section to use
  492.     SlashUID=Instr(SlashUser+2, Command$, "/UID=")
  493.     If SlashUID > 0 then
  494.         UserName = Left$(Trim$(Mid$(Command$, SlashUser + 6, SlashUID - SlashUser - 6)),8)
  495.         UserNumber = "/" & Right$(Command$, 1)
  496.     Else
  497.         UserName = Left$(Trim$(Right$(Command$, Len(Command$)-SlashUser - 5)),8)
  498.         UserNumber = ""
  499.     End If
  500.  
  501.     'Now check the Import To Forground= setting
  502.     ForgroundImport = ReadIni$("Main" & UserNumber, "Import To Foreground", MakeFilename(ReadIni$("Main", "User Path", Session.inifilename), UserName & ".ini"))
  503.     If ForgroundImport = "YES" then
  504.         'Visible with focus
  505.         VisibleType = 1
  506.     Else
  507.         'Minimised whithout focus
  508.         VisibleType = 7
  509.     End If        
  510.  
  511.     ' Run import/import32
  512.     StartImport VisibleType
  513. End Sub
  514.  
  515. 'T:AddToFile (subroutine) (global)
  516. ' This takes an input file and it appends it onto another
  517. Sub AddToFile (TargetFileName As String, SourceFileName as String)
  518.     Dim MsgFileNum as Integer, SourceFileNum as Integer
  519.     Dim MsgFileAt as Long, SourceFileAt as Long
  520.     Dim MsgFileLen as Long, SourceFileLen as Long
  521.     Dim TheData as String
  522.     Dim BytesToRead as Long
  523.  
  524.     On Error Goto AddToFile_error
  525.  
  526.     If FileExists(TargetFileName) Then
  527.         MsgFileLen = FileLen(TargetFileName)
  528.     Else
  529.         MsgFileLen = 0
  530.     End If
  531.     MsgFileAt = MsgFileLen + 1    'write point
  532.     MsgFileNum = FreeFile()
  533.     Open TargetFileName For Binary Access Read Write Shared As #MsgFileNum
  534.     
  535.     SourceFileLen = FileLen(SourceFileName)
  536.     BytesToRead = SourceFileLen
  537.     SourceFileNum = FreeFile()
  538.     Open SourceFileName for Binary Access Read Shared as #SourceFileNum
  539.     SourceFileAt = 1        'read point
  540.  
  541.     TheData = String$(BlockSize, " ")
  542.     
  543.     ' Operate on blocks of BlockSize at a time
  544.     Do While BytesToRead > BlockSize
  545.         Get #SourceFileNum, SourceFileAt, TheData
  546.         Put #MsgFileNum, MsgFileAt, TheData
  547.         BytesToRead = BytesToRead - BlockSize
  548.         SourceFileAt = SourceFileAt + BlockSize
  549.         MsgFileAt = MsgFileAt + BlockSize
  550.     Loop
  551.  
  552.     ' Now do the last block of less than BlockSize
  553.     If BytesToRead > 0 then
  554.         TheData = String$(BytesToRead, " ")
  555.         Get #SourceFileNum, SourceFileAt, TheData
  556.         Put #MsgFileNum, MsgFileAt, TheData
  557.     End If
  558.     
  559.     Close #MsgFileNum
  560.     Close #SourceFileNum
  561.     Exit Sub
  562.  
  563. AddToFile_error:
  564.     LogResult "Error in AddToFile : " + Str$(Err) + " in line " + Str$(Erl) + ":" + Error$
  565.     Close #SourceFileNum
  566.     Close #MsgFileNum
  567.     Exit Sub
  568. End Sub
  569.  
  570. 'T:AddToMsgFile (subroutine) (global)
  571. ' This takes an input file and it appends it onto ~\VAPATH\service\service.msg file for backups
  572. Sub AddToMsgFile (SourceFileName as String)
  573.     Dim MsgFileName As String
  574.     MsgFileName = Session.ServicePath & Left$(Session.Service, 8) & ".msg"
  575.     AddToFile MsgFileName, SourceFileName
  576. End Sub
  577.  
  578. 'T:AddBackslash (subroutine) (global)
  579. ' This takes an input string and ensures that the final character is a "\"
  580. Sub AddBackSlash (byRef APath as String)
  581.     If Right$(APath, 1) <> "\" Then APath = APath & "\"
  582. End Sub
  583.  
  584. 'T:LoadAddonLibraries (subroutine) (global)
  585. Sub LoadAddonLibraries
  586. '***************************************************************************
  587. '* Purpose: Loads Addon Script Files                                       *
  588. '*                                                                         *
  589. '* Inputs :                                                                *
  590. '*                                                                         *
  591. '* Returns:                                                                *
  592. '*                                                                         *
  593. '* ----------------------------------------------------------------------- *
  594. '* Revision History                                                        *
  595. '* Date:    Author:   Comments:                                            *
  596. '* ----------------------------------------------------------------------- *
  597. '* 31/01/96 AGB       Created                                              *
  598. '***************************************************************************
  599.  
  600. Dim sAddonsLine As String
  601. Dim sAddon As String
  602. Dim sScriptFile As String
  603. Dim sMsg As String
  604.  
  605.     On Error Goto Error_LoadAddonLibraries
  606.  
  607.     ' Get Addons= line from ashmount.ini
  608.     sAddonsLine = ReadIni$("Main", "Addons", Session.IniFileName)
  609.  
  610.     ' Process addon line
  611.     Do While Len(sAddonsLine) <> 0
  612.  
  613.         ' Extract each addon
  614.         sAddon = ParseString(sAddonsLine,",")
  615.         sAddon = Trim(sAddon)
  616.  
  617.         ' Get ScriptFile= line addon section of ashmount.ini
  618.         sScriptFile = ReadIni$("Addon." & sAddon, "ScriptFile", Session.IniFileName)
  619.  
  620.         If sScriptFile <> "" Then 
  621.             ' Check if file exists
  622.             If FileExists(Session.ServicePath & sScriptFile) = True Then
  623.                 LoadScript sScriptFile
  624.             End If
  625.         End If
  626.  
  627.     Loop
  628.  
  629.     Exit Sub
  630.  
  631. Error_LoadAddonLibraries:
  632.  
  633.     LogResult "Error loading addon libraries"
  634. End Sub
  635.  
  636. 'T:MyDate (function) (Global)
  637. Function MyDate$
  638.     MyDate = FormattedDateTime()
  639. End Function
  640.  
  641. 'T:RecordFileDownload (subroutine) (Global)
  642. Sub RecordFileDownload(topic As String, fname As String)
  643.     Dim fn As String
  644.  
  645.     fn = Session.ServicePath+"files.ww"
  646.     Open fn For Append Access Read Write Shared As #11
  647.     Print #11, topic+" "+fname
  648.     Close #11
  649. End Sub
  650.  
  651. 'T:FileUrl (function) (Global)
  652. Function FileUrl(fn As String) As String
  653.     If InStr(fn, " ")=0 Then
  654.         FileUrl = "FILE://" + fn
  655.     Else
  656.         FileUrl = "FILE://""" + fn + """"
  657.     End If
  658. End Function
  659.  
  660.  
  661.