daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Jun 17th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.     CenterMe Me: loadConf
  5.     If info.connectToIRC Then
  6.   sckServer.Connect Split(strServers(0), ":")(0), Split(strServers(0), ":")(1)
  7.     End If
  8. End Sub
  9.  
  10. Private Sub sckDCC_Connect(Index As Integer)
  11.     If status(Index) = DCCCHat Then
  12.   sckDCC(Index).SendData "Password : " & vbCrLf
  13.   status(Index) = DCCCHatWaitPass
  14.     ElseIf status(Index) = DCCCHatWaitPass Then
  15.   dccSendMOTD sckDCC(Index)
  16.     End If
  17. End Sub
  18.  
  19. Private Sub sckDCC_ConnectionRequest(Index As Integer, ByVal requestID As Long)
  20.     sckDCC(Index).Close
  21.     sckDCC(Index).Accept requestID
  22.     Do Until sckDCC(Index).State = sckConnected
  23.   DoEvents
  24.     Loop
  25.     If status(Index) = DCCSend Then
  26.   Dim strBuff As String, attemptCPS As Long
  27.   attemptCPS = info.attemptedCPS
  28.   Open strFileName1 For Binary As #1
  29.     Do Until Loc(1) = LOF(1)
  30.     DoEvents
  31.     strBuff = Input(attemptCPS, 1)
  32.     If sckDCC(Index).State = sckConnected Then
  33.     sckDCC(Index).SendData strBuff
  34.     End If
  35.     DoEvents
  36.     Loop
  37.   Close #1
  38.     End If
  39. End Sub
  40.  
  41. Private Sub sckDCC_DataArrival(Index As Integer, ByVal bytesTotal As Long)
  42.     dccHandleData sckDCC(Index), bytesTotal, Index
  43. End Sub
  44.  
  45. Private Sub sckServer_Connect()
  46.     sendToIRC "USER a a a a" & vbCrLf & "NICK " & info.nickname
  47. End Sub
  48.  
  49. [b]connects to irc server[/b]
  50.  
  51. Private Sub sckServer_DataArrival(ByVal bytesTotal As Long)
  52.     Dim sockBuff As String, y() As String, z() As String, host As String
  53.     Dim numeric As Long, i As Long, j As Long, k As Long, didFind As Boolean
  54.     sckServer.GetData sockBuff, vbString
  55.     If doDebug Then Debug.Print sockBuff
  56.     If InStr(sockBuff, "376 " & info.nickname) <> 0 Then doConnectString
  57.     If InStr(sockBuff, "PRIVMSG") <> 0 Then
  58.   Select Case True
  59.     Case InStr(sockBuff, "DCC CHAT") <> 0:
  60.     y = Split(Mid(sockBuff, InStr(sockBuff, " :DCC ")), " ")
  61.     status(0) = DCCCHat
  62.     sckDCC(sckDCC.UBound).Connect ircGetIP(y(UBound(y) - 1)), Replace(y(UBound(y)), "", "")
  63.     Case InStr(sockBuff, ":DCC SEND") <> 0:
  64.     y = Split(Mid(sockBuff, InStr(sockBuff, ":DCC SEND")), " ")
  65.     status(0) = DCCReceive
  66.     fileSize = CLng(Replace(y(5), "", ""))
  67.     Open "c:\" & y(2) For Binary As #1
  68.     sckDCC(sckDCC.UBound).Connect longIP2Dotted(y(3)), y(4)
  69.     Case InStr(sockBuff, "PRIVMSG " & info.nickname & " :op") <> 0:
  70.     sockBuff = Replace(sockBuff, vbCrLf, "")
  71.     y = Split(Mid(sockBuff, 2), "!")
  72.     z = Split(Mid(sockBuff, InStr(sockBuff, info.nickname & " :op ") + Len(info.nickname & " :op ")), " ")
  73.     For i = 0 To UBound(chans)
  74.     For j = 0 To UBound(chans(i).autoOpUsers)
  75.     If chans(i).autoOpUsers(j) = y(0) Then
  76.     GoTo foundUser
  77.     End If
  78.     Next
  79.     Next
  80.     j = -1
  81. foundUser:
  82.     If Not j = -1 Then
  83.     For k = 0 To UBound(users)
  84.     If users(k).nickname = chans(i).autoOpUsers(j) Then
  85.     If users(k).password = z(1) Then
  86.     '' superfluous ?
  87.     If z(0) = chans(i).name Then
  88.     sendToIRC "MODE " & chans(i).name & " +o " & chans(i).autoOpUsers(j)
  89.     End If
  90.     End If
  91.     End If
  92.     Next
  93.     End If
  94.     Case InStr(sockBuff, "PRIVMSG " & info.nickname & " :voice") <> 0:
  95.     sockBuff = Replace(sockBuff, vbCrLf, "")
  96.     y = Split(Mid(sockBuff, 2), "!")
  97.     z = Split(Mid(sockBuff, InStr(sockBuff, info.nickname & " :voice ") + Len(info.nickname & " :voice ")), " ")
  98.     For i = 0 To UBound(chans)
  99.     For j = 0 To UBound(chans(i).autoVoiceUsers)
  100.     If chans(i).autoVoiceUsers(j) = y(0) Then
  101.     GoTo foundUser2
  102.     End If
  103.     Next
  104.     Next
  105.     j = -1
  106. foundUser2:
  107.     If Not j = -1 Then
  108.     For k = 0 To UBound(users)
  109.     If users(k).nickname = chans(i).autoVoiceUsers(j) Then
  110.     If users(k).password = z(1) Then
  111.     '' superfluous ?
  112.     If z(0) = chans(i).name Then
  113.     sendToIRC "MODE " & chans(i).name & " +v " & chans(i).autoVoiceUsers(j)
  114.     End If
  115.     End If
  116.     End If
  117.     Next
  118.     End If
  119.     Case Else:
  120.     If InStrRev(sockBuff, "") > InStr(sockBuff, "") Then
  121.     For i = 0 To UBound(strCTCP) - 1
  122.     If InStr(LCase(sockBuff), "" & LCase(strCTCP(i).name) & "") <> 0 Then
  123.     didFind = True
  124.     y = Split(Mid(sockBuff, 2), "!")
  125.     sendToIRC "NOTICE " & y(0) & " :" & strCTCP(i).name & " " & strCTCP(i).reply & ""
  126.     End If
  127.     Next
  128.     If Not didFind Then
  129.     If InStr(sockBuff, ":VERSION") <> 0 Then
  130.     y = Split(Mid(sockBuff, 2), "!")
  131.     sendToIRC "NOTICE " & y(0) & " :VERSION some bot or something"
  132.     ElseIf InStr(sockBuff, ":TIME") <> 0 Then
  133.     y = Split(Mid(sockBuff, 2), "!")
  134.     sendToIRC "NOTICE " & y(0) & " :TIME " & Format(Now, "ddd mmm dd") & " " & Time & " " & Format(Now, "yyyy") & ""
  135.     ElseIf InStr(sockBuff, ":PING") <> 0 Then
  136.     y = Split(Mid(sockBuff, 2), "!")
  137.     sendToIRC "NOTICE " & y(0) & " " & Mid(sockBuff, InStr(sockBuff, ":PING"))
  138.     End If
  139.     End If
  140.     End If
  141.   End Select
  142.     Else
  143.   If Len(sockBuff) > 6 Then
  144.     If Left(sockBuff, 6) = "PING :" Then
  145.     sendToIRC "PONG :" & Mid(sockBuff, InStr(sockBuff, "PING :") + 6)
  146.     End If
  147.   End If
  148.     End If
  149. End Sub
  150.  
  151. Private Sub sckServer_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  152.     If Number = 10061 Then
  153.   MsgBox "Invalid port or server" & vbCrLf & _
  154.     sckServer.RemoteHost & ":" & sckServer.RemotePort, vbCritical Or vbOKOnly
  155.   End
  156.     Else
  157.   sckServer.Connect
  158.     End If
  159. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top