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

  1. 'T:SYSOP.EBS for CompuServe
  2. ' VA 4.52 release
  3.  
  4. Const IM_DELETE  = 2048
  5. Const IM_MARKUNREAD = 131072
  6.  
  7. ' File Header Options
  8. Const FAP_FILE_DELETABLE% = &H1
  9. Const FAP_FILE_NON_PUBLIC% = &H2
  10. Const FAP_FILE_MARKED_FOR_DELETION% = &H4
  11. Const FAP_FILE_HAS_FEE% = &H8
  12.  
  13. Const Months$ = "JanFebMarAprMayJunJulAugSepOctNovDec"
  14.  
  15. Declare Function UniqueFileName$
  16. Declare Function QueueFile(service As String, sfilename As String, queueflags As Long) As Boolean
  17. Declare Sub ReportSuccess(id As String)
  18. Declare Function GoForum(ByVal forum As String) As Boolean
  19. Declare Sub ReadNumber(id As String, forum As String, msg As String)
  20. Declare Function StartCapture(pseudo As String)
  21. Declare Function SectionNumber(ByVal section As String)
  22. Declare Function MyDate$
  23. Declare Sub FetchMessageThread(id As String, forum As String, number As String, thr As Boolean)
  24. Declare Sub SendCR(t As Tracker)
  25. Declare Function ParseSectionList(ByVal sect As String, ByVal validsects As Long, ByRef count As Integer) As Long
  26. Declare Sub BeginSysopLog(ByVal forum As String, msg As String)
  27.  
  28. Public FAPconfig As FAPCONFIG
  29.  
  30. Dim syslog As String            ' Location of SysOp logs
  31. Dim breakforum As String
  32. Dim libcount As Long
  33.  
  34. Sub StartSysopLog(forum As String, msg As String)
  35.     forum = ParseString(forum, "/")
  36.     If ReadIni$("Main", "Sysop Log file", Session.IniFilename)="YES" Then
  37.         Capture CAPTURE_ON, "sysop.log"
  38.     Else
  39.         syslog = UniqueFilename$()
  40.         Capture CAPTURE_ON, syslog
  41.         CaptureText Basic.Eoln$+"!start "+forum+"/Sysop_Logs CompuServe"+Basic.Eoln$
  42.     End If
  43.     CaptureText msg+Basic.Eoln$
  44. End Sub
  45.  
  46. Sub EndSysopLog
  47.     Dim b As Boolean
  48.  
  49.     If ReadIni$("Main", "Sysop Log file", Session.IniFilename)<>"YES" Then
  50.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  51.         Capture CAPTURE_OFF
  52.  
  53.         b = QueueFile(Session.Service, syslog, IM_DELETE)
  54.     End If
  55. End Sub
  56.  
  57. 'T:SysopModify (subroutine) (CompuServe)
  58. Sub SysopModify(id As String, forum As String, num As String, section As String)
  59.     If Not GoForum(forum) Then
  60.         LogResult "Unable to modify section "+forum+" #"+num+" to "+section
  61.         Exit Sub
  62.     End If
  63.  
  64.     StartSysopLog forum, "Modify section: "+forum+" thread #"+num+" to "+section
  65.  
  66.     Comms.Send "mess;mod sec "+num+";y;"+section+"\r"
  67.     WaitForPrompt "Prompt"
  68.     EndSysopLog
  69.  
  70.     If PromptMatches("PromptMessage") Then
  71.         FetchMessageThread "", forum, num, True
  72.     Else
  73.         Comms.Send "mess\r"
  74.         WaitForPrompt "Prompt"
  75.     End If
  76.  
  77.     ReportSuccess id & " : Message #" & num & " moved to " & section & " "
  78. End Sub
  79.  
  80. 'T:SysopHold (subroutine) (CompuServe)
  81. Sub SysopHold(id As String, forum As String, num As String, onoff As String, what As String)
  82.     If Not GoForum(forum) Then
  83.         LogResult "Unable to hold/unhold "+forum+" #"+num+" to "+what+" "+onoff
  84.         Exit Sub
  85.     End If
  86.  
  87.     If what="Message" Then
  88.         what = ""
  89.     End If
  90.     Comms.Send "mess;hold "+what+" "+onoff+" "+num+";y\r"
  91.     WaitFor "y\r"
  92.     StartSysopLog forum, "Hold/unhold: "+forum+" "+what+" #"+num+" to "+onoff
  93.     WaitForPrompt "Prompt"
  94.     CaptureRewind 10
  95.     EndSysopLog
  96.     FetchMessageThread "", forum, num, True
  97.  
  98.     ReportSuccess id & " : Hold/unhold: " & forum & " " & what & " #" & num & " to " & onoff & " "
  99. End Sub
  100.  
  101. 'T:SysopFMB (subroutine) (CompuServe)
  102. Sub SysopFMB(id As String, forum As String, num As String, userid As String, _
  103.     priv As String, asnew As String, subject As String, section As String)
  104.  
  105.     If Not GoForum(forum) Then
  106.         LogResult "Unable to forward message #"+num+" to "+userid
  107.         Exit Sub
  108.     End If
  109.  
  110.     StartSysopLog forum, "Forward message: "+forum+" #"+num+" to "+userid
  111.  
  112.     If priv="" Then priv="n"
  113.     If asnew="" Then asnew="n"
  114.     subject = Mid$(subject, 1, 24)
  115.     If asnew="y" Then
  116.         Comms.Send "mess;for boa new "+num+";y;"+userid+";"+priv+";"+subject+";"+section+";\r"
  117.     Else
  118.         Comms.Send "mess;for boa "+num+";y;"+userid+";"+priv+"\r"
  119.     End If
  120.     WaitForPrompt "Prompt"
  121.     If PromptMatches("PromptMessage") Then
  122.         ReadNumber "", forum, num
  123.     Else
  124.         Comms.Send "mess\r"
  125.         WaitForPrompt "Prompt"
  126.     End If
  127.  
  128.     EndSysopLog
  129.  
  130.     ReportSuccess id & " : Forward message " & forum & " #" & num & " to " & userid & " "
  131. End Sub
  132.  
  133. 'T:SysopFMA (subroutine) (CompuServe)
  134. Sub SysopFMA(id As String, forum As String, num As String, userid As String)
  135.  
  136.     If Not GoForum(forum) Then
  137.         LogResult "Unable to forward message #"+num+" to by mail "+userid
  138.         Exit Sub
  139.     End If
  140.  
  141.     StartSysopLog forum, "Forward by Mail: "+forum+" #"+num+" mail to "+userid
  142.  
  143.     Comms.Send "mess;for mail "+num+";y;"+userid+"\r"
  144.     WaitForPrompt "Prompt"
  145.     If Not PromptMatches("PromptMessage") Then
  146.         Comms.Send "mess\r"
  147.         WaitForPrompt "Prompt"
  148.     End If
  149.  
  150.     EndSysopLog
  151.  
  152.     ReportSuccess id & " : Forward by Mail " & forum & " #" & num & " to " & userid & " "
  153. End Sub
  154.  
  155. 'T:SysopDelete (subroutine) (CompuServe)
  156. Sub SysopDelete(id As String, forum As String, num As String)
  157.     If Not GoForum(forum) Then
  158.         LogResult "Unable to delete message #"+number+" from "+forum
  159.         Exit Sub
  160.     End If
  161.  
  162.     StartSysopLog forum, "Delete Message: "+forum+" #"+num
  163.  
  164.     ' Delete if it's there
  165.     Comms.Send "mess;rem "+num+";y\r"
  166.     WaitForPrompt "Prompt"
  167.     If Not PromptMatches("PromptMessage") Then
  168.         Comms.Send "mess\r"
  169.         WaitForPrompt "Prompt"
  170.     End If
  171.  
  172.     EndSysopLog
  173.  
  174.     ReportSuccess id & " : Message #" & num & " from " & forum & " deleted "
  175. End Sub
  176.  
  177. 'T:GoSysOp (subroutine) (CompuServe)
  178. ' Go to forum sysop area and input password
  179. Function GoSysOp(ByVal forum As String)
  180.     Dim tPassword As Tracker, password As String, r As Integer
  181.     Begin Dialog SysOpDlg,,168,56,"Sysop Password",,,1
  182.         Text 9,8,108,8,"Please type in your SysOp password",.Text1,,,ebRegular
  183.         TextBox 9,20,99,12,.Password
  184.         CheckBox 9,40,108,8,"Save password for future use",.Save
  185.  
  186.         OKButton 120,8,40,14
  187.         CancelButton 120,24,40,14
  188.     End Dialog
  189.     Dim SysOp As SysOpDlg, SavePassword As Boolean
  190.  
  191.     ' Go to the forum
  192.     forum = ParseString(forum, "/")
  193.     If Not GoForum(forum) Then
  194.         LogResult "Unable to access "+forum
  195.         GoSysOp = FALSE
  196.         Exit Function
  197.     End If
  198.  
  199.     ' Load the Sysop password from the cis\sysop.ini [Passwords] section
  200.     password = ReadIni$("Passwords", forum, Session.ServicePath+"sysop.ini")
  201.  
  202.     ' If password is blank then stick up a dialog and ask them - with
  203.     If password="" Then
  204.         r = Dialog(SysOp,3,10000)    ' 10 second wait
  205.         If r=-1 And SysOp.Password <> "" Then
  206.             ' OK
  207.             password = SysOp.Password
  208.             SavePassword = SysOp.Save
  209.         Else
  210.             GoSysOp = FALSE
  211.             Exit Function
  212.         End If
  213.     End If
  214.  
  215.     ' Send the sysop password unless we're already at the SO ! prompt
  216.     If Not PromptMatches("PromptSO") Then
  217.         Set tPassword = CreateTracker("PromptPassword", "\nPassword:")
  218.         Comms.Send "so\r"
  219.         WaitForPrompt "Prompt"
  220.         If PromptMatches("PromptPassword") Then
  221.             tPassword.delete
  222.             If password<>"" Then
  223.                 Comms.Send password + "\r"
  224.             End If
  225.             WaitForPrompt "Prompt"
  226.  
  227.             ' a check to allow them to store the password for future use.
  228.             If SavePassword Then
  229.                 WriteIni "Passwords", forum, password, Session.ServicePath+"sysop.ini"
  230.             End If
  231.  
  232.             GoSysOp = PromptMatches("PromptSO")
  233.             Exit Function
  234.         End If
  235.     End If
  236.  
  237.     GoSysOp = TRUE
  238. End Function
  239.  
  240. 'T:AddMember (subroutine) (CompuServe)
  241. ' Go to forum sysop area and add member
  242. Sub AddMember(id As String, forum As String, uid As String, user as String, _
  243.               aux As String, flgs As String, addsct As String, _
  244.               remsct As String, addlib As String, remlib As String, _
  245.               addco As String, remco As String)
  246.     Dim tNotMember As Tracker, tBadId As Tracker, tOkay As Tracker
  247.     Dim tSys1 As Tracker, tSys2 As Tracker, tSys3 As Tracker, tSys4 As Tracker
  248.  
  249.     If Not GoSysOp(forum) Then
  250.         LogResult "Unable to access " + forum + "to add user " + uid + " " + user
  251.         Exit Sub
  252.     End If
  253.  
  254.     ' Send the command
  255.     Comms.Send "so;mai;mem;add\r"
  256.  
  257.     WaitFor "User ID:"
  258.     Set tNotMember = CreateTracker("AddMember", "\n% That User ID is Already a Member")
  259.     Set tBadId = CreateTracker("AddBadId", "\n% Bad User ID Entered")
  260.     Set tOkay = CreateTracker("AddOkay", "Name :")
  261.     Comms.Send uid + "\r"
  262.  
  263.     WaitForPrompt "Add"
  264.     tNotMember.delete
  265.     tBadId.delete
  266.     tOkay.delete
  267.     If PromptMatches("AddMember") Then
  268.         WaitFor "User ID:"
  269.         Comms.Send "\r"
  270.         WaitFor " !"
  271.  
  272.         ' Already a member so just go and edit them instead
  273.         EditMember id, forum, uid, user, aux, flgs, addsct, _
  274.                    remsct, addlib, remlib, addco, remco
  275.         Exit Sub
  276.     End If
  277.  
  278.     StartSysopLog forum, "Add Member: "+uid
  279.  
  280.     If PromptMatches("AddBadId") Then
  281.         WaitFor "User ID:"
  282.         Comms.Send "\r"
  283.         WaitFor " !"
  284.  
  285.         LogResult "Bad User ID Entered - " & uid
  286.         Exit Sub
  287.     End If
  288.  
  289.     Set tSys1 = CreateTracker("SysopSect1", "Sysop In Sections:", "SendCR")
  290.     Set tSys2 = CreateTracker("SysopSect2", "Sysop In Libraries:", "SendCR")
  291.     Set tSys3 = CreateTracker("SysopSect3", "Please Enter (Y or N) :", "SendCR")
  292.  
  293.     Comms.Send user +"\r"
  294.     WaitFor "Data:"
  295.     Comms.Send aux + "\r"
  296.     WaitFor "Flags (H for list):"
  297.     Set tSys4 = CreateTracker("SysopSect4", "Flags (H for list):", "SendCR")
  298.     Comms.Send flgs +"\r"
  299.     WaitFor "Add Special Section Access:"
  300.     Comms.Send addsct +"\r"
  301.     WaitFor "Remove Special Section Access:"
  302.     Comms.Send remsct +"\r"
  303.     WaitFor "Add Special Library Access:"
  304.     Comms.Send addlib +"\r"
  305.     WaitFor "Remove Special Library Access:"
  306.     Comms.Send remlib +"\r"
  307.     WaitFor "Add Special Conference Room Access:"
  308.     Comms.Send addco + "\r"
  309.     WaitFor "Remove Special Conference Room Access:"
  310.     Comms.Send remco + "\r"
  311.  
  312.     tSys1.delete
  313.     tSys2.delete
  314.     tSys3.delete
  315.     tSys4.delete
  316.  
  317.     'The sysop log stuff really only needs what's listed here and not
  318.     ' all the above, but not sure how much rewind we want to do
  319.     ' might fake it and capture it all for the first pass
  320.  
  321.     WaitFor "<A>bort):"
  322.     Comms.Send "y\r"
  323.     WaitFor "User ID:"
  324.     Comms.Send "\r"
  325.     WaitFor " !"
  326.     Comms.Send "mes\r"
  327.     WaitForPrompt "Prompt"
  328.  
  329.     EndSysopLog
  330.  
  331.     ReportSuccess id & " : " & user & " [" & uid & "] added to " & forum & " "
  332. End Sub
  333.  
  334. 'T:EditMember (subroutine) (CompuServe)
  335. ' Go to forum sysop area and edit member
  336. Sub EditMember(id As String, forum As String, uid As String, user as String, _
  337.                aux As String, flgs As String, addsct As String, _
  338.                remsct As String, addlib As String, remlib As String, _
  339.                addco As String, remco As String)
  340.     Dim tNotMember As Tracker, tBadId As Tracker, tOkay As Tracker
  341.     Dim tSys1 As Tracker, tSys2 As Tracker, tSys3 As Tracker, tSys4 As Tracker
  342.  
  343.     If Not GoSysOp(forum) Then
  344.         LogResult "Unable to access " + forum + "to edit user " + uid + " " + user
  345.         Exit Sub
  346.     End If
  347.  
  348.     ' Send the command
  349.     Comms.Send "so;mai;mem;edi\r"
  350.  
  351.     WaitFor "Edit User ID (or Name):"
  352.     Set tNotMember = CreateTracker("EditNotMember", "\n% That User is Not a Member")
  353.     Set tBadId = CreateTracker("EditBadId", "\n% Bad User ID Entered")
  354.     Set tOkay = CreateTracker("EditOkay", "Okay? (<Y>es, <N>o, <A>bort):")
  355.     Comms.Send uid + "\r"
  356.  
  357.     WaitForPrompt "Edit"
  358.     tNotMember.delete
  359.     tBadId.delete
  360.     tOkay.delete
  361.     If PromptMatches("EditNotMember") Then
  362.         LogResult "User "+uid+" is not a member of "+forum+" - cannot edit member."
  363.         Comms.Send "\r"
  364.         WaitFor " !"
  365.         Comms.Send "mes\r"
  366.         WaitForPrompt "Prompt"
  367.  
  368.         ' Not a member so just go and add them instead
  369.         AddMember id, forum, uid, user, aux, flgs, addsct, _
  370.                   remsct, addlib, remlib, addco, remco
  371.         Exit Sub
  372.     End If
  373.  
  374.     StartSysopLog forum, "Edit Member: "+uid
  375.  
  376.     If PromptMatches("EditBadId") Then
  377.         WaitFor "User ID:"
  378.         Comms.Send "\r"
  379.         WaitFor " !"
  380.  
  381.         LogResult "Bad User ID Entered - " & uid
  382.         Exit Sub
  383.     End If
  384.     Comms.Send "n\r"
  385.  
  386.     Set tSys1 = CreateTracker("SysopSect1", "Sysop In Sections:", "SendCR")
  387.     Set tSys2 = CreateTracker("SysopSect2", "Sysop In Libraries:", "SendCR")
  388.     Set tSys3 = CreateTracker("SysopSect3", "Please Enter (Y or N) :", "SendCR")
  389.  
  390.     WaitFor "Name :"
  391.     Comms.Send user +"\r"
  392.     WaitFor "Data:"
  393.     Comms.Send aux + "\r"
  394.     WaitFor "Flags (H for list):"
  395.     Set tSys4 = CreateTracker("SysopSect4", "Flags (H for list):", "SendCR")
  396.     Comms.Send flgs +"\r"
  397.     WaitFor "Add Special Section Access:"
  398.     Comms.Send addsct +"\r"
  399.     WaitFor "Remove Special Section Access:"
  400.     Comms.Send remsct +"\r"
  401.     WaitFor "Add Special Library Access:"
  402.     Comms.Send addlib +"\r"
  403.     WaitFor "Remove Special Library Access:"
  404.     Comms.Send remlib +"\r"
  405.     WaitFor "Add Special Conference Room Access:"
  406.     Comms.Send addco + "\r"
  407.     WaitFor "Remove Special Conference Room Access:"
  408.     Comms.Send remco + "\r"
  409.  
  410.     tSys1.delete
  411.     tSys2.delete
  412.     tSys3.delete
  413.     tSys4.delete
  414.  
  415.     'The sysop log stuff really only needs what's listed here and not
  416.     ' all the above, but not sure how much rewind we want to do
  417.     ' might fake it and capture it all for the first pass
  418.  
  419.     WaitFor "<A>bort):"
  420.     Comms.Send "y\r"
  421.     WaitFor "Name):"
  422.     Comms.Send "\r"
  423.     WaitFor " !"
  424.     Comms.Send "mes\r"
  425.     WaitForPrompt "Prompt"
  426.  
  427.     EndSysopLog
  428.  
  429.     ReportSuccess id & " : Member privileges for " & user & " [" & uid & "] on " & forum & " changed"
  430. End Sub
  431.  
  432. 'T:MailMerge (function) (CompuServe)
  433. 'Takes input from one file and substitutes %DATE% for the current date
  434. Function MailMerge(filename As String) As String
  435.     Dim MsgFileNum%
  436.     Dim SourceFileNum%
  437.     Dim ALine$, buf$
  438.  
  439.     On Error Goto MailMerge_error
  440.  
  441.     MsgFileName$ = UniqueFileName$()
  442.     MsgFileNum% = FreeFile()
  443.     Open MsgFileName$ For Append Access Read Write Shared As #MsgFileNum%
  444.     SourceFileNum% = FreeFile()
  445.     Open filename for Input Access Read Shared as #SourceFileNum%
  446.  
  447.     'Spool text from Source to Msg
  448.     While Not Eof(SourceFileNum%)
  449.         Line Input #SourceFileNum%, ALine$
  450.         If InStr(ALine$, "%DATE%") Then
  451.             buf$ = ALine$
  452.             ALine$ = Left$(buf$, InStr(buf$, "%DATE%")-1)
  453.             ALine$ = ALine$ + MyDate$
  454.             ALine$ = ALine$ + Right$(buf$, Len(buf$)-InStr(buf$, "%DATE%")-5)
  455.         End If
  456.         Print #MsgFileNum%, ALine$
  457.     Wend
  458.  
  459.     Close #SourceFileNum%
  460.     Close #MsgFileNum%
  461.     MailMerge = MsgFileName$
  462.     Exit Function
  463.  
  464. MailMerge_error:
  465.     LogResult "Error:" + Str$(Err) + " in line " + Str$(Erl) + ":" + Error$
  466.     On Error resume next
  467.     Close #SourceFileNum%
  468.     Close #MsgFileNum%
  469.     MailMerge = ""
  470.     Exit Function
  471. End Function
  472.  
  473. 'T:UploadAnnouncements (subroutine) (CompuServe)
  474. ' Go to forum sysop area and upload annoucements
  475. Sub UploadAnnouncements(id As String, forum As String, ann As String, _
  476.                        filename as String, resetfl As String)
  477.     Dim tmpfile As String, t As Tracker
  478.  
  479.     If Not GoSysOp(forum) Then
  480.         LogResult "Unable to access " + forum + " to upload announcements."
  481.         Exit Sub
  482.     End If
  483.  
  484.     ' NOTE: When you are uploading a COnference announcement you will
  485.     '        receive any chat from the rooms.  This can break things!
  486.  
  487.     ' Send the command
  488.     Comms.Send "so;mai;ann;upl;"+Trim(Left(ann,2))+";2\r"
  489.     WaitFor "(Y or N)?"
  490.     Comms.Send "y\r"
  491.     WaitFor "puter:"
  492.  
  493.     ' %DATE% -> today's date
  494.     tmpfile = MailMerge(filename)
  495.  
  496.     ' Send filename
  497.     Comms.SendLiteral tmpfile
  498.     Comms.Send "\r"
  499.  
  500.     ' Reset announcement flags
  501.     Set t = CreateTracker("PromptYN", "(Y or N)?")
  502.     WaitForPrompt "Prompt"
  503.     If PromptMatches("PromptYN") Then
  504.         Comms.Send resetfl+"\r"
  505.         WaitForPrompt "Prompt"
  506.     End If
  507.  
  508.     Comms.Send "mes\r"
  509.     WaitForPrompt "Prompt"
  510.  
  511.     DeleteFile tmpfile
  512.  
  513.     ReportSuccess id & " : Announcement " & ann & " for forum " & forum & " uploaded "
  514. End Sub
  515.  
  516. 'T:SysopModSecSub (subroutine) (CompuServe)
  517. 'Changes subject and section of a message all in one go
  518. Sub SysopModSecSub(id As String, forum As String, num As String, section As String, subject As String)
  519.  
  520.     If Not GoForum(forum) Then
  521.         LogResult "Unable to modify section "+forum+" #"+num+" to "+section
  522.         Exit Sub
  523.     End If
  524.  
  525.     StartSysopLog forum, "Modify section: "+forum+" thread #"+num+" to section "+section +"new subject: "+subject
  526.  
  527.     Comms.Send "mess;mod sec sub " +num+ ";y;" + section + ";" + subject +"\r"
  528.     WaitForPrompt "Prompt"
  529.     EndSysopLog
  530.  
  531.     If PromptMatches("PromptMessage") Then
  532.         FetchMessageThread "", forum, num, True
  533.     Else
  534.         Comms.Send "mess\r"
  535.         WaitForPrompt "Prompt"
  536.     End If
  537.  
  538.     ReportSuccess id & " : Message #" & num & " New Section #" & section & " New subject " & subject
  539. End Sub
  540.  
  541. 'T:GetUsers (subroutine) (CompuServe)
  542. ' Get list of who's online
  543. Sub GetUsers(id As String, forum As String)
  544.     Dim filename As String
  545.  
  546.     If Not GoForum(forum) Then
  547.         LogResult "Unable to access " + forum + " to get user list"
  548.         Exit Sub
  549.     End If
  550.  
  551.     filename = StartCapture(forum + "/Sysop_Logs User_Log")
  552.     CaptureText "Who was Online"+Basic.Eoln$
  553.     Terminal.Status "Collecting User List ... Please Wait"
  554.     Comms.Send "users\r"
  555.     WaitForPrompt "Prompt"
  556.     CaptureRewind 7
  557.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  558.     Capture CAPTURE_OFF
  559.  
  560.     ' Add to import queue
  561.     If QueueFile(Session.Service, filename, IM_DELETE) Then
  562.         ReportSuccess id & " : Users online for forum " & forum & " collected"
  563.     Else
  564.         ReportSuccess id & " : Users online for forum " & forum & " failed"
  565.     End If
  566. End Sub
  567.  
  568. 'T:AsciiListMembers (subroutine) (CompuServe)
  569. ' Get membership list
  570. Sub AsciiListMembers(id As String, forum As String, list As String, info As String)
  571.     Dim filename As String
  572.  
  573.     menuitem = ParseString(list, " ")
  574.     If Not GoSysOp(forum) Then
  575.         LogResult "Unable to access " + forum + " to get member list"
  576.         Exit Sub
  577.     End If
  578.  
  579.     filename = StartCapture(forum + "/Membership Member_List")
  580.     CaptureText list + " " + info + Basic.Eoln$
  581.     Terminal.Status "Collecting Member List ... Please Wait"
  582.     Terminal.Enabled = False
  583.     If StrComp(list, "ALL", 1)=0 Then
  584.         Comms.Send "mai;mem;lis;uid;all\r"
  585.     ElseIf info="" Then
  586.         Comms.Send "mai;mem;lis;" + menuitem + "\r"
  587.     Else 
  588.         Comms.Send "mai;mem;lis;" + menuitem + ";" + info + "\r"
  589.     End If
  590.  
  591.     WaitFor "Membership !"
  592.     CaptureRewind 12
  593.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  594.     Terminal.Enabled = True
  595.  
  596.     Capture CAPTURE_OFF
  597.  
  598.     ' back to so area for other scripts to work
  599.     Comms.Send "so\r"
  600.  
  601.     ' Add to import queue
  602.     If QueueFile(Session.Service, filename, IM_DELETE) Then
  603.         ReportSuccess id & " : Membership info for forum " & forum & " collected"
  604.     Else
  605.         ReportSuccess id & " : Membership info for forum " & forum & " failed"
  606.     End If
  607. End Sub
  608.  
  609. 'T:AsciiGetMemberCount (subroutine) (CompuServe)
  610. ' Get Membership Count
  611. Sub AsciiGetMemberCount(id As String, forum As String)
  612.     Dim filename As String
  613.  
  614.     If Not GoSysop(forum) Then
  615.         LogResult "Unable to access " + forum + " to get member count"
  616.         Exit Sub
  617.     End If
  618.  
  619.     Terminal.Status "Getting Member Count ... Please Wait"
  620.  
  621.     Comms.Send "mai;mem;cnt\r"
  622.     WaitFor "\n"
  623.     filename = StartCapture(forum + "/Membership Member_Count")
  624.     WaitFor "Maintenance"
  625.     CaptureRewind 22
  626.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  627.     Capture CAPTURE_OFF
  628.  
  629.     ' back to so area for other scripts to work
  630.     Comms.Send "so\r"
  631.  
  632.     ' Add to import queue
  633.     If QueueFile(Session.Service, filename, IM_DELETE) Then
  634.         ReportSuccess id & " : Member count for forum " & forum & " collected"
  635.     Else
  636.         ReportSuccess id & " : Member count for forum " & forum & " failed"
  637.     End If
  638. End Sub
  639.  
  640. 'T:AsciiWhoIs (subroutine) (CompuServe)
  641. Sub AsciiWhoIs(id As String, forum As String, uid As String)
  642.     Dim filename As String
  643.  
  644.     If Not GoForum(forum) Then
  645.         LogResult "Unable to access " + forum + " to get who is"
  646.         Exit Sub
  647.     End If
  648.  
  649.     filename = StartCapture(forum + "/Sysop_Logs Who_Is")
  650.     CaptureText "Who is UID "+ uid +Basic.Eoln$
  651.     Terminal.Status "Getting member records ... Please Wait"
  652.     Comms.Send "who " + uid + "\r"
  653.     WaitForPrompt "Prompt"
  654.     CaptureRewind 7
  655.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  656.     Capture CAPTURE_OFF
  657.  
  658.     ' Add to import queue
  659.     If QueueFile(Session.Service, filename, IM_DELETE) Then
  660.         ReportSuccess id & " : Who is for " & uid & " collected"
  661.     Else
  662.         ReportSuccess id & " : Who is for " & uid & " failed"
  663.     End If
  664. End Sub
  665.  
  666. 'T:InfoPageBreak (subroutine) (CompuServe)
  667. Sub InfoPageBreak(t As Tracker)
  668.     CaptureRewind Len(t.match)
  669.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  670.     CaptureText "!start "+breakforum+"/Statistics CompuServe"+Basic.Eoln$
  671.  
  672.     If t.match=Chr$(10)+"Generating library statistics...please wait" Then
  673.         CaptureText Chr$(10)+"Library statistics"
  674.     Else
  675.         CaptureText t.match
  676.     End If
  677.     t.reset
  678. End Sub
  679.  
  680. 'T:AdvancedForumStats (subroutine) (CompuServe)
  681. Sub AdvancedForumStats(id As String, forum As String)
  682.     Dim filename As String
  683.     Dim tMore As Tracker, tEnter As Tracker, tBreak1 As Tracker
  684.     Dim tBreak2 As Tracker, tBreak3 As Tracker, tBreak4 As Tracker
  685.     Dim tBreak5 As Tracker, tBreak6 As Tracker, tError As Tracker
  686.  
  687.     If Not GoSysop(forum) Then
  688.         LogResult "Unable to access " + forum + " to get advanced forum statistics"
  689.         Exit Sub
  690.     End If
  691.  
  692.     breakforum = forum
  693.     Terminal.Status "Getting Advanced Forum Statistics ... Please Wait"
  694.     Set tMore = CreateTracker("PromptHideMore", "\nPress <CR> for more :", "SendCR")
  695.     Set tEnter = CreateTracker("PromptEnter2", "\nPress <CR> :")
  696.     Set tError = CreateTracker("PromptEnter3", "\n% Ambiguous command")
  697.     Set tBreak1 = CreateTracker("PageBreak1", "\nMESSAGE STATISTICS", "InfoPageBreak")
  698.     Set tBreak2 = CreateTracker("PageBreak2", "\nMessage Size Statistics:", "InfoPageBreak")
  699.     Set tBreak3 = CreateTracker("PageBreak3", "\nSlot Statistics", "InfoPageBreak")
  700.     Set tBreak4 = CreateTracker("PageBreak4", "\nGenerating library statistics...please wait", "InfoPageBreak")
  701.     Set tBreak5 = CreateTracker("PageBreak5", "Library Download History", "InfoPageBreak")
  702.     Set tBreak6 = CreateTracker("PageBreak6", "\nMEMBERSHIP STATISTICS", "InfoPageBreak")
  703.  
  704.     ' Message statistics
  705.     Comms.Send "sta;mes;1;2;3\r"
  706.     WaitFor "\n"
  707.     filename = UniqueFilename$()
  708.     Capture CAPTURE_ON, filename
  709.     WaitForPrompt "PromptEnter"
  710.     If PromptMatches("PromptEnter3") Then
  711.         Capture CAPTURE_OFF
  712.         LogResult "Unable to get advanced forum statistics from "+forum
  713.     Else
  714.         CaptureRewind 12
  715.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  716.         Capture CAPTURE_OFF
  717.         Comms.Send "\r"
  718.         WaitFor "!"
  719.         Comms.Send "\r"
  720.         WaitFor "!"
  721.  
  722.         ' Library statistics
  723.         Comms.Send "lib\r"
  724.         WaitFor "\n"
  725.         Capture CAPTURE_ON, filename
  726.         CaptureText "!start "+forum+"/Statistics CompuServe"+Basic.Eoln$
  727.         WaitForPrompt "PromptEnter"
  728.         CaptureRewind 12
  729.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  730.         Capture CAPTURE_OFF
  731.         Comms.Send "\r"
  732.         WaitFor "!"
  733.  
  734.         ' Member statistics
  735.         Comms.Send "mem\r"
  736.         WaitFor "or N)\?"
  737.         Comms.Send "y\r"
  738.         WaitFor "please wait"
  739.         Capture CAPTURE_ON, filename
  740.         CaptureText "!start "+forum+"/Statistics CompuServe"+Basic.Eoln$
  741.         WaitForPrompt "PromptEnter"
  742.         CaptureRewind 12
  743.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  744.         Capture CAPTURE_OFF
  745.         Comms.Send "\r"
  746.         WaitFor "!"
  747.         Comms.Send "so\r"
  748.         WaitForPrompt "Prompt"
  749.  
  750.         ' Get more library stats
  751.         Comms.Send "mai;lib;all\r"
  752.         WaitFor "\n"
  753.         Capture CAPTURE_ON, filename
  754.         CaptureText Basic.Eoln$+"!start "+forum+"/Statistics CompuServe"+Basic.Eoln$
  755.         WaitFor "\nEnter Library number to change (CR when done):"
  756.         CaptureRewind 46
  757.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  758.         Capture CAPTURE_OFF
  759.         Comms.Send "\r"
  760.  
  761.         ' Add to import queue
  762.         If QueueFile(Session.Service, filename, IM_DELETE) Then
  763.             ReportSuccess id & " : Advanced Forum Statistics for forum " & forum & " collected"
  764.         Else
  765.             ReportSuccess id & " : Advanced Forum Statistics for forum " & forum & " failed"
  766.         End If
  767.     End If
  768.     WaitFor "!"
  769.     Comms.Send "so\r"
  770.     WaitForPrompt "Prompt"
  771.  
  772.     ' Cleanup
  773.     tEnter.delete
  774.     tError.delete
  775.     tMore.delete
  776.     tBreak1.delete
  777.     tBreak2.delete
  778.     tBreak3.delete
  779.     tBreak4.delete
  780.     tBreak5.delete
  781.     tBreak6.delete
  782. End Sub
  783.  
  784. Sub GotAFile(t As Tracker)
  785.     libcount = libcount + 1
  786.     Terminal.CaptureStatus libcount
  787.     Comms.Send "\r"
  788.     t.reset
  789. End Sub
  790.  
  791. Sub ExtractDate(l As String, d As HMITIMESTAMP)
  792.     Dim t As String
  793.     Dim notime AS HMITIMESTAMP
  794.  
  795.     d = notime
  796.     t = ParseString(l, "-")
  797.     If Val(t) = 0 Then Exit Sub
  798.     d.cDay = Val(t)
  799.     t = ParseString(l, "-")
  800.     d.cMonth = (Instr(Months, t) \ 3) + 1
  801.     t = ParseString(l, " ")
  802.     d.cYear = Val(t) - 70
  803. End Sub
  804.  
  805. Sub ParseSysopLibraryCaptureFile(f As String, forum As String, section As Integer)
  806.     Dim fname As String, l As String, h As Integer
  807.     Dim filedesc As FAPFILEDESCRIPTION
  808.     Dim state As Integer, t As String, count As Integer
  809.     Dim notime AS HMITIMESTAMP
  810.  
  811.     h = FreeFile
  812.     Open f For Input Access Read Shared As #h
  813.     filedesc.cLibSectionNo = section
  814.     filedesc.dwCatalogNo = 0
  815.     state = 0
  816.     fname = UniqueFilename$()
  817.     Capture CAPTURE_ON, fname
  818.     While Not Eof(h)
  819.         LINE INPUT #h, l
  820.         Select Case state
  821.         Case 0      'Waiting for first line
  822.             If Left$(l, 1) = "[" Then
  823.                 l = Mid$(l, 2)
  824.                 t = ParseString(l, "]")
  825.                 filedesc.lpUserID = t
  826.                 t = Trim$(ParseString(l, "*"))
  827.                 filedesc.lpUserName = t
  828.                 t = ParseString(l, "*")
  829.                 filedesc.tsReleaseDate = notime
  830.                 If Mid$(t, 5, 1) = "E" Then
  831.                     filedesc.cOptions = FAP_FILE_MARKED_FOR_DELETION
  832.                 Else
  833.                     filedesc.cOptions = FAP_FILE_NON_PUBLIC 
  834.                 End If
  835.                 filedesc.lpAbstract = ""
  836.                 state = 1
  837.             End If
  838.         Case 1      'File name
  839.             filedesc.lpFilename = l
  840.             state = 2
  841.         Case 2      'Details
  842.             t = Trim$(ParseString(l, ","))
  843.             filedesc.nFileType = Instr("TBIRNGJEHP", Left$(t, 1))
  844.             t = ParseString(l, ":")
  845.             t = ParseString(l, ",")
  846.             filedesc.dwFileSize = Val(t)
  847.             t = ParseString(l, ":")
  848.             t = ParseString(l, ",")
  849.             filedesc.dwAccessCount = Val(t)
  850.             ExtractDate l, filedesc.tsSubmitted
  851.             t = ParseString(l, ":")
  852.             ExtractDate l, filedesc.tsLastAccess
  853.             state = 3
  854.         Case 3      'Title
  855.             t = Trim$(ParseString(l, ":"))
  856.             If t = "Title" Then
  857.                 t = Trim$(l)
  858.                 filedesc.lpTitle = t
  859.                 state = 4
  860.             End If
  861.         Case 4      'Keywords
  862.             t = Trim$(ParseString(l, ":"))
  863.             t = Trim$(l)
  864.             filedesc.lpKeys = t
  865.             state = 5
  866.         Case 5      'Abstract
  867.             If Left$(l, 13) = "Disposition !" Then
  868.                 WriteLibraryMessage forum, filedesc, ""
  869.                 count = count + 1
  870.                 state = 0
  871.             ElseIf l > "" Then
  872.                 t = LTrim$(l)
  873.                 filedesc.lpAbstract = filedesc.lpAbstract & t & Chr$(10)
  874.             End If
  875.         End Select
  876.     Wend
  877.     Close h
  878.     Capture CAPTURE_OFF
  879.  
  880.     ' Add to import queue
  881.     If count > 0 Then
  882.         b = QueueFile(Session.Service, fname, IM_DELETE Or IM_MARKUNREAD)
  883.     Else
  884.         DeleteFile fname
  885.     End If
  886.     DeleteFile f
  887. End Sub
  888.  
  889. Sub SysopLibrary(id As String, forum As String, section As String)
  890.     Dim d As Tracker, f As String, sectno As Integer
  891.     Dim sectionvector As Long
  892.  
  893.     If Not GoSysop(forum) Then
  894.         LogPrint "Unable to download unmerged files list from forum "+forum
  895.         EndSysopLog
  896.         Exit Sub
  897.     End If
  898.  
  899.     On Error Goto SysopLibrary_error
  900.     sectionvector = ParseSectionList(section, FAPconfig.svLibSections, sectno)
  901.     libcount = 0
  902.  
  903.     For sectno = 0 To 24
  904.         If (sectionvector And (2^sectno))<>0 Then
  905.             BeginSysopLog forum, "Downloading unmerged files from " + forum + " section " & sectno
  906.             Comms.Send "so;mai;lib;pre " & sectno & "\r"
  907.  
  908.             Set d = CreateTracker("Disposition", "\nDisposition !", "GotAFile")
  909.  
  910.             WaitForPrompt "Prompt"
  911.             EndSysopLog
  912.             If Not PromptMatches("PromptLibrary") Then
  913.                 d.Delete
  914.                 Exit Sub
  915.             End If
  916.  
  917.             f = UniqueFilename$()
  918.             Capture CAPTURE_ON, f
  919.             Comms.Send "bro\r"
  920.             Terminal.CaptureStatus CAPTURE_ON
  921.             Terminal.Enabled = False
  922.             WaitForPrompt "PromptLibrary"
  923.             Terminal.CaptureStatus CAPTURE_OFF
  924.             Capture CAPTURE_OFF
  925.             Comms.Send "so\r"
  926.             WaitForPrompt "Prompt"
  927.             Terminal.Enabled = True
  928.             d.Delete
  929.  
  930.             ParseSysopLibraryCaptureFile f, forum, sectno
  931.         End If
  932.     Next
  933.  
  934.     Comms.Send "mes\r"
  935.     WaitForPrompt "Prompt"
  936.     Terminal.Print "Collected "+LTrim$(Str(libcount))+" unmerged files" + Basic.Eoln$
  937.     ReportSuccess id & " : Downloaded unmerged files list for " & forum
  938.     Exit Sub
  939. SysopLibrary_error:
  940.     Capture CAPTURE_OFF
  941.     Terminal.CaptureStatus CAPTURE_OFF
  942.     Terminal.Enabled = True
  943.     LogResult "Error " & FullErrorMessage
  944.     LogResult "Error while downloading unmerged files list from "+forum
  945. End Sub
  946.  
  947.  
  948.