TALKINCHAT FULL SOURCE CODES
Sat Jul 01, 2023 2:23 pm
HI GUYS,TODAY I WILL GONNA SHARE THE FULL SOURCE CODES OF TALKINCHAT,THIS CODES YOU CAN MAKE YOUR OWN TC SOFTWARE LIKE BOTS AND CLIENTS.
[You must be registered and logged in to see this link.]
THIS IS THE CODES:
FOR THE RCLIENT LIBRARYS,PLEASE DOWNLOAD MY PHILBOT SOFTWARE AND TAKE THAT ALL DLL FILES NEEDED,THANKS!
HAPPY CODING!
[You must be registered and logged in to see this link.]
THIS IS THE CODES:
FOR THE RCLIENT LIBRARYS,PLEASE DOWNLOAD MY PHILBOT SOFTWARE AND TAKE THAT ALL DLL FILES NEEDED,THANKS!
- Code:
Imports System.Threading
Imports RClient
Imports RClient.MultiUserChat
Imports RClient.User
Imports System.Threading.Tasks
Imports System.Net
Public Class Form1
Private ryu As RChat
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Button1.Text = "LogIn" Then
ryu = New RChat
ryu.Username = (TxtUser.Text)
ryu.Password = TxtPass.Text
ryu.Login(TxtUser.Text, TxtPass.Text)
AddHandler ryu.OnConnected, AddressOf connected
AddHandler ryu.OnLogin, AddressOf login
AddHandler ryu.OnLogout, AddressOf logout
AddHandler ryu.OnClose, AddressOf onClose
AddHandler ryu.OnMucJoined, AddressOf joined
AddHandler ryu.OnMucSearchComplete, AddressOf mucsearch
AddHandler ryu.OnMucMessage, AddressOf mucmsg
AddHandler ryu.OnMucUserPresence, AddressOf mucpresence
AddHandler ryu.OnMucError, AddressOf muceror
lblstatus.Text = "Connecting..."
ElseIf Button1.Text = "LogOut" Then
ryu.Logout()
End If
End Sub
Private Sub muceror(ryu As RChat, mucName As String, [error] As MucError)
If [error] = MucError.AlreadyJoined Then
rtfchat.SelectionColor = Color.DarkGreen
rtfchat.AppendText("You Are Already In the Room!" + vbNewLine)
rtfchat.ScrollToCaret()
ElseIf [error] = MucError.MaxUsers Then
rtfchat.SelectionColor = Color.Red
rtfchat.Text = ("Room Has Maximum Users!")
rtfchat.ScrollToCaret()
ElseIf [error] = MucError.RequiredMembership Then
rtfchat.SelectionColor = Color.Red
rtfchat.AppendText("Room is Member Only!" + vbNewLine)
rtfchat.ScrollToCaret()
ElseIf [error] = MucError.NotInMuc Then
rtfchat.SelectionColor = Color.Red
rtfchat.AppendText("You Are Not In Room!" + vbNewLine)
Button2.Text = "Join"
rtfchat.Clear()
listusers.Items.Clear()
lblcount.Text = "0"
rtfchat.ScrollToCaret()
ElseIf [error] = MucError.RequiredPassword Then
rtfchat.SelectionColor = Color.Red
rtfchat.AppendText("Room is Lock!" + vbNewLine)
rtfchat.ScrollToCaret()
ElseIf [error] = MucError.Outcast Then
End If
End Sub
Private Sub mucpresence(ryu As RChat, mucUser As MucUser)
If mucUser IsNot Nothing Then
If mucUser.IsJoined Then
rtfchat.SelectionColor = Color.ForestGreen
rtfchat.AppendText(mucUser.Username.ToString + " join the Room as " + mucUser.Role.ToString + vbNewLine)
rtfchat.ScrollToCaret()
listusers.Items.Add(mucUser.Username.ToString)
lblcount.Text += 1
Else
If mucUser.Username = ryu.Username Then
Button2.Text = "Join"
rtfchat.Clear()
listusers.Items.Clear()
lblcount.Text = "0"
Else
rtfchat.SelectionColor = Color.ForestGreen
rtfchat.AppendText(mucUser.Username.ToString + " Leave the Room " + vbNewLine)
rtfchat.ScrollToCaret()
listusers.Items.Remove(mucUser.Username.ToString)
lblcount.Text -= 1
End If
End If
End If
End Sub
Private Sub mucmsg(ryu As RChat, message As MucMessage)
If message IsNot Nothing Then
Dim from As String = message.From
Dim body As String = message.Body
Dim url As String = message.FileUrl
Dim mediaType As MessageMediaType = message.MediaType
If mediaType = MessageMediaType.text Then
If message.From = ryu.Username Then
rtfchat.SelectionColor = Color.Red
rtfchat.AppendText(from + ": ")
rtfchat.SelectionColor = Color.Black
rtfchat.AppendText(body + vbNewLine)
rtfchat.ScrollToCaret()
Else
rtfchat.SelectionColor = Color.Blue
rtfchat.AppendText(from + ": ")
rtfchat.SelectionColor = Color.Black
rtfchat.AppendText(body + vbNewLine)
rtfchat.ScrollToCaret()
End If
ElseIf mediaType = MessageMediaType.audio Then
If message.From = ryu.Username Then
rtfchat.SelectionColor = Color.Red
rtfchat.AppendText(from + ": ")
rtfchat.SelectionColor = Color.Black
rtfchat.AppendText(url + vbNewLine)
rtfchat.ScrollToCaret()
Else
rtfchat.SelectionColor = Color.Blue
rtfchat.AppendText(from + ": ")
rtfchat.SelectionColor = Color.Black
rtfchat.AppendText(url + vbNewLine)
rtfchat.ScrollToCaret()
End If
ElseIf mediaType = MessageMediaType.image Then
If message.From = ryu.Username Then
rtfchat.SelectionColor = Color.Red
rtfchat.AppendText(from + ": ")
rtfchat.SelectionColor = Color.Black
rtfchat.AppendText(url + vbNewLine)
rtfchat.ScrollToCaret()
Else
rtfchat.SelectionColor = Color.Blue
rtfchat.AppendText(from + ": ")
rtfchat.SelectionColor = Color.Black
rtfchat.AppendText(url + vbNewLine)
rtfchat.ScrollToCaret()
End If
End If
End If
End Sub
Private Sub mucsearch(ryu As RChat, mucType As MucType, infoList As List(Of MucInfo))
If infoList.Count > 0 Then
Thread.Sleep(1000)
If ryu IsNot Nothing Then
ryu.GetNextMucList()
End If
End If
If mucType = MucType.public Then
For i As Integer = 0 To infoList.Count - 1
Dim info As MucInfo = infoList(i)
ListRoom.Items.Add(info.Name)
Next
ElseIf mucType = MucType.search Then
ListRoom.Items.Clear()
For i As Integer = 0 To infoList.Count - 1
Dim info As MucInfo = infoList(i)
ListRoom.Items.Add(info.Name)
Next
End If
End Sub
Private Sub joined(ryu As RChat, muc As Muc)
If muc IsNot Nothing Then
For i As Integer = 0 To muc.MucUsers.Count - 1
Dim user As MucUser = muc.MucUsers.ElementAt(i).Value
If user IsNot Nothing Then
If user.Username.ToString = ryu.Username Then
Button2.Text = "Leave"
rtfchat.SelectionColor = Color.ForestGreen
rtfchat.AppendText("You join the Room as " + user.Role.ToString + vbNewLine)
rtfchat.ScrollToCaret()
listusers.Items.Add(user.Username.ToString)
Else
rtfchat.SelectionColor = Color.ForestGreen
rtfchat.AppendText(user.Username.ToString + " join the Room as " + user.Role.ToString + vbNewLine)
rtfchat.ScrollToCaret()
listusers.Items.Add(user.Username.ToString)
End If
lblcount.Text += 1
End If
Next
End If
End Sub
Private Sub onClose(ryu As RChat)
Button1.Text = "LogIn"
lblstatus.Text = "Disconnected"
End Sub
Private Sub logout(ryu As RChat)
Button1.Text = "LogIn"
lblstatus.Text = "Offline"
End Sub
Private Sub login(ryu As RChat, authCode As AuthCode)
lblstatus.Text = authCode.ToString
ryu.GetMucList(MucType.public)
End Sub
Private Sub connected(ryu As RChat)
lblstatus.Text = ("Connected")
Button1.Text = "LogOut"
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If Button2.Text = "Join" Then
rtfchat.Clear()
listusers.Items.Clear()
lblcount.Text = "0"
ryu.JoinMuc(TxtRoom.Text, 0)
ElseIf Button2.Text = "Leave" Then
ryu.LeaveMuc(TxtRoom.Text)
End If
End Sub
Private Sub TxtSearch_TextChanged(sender As Object, e As EventArgs) Handles TxtSearch.TextChanged
ryu.SearchMuc(TxtSearch.Text)
End Sub
Private Sub ListRoom_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListRoom.SelectedIndexChanged
TxtRoom.Text = ListRoom.SelectedItem
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
ryu.SendMessage(TxtRoom.Text, txtsend.Text, MessageType.MucMessage)
txtsend.Text = ""
End Sub
End Class
HAPPY CODING!
Permissions in this forum:
You cannot reply to topics in this forum
|
|