VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "CChatConnection"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private ChatConn As ChatConnection
Private WithEvents ChatChan As ChatChannel
Attribute ChatChan.VB_VarHelpID = -1

Private Sub Class_Initialize()
  Set ChatConn = New ChatConnection
End Sub

Private Sub Class_Terminate()
  Set ChatChan = Nothing
  Set ChatConn = Nothing
End Sub

Sub ConnectUser(UserName As String)
  Set ChatChan = ChatConn.ChatChannel
  BroadcastMessage UserName, "connect"
End Sub

Sub DisconnectUser(UserName As String)
  BroadcastMessage UserName, "disconnect"
  Set ChatChan = Nothing
End Sub

Sub BroadcastMessage(UserName As String, Message As String)
  ChatConn.BroadcastMessage UserName, Message
End Sub

Private Sub ChatChan_GotMessage(ByVal UserName As String, ByVal Message As String)
  Form1.GotChatMessage UserName, Message
End Sub
