\' Gambas class file
Inherits ISalonDeChat
Private Usuarios As New Collection
Public ZonaEscribe As TextLabel
Public Sub _new(z As TextLabel)
ZonaEscribe = z
ZonaEscribe.text = "<br>Inicio la conversación...<br><br>"
End
Public Sub registra(user As Usuario)
usuarios.Add(user, User.getNombre())
End
Public Sub envia(de As String, a As String, msg As String)
Dim u As Usuario
If usuarios.Exist(de) = False Then
ZonaEscribe.Text &= "Salon Chat: No existe el Usuario " & de & ", para enviarle el mensaje < br > "
Endif
If usuarios.Exist(a) = False Then
ZonaEscribe.Text &= "Salon Chat: No existe el Usuario " & a & ", para enviarle el mensaje: <b>" & msg & "</b><br>"
Endif
If usuarios.Exist(de) And usuarios.Exist(a) Then
u = usuarios[a]
u.recibe(de, msg)
Endif
End
Public Sub cierra()
\'esto se hace para cuando se deje de usar el objeto, no queden referencias circulares
usuarios = Null
End