home *** CD-ROM | disk | FTP | other *** search
/ Chip Special: HTML & Java / Chip-Special_1997-01_HTML-a-Java.bin / chatsdk / chatsdk.exe / EXECC.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-12-12  |  27.4 KB  |  799 lines

  1. VERSION 4.00
  2. Begin VB.Form ExecC 
  3.    BackColor       =   &H00FFFFC0&
  4.    Caption         =   "Executive Chat Monitoring Tool"
  5.    ClientHeight    =   8310
  6.    ClientLeft      =   990
  7.    ClientTop       =   405
  8.    ClientWidth     =   8850
  9.    Height          =   8715
  10.    Left            =   930
  11.    LinkTopic       =   "ExecC"
  12.    ScaleHeight     =   8310
  13.    ScaleWidth      =   8850
  14.    Top             =   60
  15.    Width           =   8970
  16.    Begin VB.CheckBox chkAutoPaste 
  17.       BackColor       =   &H00FFFFC0&
  18.       Caption         =   "Paste Clipboard Content into Send text boxes?"
  19.       Height          =   615
  20.       Left            =   3840
  21.       TabIndex        =   27
  22.       Top             =   720
  23.       Width           =   2055
  24.    End
  25.    Begin VB.ListBox lstPartID 
  26.       Enabled         =   0   'False
  27.       Height          =   255
  28.       Left            =   7920
  29.       TabIndex        =   22
  30.       Top             =   120
  31.       Visible         =   0   'False
  32.       Width           =   855
  33.    End
  34.    Begin VB.Frame frmGuest 
  35.       BackColor       =   &H00FFFFC0&
  36.       Caption         =   "Special Guest Functions"
  37.       Enabled         =   0   'False
  38.       Height          =   615
  39.       Left            =   120
  40.       TabIndex        =   17
  41.       Top             =   3600
  42.       Width           =   8655
  43.       Begin VB.CommandButton cmdGWhisperToHosts 
  44.          Caption         =   "Whisper To Hosts"
  45.          Enabled         =   0   'False
  46.          Height          =   255
  47.          Left            =   4560
  48.          TabIndex        =   29
  49.          Top             =   240
  50.          Width           =   1935
  51.       End
  52.       Begin VB.CommandButton cmdGWhisperToModerator 
  53.          Caption         =   "Whisper To Moderator"
  54.          Enabled         =   0   'False
  55.          Height          =   255
  56.          Left            =   6600
  57.          TabIndex        =   23
  58.          Top             =   240
  59.          Width           =   1935
  60.       End
  61.    End
  62.    Begin VB.Frame frmModerator 
  63.       BackColor       =   &H00FFFFC0&
  64.       Caption         =   "Moderator Functions"
  65.       Enabled         =   0   'False
  66.       Height          =   975
  67.       Left            =   120
  68.       TabIndex        =   16
  69.       Top             =   2520
  70.       Visible         =   0   'False
  71.       Width           =   8655
  72.       Begin VB.CommandButton cmdMWhisperToHosts 
  73.          Caption         =   "Whisper To Hosts"
  74.          Enabled         =   0   'False
  75.          Height          =   255
  76.          Left            =   6720
  77.          TabIndex        =   28
  78.          Top             =   240
  79.          Width           =   1815
  80.       End
  81.       Begin VB.CommandButton cmdMSendToEntireRoom 
  82.          Caption         =   "Send To Entire Room"
  83.          Enabled         =   0   'False
  84.          Height          =   615
  85.          Left            =   4680
  86.          TabIndex        =   21
  87.          Top             =   240
  88.          Width           =   1935
  89.       End
  90.       Begin VB.CommandButton cmdWhisperToGuest 
  91.          Caption         =   "Whisper To Guest"
  92.          Enabled         =   0   'False
  93.          Height          =   255
  94.          Left            =   6720
  95.          TabIndex        =   20
  96.          Top             =   600
  97.          Width           =   1815
  98.       End
  99.       Begin VB.CommandButton cmdSetGuestID 
  100.          Caption         =   "Identify Special Guest"
  101.          Enabled         =   0   'False
  102.          Height          =   255
  103.          Left            =   120
  104.          TabIndex        =   18
  105.          Top             =   240
  106.          Width           =   1815
  107.       End
  108.       Begin VB.Label lblGuestAlias 
  109.          BackColor       =   &H00FFFF00&
  110.          Caption         =   "<Special Guest Alias>"
  111.          Height          =   255
  112.          Left            =   2040
  113.          TabIndex        =   19
  114.          Top             =   240
  115.          Width           =   2415
  116.       End
  117.    End
  118.    Begin VB.Frame frmHost 
  119.       BackColor       =   &H00FFFFC0&
  120.       Caption         =   "Host Functions"
  121.       Enabled         =   0   'False
  122.       Height          =   975
  123.       Left            =   120
  124.       TabIndex        =   12
  125.       Top             =   1440
  126.       Visible         =   0   'False
  127.       Width           =   8655
  128.       Begin VB.CommandButton cmdHWhisperToHosts 
  129.          Caption         =   "Whisper To Hosts"
  130.          Enabled         =   0   'False
  131.          Height          =   255
  132.          Left            =   6720
  133.          TabIndex        =   26
  134.          Top             =   240
  135.          Width           =   1815
  136.       End
  137.       Begin VB.CheckBox chkSpeakerView 
  138.          BackColor       =   &H00FFFFC0&
  139.          Caption         =   "Enable Send and Whisper to Room Features?"
  140.          Height          =   255
  141.          Left            =   120
  142.          TabIndex        =   25
  143.          Top             =   600
  144.          Width           =   3855
  145.       End
  146.       Begin VB.CommandButton cmdShowHostPanel 
  147.          Caption         =   "Show Host Panel"
  148.          Enabled         =   0   'False
  149.          Height          =   255
  150.          Left            =   6720
  151.          TabIndex        =   24
  152.          Top             =   600
  153.          Width           =   1815
  154.       End
  155.       Begin VB.CommandButton cmdHWhisperToModerator 
  156.          Caption         =   "Whisper To Moderator"
  157.          Enabled         =   0   'False
  158.          Height          =   615
  159.          Left            =   4680
  160.          TabIndex        =   15
  161.          Top             =   240
  162.          Width           =   1935
  163.       End
  164.       Begin VB.CommandButton cmdSetModeratorID 
  165.          Caption         =   "Identify Moderator"
  166.          Enabled         =   0   'False
  167.          Height          =   255
  168.          Left            =   120
  169.          TabIndex        =   13
  170.          Top             =   240
  171.          Width           =   1575
  172.       End
  173.       Begin VB.Label lblModeratorAlias 
  174.          BackColor       =   &H00FFFF00&
  175.          Caption         =   "<Moderator Alias>"
  176.          Height          =   255
  177.          Left            =   1800
  178.          TabIndex        =   14
  179.          Top             =   240
  180.          Width           =   2175
  181.       End
  182.    End
  183.    Begin VB.CommandButton cmdClearHistory 
  184.       Caption         =   "Clear History"
  185.       Height          =   375
  186.       Left            =   6000
  187.       TabIndex        =   11
  188.       Top             =   840
  189.       Width           =   1215
  190.    End
  191.    Begin VB.Frame Frame1 
  192.       BackColor       =   &H00FFFF00&
  193.       Caption         =   "User Mode"
  194.       Height          =   615
  195.       Left            =   120
  196.       TabIndex        =   7
  197.       Top             =   720
  198.       Width           =   3630
  199.       Begin VB.OptionButton optGuest 
  200.          BackColor       =   &H00FFFF00&
  201.          Caption         =   "Special Guest"
  202.          Height          =   255
  203.          Left            =   2160
  204.          TabIndex        =   10
  205.          Top             =   240
  206.          Value           =   -1  'True
  207.          Width           =   1320
  208.       End
  209.       Begin VB.OptionButton optModerator 
  210.          BackColor       =   &H00FFFF00&
  211.          Caption         =   "Moderator"
  212.          Height          =   255
  213.          Left            =   960
  214.          TabIndex        =   9
  215.          Top             =   240
  216.          Width           =   1455
  217.       End
  218.       Begin VB.OptionButton optHost 
  219.          BackColor       =   &H00FFFF00&
  220.          Caption         =   "Host"
  221.          Height          =   255
  222.          Left            =   120
  223.          TabIndex        =   8
  224.          Top             =   240
  225.          Width           =   735
  226.       End
  227.    End
  228.    Begin VB.CommandButton cmdFlux 
  229.       Caption         =   "Enter Chat"
  230.       Height          =   375
  231.       Left            =   7320
  232.       TabIndex        =   6
  233.       Top             =   840
  234.       Width           =   1455
  235.    End
  236.    Begin ComctlLib.StatusBar StatusBar 
  237.       Align           =   2  'Align Bottom
  238.       Height          =   255
  239.       Left            =   0
  240.       TabIndex        =   31
  241.       Top             =   8055
  242.       Width           =   8850
  243.       _Version        =   65536
  244.       _ExtentX        =   15610
  245.       _ExtentY        =   450
  246.       _StockProps     =   68
  247.       AlignSet        =   -1  'True
  248.       SimpleText      =   ""
  249.       NumPanels       =   3
  250.       i1              =   "execc.frx":0000
  251.       i2              =   "execc.frx":00FD
  252.       i3              =   "execc.frx":0202
  253.    End
  254.    Begin MSChatObjectsCtl.MSChat MSChat 
  255.       Height          =   3615
  256.       Left            =   120
  257.       TabIndex        =   30
  258.       Top             =   4320
  259.       Width           =   8655
  260.       _ExtentX        =   15266
  261.       _ExtentY        =   6376
  262.       BorderStyle     =   0
  263.       UIOption        =   4093
  264.       BackColor       =   192
  265.    End
  266.    Begin VB.Label lblRoomTopic 
  267.       BackColor       =   &H00FFFF00&
  268.       Height          =   255
  269.       Left            =   3840
  270.       TabIndex        =   5
  271.       Top             =   360
  272.       Width           =   4935
  273.    End
  274.    Begin VB.Label lblUserName 
  275.       BackColor       =   &H00FFFF00&
  276.       Height          =   255
  277.       Left            =   2040
  278.       TabIndex        =   4
  279.       Top             =   360
  280.       Width           =   1695
  281.    End
  282.    Begin VB.Label lblAlias 
  283.       BackColor       =   &H00FFFF00&
  284.       Height          =   255
  285.       Left            =   120
  286.       TabIndex        =   3
  287.       Top             =   360
  288.       Width           =   1815
  289.    End
  290.    Begin VB.Label Label10 
  291.       BackColor       =   &H00FFFFC0&
  292.       Caption         =   "Name"
  293.       Height          =   255
  294.       Left            =   2040
  295.       TabIndex        =   2
  296.       Top             =   120
  297.       Width           =   1695
  298.    End
  299.    Begin VB.Label Label8 
  300.       BackColor       =   &H00FFFFC0&
  301.       Caption         =   "Room Topic"
  302.       Height          =   255
  303.       Left            =   3840
  304.       TabIndex        =   1
  305.       Top             =   120
  306.       Width           =   4935
  307.    End
  308.    Begin VB.Label Label7 
  309.       BackColor       =   &H00FFFFC0&
  310.       Caption         =   "Alias"
  311.       Height          =   255
  312.       Left            =   120
  313.       TabIndex        =   0
  314.       Top             =   120
  315.       Width           =   1815
  316.    End
  317. Attribute VB_Name = "ExecC"
  318. Attribute VB_Creatable = False
  319. Attribute VB_Exposed = False
  320. Option Explicit
  321. Private Sub chkSpeakerView_Click()
  322.     On Error GoTo errSpeakerView
  323.     If (chkSpeakerView.Value = 1) Then
  324.         MSChat.UIOption = MSChat.UIOption + 19
  325.     Else
  326.         MSChat.UIOption = MSChat.UIOption - 19
  327.     End If
  328.     Exit Sub
  329. errSpeakerView:
  330.     DisplayError "chkSpeakerView_Click"
  331. End Sub
  332. Private Sub cmdFlux_Click()
  333.     On Error GoTo errFlux
  334.     Select Case (MSChat.State)
  335.         Case 1: 'disconnected
  336.             EnterOptions.Show
  337.         Case 2: 'connecting
  338.             MSChat.CancelEntering
  339.             WriteLogFile "Cancelling EnterRoom operation..."
  340.         Case 3: 'connected
  341.             MSChat.ExitRoom
  342.             WriteLogFile "Exiting Room."
  343.     End Select
  344.     Exit Sub
  345. errFlux:
  346.     DisplayError "Flux_Click"
  347. End Sub
  348. Sub GetMemberCount()
  349.     On Error Resume Next
  350.     StatusBar.Panels(1).Text = CStr(MSChat.MemberCount) + " Members"
  351. End Sub
  352. Sub SetState(NewState As Integer)
  353.     On Error GoTo errSetState
  354.     Select Case NewState
  355.     Case 1:
  356.         lModeratorID = 0
  357.         WriteLogFile "lModeratorID set to 0 in SetState(1)"
  358.         lGuestID = 0
  359.         WriteLogFile "lGuestID set to 0 in SetState(1)"
  360.         nRealNameType = 0
  361.         
  362.         lstPartID.Clear
  363.         WhispToHosts.lstHosts.Clear
  364.         
  365.         lblModeratorAlias.Caption = "<Moderator Alias>"
  366.         lblGuestAlias.Caption = "<Special Guest Alias>"
  367.         
  368.         cmdFlux.Caption = "Enter Room"
  369.         StatusBar.Panels(1).Text = "0 Members"
  370.         StatusBar.Panels(2).Text = "Disconnected"
  371.         StatusBar.Panels(3).Text = "Not in a room"
  372.         lblAlias.Caption = ""
  373.         lblUserName.Caption = ""
  374.         lblRoomTopic.Caption = ""
  375.         
  376.         MSChat.BackColor = &HC0&
  377.         
  378.         optHost.Enabled = True
  379.         optModerator.Enabled = True
  380.         optGuest.Enabled = True
  381.         
  382.         frmHost.Enabled = False
  383.         frmModerator.Enabled = False
  384.         frmGuest.Enabled = False
  385.         
  386.         cmdSetModeratorID.Enabled = False
  387.         cmdSetGuestID.Enabled = False
  388.         
  389.         cmdGWhisperToHosts.Enabled = False
  390.         cmdMWhisperToHosts.Enabled = False
  391.         cmdHWhisperToHosts.Enabled = False
  392.         
  393.         cmdGWhisperToModerator.Enabled = False
  394.         cmdHWhisperToModerator.Enabled = False
  395.         cmdWhisperToGuest.Enabled = False
  396.         
  397.         cmdMSendToEntireRoom.Enabled = False
  398.         cmdShowHostPanel.Enabled = False
  399.         WriteLogFile ""
  400.     Case 2:
  401.         cmdFlux.Caption = "Cancel entering"
  402.         StatusBar.Panels(2).Text = "Connecting..."
  403.         MSChat.BackColor = &H80FF&
  404.         optHost.Enabled = False
  405.         optModerator.Enabled = False
  406.         optGuest.Enabled = False
  407.     Case 3:
  408.         cmdFlux.Caption = "Leave Room"
  409.         StatusBar.Panels(2).Text = "Connected"
  410.         MSChat.BackColor = &HC000&
  411.         
  412.         frmHost.Enabled = True
  413.         frmModerator.Enabled = True
  414.         frmGuest.Enabled = True
  415.         
  416.         cmdSetModeratorID.Enabled = True
  417.         cmdSetGuestID.Enabled = True
  418.         
  419.         cmdGWhisperToHosts.Enabled = True
  420.         cmdMWhisperToHosts.Enabled = True
  421.         cmdHWhisperToHosts.Enabled = True
  422.         
  423.         cmdMSendToEntireRoom.Enabled = True
  424.         cmdShowHostPanel.Enabled = True
  425.     End Select
  426.     Exit Sub
  427. errSetState:
  428.     DisplayError "SetState"
  429. End Sub
  430. Private Sub cmdGWhisperToHosts_Click()
  431.     WhispToHosts.Show
  432.     If (chkAutoPaste.Value = 1) Then
  433.         WhispToHosts.txtMessage.Text = Clipboard.GetText()
  434.     End If
  435. End Sub
  436. Private Sub cmdGWhisperToModerator_Click()
  437.     On Error Resume Next
  438.     WhispToMod.Show
  439.     If (chkAutoPaste.Value = 1) Then
  440.         WhispToMod.txtMessage.Text = Clipboard.GetText()
  441.     End If
  442. End Sub
  443. Private Sub cmdHWhisperToHosts_Click()
  444.     WhispToHosts.Show
  445.     If (chkAutoPaste.Value = 1) Then
  446.         WhispToHosts.txtMessage.Text = Clipboard.GetText()
  447.     End If
  448. End Sub
  449. Private Sub cmdMSendToEntireRoom_Click()
  450.     SendToRoom.Show
  451.     If (chkAutoPaste.Value = 1) Then
  452.         SendToRoom.txtMessage.Text = Clipboard.GetText()
  453.     End If
  454. End Sub
  455. Private Sub cmdMWhisperToHosts_Click()
  456.     WhispToHosts.Show
  457.     If (chkAutoPaste.Value = 1) Then
  458.         WhispToHosts.txtMessage.Text = Clipboard.GetText()
  459.     End If
  460. End Sub
  461. Private Sub cmdSetGuestID_Click()
  462.     Dim txtRealName As String
  463.     On Error GoTo errSetGuestID
  464.     nRealNameType = RN_GUEST
  465.     MSChat.GetParticipantRealName -1, "", False, txtRealName
  466.     Exit Sub
  467. errSetGuestID:
  468.     DisplayError "cmdSetGuestID_Click"
  469. End Sub
  470. Private Sub cmdSetModeratorID_Click()
  471.     Dim txtRealName As String
  472.     On Error GoTo errSetModeratorID
  473.     nRealNameType = RN_MODERATOR
  474.     MSChat.GetParticipantRealName -1, "", False, txtRealName
  475.     Exit Sub
  476. errSetModeratorID:
  477.     DisplayError "cmdSetModeratorID"
  478. End Sub
  479. Private Sub cmdShowHostPanel_Click()
  480.     On Error Resume Next
  481.     HostPanel.Show
  482. End Sub
  483. Private Sub cmdWhisperToGuest_Click()
  484.     WhispToGuest.Show
  485.     If (chkAutoPaste.Value = 1) Then
  486.         WhispToGuest.txtMessage.Text = Clipboard.GetText()
  487.     End If
  488. End Sub
  489. Private Sub cmdHWhisperToModerator_Click()
  490.     On Error Resume Next
  491.     WhispToMod.Show
  492.     If (chkAutoPaste.Value = 1) Then
  493.         WhispToMod.txtMessage.Text = Clipboard.GetText()
  494.     End If
  495. End Sub
  496. Private Sub Form_Load()
  497.     MSChat.Top = MSCHAT_TOP
  498.     frmHost.Top = FUNCTIONS_TOP
  499.     frmModerator.Top = FUNCTIONS_TOP
  500.     frmGuest.Top = FUNCTIONS_TOP
  501.     lModeratorID = 0
  502.     lGuestID = 0
  503.     nRealNameType = 0
  504.     Load WhispToHosts
  505.     OpenLogFile
  506. End Sub
  507. Private Sub Form_Resize()
  508.     On Error Resume Next
  509.     MSChat.Height = ExecC.Height - StatusBar.Height - MSChat.Top - 500
  510.     MSChat.Width = ExecC.Width - 350
  511. End Sub
  512. Private Sub Form_Unload(Cancel As Integer)
  513.     Unload EnterOptions
  514.     Unload HostPanel
  515.     Unload KickBan
  516.     Unload UISettings
  517.     Unload WhispToMod
  518.     Unload WhispToGuest
  519.     Unload WhispToHosts
  520.     Unload SendToRoom
  521.     CloseLogFile
  522. End Sub
  523. Private Sub cmdClearHistory_Click()
  524.     On Error Resume Next
  525.     MSChat.ClearHistory
  526. End Sub
  527. Private Sub MSChat_OnEndEnumeration()
  528.     On Error GoTo errOnEndEnumeration
  529.     ' For the Moderator and the Guest, ignore all none-host members
  530.     If (Not optHost.Value) Then
  531.         Dim nCnt As Integer
  532.         Dim nStatus As Integer
  533.         Dim nAliasLen As Integer
  534.         For nCnt = 0 To lstPartID.ListCount - 1
  535.             nAliasLen = InStr(lstPartID.List(nCnt), ",") - 1
  536.             nStatus = CInt(Mid(lstPartID.List(nCnt), nAliasLen + 2))
  537.             If (((nStatus And STAT_PARTICIPANT) Or (nStatus And STAT_SPECTATOR)) And (lstPartID.ItemData(nCnt) <> MSChat.ThisParticipantID)) Then
  538.                 MSChat.SetParticipantStatus lstPartID.ItemData(nCnt), MASK_IGNORED, STAT_IGNORED
  539.             End If
  540.         Next nCnt
  541.     End If
  542.     lblRoomTopic.Caption = MSChat.RoomTopic
  543.     lblUserName.Caption = MSChat.ThisParticipantName
  544.     StatusBar.Panels(3).Text = MSChat.RoomPath
  545.     GetMemberCount
  546.     Exit Sub
  547. errOnEndEnumeration:
  548.     DisplayError "OnEndEnumeration"
  549. End Sub
  550. Private Sub MSChat_OnEnterParticipant(ByVal ParticipantID As Long, ByVal Alias As String, ByVal Status As Integer)
  551.     On Error GoTo errOnEnterParticipant
  552.     GetMemberCount
  553.     lstPartID.AddItem Alias + "," + CStr(Status)
  554.     lstPartID.ItemData(lstPartID.NewIndex) = ParticipantID
  555.     If (Status And STAT_HOST) Then
  556.         WhispToHosts.lstHosts.AddItem Alias
  557.         WhispToHosts.lstHosts.ItemData(WhispToHosts.lstHosts.NewIndex) = ParticipantID
  558.     End If
  559.     If ((MSChat.ThisParticipantID <> 0) And (optGuest.Value Or optModerator.Value) And ((Status And STAT_PARTICIPANT) Or (Status And STAT_SPECTATOR))) Then
  560.         ' Guest and Moderator ignore anybody that is not a host
  561.         MSChat.SetParticipantStatus ParticipantID, MASK_IGNORED, STAT_IGNORED
  562.     End If
  563.     Exit Sub
  564. errOnEnterParticipant:
  565.     DisplayError "OnEnterParticipant"
  566. End Sub
  567. Private Sub MSChat_OnExitParticipant(ByVal ParticipantID As Long)
  568.     On Error GoTo errOnExitPart
  569.     GetMemberCount
  570.     Dim nLstPos As Integer
  571.     nLstPos = nFindParticipantIndex(ParticipantID)
  572.     If nLstPos >= 0 Then
  573.         lstPartID.RemoveItem nLstPos
  574.     Else
  575.         WriteLogFile "Couldn't find participant in OnExitParticipant(" + CStr(ParticipantID) + ")"
  576.     End If
  577.     nLstPos = nFindHostIndex(ParticipantID)
  578.     If nLstPos >= 0 Then
  579.         WhispToHosts.lstHosts.RemoveItem nLstPos
  580.     End If
  581.     If lModeratorID = ParticipantID Then
  582.         lModeratorID = 0
  583.         WriteLogFile "lModeratorID set to 0 in OnExitParticipant because Moderator left the room."
  584.         lblModeratorAlias.Caption = "<Moderator Alias>"
  585.         cmdHWhisperToModerator.Enabled = False
  586.         cmdGWhisperToModerator.Enabled = False
  587.     End If
  588.     If lGuestID = ParticipantID Then
  589.         lGuestID = 0
  590.         WriteLogFile "lGuestID set to 0 in OnExitParticipant because Guest left the room."
  591.         lblGuestAlias.Caption = "<Guest Alias>"
  592.         cmdWhisperToGuest.Enabled = False
  593.     End If
  594.     Exit Sub
  595. errOnExitPart:
  596.     DisplayError "OnExitParticipant"
  597. End Sub
  598. Private Function nFindParticipantIndex(ParticipantID As Long) As Integer
  599.     Dim nCnt As Integer
  600.     On Error GoTo errFindPartIndex
  601.     nFindParticipantIndex = -1
  602.     For nCnt = 0 To lstPartID.ListCount - 1
  603.         If lstPartID.ItemData(nCnt) = ParticipantID Then
  604.             nFindParticipantIndex = nCnt
  605.             Exit For
  606.         End If
  607.     Next nCnt
  608.     Exit Function
  609. errFindPartIndex:
  610.     DisplayError "nFindPArticipantIndex"
  611. End Function
  612. Private Function nFindHostIndex(ParticipantID As Long) As Integer
  613.     Dim nCnt As Integer
  614.     On Error GoTo errFindHostIndex
  615.     nFindHostIndex = -1
  616.     For nCnt = 0 To WhispToHosts.lstHosts.ListCount - 1
  617.         If WhispToHosts.lstHosts.ItemData(nCnt) = ParticipantID Then
  618.             nFindHostIndex = nCnt
  619.             Exit For
  620.         End If
  621.     Next nCnt
  622.     Exit Function
  623. errFindHostIndex:
  624.     DisplayError "nFindHostIndex"
  625. End Function
  626. Private Function lFindParticipantID(Alias As String) As Long
  627.     Dim nCnt As Integer
  628.     Dim nAliasLen As Integer
  629.     On Error GoTo errFindPartID
  630.     lFindParticipantID = 0
  631.     For nCnt = 0 To lstPartID.ListCount - 1
  632.         nAliasLen = InStr(lstPartID.List(nCnt), ",") - 1
  633.         If Left(lstPartID.List(nCnt), nAliasLen) = Alias Then
  634.             lFindParticipantID = lstPartID.ItemData(nCnt)
  635.             Exit For
  636.         End If
  637.     Next nCnt
  638.     Exit Function
  639. errFindPartID:
  640.     DisplayError "lFindParticipantID"
  641. End Function
  642. Private Function nFindStatus(Alias As String) As Integer
  643.     Dim nCnt As Integer
  644.     Dim nAliasLen As Integer
  645.     On Error GoTo errFindStatus
  646.     nFindStatus = 0
  647.     For nCnt = 0 To lstPartID.ListCount - 1
  648.         nAliasLen = InStr(lstPartID.List(nCnt), ",") - 1
  649.         If Left(lstPartID.List(nCnt), nAliasLen) = Alias Then
  650.             nFindStatus = CInt(Mid(lstPartID.List(nCnt), nAliasLen + 2))
  651.             Exit For
  652.         End If
  653.     Next nCnt
  654.     Exit Function
  655. errFindStatus:
  656.     DisplayError "nFindStatus"
  657. End Function
  658. Private Sub MSChat_OnMessage(ByVal SenderID As Long, ByVal Message As Variant, ByVal MessageType As Integer)
  659.     On Error GoTo errOnMessage
  660.     If (optGuest.Value) Then
  661.         If (VarType(Message) = vbInteger) Then
  662.             If (Message = 1984) Then
  663.                 lModeratorID = SenderID
  664.                 WriteLogFile "lModeratorID set to " + CStr(SenderID) + " in OnMessage handler."
  665.                 cmdGWhisperToModerator.Enabled = True
  666.             End If
  667.         End If
  668.     End If
  669.     Exit Sub
  670. errOnMessage:
  671.     DisplayError "OnMessage"
  672. End Sub
  673. Private Sub MSChat_OnParticipantAliasChanged(ByVal ParticipantID As Long, ByVal OldAlias As String, ByVal NewAlias As String)
  674.     On Error GoTo errOnPartAliasChanged
  675.         
  676.     Dim nLstPos As Integer
  677.         
  678.     nLstPos = nFindParticipantIndex(ParticipantID)
  679.     If (nLstPos <> -1) Then
  680.         lstPartID.List(nLstPos) = NewAlias + "," + Mid(lstPartID.List(nLstPos), Len(OldAlias) + 2)
  681.     Else
  682.         WriteLogFile "Couldn't find participant in OnParticipantAliasChanged(" + CStr(ParticipantID) + "," + OldAlias + "," + NewAlias + ")"
  683.     End If
  684.     nLstPos = nFindHostIndex(ParticipantID)
  685.     If nLstPos >= 0 Then
  686.         WhispToHosts.lstHosts.RemoveItem nLstPos
  687.         WhispToHosts.lstHosts.AddItem NewAlias
  688.         WhispToHosts.lstHosts.ItemData(WhispToHosts.lstHosts.NewIndex) = ParticipantID
  689.     End If
  690.     Exit Sub
  691. errOnPartAliasChanged:
  692.     DisplayError "OnParticipantAliasChanged"
  693. End Sub
  694. Private Sub MSChat_OnParticipantRealName(ByVal Alias As String, ByVal RealName As String)
  695.     On Error GoTo errOnPartRealName
  696.     Select Case nRealNameType
  697.     Case RN_MODERATOR:
  698.         lModeratorID = lFindParticipantID(Alias)
  699.         If (lModeratorID <> 0) Then
  700.             If (lModeratorID <> MSChat.ThisParticipantID) Then
  701.                 WriteLogFile "lModeratorID set to " + CStr(lModeratorID) + " (" + Alias + ") in OnParticipantRealName handler."
  702.                 lblModeratorAlias.Caption = Alias
  703.                 cmdHWhisperToModerator.Enabled = True
  704.             Else
  705.                 MsgBox "You cannot select yourself as the Moderator. Please select another member.", vbOKOnly, "Executive Chat Monitoring Tool"
  706.                 lModeratorID = 0
  707.             End If
  708.         Else
  709.             WriteLogFile "Couldn't find Moderator in OnParticipantRealName(" + Alias + "," + RealName + ")"
  710.         End If
  711.         
  712.     Case RN_GUEST:
  713.         lGuestID = lFindParticipantID(Alias)
  714.         If (lGuestID <> 0) Then
  715.             If (lGuestID <> MSChat.ThisParticipantID) Then
  716.                 cmdWhisperToGuest.Enabled = True
  717.                 lblGuestAlias.Caption = Alias
  718.                 MSChat.SendMessage lGuestID, 1, CVar(1984)
  719.             Else
  720.                 MsgBox "You cannot select yourself as the Special Guest. Please select another member.", vbOKOnly, "Executive Chat Monitoring Tool"
  721.                 lGuestID = 0
  722.             End If
  723.         Else
  724.             WriteLogFile "Couldn't find Guest in OnParticipantRealName(" + Alias + "," + RealName + ")"
  725.         End If
  726.     Case RN_PARTICIPANT:
  727.         HostPanel.lblAsyncAlias.Caption = Alias
  728.         HostPanel.lblAsyncRealName.Caption = RealName
  729.     End Select
  730.     Exit Sub
  731. errOnPartRealName:
  732.     DisplayError "OnParticipantRealName"
  733. End Sub
  734. Private Sub MSChat_OnParticipantStatusChanged(ByVal ParticipantID As Long, ByVal Status As Integer)
  735.         
  736.     On Error GoTo errOnPartStatusChanged
  737.     Dim nLstPos As Integer
  738.     Dim nAliasLen As Integer
  739.     Dim strAlias As String
  740.     nLstPos = nFindParticipantIndex(ParticipantID)
  741.     If nLstPos >= 0 Then
  742.         nAliasLen = InStr(lstPartID.List(nLstPos), ",") - 1
  743.         If (nAliasLen) Then
  744.             strAlias = Left(lstPartID.List(nLstPos), nAliasLen)
  745.             lstPartID.List(nLstPos) = strAlias + "," + CStr(Status)
  746.         End If
  747.     Else
  748.         WriteLogFile "Couldn't find participant in OnParticipantStatusChanged(" + CStr(ParticipantID) + "," + CStr(Status) + ")"
  749.     End If
  750.     nLstPos = nFindHostIndex(ParticipantID)
  751.     If (nLstPos >= 0) And (Not (Status And STAT_HOST)) Then
  752.         WhispToHosts.lstHosts.RemoveItem nLstPos
  753.     End If
  754.     If (Status And STAT_HOST) And (nLstPos = -1) Then
  755.         WhispToHosts.lstHosts.AddItem strAlias
  756.         WhispToHosts.lstHosts.ItemData(WhispToHosts.lstHosts.NewIndex) = ParticipantID
  757.     End If
  758.     Exit Sub
  759. errOnPartStatusChanged:
  760.     DisplayError "OnParticipantStatusChanged"
  761. End Sub
  762. Private Sub MSChat_OnRoomTopicChanged(ByVal NewRoomTopic As String)
  763.     On Error Resume Next
  764.     lblRoomTopic.Caption = NewRoomTopic
  765. End Sub
  766. Private Sub MSChat_OnStateChanged(ByVal NewState As Integer)
  767.     SetState NewState
  768. End Sub
  769. Private Sub optGuest_Click()
  770.     On Error Resume Next
  771.     HostPanel.Hide
  772.     MSChat.UIOption = UIOPT_GUEST
  773.     MSChat.Top = frmGuest.Top + frmGuest.Height + 100
  774.     MSChat.Height = ExecC.Height - StatusBar.Height - MSChat.Top - 500
  775.     frmHost.Visible = False
  776.     frmModerator.Visible = False
  777.     frmGuest.Visible = True
  778. End Sub
  779. Private Sub optHost_Click()
  780.     On Error Resume Next
  781.     HostPanel.Show
  782.     MSChat.UIOption = UIOPT_HOST
  783.     MSChat.Top = frmHost.Top + frmHost.Height + 100
  784.     MSChat.Height = ExecC.Height - StatusBar.Height - MSChat.Top - 500
  785.     frmHost.Visible = True
  786.     frmModerator.Visible = False
  787.     frmGuest.Visible = False
  788. End Sub
  789. Private Sub optModerator_Click()
  790.     On Error Resume Next
  791.     HostPanel.Hide
  792.     MSChat.UIOption = UIOPT_MODERATOR
  793.     MSChat.Top = frmModerator.Top + frmModerator.Height + 100
  794.     MSChat.Height = ExecC.Height - StatusBar.Height - MSChat.Top - 500
  795.     frmHost.Visible = False
  796.     frmModerator.Visible = True
  797.     frmGuest.Visible = False
  798. End Sub
  799.