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

  1. 'T:HMILIB.EBS for CompuServe
  2. ' VA 4.52 release
  3. ' 20.11.97 SH - incorporated Taz' script split and reporting improvements
  4.  
  5. Declare Function ParseString(args As String, delim As String) As String
  6. Declare Function QueueFile(service As String, sfilename As String, queueflags As Long) As Boolean
  7. Declare Sub ReportSuccess(msg As String)
  8. Declare Function FullErrorMessage() As String
  9. Declare Sub LogResult(result As String)
  10. Declare Sub RecordFileDownload(topic As String, fname As String)
  11. Declare Function UniqueFileName$()
  12. Declare Function FileUrl(fn As String) As String
  13. Declare Function ParseSectionList(ByVal sect As String, ByVal validsects As Long, ByRef count As Integer) As Long
  14. Declare Sub WriteLibraryMessage(forum As String, filedesc As FAPFILEDESCRIPTION, downloaded As String)
  15. Declare Function SectionNumber(ByVal section As String)
  16. Declare Sub NewSearchLibrary(id As String, forum As String, catalog As String, _
  17.                   ssections As String, filename As String, uploadby As String, _
  18.                   age As String, accesscount As String, keywords As String, _
  19.                   title As String, description As String, full As String, _
  20.                   replace As String)
  21. Declare Function HMIGotoForum(ByVal forum As String) As Boolean
  22. Declare Sub JoinForum(id As String, forum As String, handle As String, newmsgs As String)
  23.  
  24. Const BlockSize = 2048
  25.  
  26. Const IM_DELETE = 2048        ' Delete scratchpad file afterwards?
  27. Const IM_MARKUNREAD = 131072
  28.  
  29. Public DownloadDir As String    'where downloads go
  30. Public WhereAmI As String        'name of last forum/page etc
  31. Public FAPconfig As FAPCONFIG
  32. Public SectionLibIds(32) As Integer
  33. Public szLibSection() As FAPSECTIONENTRY
  34. Dim sectionvector As Long, filterVector As Long
  35.  
  36. Const ALL_HEADER_FIELDS% = &H1FF3
  37. Const FAP_FDC_FILE_TYPE% = &H4
  38. Const FAP_FDC_FILE_SIZE% = &H8
  39. Const FAP_FDC_ABSTRACT% = &H100
  40.  
  41. Const FAP_SFH_FILENAME% = 0
  42. Const FAP_SFH_USER_ID% = FAP_SFH_FILENAME + 1
  43. Const FAP_SFH_KEYWORD% = FAP_SFH_USER_ID + 1
  44. Const FAP_SFH_ACCESS_COUNT% = FAP_SFH_KEYWORD + 1
  45. Const FAP_SFH_DATE_RANGE% = FAP_SFH_ACCESS_COUNT + 1
  46. Const FAP_SFH_LAST_ACCESS_RANGE% = FAP_SFH_DATE_RANGE + 1
  47. Const FAP_SFH_FILE_ABSTRACT% = FAP_SFH_LAST_ACCESS_RANGE + 1
  48. Const FAP_SFH_FILE_BODY% = FAP_SFH_FILE_ABSTRACT + 1
  49. Const FAP_SFH_MATCH_NON_PUBLIC_ONLY% = FAP_SFH_FILE_BODY + 1
  50. Const FAP_SFH_SIZE_RANGE% = FAP_SFH_MATCH_NON_PUBLIC_ONLY + 1
  51. Const FAP_SFH_TITLE% = FAP_SFH_SIZE_RANGE + 1
  52.  
  53. Const DAP_AL_VOLATILE = &H02
  54. Const DAP_AP_SESSION_ONLY = &H01
  55. Const DAP_AP_VOLATILE = &H02
  56. Const DAP_AP_EX_HAVE_TITLE% = &H0100
  57. Const DAP_AP_HAVE_HEADER% = &H04
  58. Const DAP_AP_HAVE_TRAILER% = &H08
  59. Const HMI_DATA_SIZE% = 1024
  60. Const HMI_STATE_FIRST% = 0
  61. Const HMI_STATE_NEXT% = HMI_STATE_FIRST + 1
  62. Const FAP_USF_HIGH_MSG% = &H2
  63. Const FAP_USF_NAME% = &H4
  64. Const FAP_USR_JOIN% = &H1
  65. Const FAP_USR_PERMANENT% = &H2
  66. Const FAP_WAITING_MSGS% = &H1
  67. Const FAP_NEW_BULLETINS% = &H2
  68. Const FAP_CONFERENCE_IN_PROGRESS% = &H4
  69. Const FAP_NOT_A_MEMBER% = &H8
  70. Const FAP_IS_SYSOP% = &H10        ' user is SYSOP in this Forum
  71. Const FAP_FREE_USER% = &H20
  72. Const FAP_LOCKED_OUT% = &H40
  73. Const FAP_TRANSACTION_BILLING% = &H80
  74. Const FAP_ALLOW_MULTIPLE_SEARCH% = &H100
  75. Const FAP_NISA_FORUM% = &H200
  76.  
  77. Const FAP_MSS_ALL_MSGS% = 0
  78. Const FAP_MSS_WAITING_MSGS% = FAP_MSS_ALL_MSGS + 1
  79. Const FAP_MSS_SUBJECT_TEXT% = FAP_MSS_WAITING_MSGS + 1
  80. Const FAP_MSS_ORIGINATOR_NAME% = FAP_MSS_SUBJECT_TEXT + 1
  81. Const FAP_MSS_RECIPIENT_NAME% = FAP_MSS_ORIGINATOR_NAME + 1
  82. Const FAP_MSS_MSGS_WITHOUT_REPLIES% = FAP_MSS_RECIPIENT_NAME + 1
  83. Const FAP_MSS_HELD_MSGS% = FAP_MSS_MSGS_WITHOUT_REPLIES + 1
  84. Const FAP_MSS_PRIVATE_MSGS% = FAP_MSS_HELD_MSGS + 1        ' to the user
  85. Const FAP_MSS_MSGS_WITHOUT_SYSOP_REPLIES% = FAP_MSS_PRIVATE_MSGS + 1
  86. Const FAP_MSS_MESSAGE_BODY% = FAP_MSS_MSGS_WITHOUT_SYSOP_REPLIES + 1
  87. Const FAP_MSS_POSTING_DATE_RANGE% = FAP_MSS_MESSAGE_BODY + 1
  88. Const FAP_MSS_EXPIRATION_DATE_RANGE% = FAP_MSS_POSTING_DATE_RANGE + 1
  89. Const FAP_MSS_MESSAGES_HAS_BEEN_READ% = FAP_MSS_EXPIRATION_DATE_RANGE + 1
  90.  
  91. Const FAP_NO_MESSAGE_READ% = &H1
  92. Const FAP_NO_MESSAGE_SEND% = &H2
  93. Const FAP_NO_LIBRARY_READ% = &H4
  94. Const FAP_NO_LIBRARY_SEND% = &H8
  95. Const FAP_NO_CONFERENCE% = &H10
  96. Const FAP_NO_PRIVATE_MSGS% = &H20
  97. Const FAP_NO_MEMBERSHIP% = &H80
  98. Const FAP_PRIVATE_FORUM% = &H100
  99. Const FAP_RTC_CONFIG_SUPPORTED% = &H200
  100. Const FAP_SEARCH_LIBRARY_ABSTRACTS% = &H400   ' Full text search of file abstrats allowed
  101. Const FAP_SEARCH_LIBRARY_FILES% = &H800              ' Search text file contents
  102. Const FAP_SEARCH_MESSAGE_BODIES% = &H1000     ' Searching message bodies allowed
  103. Const FAP_LIBRARY_ONLY_FORUM% = &H2000
  104.  
  105. Const FAP_PRIVATE_MESSAGE% = &H1
  106. Const FAP_EXTENDED_MESSAGE% = &H80
  107.  
  108. Const FAP_MC_THREAD_ID% = &H1000
  109. Const FAP_MC_THREADS% = &H8000
  110.  
  111. Const FAP_MSR_PSEUDO_ROOTS% = &H80
  112.  
  113.  
  114. 'T:NewDownloadFile (subroutine) (CompuServe)
  115. Sub NewDownloadFile(id As String, forum As String, filename As String, pubavail As Boolean)
  116.     Dim section As Integer, sections As Long, ftype As Integer, i As Integer
  117.     Dim catalog As Long, filesize As Long, l As Long
  118.     Dim tforum As String, s As String, count As Long
  119.     Dim b As Integer, fname As String, pterm(0 to 0) As FAPSEARCHTERM
  120.     Dim fdesc() As FAPFILEDESCRIPTION, fterm(0 to 1) As FAPSEARCHTERM
  121.     Dim URLForum as String
  122.  
  123.     tforum = forum
  124.     If Not HMIGotoForum(tforum) Then
  125.         LogResult "Unable to download file "+filename+" from "+forum
  126.         Exit Sub
  127.     End If
  128.  
  129.     ' Extract the section number
  130.     section = Val(SectionNumber(forum))
  131.     sections = 2 ^ section
  132.     If (FAPconfig.svLibSections And sections) = 0 Then
  133.         LogResult id + " : Failed : Unknown library section " & forum
  134.         Exit Sub
  135.     End If
  136.  
  137.     ' Scan library for the file
  138.     On Error Goto NotFound_error
  139.     If pubavail Then
  140.         Terminal.Print "Downloading file " + filename + Basic.Eoln$
  141.  
  142.         pterm(0).cType = FAP_SFH_FILENAME
  143.         pterm(0).lpPattern = filename
  144.         FAPSearchFile fdesc(), HMI_STATE_FIRST%, 1, 1, sections, _
  145.             FAP_FDC_FILE_TYPE% + FAP_FDC_FILE_SIZE%, pterm()
  146.     Else
  147.         Terminal.Print "Downloading unreleased file " + filename + Basic.Eoln$
  148.  
  149.         fterm(0).cType = FAP_SFH_FILENAME
  150.         fterm(0).lpPattern = filename
  151.         fterm(1).cType = FAP_SFH_MATCH_NON_PUBLIC_ONLY
  152.         FAPSearchFile fdesc(), HMI_STATE_FIRST%, 1, 1, sections, _
  153.             FAP_FDC_FILE_TYPE% + FAP_FDC_FILE_SIZE%, fterm()
  154.     End If
  155.  
  156.     catalog = fdesc(0).dwCatalogNo
  157.     filesize = fdesc(0).dwFileSize
  158.     ftype = fdesc(0).nFileType
  159.  
  160.     If filesize = 0 Then
  161.         Terminal.Print "File not found." + Basic.Eoln$
  162.         LogResult "Unable to find "+filename+" in library "+forum
  163.         Exit Sub
  164.     End If
  165.  
  166.     On Error Goto DownloadFile_error
  167.     Terminal.TransferStatus False, filename, 0, filesize
  168.  
  169.     ' Open file to write to
  170.     If FileExists(DownloadDir+filename) Then
  171.         count = FileLen(DownloadDir+filename) ' Resume file download
  172.     Else
  173.         count = 0
  174.     End If
  175.     Open DownloadDir+filename For Binary Access Write Shared As #1
  176.     If count>0 Then
  177.         Terminal.Print "Resuming file download at " & count & Basic.Eoln$
  178.         Seek #1, count+1
  179.     End If
  180.  
  181.     s = FAPReceiveFileOffset(HMI_STATE_FIRST%, catalog, ftype, 0, i, count+1)
  182.     Do While s > ""
  183.         Put #1, , s
  184.         count = count + i
  185.         Terminal.TransferStatus False, filename, count, filesize
  186.         s = FAPReceiveFileOffset(HMI_STATE_NEXT%, catalog, ftype, 0, i, count+1)
  187.     Loop
  188.     If count < filesize Then 
  189.         Terminal.TransferStatus False, filename, count, count
  190.         LogResult id & " : Possible incomplete download of "+filename+" from "+forum
  191.         LogResult id & " : Reported size " & filesize & " actual size " & count
  192.     End If
  193.     Close #1
  194.     Terminal.TransferStatus
  195.  
  196.     ' Write comment to catalog entry and import into messagebase
  197.     tforum = ParseString(tforum, "/")+"/L"+LTrim(Str(section))
  198.     RecordFileDownload tforum, LTrim$(Str$(catalog))
  199.     If SectionLibIds(section) >= 0 Then
  200.         tforum = tforum +"_" + szLibSection(SectionLibIds(section)).lpTitle
  201.     Else
  202.         tforum = tforum + "_Unknown"
  203.     End If
  204.     
  205.     If pubavail Then
  206.         URLForum = forum
  207.         ReplaceAllInString URLforum, " ", "_"
  208.         URLForum = "VA:" & Session.Service & ":" & URLForum & "#" & CStr(fdesc(0).dwCatalogNo)
  209.         ReportSuccess id & " : Downloaded "+FileUrl(DownloadDir+filename)+" from " + URLForum
  210.         NewSearchLibrary "", tforum, LTrim$(Str(catalog)), "", DownloadDir+filename, _
  211.                          "", "", "", "", "", "", "y", "n"
  212.     Else
  213.         ReportSuccess id & " : Downloaded unreleased "+FileUrl(DownloadDir+filename)+" from " + forum
  214.     End If
  215.     Exit Sub
  216.  
  217. NotFound_error:
  218.     LogResult "Unable to find "+filename+" in library "+forum
  219.     Exit Sub
  220.  
  221. DownloadFile_error:
  222.     Close #1
  223.     Terminal.TransferStatus
  224.     LogResult id & " : Failed to download "+filename+" from "+forum+" error : " + FullErrorMessage()
  225. End Sub
  226.  
  227. 'T:DownloadFile (subroutine) (CompuServe)
  228. Sub DownloadFile(id As String, forum As String, filename As String)
  229.     NewDownloadFile id, forum, filename, True
  230. End Sub
  231.  
  232. 'T:DownloadFileFinder (subroutine) (CompuServe)
  233. Sub DownloadFileFinder(id As String, forum As String, filename As String, handle As String)
  234.     Dim tforum As String
  235.  
  236.     tforum = forum
  237.     If Not HMIGotoForum(forum) Then
  238.         LogResult "Unable to download file "+filename+" from "+forum
  239.         Exit Sub
  240.     End If
  241.  
  242.     ' Check to see if we need to join the forum
  243.     If ((FAPconfig.wAlerts And FAP_NOT_A_MEMBER%) <> 0) Then
  244.         tforum = ParseString(tforum, "/")
  245.         JoinForum "", tforum, handle, ""
  246.     End If
  247.  
  248.     ' Download the file
  249.     NewDownloadFile id, forum, filename, True
  250. End Sub
  251.  
  252. Sub NextSearchTerm(ByRef searchterm() As FAPSEARCHTERM, ByRef i As Integer, sfh As Integer, pat As String)
  253.     If pat="" Then Exit Sub
  254.     ReDim Preserve searchterm(0 To i)
  255.     searchterm(i).cType = sfh
  256.     searchterm(i).lpPattern = pat
  257.     i = i + 1
  258. End Sub
  259.  
  260. 'T:NewSearchLibrary (subroutine) (CompuServe)
  261. Sub NewSearchLibrary(id As String, forum As String, catalog As String, _
  262.                   ssections As String, filename As String, uploadby As String, _
  263.                   age As String, accesscount As String, keywords As String, _
  264.                   title As String, description As String, full As String, _
  265.                   replace As String)
  266.     Dim fname As String, i As Integer, t As Long
  267.     Dim section As Integer, tforum As String, count As Long
  268.     Dim filedesc() As FAPFILEDESCRIPTION, tmpdesc As FAPFILEDESCRIPTION
  269.     Dim searchterm() As FAPSEARCHTERM, errmsg As String
  270.     Dim searchflags As Long, catno As Long, ok As Boolean
  271.  
  272.     tforum = forum
  273.     catno = Val(catalog)
  274.     If Not HMIGotoForum(tforum) Then
  275.         LogResult "Unable to refresh library list from "+forum
  276.         Exit Sub
  277.     End If
  278.  
  279.     tforum = ParseString(tforum, "/")
  280.  
  281.     ' Set which bits of info we want
  282.     searchflags = &H6FF
  283.     If UCase(full)="Y" Then searchflags = searchflags + FAP_FDC_ABSTRACT%
  284.     If UCase(replace)="Y" Then
  285.         replace = "yes"
  286.     Else
  287.         replace = "no"
  288.     End If
  289.     ok = True
  290.  
  291.     ' Scan library for the files
  292.     fname = UniqueFilename$()
  293.     count = 0
  294.     Capture CAPTURE_ON, fname
  295.     CaptureText Basic.Eoln$+"#pragma ciscontrol=yes;markunread=yes;deleteexisting="+replace+Basic.Eoln$
  296.     If catno > 0 Then
  297.         Terminal.Print "Collecting library #" + LTrim$(Str(catno)) + Basic.Eoln$
  298.  
  299.         ' We know which catalog we want - get it
  300.         On Error Goto EndOfLibrary_error
  301.         i = FAPReadFileDescription(catno, searchflags, tmpdesc)
  302.         If tmpdesc.lpFilename <> "" Then
  303.             tmpdesc.dwCatalogNo = catno
  304.             WriteLibraryMessage tforum, tmpdesc, filename
  305.             count = 1
  306.         End If
  307.     Else
  308.         Terminal.Print "Collecting libraries from sections " + LTrim$(ssections) + Basic.Eoln$
  309.  
  310.         If filename="" Then filename = "*.*"
  311.  
  312.         ' Set search terms
  313.         i = 0
  314.         NextSearchTerm searchterm(), i, FAP_SFH_FILENAME%, filename
  315.         NextSearchTerm searchterm(), i, FAP_SFH_USER_ID%, uploadby
  316.         NextSearchTerm searchterm(), i, FAP_SFH_TITLE%, title
  317.         NextSearchTerm searchterm(), i, FAP_SFH_DATE_RANGE%, age
  318.         NextSearchTerm searchterm(), i, FAP_SFH_ACCESS_COUNT%, accesscount
  319.         NextSearchTerm searchterm(), i, FAP_SFH_KEYWORD%, keywords
  320.         NextSearchTerm searchterm(), i, FAP_SFH_FILE_ABSTRACT%, description
  321.  
  322.         ' Select sections to search
  323.         sectionvector = ParseSectionList(ssections, FAPconfig.svLibSections, i)
  324.         t = 1
  325.         For i = 0 to 24
  326.             If sectionvector And t Then SetLastUpdated tforum & "/L" & i
  327.             t = t + t
  328.         Next
  329.  
  330.         Terminal.CaptureStatus CAPTURE_ON
  331.         On Error Goto EndOfLibrary_error
  332.         FAPSearchFile filedesc(), HMI_STATE_FIRST%, 1, 4, sectionvector, searchflags, searchterm()
  333.         Do While filedesc(0).dwCatalogNo > 0
  334.             For i = 0 To UBound(filedesc)
  335.                 If filedesc(i).dwCatalogNo > 0 Then
  336.                     count = count + 1
  337.                     Terminal.CaptureStatus count, "Receiving Library Message"
  338.                     WriteLibraryMessage tforum, filedesc(i), ""
  339.                 End If
  340.             Next
  341.  
  342.             FAPSearchFile filedesc(), HMI_STATE_NEXT%, 1, 4, sectionvector, searchflags, searchterm()
  343.         Loop
  344.         Terminal.Print "Collected "+LTrim$(Str(count))+" library entries" + Basic.Eoln$
  345.     End If
  346. EndOfLibrary_ok:
  347.     On Error Goto 0
  348.     Terminal.CaptureStatus CAPTURE_OFF
  349.     Capture CAPTURE_OFF
  350.  
  351.     ' Add to import queue
  352.     If count > 0 Then
  353.         b = QueueFile(Session.Service, fname, IM_DELETE Or IM_MARKUNREAD)
  354.     Else
  355.         DeleteFile fname
  356.     End If
  357.  
  358.     If ok And id<>"" Then ReportSuccess id & " : Downloaded library list(s) for " & forum & " " & LTrim$(ssections)
  359.     Exit Sub
  360. EndOfLibrary_error:
  361.     If Err<>9 Then
  362.         errmsg = FullErrorMessage()
  363.         If InStr(errmsg, "No library sections specified in request")>0 Then
  364.             LogResult "Error while downloading library from "+forum+" - no valid library section(s) selected"
  365.         Else
  366.             LogResult "Error while downloading library from "+forum+" error : " + errmsg
  367.         End If
  368.         ok = False
  369.     End If
  370.     Resume EndOfLibrary_ok
  371. End Sub
  372.  
  373. 'T:SearchLibrary (subroutine) (CompuServe)
  374. Sub SearchLibrary(id As String, forum As String, catalog As String, _
  375.                   ssections As String, filename As String, uploadby As String, _
  376.                   age As String, accesscount As String, keywords As String, _
  377.                   title As String, description As String, full As String)
  378.     NewSearchLibrary id, forum, catalog, ssections, filename, uploadby, _
  379.                         age, accesscount, keywords, title, description, _
  380.                         full, "n"
  381. End Sub
  382.  
  383. Function CheckLibraryBeforePosting(id As String, topic As String, section As Integer) As Boolean
  384.     Dim i As Integer
  385.  
  386.     If Not HMIGotoForum(topic) Then
  387.         LogResult id + " : Failed : Unable to upload file."
  388.         Exit Function
  389.     End If
  390.  
  391.     If FAPconfig.wRestrictions And FAP_NO_LIBRARY_SEND Then
  392.         LogResult id + " : Failed : Uploading not allowed in forum " & topic
  393.         Exit Function
  394.     End If
  395.  
  396.     section = Val(SectionNumber(topic))
  397.     If (FAPconfig.svLibSections And (2 ^ section)) = 0 Then
  398.         LogResult id + " : Failed : Unknown section " & topic
  399.         Exit Function
  400.     End If
  401.     CheckLibraryBeforePosting = True
  402. End Function
  403.  
  404. 'T:UploadFile (subroutine) (CompuServe)
  405. Sub UploadFile(id As String, forum As String, filename As String, _
  406.                ftype As String, keywords As String, title As String, _
  407.                msgfile As String)
  408.     Dim path As String, sname As String, body As String, nState As Integer
  409.     Dim section As Integer, SourceFileNum as Integer, SourceFileAt as Long
  410.     Dim SourceFileLen as Long, TheData as String, BytesToRead as Long
  411.     Dim i As Integer, iType As Integer
  412.  
  413.     If Not CheckLibraryBeforePosting(id, forum, section) Then
  414.         Exit Sub
  415.     End If
  416.  
  417.     Terminal.Print "Uploading file " + filename + Basic.Eoln$
  418.  
  419.     ' Does the file exist ?
  420.     If Not FileExists(filename) Then
  421.         LogResult "File doesn't exist"
  422.         Exit Sub
  423.     End If
  424.     SourceFileLen = FileLen(filename)
  425.     If SourceFileLen <= 0 Then
  426.         LogResult "Can't upload file"
  427.         Exit Sub
  428.     End If
  429.     SplitPath filename, path, sname
  430.     iType = Val(ftype)
  431.  
  432.     ' Overwrite and reset file download counts
  433.     If FAPSendFileInfo(section, SourceFileLen, iType, 3, sname, title, keywords)=0 Then
  434.         LogResult "Failed sending file info"
  435.         Exit Sub
  436.     End If
  437.  
  438.     ' Send the abstract
  439.     body = ReadMessageFile(msgfile, 2)
  440.     If FAPSendFileAbstract(body, 3, "", Session.LoginName)=0 Then
  441.         LogResult "Failed sending file abstract"
  442.         Exit Sub
  443.     End If
  444.  
  445.     ' Send the file
  446.     On Error Goto UploadFile_error
  447.     BytesToRead = SourceFileLen
  448.     SourceFileNum = FreeFile()
  449.     Open filename for Binary Access Read Shared as #SourceFileNum
  450.     SourceFileAt = 1        'read point
  451.  
  452.     TheData = String$(BlockSize, " ")
  453.     nState = 0
  454.     
  455.     ' Operate on blocks of BlockSize at a time
  456.     Do While BytesToRead > BlockSize
  457.         Terminal.TransferStatus True, filename, SourceFileAt-1, SourceFileLen
  458.         Get #SourceFileNum, SourceFileAt, TheData
  459.         i = FAPSendFileData(iType, TheData, nState)
  460.         BytesToRead = BytesToRead - BlockSize
  461.         SourceFileAt = SourceFileAt + BlockSize
  462.         nState = 1
  463.     Loop
  464.  
  465.     ' Now do the last block of less than BlockSize
  466.     If BytesToRead > 0 then
  467.         TheData = String$(BytesToRead, " ")
  468.         Get #SourceFileNum, SourceFileAt, TheData
  469.         i = FAPSendFileData(iType, TheData, nState)
  470.     End If
  471.     Terminal.TransferStatus True, filename, SourceFileLen, SourceFileLen
  472.     i = FAPSendFileData(iType, "", nState)
  473.     
  474.     Close #SourceFileNum
  475.     Terminal.TransferStatus
  476.     ReportSuccess id & " : " & filename & " was uploaded to " & forum
  477.     Exit Sub
  478.  
  479. UploadFile_error:
  480.     Terminal.TransferStatus
  481.     LogResult "Error in UploadFile : " + FullErrorMessage()
  482.     Close #SourceFileNum
  483.     Exit Sub
  484. End Sub
  485.  
  486. Sub UpdateLibrary(id As String, forum As String, sect As String, sdate As String)
  487.     SearchLibrary id, forum, "", sect, "", "", sdate, "", "", "", "", "y"
  488. End Sub
  489.  
  490.  
  491.