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

  1. 'T:MODERATE.EBS for CIX
  2. ' VA 4.52 release
  3.  
  4. 'Add file to import queue
  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 for CIX (constant)
  9. 'iFlags
  10. Global Const IM_DELETE = 2048        ' Delete scratchpad file afterwards?
  11.  
  12. Dim lastprompt As String        'Tracker name of the last prompt encountered
  13. Dim MailID As String            'ID of current mail or deferred command
  14. Dim Success As Boolean            'Whether command succeeded
  15. Dim Failure As String            'Reason command failed (CIX error message)
  16. Dim sctrack As Tracker            'Success/Failure tracker
  17. Dim messagescript As String        'File name of CIX script to upload
  18. Dim DownloadFTPid As String        'Deferred FTPDown command ID
  19. Dim SeenFTPFile As Boolean        'There are some FTP files to download
  20. Dim LastArea As String            'Main or Newsnet
  21.  
  22. Declare Function UniqueFileName$
  23. Declare Function QueueFile(service As String, sfilename As String, _
  24.                            queueflags As Long) As Boolean
  25. Declare Sub ReportSuccess(id As String)
  26. Declare Sub GetToMainPrompt
  27.  
  28. 'T:ModerateConference (function) (CIX)
  29. Function ModerateConference(id As String, conference As String)
  30.     GotoArea "Main"
  31.     Comms.Send "mod " + conference + "\r"
  32.     WaitForPrompt "Prompt"
  33.     If PromptMatches("PromptMod") Then
  34.         ModerateConference = True
  35.     Else
  36.         ModerateConference = False
  37.         ReportFailure id, "Conference not found"
  38.         If Not PromptMatches("PromptMain") Then
  39.             GetToMainPrompt
  40.         End If
  41.         EatExtraPrompts
  42.     End If
  43. End Function
  44.  
  45. 'T:ModWithdraw (subroutine) (CIX)
  46. Sub ModWithdraw(id As String, topic As String, message As String, _
  47.                 user As String, filename As String)
  48.     Dim fname As String
  49.  
  50.     If Not JoinConference(id, topic) Then Exit Sub
  51.     Trackers("YES").active = True
  52.     Comms.Send "withdraw " + message + "\r"
  53.     WaitForPrompt "Prompt"
  54.     Trackers("YES").active = False
  55.     Comms.Send "file " + message + "\r"
  56.     WaitForMainPrompt
  57.     fname = UniqueFileName$()
  58.     If Not DownloadScratchpad(id, fname) Then Exit Sub
  59.     If Not QueueFile(Session.Service, fname, IM_DELETE) Then
  60.         ReportFailure id, "Empty scratchpad or download failure"
  61.         Exit Sub
  62.     End If
  63.     Comms.Send "killscratch\r"
  64.     WaitForMainPrompt
  65.     Comms.Send "mail to " + user + "\r"
  66.     UploadMailMessage "MESSAGE WITHDRAWN", "In " + topic + "\rMessage #" + message + " has been withdrawn.\r\r.", filename
  67.     ReportSuccess id & " : withdrew #" & message & " from " & topic
  68.     EatExtraPrompts
  69. End Sub
  70.  
  71. 'T:ModAddPerson (subroutine) (CIX)
  72. Sub ModAddPerson(id As String, conference As String, user As String, _
  73.                  message As String)
  74.     If Not ModerateConference(id, conference) Then Exit Sub
  75.     Comms.Send "add part " + user + "\r"
  76.     WaitForMainPrompt
  77.     Comms.Send "mail to " + user + "\r"
  78.     UploadMailMessage "Addpart Notification", _
  79.                       "You have been joined to conference "+conference+"\r", _
  80.                       message
  81.     ReportSuccess id & " : Added " & user & " to " & conference
  82.     EatExtraPrompts
  83. End Sub
  84.  
  85. 'T:ModAddPart (subroutine) (CIX)
  86. Sub ModAddPart(id As String, conference As String, users As String)
  87.     If Not ModerateConference(id, conference) Then Exit Sub
  88.     Comms.Send "add part " + users + "\r"
  89.     WaitForMainPrompt
  90.     ReportSuccess id & " : Added " & users & " to " & conference
  91.     EatExtraPrompts
  92. End Sub
  93.  
  94. 'T:ModRemPart (subroutine) (CIX)
  95. Sub ModRemPart(id As String, conference As String, users As String)
  96.     If Not ModerateConference(id, conference) Then Exit Sub
  97.     Comms.Send "rem part " + users + "\r"
  98.     WaitForMainPrompt
  99.     ReportSuccess id & " : Removed " & users & " from " & conference
  100.     EatExtraPrompts
  101. End Sub
  102.  
  103. 'T:AddTopicToConference (subroutine) (CIX)
  104. Sub AddTopicToConference(id As String, conference as String, topic As String, _
  105.                          topicdesc As String, flist As String)
  106.     Dim ctopic As String
  107.     Dim tNameOK As Tracker, tNameBad As Tracker
  108.  
  109.     GotoArea "Main"
  110.     ctopic = conference + "/" + topic
  111.     WaitFor "opicname:"
  112.     Set tNameOK = CreateTracker("PromptNameOK", "FLIST) (y/n)? N")
  113.     Set tNameBAD = CreateTracker("PromptNameBAD", "another topicname:")
  114.     Comms.Send topic + "\r"
  115.     WaitForPrompt "PromptName"
  116.     If PromptMatches("PromptNameOK") then
  117.         'WaitFor "FLIST) (y/n)? N"
  118.         Comms.Send flist + "\r"
  119.         WaitFor ":"
  120.         Comms.SendLiteral topicdesc
  121.         Comms.Send "\r"
  122.         WaitFor "opicname:"
  123.         Comms.Send "q\r"
  124.         Terminal.Status "CIX is adding participants to the new topic, please wait"
  125.         WaitForMainPrompt
  126.         Terminal.Status ""
  127.         Comms.Send "upload\r"
  128.         WaitFor "X)"
  129.         FileUpload PROT_ZMODEM, Session.ServicePath + "firstsay.bsc"
  130.         WaitForMainPrompt
  131.         If Not JoinConference(id, ctopic) Then Exit Sub
  132.         Comms.Send "scput script script\r"
  133.         WaitForMainPrompt
  134.         Comms.Send "join " + ctopic + "\r"
  135.         WaitForPrompt "PromptRead"
  136.         Comms.Send "file 1\r"
  137.         WaitForMainPrompt
  138.         DownloadMessage id
  139.         ReportSuccess id & " : Added " & topic & " to " & conference & " : flist " & flist
  140.     Else
  141.         Comms.Send "quit\r"
  142.         WaitForMainPrompt
  143.         ReportFailure id, " : Cannot add topic " & topic & " to " & conference
  144.     End If
  145.     tNameOK.Delete
  146.     tNameBAD.Delete
  147. End Sub
  148.  
  149.  
  150. 'T:MakeConfidential (subroutine) (CIX)
  151. Sub MakeConfidential(id As String, confname As String, _
  152. topicname As String, topicdesc As String, flist As String)
  153.     Dim tnameOK As Tracker
  154.  
  155.     Set tnameOK = CreateTracker("PromptNameOK", "losed (y/n)\?")
  156.  
  157.     GotoArea "Main"
  158.     Comms.Send "mod new\r"
  159.     WaitFor "onference name?"
  160.     Comms.Send confname + "\r"
  161.     WaitForPrompt "Prompt"
  162.     
  163.     If PromptMatches("PromptNameOK") then
  164.         tnameOK.delete
  165.         Comms.Send "y\r" 
  166.         WaitFor "onfidential (y/n)\?"
  167.         Comms.Send "y\r" 
  168.         LogResult id & " : created confidential conference : " & confname & " : Success"
  169.         AddTopicToConference id, confname, topicname, topicdesc, flist
  170.         EatExtraPrompts
  171.     Else
  172.         tnameOK.delete
  173.         ReportFailure id, "cannot create a conference called " & confname
  174.     End If
  175.  
  176. End Sub
  177.  
  178.  
  179. 'T:MakeConference (subroutine) (CIX)
  180. Sub MakeConference(id As String, conftype As String, confname As String, _
  181. confdesc As String, topicname As String, topicdesc As String, flist As String)
  182.     Dim tnameOK As Tracker
  183.  
  184.     If conftype="Confidential" Then
  185.         MakeConfidential id, confname, topicname, topicdesc, flist
  186.         Exit Sub
  187.     End If
  188.  
  189.     Set tnameOK = CreateTracker("PromptNameOK", "losed (y/n)\?")
  190.  
  191.     GotoArea "Main"
  192.     Comms.Send "mod new\r"
  193.     WaitFor "onference name?"
  194.     Comms.Send confname + "\r"
  195.     WaitForPrompt "Prompt"
  196.     
  197.     If PromptMatches("PromptNameOK") then
  198.         tnameOK.delete
  199.         If conftype <> "Open" Then
  200.             Comms.Send "y\r" 
  201.             WaitFor "onfidential (y/n)\?"
  202.             Comms.Send "n\r"
  203.             LogResult id & " : Created closed conference : " & confname & " : Success"
  204.         Else 
  205.             Comms.Send "n\r"
  206.             LogResult id & " : Created open conference : " & confname & " : Success"
  207.         End If
  208.         WaitFor "escription:"
  209.         Comms.SendLiteral confdesc
  210.         Comms.Send "\r"
  211.         AddTopicToConference id, confname, topicname, topicdesc, flist
  212.     Else
  213.         tnameOK.delete
  214.         ReportFailure id, "cannot create a conference called " & confname
  215.     End If
  216.  
  217. End Sub
  218.  
  219. 'T:ModAddTopic (subroutine) (CIX)
  220. Sub ModAddTopic(id As String, conference As String, topic As String, _
  221. topicdesc As String, flist As String)
  222.     If Not ModerateConference(id, conference) Then Exit Sub
  223.     Comms.Send "add topic\r"
  224.     AddTopicToConference id, conference, topic, topicdesc, flist
  225.     EatExtraPrompts
  226. End Sub
  227.  
  228. 'T:ModRemTopic (subroutine) (CIX)
  229. Sub ModRemTopic(id As String, conference As String, topic As String)
  230.     If Not ModerateConference(id, conference) Then Exit Sub
  231.     Comms.Send "rem topic " + topic + "\r"
  232.     Terminal.Status "removing " & topic & " from " & conference
  233.     WaitForMainPrompt
  234.     ReportSuccess id & " : Removed " & topic & " from " & conference
  235.     EatExtraPrompts
  236.     Terminal.Status ""
  237. End Sub
  238.  
  239. 'T:ModROToggle (subroutine) (CIX)
  240. Sub ModROToggle(id As String, conference As String, topic As String)
  241.     If Not ModerateConference(id, conference) Then Exit Sub
  242.     Comms.Send "rdonly\r"
  243.     WaitFor "status of\?"
  244.     Comms.Send topic + "\r"
  245.     WaitForMainPrompt
  246.     ReportSuccess id & " : Toggled ReadOnly/Readwrite status of " & conference & "/" & topic
  247.     EatExtraPrompts
  248. End Sub
  249.  
  250. 'T:ModComod (subroutine) (CIX)
  251. Sub ModComod(id As String, conference As String, user As String)
  252.     If Not ModerateConference(id, conference) Then Exit Sub
  253.     Comms.Send "comod " + user + "\r"
  254.     WaitForMainPrompt
  255.     ReportSuccess id & " : Added " & user & " as CoModerator to " & conference
  256.     EatExtraPrompts
  257. End Sub
  258.  
  259. 'T:ModExmod (subroutine) (CIX)
  260. Sub ModExmod(id As String, conference As String, user As String)
  261.     If Not ModerateConference(id, conference) Then Exit Sub
  262.     Comms.Send "exmod " + user + "\r"
  263.     WaitForMainPrompt
  264.     ReportSuccess id & " : Removed " & user & " as CoModereaor from " & conference
  265.     EatExtraPrompts
  266. End Sub
  267.  
  268. 'T:FileExport (subroutine) (CIX)
  269. Sub FileExport(id As String, topic As String, filename As String)
  270.     If Not JoinConference(id, topic) Then Exit Sub
  271.     Terminal.Status "Exporting " & filename & " from " & topic & " to filepool"
  272.     Comms.Send "fexport " + filename + "\r"
  273.     WaitForMainPrompt
  274.     ReportSuccess id & " : Exported " & filename & " to filepool"
  275.     EatExtraPrompts
  276.     Terminal.Status ""
  277. End Sub
  278.  
  279. 'T:ModDirectory (subroutine) (CIX)
  280. Sub ModDirectory(id As String, topic As String, filename As String)
  281.     If Not JoinConference(id, topic) Then Exit Sub
  282.     Terminal.Status "Collecting file directory of " & topic
  283.     Comms.Send "file fdir\r"
  284.     WaitForMainPrompt
  285.     If DownloadScratchpad(id, filename) Then
  286.         ReportSuccess id & " : Collected Moderators Directory of " & topic
  287.     End If
  288.     Terminal.Status ""
  289. End Sub
  290.  
  291. 'T:ModUploadFile (subroutine) (CIX)
  292. Sub ModUploadFile(id As String, topic As String, filename As String)
  293.     If Not JoinConference(id, topic) Then Exit Sub
  294.     Comms.Send "ful\r"
  295.     WaitFor "X)"
  296.     FileUpload PROT_ZMODEM, filename
  297.     WaitForMainPrompt
  298.     ReportSuccess id & " : Uploaded " & filename & " to " & topic
  299.     EatExtraPrompts
  300. End Sub
  301.  
  302. 'T:ModRenameFile (subroutine) (CIX)
  303. Sub ModRenameFile(id As String, topic As String, oldname As String, _
  304.                   newname As String)
  305.     If Not JoinConference(id, topic) Then Exit Sub
  306.     Comms.Send "ren " + oldname + " " + newname + "\r"
  307.     WaitForMainPrompt
  308.     ReportSuccess id & " : Renamed " & oldname & " to " & newname & " in " & topic
  309.     EatExtraPrompts
  310. End Sub
  311.  
  312. 'T:ModDeleteFile (subroutine) (CIX)
  313. Sub ModDeleteFile(id As String, topic As String, filename As String)
  314.     If Not JoinConference(id, topic) Then Exit Sub
  315.     Comms.Send "era " + filename + "\r"
  316.     Trackers("YES").active = True
  317.     WaitForMainPrompt
  318.     Trackers("YES").active = False
  319.     ReportSuccess id & " : Deleted " & filename & " in " & topic
  320.     EatExtraPrompts
  321. End Sub
  322.  
  323. 'T:ModReplaceFlist (subroutine) (CIX)
  324. Sub ModReplaceFlist(id As String, topic As String, filename As String)
  325.     If Not JoinConference(id, topic) Then Exit Sub
  326.     Comms.Send "upload\r"
  327.     WaitFor "X)"
  328.     FileUpload PROT_ZMODEM, filename
  329.     WaitForPrompt "PromptRead"
  330.     Comms.Send "scput flist\r"
  331.     WaitForMainPrompt
  332.     ReportSuccess id & " : Replaced flist in " & topic
  333.     EatExtraPrompts
  334. End Sub
  335.  
  336. 'T:ModDownloadFlist (subroutine) (CIX)
  337. Sub ModDownloadFlist(id As String, topic As String, filename As String)
  338.     If Not JoinConference(id, topic) Then Exit Sub
  339.     Terminal.Status "Collecting moderators file list from " & topic
  340.     Comms.Send "scget flist\r"
  341.     WaitForMainPrompt
  342.     If DownloadScratchpad(id, filename) Then
  343.             ReportSuccess id & " : Downloaded Moderators Flist from " & topic
  344.         Else
  345.             ReportFailure id, " : Failed to download Moderators Flist from " & topic
  346.     End If
  347. End Sub
  348.  
  349. 'T:TopicSize (subroutine) (CIX)
  350. Sub TopicSize(id As String, conference As String, topic As String)
  351.     Dim filename As String
  352.     Dim b As Boolean
  353.  
  354.     If Not ModerateConference(id, conference) Then Exit Sub
  355.     Comms.Send "topicsize " + topic + "\r"
  356.     WaitFor "\n"
  357.     filename = UniqueFilename$()
  358.     Capture CAPTURE_ON, filename
  359.     CaptureText "!start actions/moderators CIX"+Basic.Eoln$
  360.     WaitFor "\nMod:"
  361.     CaptureRewind 4
  362.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  363.     Capture CAPTURE_OFF
  364.     b = QueueFile(Session.Service, filename, IM_DELETE)
  365.     GetToMainPrompt
  366.     ReportSuccess id & " : Collected topic size information for " & topic
  367.     EatExtraPrompts
  368. End Sub
  369.  
  370. 'T:PruneTopic (subroutine) (CIX)
  371. Sub PruneTopic(id As String, conference As String, topic As String)
  372.     Dim filename As String
  373.     Dim b As Boolean
  374.  
  375.     If Not ModerateConference(id, conference) Then Exit Sub
  376.     Comms.Send "prune " + topic + "\r"
  377.     WaitForMainPrompt
  378.     ReportSuccess id & " : Pruned (compressed) " & conference & "/" & topic
  379.     EatExtraPrompts
  380. End Sub
  381.  
  382.