Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Dim CMode As String
- Dim sData As String
- Dim sChannel As String
- Dim HostGroup As String
- Dim OwnerGroup As String
- Dim GuideGroup As String
- Dim sRoomList As String
- Dim lFoundPosition As Long
- Dim Color As Boolean
- Dim sList As ListItem
- Dim i As Integer
- '--------------------------------------------------------
- '----------- Control Interface
- '--------------------------------------------------------
- Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
- txtServer.Text = PropBag.ReadProperty("Server", "irc.xtcomputing.com")
- txtNickName.Text = PropBag.ReadProperty("NickName", "Webchat_" & Format(Now, "mmss"))
- txtRoom.Text = PropBag.ReadProperty("RoomName", "extremeteam")
- UserControl.BackColor = PropBag.ReadProperty("BackColor", &HE8FFFF)
- 'UserControl.ScaleHeight = PropBag.ReadProperty("ScaleHeight", 7005)
- 'UserControl.ScaleWidth = PropBag.ReadProperty("ScaleWidth", 12555)
- frTopBack.BackColor = PropBag.ReadProperty("TopBackHighlightColor", &HCEB2A5)
- frBack.BackColor = PropBag.ReadProperty("BackHighlightColor", &HF7EFEF)
- lstMe.BackColor = PropBag.ReadProperty("BackHighlightColor", &HF7EFEF)
- lRoomName.ForeColor = PropBag.ReadProperty("BackColor", &HE8FFFF)
- frInputBorder.BackColor = PropBag.ReadProperty("ButtonFrameColor", &HFF9966)
- frButtonFrame.BackColor = PropBag.ReadProperty("InputBordercolor", &H9C654A)
- cmdSend.BackColor = PropBag.ReadProperty("ButtonBackColor", &HFFEACE)
- cmdAction.BackColor = PropBag.ReadProperty("ButtonBackColor", &HFFEACE)
- cmdOptions.BackColor = PropBag.ReadProperty("BackHighlightColor", &HF7EFEF)
- End Sub
- Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
- Call PropBag.WriteProperty("RoomName", txtRoom.Text, "extremeteam")
- Call PropBag.WriteProperty("NickName", txtNickName.Text, "Webchat_" & Format(Now, "mmss"))
- Call PropBag.WriteProperty("Server", txtServer.Text, "irc.xtcomputing.com")
- Call PropBag.WriteProperty("BackColor", UserControl.BackColor, &HE8FFFF)
- 'Call PropBag.WriteProperty("ScaleHeight", UserControl.ScaleHeight, 7005)
- 'Call PropBag.WriteProperty("ScaleWidth", UserControl.ScaleWidth, 12555)
- Call PropBag.WriteProperty("TopBackHighlightColor", frTopBack.BackColor, &HCEB2A5)
- Call PropBag.WriteProperty("BackHighlightColor", frBack.BackColor, &HF7EFEF)
- Call PropBag.WriteProperty("ButtonFrameColor", frInputBorder.BackColor, &HFF9966)
- Call PropBag.WriteProperty("InputBordercolor", frButtonFrame.BackColor, &H9C654A)
- Call PropBag.WriteProperty("ButtonBackColor", cmdSend.BackColor, &HFFEACE)
- End Sub
- Private Sub UserControl_InitProperties()
- RoomName = txtRoom.Text
- NickName = txtNickName.Text
- BackColor = UserControl.BackColor
- TopBackHighlightColor = frTopBack.BackColor
- BackHighlightColor = frBack.BackColor
- 'ScaleHeight = UserControl.ScaleHeight
- 'ScaleWidth = UserControl.ScaleWidth
- ButtonFrameColor = frInputBorder.BackColor
- End Sub
- 'MappingInfo=txtRoom,txtRoom,-1,Text
- Public Property Get RoomName() As String
- RoomName = txtRoom.Text
- End Property
- Public Property Let RoomName(ByVal New_RoomName As String)
- txtRoom.Text() = New_RoomName
- PropertyChanged "RoomName"
- End Property
- Public Property Get NickName() As String
- NickName = txtNickName.Text
- End Property
- Public Property Let NickName(ByVal New_NickName As String)
- txtNickName.Text() = New_NickName
- PropertyChanged "NickName"
- End Property
- Public Property Get Server() As String
- Server = txtServer.Text
- End Property
- Public Property Let Server(ByVal New_Server As String)
- txtServer.Text() = New_Server
- PropertyChanged "Server"
- End Property
- 'MappingInfo=UserControl,UserControl,-1,BackColor
- Public Property Get BackColor() As OLE_COLOR
- BackColor = UserControl.BackColor
- End Property
- Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
- UserControl.BackColor() = New_BackColor
- PropertyChanged "BackColor"
- End Property
- 'MappingInfo=UserControl,UserControl,-1,ScaleHeight
- 'Public Property Get ScaleHeight() As Single
- 'ScaleHeight = UserControl.ScaleHeight
- 'End Property
- 'Public Property Let ScaleHeight(ByVal New_ScaleHeight As Single)
- 'UserControl.ScaleHeight() = New_ScaleHeight
- 'PropertyChanged "ScaleHeight"
- 'End Property
- 'MappingInfo=UserControl,UserControl,-1,ScaleWidth
- 'Public Property Get ScaleWidth() As Single
- 'ScaleWidth = UserControl.ScaleWidth
- 'End Property
- 'Public Property Let ScaleWidth(ByVal New_ScaleWidth As Single)
- 'UserControl.ScaleWidth() = New_ScaleWidth
- 'PropertyChanged "ScaleWidth"
- 'End Property
- Public Property Get TopBackHighlightColor() As OLE_COLOR
- TopBackHighlightColor = frTopBack.BackColor
- End Property
- Public Property Let TopBackHighlightColor(ByVal New_BackColor As OLE_COLOR)
- frTopBack.BackColor() = New_BackColor
- PropertyChanged "TopBackHighlightColor"
- End Property
- Public Property Get BackHighlightColor() As OLE_COLOR
- BackHighlightColor = frBack.BackColor
- End Property
- Public Property Let BackHighlightColor(ByVal New_BackColor As OLE_COLOR)
- frBack.BackColor() = New_BackColor
- PropertyChanged "BackHighlightColor"
- End Property
- Public Property Get ButtonFrameColor() As OLE_COLOR
- ButtonFrameColor = frInputBorder.BackColor
- End Property
- Public Property Let ButtonFrameColor(ByVal New_BackColor As OLE_COLOR)
- frInputBorder.BackColor() = New_BackColor
- PropertyChanged "ButtonFrameColor"
- End Property
- Public Property Get InputBordercolor() As OLE_COLOR
- InputBordercolor = frButtonFrame.BackColor
- End Property
- Public Property Let InputBordercolor(ByVal New_BackColor As OLE_COLOR)
- frButtonFrame.BackColor() = New_BackColor
- PropertyChanged "InputBordercolor"
- End Property
- Public Property Get ButtonBackColor() As OLE_COLOR
- ButtonBackColor = cmdSend.BackColor
- End Property
- Public Property Let ButtonBackColor(ByVal New_BackColor As OLE_COLOR)
- cmdSend.BackColor() = New_BackColor
- PropertyChanged "ButtonBackColor"
- End Property
- Private Sub cmdSend_Click() ' the send button code
- If txtSend = "" Then Exit Sub
- txtmain.SelStart = Len(txtmain.Text)
- If UCase$(Left$(txtSend, 6)) = "/CLEAR" Then
- txtmain.Text = ""
- txtSend.Text = ""
- Exit Sub
- ElseIf UCase$(Left$(txtSend, 1)) = "/" Then
- SendServ Replace$(txtSend, "/", "")
- txtSend.Text = ""
- Exit Sub
- End If
- SendServ "PRIVMSG " & sChannel & " :" & txtSend.Text
- SendMsg txtSend.Text
- End Sub
- Private Sub cmdAction_Click() ' action button code
- SendServ "PRIVMSG " & sChannel & " :" & Chr$(1) & "ACTION " & txtSend.Text & "" & Chr$(1)
- SendAction txtSend.Text
- End Sub
- Public Sub SendMsg(sMsg As String) ' send message routine
- txtmain.SelStart = Len(txtmain.Text)
- txtmain.SelBold = True
- txtmain.SelText = " " & CheckNick(sMyNick) & " : "
- txtmain.SelBold = False
- txtmain.SelText = sMsg & vbCrLf
- txtSend.Text = ""
- ResetFontFormat
- End Sub
- Public Sub SendAction(sMsg As String) 'send action routine
- txtmain.SelStart = Len(txtmain.Text)
- txtmain.SelColor = &H800080
- txtmain.SelItalic = True
- txtmain.SelText = " " & CheckNick(sMyNick) & " " & sMsg & "" & vbCrLf
- txtSend.Text = ""
- ResetFontFormat
- End Sub
- Private Sub cmdOptions_Click()
- frmTrace.Show vbModal, Me
- End Sub
- Private Sub lstMe_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'lstMe is your own nick
- Dim sUser As String
- sUser = lstMe.SelectedItem.Text
- If sUser <> "" Then
- If Button = 2 Then
- 'UserControl.PopupMenu mnuUsers, vbPopupMenuRightButton
- End If
- End If
- End Sub
- Private Sub lstUsers_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'lstUsers are the users
- Dim sUser As String
- On Error Resume Next
- sUser = lstUsers.SelectedItem.Text
- If sUser <> "" Then
- If Button = 2 Then
- UserControl.PopupMenu mnuUsers, vbPopupMenuRightButton
- End If
- End If
- End Sub
- Private Sub mnuPart_Click()
- On Error Resume Next
- SendServ "MODE " & sChannel & " -q " & lstUsers.SelectedItem.Key
- SendServ "MODE " & sChannel & " -o " & lstUsers.SelectedItem.Key
- End Sub
- Private Sub mnuHost_Click()
- On Error Resume Next
- SendServ "MODE " & sChannel & " +o " & lstUsers.SelectedItem.Key
- End Sub
- Private Sub mnuOwner_Click()
- On Error Resume Next
- SendServ "MODE " & sChannel & " +q " & lstUsers.SelectedItem.Key
- End Sub
- Private Sub mnuWhisper_Click()
- '
- End Sub
- Private Sub mnuSlap_Click()
- On Error Resume Next
- SendServ "PRIVMSG " & sChannel & " :" & Chr$(1) & "ACTION slaps " & lstUsers.SelectedItem.Key & " around a bit with a large trout" & Chr$(1)
- SendAction "slaps " & lstUsers.SelectedItem.Text & " around a bit with a large trout"
- End Sub
- Private Sub txtSend_Change()
- If txtSend.Text <> "" And ds1.State = 7 Then
- cmdSend.Enabled = True
- cmdAction.Enabled = True
- End If
- If txtSend.Text = "" Or ds1.State <> 7 Then
- cmdSend.Enabled = False
- cmdAction.Enabled = False
- End If
- End Sub
- Private Sub txtSend_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- Call cmdSend_Click
- KeyAscii = 0
- End If
- End Sub
- Private Sub lstUsers_DblClick()
- Dim tempNick As String
- tempNick = lstUsers.SelectedItem.Text
- If Left$(tempNick, 1) = "@" Or Left$(tempNick, 1) = "+" Or Left$(tempNick, 1) = "." Then
- tempNick = Right$(tempNick, Len(tempNick) - 1)
- End If
- If Not DoesPvtExists(tempNick) Then 'if no curren window exists
- Dim PvtIndex As Integer
- PvtIndex = FreePvtIndex
- Call PvtWindows(PvtIndex).SetEventObject(Me)
- PvtWindows(PvtIndex).Tag = PvtIndex 'the tag will contain the array index of the window
- PvtWindows(PvtIndex).Caption = tempNick 'change the caption to nick
- PvtWindows(PvtIndex).Show vbModal, Me 'display the window
- PvtWindowState(PvtIndex).name = tempNick 'just
- Else
- PvtWindows(GetPvtIndex(tempNick)).WindowState = vbNormal 'yeah need to open!
- End If
- End Sub
- Private Sub UserWhisper(sNick As String)
- Dim sMsg As String
- sMsg = Mid(sData, 3)
- sMsg = Mid(sMsg, InStr(1, sMsg, ":", 1) + 1)
- sMsg = Replace(sMsg, vbCrLf, "")
- sMsg = Replace(sMsg, Chr$(1), "")
- 'txtmain.SelStart = Len(txtmain.Text)
- 'txtmain.SelBold = True
- 'txtmain.SelText = " " & CheckNick(sNick)
- 'txtmain.SelColor = &H800080
- 'txtmain.SelText = " Whispers to "
- 'txtmain.SelColor = &H800000
- 'txtmain.SelText = CheckNick(sMyNick) & " : "
- 'txtmain.SelText = sMsg & vbCrLf
- 'ResetFontFormat
- 'write the msg to pvt window
- Dim PvtIndex As Integer
- If Not DoesPvtExists(sNick) Then 'if no pvt for sender
- PvtIndex = FreePvtIndex
- Call PvtWindows(PvtIndex).SetEventObject(Me)
- PvtWindows(PvtIndex).Tag = PvtIndex 'the tag will contain the array index of the window
- PvtWindows(PvtIndex).Caption = sNick 'change the caption to nick
- PvtWindows(PvtIndex).Show vbModal, Me 'display the window
- PvtWindowState(PvtIndex).name = sNick 'just
- End If
- PvtIndex = GetPvtIndex(sNick)
- PvtWindows(PvtIndex).WindowState = vbNormal
- PvtWindows(PvtIndex).AddText sMsg, sNick
- End Sub
- Private Sub ResetFontFormat()
- SetEmo
- lFoundPosition = Len(txtmain.Text) - 1
- txtmain.SelStart = Len(txtmain.Text) ' jump to end
- txtmain.SelBold = False
- txtmain.SelUnderline = False
- txtmain.SelItalic = False
- txtmain.SelFontName = "Tahoma"
- txtmain.SelColor = &H0&
- End Sub
- Private Sub Webding()
- txtmain.SelStart = Len(txtmain.Text) 'jump to end
- txtmain.SelBold = False
- txtmain.SelUnderline = False
- txtmain.SelItalic = False
- txtmain.SelColor = &H808080
- txtmain.SelFontName = "Webdings"
- txtmain.SelText = " 4"
- End Sub
- Function CheckNick(str As String)
- CheckNick = Replace(str, ">", "Guest_")
- End Function
- Dim sNewNick As String
- On Error Resume Next
- sNewNick = Split(sData, " ")(2)
- sNewNick = Replace$(sNewNick, ":", "")
- Webding
- txtmain.SelFontName = "Tahoma"
- txtmain.SelText = Replace$(CheckNick(sNick), "'", "") & " is now known as " & sNewNick & vbCrLf
- ResetFontFormat
- GuideGroup = Replace$(GuideGroup, " " & sNick & " ", " " & sNewNick & " ")
- HostGroup = Replace$(HostGroup, " " & sNick & " ", " " & sNewNick & " ")
- OwnerGroup = Replace$(OwnerGroup, " " & sNick & " ", " " & sNewNick & " ")
- If sNick = lstMe.ListItems(1).Text Then
- sMyNick = sNewNick
- lstMe.ListItems.Remove 1
- lstMe.ListItems.Add , sNewNick, sNewNick
- Exit Sub
- End If
- For i = 1 To lstUsers.ListItems.Count
- If lstUsers.ListItems(i).Key = sNick Then
- lstUsers.ListItems.Remove i
- Exit For
- End If
- Next i
- If InStr(1, OwnerGroup, " " & sNewNick & " ") <> 0 Then
- Set sList = lstUsers.ListItems.Add(, sNewNick, "." & sNewNick, , "gold")
- sList.ListSubItems.Add , , sNewNick & " (Host)", "gold"
- ElseIf InStr(1, HostGroup, " " & sNewNick & " ") <> 0 Then
- Set sList = lstUsers.ListItems.Add(, sNewNick, "@" & sNewNick, , "brown")
- sList.ListSubItems.Add , , sNewNick & " (Host)", "brown"
- ElseIf InStr(1, GuideGroup, " " & sNewNick & " ") <> 0 Then
- Set sList = lstUsers.ListItems.Add(, sNewNick, "&" & sNewNick, , "guide")
- sList.ListSubItems.Add , , sNewNick & " (Host)", "guide"
- Else
- Set sList = lstUsers.ListItems.Add(, sNewNick, Replace$(sNewNick, ">", ""), 1)
- sList.ListSubItems.Add , , CheckNick(sNewNick), "blank"
- End If
- lstUsers.Refresh
- End Sub
- Private Sub UserKicked(sNick As String)
- On Error Resume Next
- Dim sKicked As String
- Dim sReason As String
- sKicked = Split(sData, " ")(3)
- sReason = Replace(Split(sData, " :")(1), vbCrLf, "")
- txtmain.SelStart = Len(txtmain.Text)
- txtmain.SelColor = &HFF&
- txtmain.SelBold = True
- txtmain.SelFontName = "Tahoma"
- txtmain.SelText = " Host " & sNick & " Kicked " & sKicked & " :" & sReason & vbCrLf
- ResetFontFormat
- If sKicked = sMyNick Then
- lstMe.ListItems.Clear
- lstUsers.ListItems.Clear
- ds1.Close
- lUserCount.Caption = "0 chatters in room."
- Exit Sub
- End If
- For i = 1 To lstUsers.ListItems.Count
- If lstUsers.ListItems(i).Key = sKicked Then
- lstUsers.ListItems.Remove i
- Exit For
- End If
- Next i
- GuideGroup = Replace$(GuideGroup, " " & sNick & " ", " ")
- HostGroup = Replace$(HostGroup, " " & sNick & " ", " ")
- OwnerGroup = Replace$(OwnerGroup, " " & sNick & " ", " ")
- lUserCount.Caption = lstUsers.ListItems.Count - 1 & " chatters in room."
- End Sub
- Private Sub UserControl_Initialize()
- On Error Resume Next
- ReDim Emo(16)
- ReDim Icon(16)
- Emo(1) = "(H) (h)"
- Icon(1) = frmEmo.sunglass.Text
- Emo(2) = ":P :p :-P :-p"
- Icon(2) = frmEmo.Tongue.Text
- Emo(3) = ":O :o :-o :-O"
- Icon(3) = frmEmo.Oh.Text
- Emo(4) = "(Y) (y)"
- Icon(4) = frmEmo.thumbsup.Text
- Emo(5) = ":) :-)"
- Icon(5) = frmEmo.Smile.Text
- Emo(6) = ":D :-D :d :-d :>"
- Icon(6) = frmEmo.BSmile.Text
- Emo(7) = ":( :-("
- Icon(7) = frmEmo.Sad.Text
- Emo(8) = ":| :-|"
- Icon(8) = frmEmo.shut.Text
- Emo(9) = ":'("
- Icon(9) = frmEmo.cry.Text
- Emo(10) = "(F) (f)"
- Icon(10) = frmEmo.flower.Text
- Emo(11) = ":s :S :-S :-s"
- Icon(11) = frmEmo.SS.Text
- Emo(12) = ";) ;-)"
- Icon(12) = frmEmo.knipoog.Text
- Emo(13) = ":@"
- Icon(13) = frmEmo.angry.Text
- Emo(14) = "(K) (k)"
- Icon(14) = frmEmo.kiss.Text
- Emo(15) = ":$ :-$"
- Icon(15) = frmEmo.blush.Text
- Emo(16) = "(A) (a)"
- Icon(16) = frmEmo.angel.Text
- txtNickName.Text = "Webchat_" & Format(Now, "mmss") 'this is the random name
- ' the resize part isnt done for everything (yet?)
- frButtonFrame.Move 0, (UserControl.ScaleHeight - 660), (UserControl.ScaleWidth - 2895 - 200), 560
- frInputBorder.Move 90, (UserControl.ScaleHeight - 565), (UserControl.ScaleWidth - 5120), 380
- txtSend.Move 130, (UserControl.ScaleHeight - 520), (UserControl.ScaleWidth - 5200), 300
- cmdSend.Move (UserControl.ScaleWidth - 4920), (UserControl.ScaleHeight - 565), 1275, 380
- cmdAction.Move (UserControl.ScaleWidth - 3550), (UserControl.ScaleHeight - 565), 375, 380
- txtmain.Move 120, 80, (UserControl.ScaleWidth - 3225), (UserControl.ScaleHeight - 845)
- frBack.Move (UserControl.ScaleWidth - frBack.Width - 100), 0, frBack.Width, (UserControl.ScaleHeight - 80)
- chListback.Move (UserControl.ScaleWidth - chListback.Width - 120), 1080, chListback.Width, (UserControl.ScaleHeight - 1755)
- lstUsers.Move (UserControl.ScaleWidth - lstUsers.Width - 140), 1150, 2800, (UserControl.ScaleHeight - 1850)
- cmdOptions.Move (UserControl.ScaleWidth - 2905), (UserControl.ScaleHeight - 600), cmdOptions.Width, cmdOptions.Height
- frTopBack.Move (UserControl.ScaleWidth - 3005), 0, frTopBack.Width, frTopBack.Height
- lstMe.Move (UserControl.ScaleWidth - 2905), 800, lstMe.Width, lstMe.Height
- lUserCount.Move (UserControl.ScaleWidth - 2805), 360, lUserCount.Width, lUserCount.Height
- lRoomName.Move (UserControl.ScaleWidth - 2805), 40, lRoomName.Width, lRoomName.Height
- shBack.Move 160, 60, (UserControl.ScaleWidth - 3255), (UserControl.ScaleHeight - 815)
- shCorner.Move 60, 60, 855, (UserControl.ScaleHeight - 815)
- EnableURLDetect txtmain.hWnd, Me.hWnd
- End Sub
- Public Property Get hWnd() As Long
- hWnd = UserControl.hWnd
- End Property
- Private Sub UserMode(sNick As String, sUser As String, sEvent As String, sIcon As String, sGroup As String)
- Webding ' I use this to skip tonns of code each time
- txtmain.SelFontName = "Tahoma"
- txtmain.SelText = sNick & " has made " & sUser & sEvent & vbCrLf
- ResetFontFormat
- If sUser = lstMe.ListItems(lstMe.ListItems.Count).Key Then
- lstMe.ListItems(lstMe.ListItems.Count).SmallIcon = sIcon
- Exit Sub
- End If
- For i = 1 To lstUsers.ListItems.Count
- If lstUsers.ListItems(i).Key = sUser Then
- Set sList = lstUsers.ListItems(i)
- sList.ListSubItems(1).ReportIcon = sIcon
- If sIcon = "gold" Then
- sGroup = sGroup & " " & lstUsers.ListItems(i).Key & " "
- sList.ListSubItems(1).Text = sList.ListSubItems(1).Text & " (Host)"
- lstUsers.ListItems(i).Text = "." & lstUsers.ListItems(i).Text
- ElseIf sIcon = "brown" Then
- sGroup = sGroup & " " & lstUsers.ListItems(i).Key & " "
- sList.ListSubItems(1).Text = sList.ListSubItems(1).Text & " (Host)"
- lstUsers.ListItems(i).Text = "@" & lstUsers.ListItems(i).Text
- ElseIf sIcon = "blank" Then
- sGroup = Replace(sGroup, " " & lstUsers.ListItems(i).Key & " ", "")
- sList.ListSubItems(1).Text = Replace(sList.ListSubItems(1).Text, " (Host)", "")
- lstUsers.ListItems(i).Text = Replace(lstUsers.ListItems(i).Text, "@", "")
- lstUsers.ListItems(i).Text = Replace(lstUsers.ListItems(i).Text, ".", "")
- End If
- lstUsers.ListItems(i).SmallIcon = sIcon
- Exit For
- End If
- Next i
- lstUsers.ListItems.Add , " ", " "
- For i = 1 To lstUsers.ListItems.Count
- If lstUsers.ListItems(i).Key = " " Then
- lstUsers.ListItems.Remove i
- Exit For
- End If
- Next i
- End Sub
- Private Sub SetEmo()
- Dim j As Integer
- Dim CharCombo() As String
- Dim lFoundPosition2 As Long
- On Error Resume Next
- For i = 0 To 30
- CharCombo = Split(Emo(i), " ")
- For j = 0 To UBound(CharCombo)
- lFoundPosition2 = InStr(lFoundPosition, txtmain.Text, CharCombo(j))
- While lFoundPosition2 > 0
- txtmain.SelStart = lFoundPosition2 - 1
- txtmain.SelLength = Len(CharCombo(j))
- txtmain.SelRTF = Icon(i)
- lFoundPosition2 = InStr(lFoundPosition2, txtmain.Text, CharCombo(j))
- Wend
- Next j
- Next i
- lFoundPosition = Len(txtmain.Text) - 1
- End Sub
- Private Sub UserControl_Resize()
- On Error Resume Next
- frButtonFrame.Move 0, (UserControl.ScaleHeight - 660), (UserControl.ScaleWidth - 2895 - 200), 560
- frInputBorder.Move 90, (UserControl.ScaleHeight - 565), (UserControl.ScaleWidth - 5120), 380
- txtSend.Move 130, (UserControl.ScaleHeight - 520), (UserControl.ScaleWidth - 5200), 300
- cmdSend.Move (UserControl.ScaleWidth - 4920), (UserControl.ScaleHeight - 565), 1275, 380
- cmdAction.Move (UserControl.ScaleWidth - 3550), (UserControl.ScaleHeight - 565), 375, 380
- txtmain.Move 120, 80, (UserControl.ScaleWidth - 3225), (UserControl.ScaleHeight - 845)
- frBack.Move (UserControl.ScaleWidth - frBack.Width - 100), 0, frBack.Width, (UserControl.ScaleHeight - 80)
- chListback.Move (UserControl.ScaleWidth - chListback.Width - 120), 1080, chListback.Width, (UserControl.ScaleHeight - 1755)
- lstUsers.Move (UserControl.ScaleWidth - lstUsers.Width - 140), 1150, 2800, (UserControl.ScaleHeight - 1850)
- cmdOptions.Move (UserControl.ScaleWidth - 2905), (UserControl.ScaleHeight - 600), cmdOptions.Width, cmdOptions.Height
- frTopBack.Move (UserControl.ScaleWidth - 3005), 0, frTopBack.Width, frTopBack.Height
- lstMe.Move (UserControl.ScaleWidth - 2905), 800, lstMe.Width, lstMe.Height
- lUserCount.Move (UserControl.ScaleWidth - 2805), 360, lUserCount.Width, lUserCount.Height
- lRoomName.Move (UserControl.ScaleWidth - 2805), 40, lRoomName.Width, lRoomName.Height
- shBack.Move 160, 60, (UserControl.ScaleWidth - 3255), (UserControl.ScaleHeight - 815)
- shCorner.Move 60, 60, 855, (UserControl.ScaleHeight - 815)
- End Sub
- Private Sub UserControl_Show()
- txtRoom.Text = Replace(txtRoom.Text, " ", "\b")
- CMode = 1
- Dim localport As Long
- ds1.Close
- localport = 0
- ds1.RemotePort = 6667
- ds1.localport = localport
- identd.localport = 113
- On Error GoTo closeidentd
- identd.Listen
- closeidentd:
- ds1.Connect txtServer, 6667
- txtmain.SelColor = &H8000&
- txtmain.SelItalic = False
- txtmain.SelText = "Please wait, connecting to server..." & vbCrLf
- ResetFontFormat
- End Sub
- Private Sub UserControl_Terminate()
- On Error Resume Next
- ds1.Close
- Set sList = Nothing
- Set ie = Nothing
- DisableURLDetect
- End Sub
- Private Sub ds1_Connect()
- Dim sPass As String
- SendServ ("NICK " & txtNickName.Text)
- SendServ ("Nickserv Identify " & sPass)
- SendServ ("USER " & txtNickName.Text) & " " & ds1.LocalHostName & " irc.xtcomputing.com :XTeam"
- End Sub
- Private Sub ds1_DataArrival(ByVal bytesTotal As Long)
- Dim asData() As String
- Dim i As Integer
- ds1.GetData sData, vbString
- asData = Split(sData, vbCrLf)
- ReDim Preserve asData(UBound(asData)) As String
- For i = 0 To UBound(asData)
- sData = asData(i)
- If sData <> "" Then
- Parse
- End If
- Next i
- Erase asData
- End Sub
- Private Sub Parse()
- Dim sUsers As String
- Dim sTopic As String
- Dim sWelcome As String
- Dim sTemp As String
- txtmain.SelStart = Len(txtmain.Text)
- On Error Resume Next
- Select Case CMode
- Case 1
- Select Case Split(sData, " ")(1)
- Case "001"
- sMyNick = Split(sData, " ")(2)
- lstMe.ListItems.Add , sMyNick, sMyNick
- SendServ "JOIN #" & txtRoom.Text
- Exit Sub
- Case "NOTICE"
- Broadcast
- Exit Sub
- Case "433"
- MsgBox "Nickname already in use.", vbOKOnly, "Nick in use"
- ds1.Close
- Exit Sub
- Case "913"
- MsgBox "You are banned from this chatroom.", vbOKOnly, "Banned"
- ds1.Close
- Exit Sub
- Case "437"
- MsgBox "Invite only chatroom.", vbOKOnly, "Invite only mode"
- ds1.Close
- Exit Sub
- Case "JOIN"
- txtmain.SelColor = &HFF&
- txtmain.SelItalic = False
- txtmain.SelText = "Connected!" & vbCrLf & vbCrLf
- ResetFontFormat
- sChannel = Split(sData, " ")(2)
- sChannel = Replace$(sChannel, ":", "")
- lRoomName.Caption = LCase$(Replace$(Replace$(sChannel, "#", ""), "\b", " "))
- Case "332"
- sTopic = Split(sData, " :")(1)
- sTopic = Replace(sTopic, "\b", " ")
- txtmain.SelColor = &H808000
- txtmain.SelText = vbCrLf & "The chat's topic is: "
- txtmain.SelColor = &H0&
- txtmain.SelText = sTopic & vbCrLf & vbCrLf
- ResetFontFormat
- Exit Sub
- Case "353"
- sUsers = Split(sData, sChannel & " :")(1)
- ReadNames (sUsers)
- Exit Sub
- Case "366"
- CMode = 2
- End Select
- Case 2
- Select Case Split(sData, " ")(1)
- Case "NOTICE"
- Broadcast
- Exit Sub
- Case "KICK"
- UserKicked GetNick(sData)
- Exit Sub
- Case "JOIN"
- UserJoined GetNick(sData)
- Exit Sub
- Case "QUIT"
- UserParted GetNick(sData)
- Exit Sub
- Case "PART"
- UserParted GetNick(sData)
- Exit Sub
- Case "PRIVMSG"
- If Split(sData, " ")(3) = ":ACTION" Then
- UserAction GetNick(sData)
- Exit Sub
- ElseIf Split(sData, " ")(2) = sMyNick Then
- UserWhisper GetNick(sData)
- Exit Sub
- Else
- UserSpoke GetNick(sData)
- Exit Sub
- End If
- Case "MODE"
- Select Case Split(sData, " ")(3)
- Case "+q"
- UserMode GetNick(sData), (Split(sData, " ")(4)), " an Owner.", "gold", OwnerGroup
- Case "+o"
- UserMode GetNick(sData), (Split(sData, " ")(4)), " a Host.", "brown", HostGroup
- Case "-q"
- UserMode GetNick(sData), (Split(sData, " ")(4)), " a Participant.", "blank", OwnerGroup
- Case "-o"
- UserMode GetNick(sData), (Split(sData, " ")(4)), " a Participant.", "blank", HostGroup
- End Select
- Case "NICK"
- NickChanged GetNick(sData)
- Case "499"
- Webding
- txtmain.SelFontName = "Tahoma"
- txtmain.SelText = "You're not a channel owner." & vbCrLf
- ResetFontFormat
- End Select
- End Select
- Select Case Split(UCase$(sData), " ")(0)
- Case "PING" 'PING :19D30FF
- sTemp = Split(sData, "PING :")(1)
- SendServ "PONG :" & sTemp
- End Select
- WriteLog "RECEIVED: " & sData
- End Sub
- Function GetNick(str As String)
- GetNick = Split(str, "!")(0)
- GetNick = Right$(GetNick, Len(GetNick) - 1)
- End Function
- Public Sub SendServ(strData As String)
- On Error GoTo ERRH_
- ds1.SendData strData & vbCrLf
- WriteLog "SEND: " & strData
- Exit Sub
- ERRH_:
- MsgBox "Description: " & Err.Description & vbNewLine & "Number: " & Err.Number
- End Sub
- Private Sub UserAction(sNick As String)
- Dim sMsg As String
- sMsg = Split(sData, ":ACTION")(1)
- sMsg = Replace(sMsg, "", "")
- sMsg = Replace(sMsg, vbCrLf, "")
- Status sNick
- txtmain.SelStart = Len(txtmain.Text)
- txtmain.SelItalic = True
- txtmain.SelColor = &H800080
- txtmain.SelText = Replace(CheckNick(sNick), "'", "") & " " & sMsg & vbCrLf
- ResetFontFormat
- End Sub
- Private Sub UserSpoke(sNick As String)
- Dim sMsg As String
- sMsg = Split(sData, " PRIVMSG " & sChannel & " :")(1)
- Status sNick
- txtmain.SelStart = Len(txtmain.Text)
- txtmain.SelColor = &H800000
- txtmain.SelText = Replace$(CheckNick(sNick), "'", "") & " : "
- txtmain.SelColor = read_color(sMsg)
- txtmain.SelBold = sBold
- txtmain.SelText = sParsed & vbCrLf
- txtmain.SelFontName = "Tahoma"
- sBold = False
- ResetFontFormat
- End Sub
- Private Sub Status(sNick As String)
- If InStr(1, HostGroup, " " & sNick & " ") <> 0 Then
- txtmain.SelText = " "
- txtmain.SelRTF = frmEmo.brown.Text
- ElseIf InStr(1, GuideGroup, " " & sNick & " ") <> 0 Then
- txtmain.SelText = " "
- txtmain.SelRTF = frmEmo.butterfly.Text
- ElseIf InStr(1, OwnerGroup, " " & sNick & " ") <> 0 Then
- txtmain.SelText = " "
- txtmain.SelRTF = frmEmo.gold.Text
- Else
- txtmain.SelText = " "
- End If
- End Sub
- Private Sub UserJoined(sNick As String)
- Webding
- txtmain.SelFontName = "Tahoma"
- txtmain.SelText = Replace$(CheckNick(sNick), "'", "") & " has joined the conversation." & vbCrLf
- ResetFontFormat
- If Left$(sNick, 1) = "'" Then
- GuideGroup = GuideGroup & " " & sNick & " "
- Set sList = lstUsers.ListItems.Add(, sNick, " " & sNick, , "guide")
- sList.ListSubItems.Add , , Replace(sNick, "'", "") & " (Host)", "guide"
- Else
- Set sList = lstUsers.ListItems.Add(, sNick, CheckNick(sNick))
- sList.ListSubItems.Add , , CheckNick(sNick), "blank"
- End If
- lUserCount.Caption = lstUsers.ListItems.Count + 1 & " chatters in room."
- End Sub
- Private Sub UserParted(sNick As String)
- Webding
- txtmain.SelFontName = "Tahoma"
- txtmain.SelText = Replace(CheckNick(sNick), "'", "") & " has left the conversation." + vbCrLf
- ResetFontFormat
- GuideGroup = Replace(GuideGroup, " " & sNick & " ", "")
- HostGroup = Replace(HostGroup, " " & sNick & " ", "")
- OwnerGroup = Replace(OwnerGroup, " " & sNick & " ", "")
- For i = 1 To lstUsers.ListItems.Count
- If lstUsers.ListItems(i).Key = sNick Then
- lstUsers.ListItems.Remove i
- Exit For
- End If
- Next i
- lUserCount.Caption = lstUsers.ListItems.Count + 1 & " chatters in room."
- End Sub
- Private Sub Broadcast()
- Dim msg As String
- msg = Split(sData, " :")(1)
- msg = Replace(msg, vbCrLf, "")
- txtmain.SelStart = Len(txtmain.Text)
- txtmain.SelColor = &HFF&
- txtmain.SelText = "Broadcast Message from " & txtServer & ":" & vbCrLf
- txtmain.SelColor = &H0&
- txtmain.SelText = msg & vbCrLf
- ResetFontFormat
- End Sub
- Private Sub WriteLog(StrText As String, Optional Color As Long = vbBlack)
- StrText = Replace(StrText, vbCrLf, "")
- On Error Resume Next
- frmTrace.txtTrace.SelStart = Len(frmTrace.txtTrace.Text) 'Jump to end
- frmTrace.txtTrace.SelText = frmTrace.txtTrace.SelText & StrText & vbCrLf 'Write text
- frmTrace.txtTrace.SelStart = Len(frmTrace.txtTrace.Text) 'Jup to end again
- End Sub
- Private Sub ReadNames(Users)
- Dim asUsers() As String
- Dim strName As String
- Dim i As Integer
- asUsers = Split(Users, " ")
- For i = 0 To UBound(asUsers)
- On Error Resume Next
- Select Case (Left$(asUsers(i), 1))
- Case "~"
- strName = Replace$(asUsers(i), "~", "")
- If strName <> sMyNick Then
- OwnerGroup = OwnerGroup & " " & strName & " "
- Set sList = lstUsers.ListItems.Add(, strName, "." & strName, "gold")
- sList.ListSubItems.Add , , strName & " (Host)", "gold"
- End If
- Case "&"
- strName = Replace$(asUsers(i), "&", "")
- If strName <> sMyNick Then
- GuideGroup = GuideGroup & " " & strName & " "
- Set sList = lstUsers.ListItems.Add(, strName, asUsers(i), , "guide")
- sList.ListSubItems.Add , , strName & " (Host)", "guide"
- End If
- Case "%"
- strName = Replace$(asUsers(i), "%", "")
- If strName <> sMyNick Then
- HostGroup = HostGroup & " " & strName & " "
- Set sList = lstUsers.ListItems.Add(, strName, asUsers(i), , "brown")
- sList.ListSubItems.Add , , strName & " (Host)", "brown"
- End If
- Case "@"
- strName = Replace$(asUsers(i), "@", "")
- If strName <> sMyNick Then
- HostGroup = HostGroup & " " & strName & " "
- Set sList = lstUsers.ListItems.Add(, strName, asUsers(i), , "brown")
- sList.ListSubItems.Add , , strName & " (Host)", "brown"
- Else
- HostGroup = HostGroup & " " & strName & " "
- lstMe.ListItems.Remove 1
- Set sList = lstMe.ListItems.Add(, strName, strName, , "brown")
- End If
- Case "+"
- strName = Replace$(asUsers(i), "+", "")
- If strName <> sMyNick Then
- Set sList = lstUsers.ListItems.Add(, strName, asUsers(i), 1)
- sList.ListSubItems.Add , , CheckNick(strName), "blank"
- End If
- Case Else
- If asUsers(i) <> sMyNick And asUsers(i) <> "" Then
- Set sList = lstUsers.ListItems.Add(, asUsers(i), asUsers(i), 1)
- sList.ListSubItems.Add , , CheckNick(asUsers(i)), "blank"
- End If
- End Select
- lUserCount.Caption = lstUsers.ListItems.Count + 1 & " chatters in room."
- Next
- lstMe.ListItems(1).Text = CheckNick(lstMe.ListItems(1).Text)
- lstUsers.Refresh
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment