All pastes #911860 Raw Edit

Mine

public text v1 · immutable
·published 2008-02-20 23:30 UTC
rendered paste body
Option Explicit

Private Sub cmdClose_Click()
    Me.Hide
    frmChannel.Show
End Sub

Private Sub cmdConnect_Click()
'    Me.Hide                         ' We don't need this to connect now
    
    strPNick = txtPNick.Text           ' Our 1st nickname
    intPNickLen = Len(txtPNick.Text)   ' Our 1st nickname length
    strANick = txtANick.Text           ' Our 2nd nickname
    intANickLen = Len(txtANick.Text)   ' Our 2nd nickname length
    strServer = cboServer.Text         ' The server to connect to
    intPort = cboPort.Text             ' The port number to use for the server
    
    ' == Socket Connection ==
    
        Dim lngI As Long
    
    For lngI = 1 To 10
        Load sckIdent(lngI)
    Next lngI
    
    sckIdent(0).Close
    sckIdent(0).LocalPort = 113           ' Ident
    sckIdent(0).Listen
    MsgBox "IdentD Socket State: " & sckIdent(0).State


    sckIRC(0).Close                    ' Close current connections
    sckIRC(0).Connect strServer, intPort
    
End Sub

Private Sub Form_Load()
    cboServer.AddItem "irc.efnet.pl"
    cboServer.AddItem "irc.efnet.org"
    cboServer.AddItem "irc.prison.net"
    cboServer.AddItem "irc.mzima.net"
    
    cboServer.ListIndex = 3
    cboPort.AddItem "6667"
    cboPort.AddItem "7000"
    cboPort.ListIndex = 0
End Sub

Private Sub sckIdent_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    Dim Socket As Variant
    
    On Error GoTo sckident_connectionreq_error
    
    For Each Socket In sckIdent
        If (Socket.State = sckClosed Or Socket.State = sckError) Then
            Socket.Close
            Socket.Accept requestID
            Socket.SendData requestID & " , " & Socket.RemotePort & " : USERID : " & "WIN32 : test" & vbCrLf
            txtStatus.Text = txtStatus.Text & "IdentD request from " & sckIdent(0).RemoteHostIP & vbCrLf
            txtStatus.Text = txtStatus.Text & "IdentD reply: " & requestID & " , " & Socket.RemotePort & " : USERID : WIN32 : test" & crlf

            DoEvents
            Socket.Close
    Exit For
        End If
        Next ' Socket
        
        On Error GoTo 0
        Exit Sub
        
sckident_connectionreq_error:
    txtStatus.Text = txtStatus.Text & Err.Number & " (" & Err.Description & ") "
End Sub

Private Sub sckIRC_Close(Index As Integer)
    ' We want to send a "QUIT" to the irc server to notify we disconnected.
    
'    sckIRC(0).SendData ":QUIT Closed IRC Socket"
End Sub

Private Sub sckIRC_Connect(Index As Integer)
    sckIRC(0).SendData "USER " & "guest 0 * :Wiz" & vbCrLf
    sckIRC(0).SendData "NICK " & strPNick
End Sub

Private Sub sckIRC_ConnectionRequest(Index As Integer, ByVal requestID As Long)
   sckIRC(0).Accept requestID
End Sub

Private Sub sckIRC_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    Dim strData As String
    sckIRC(0).GetData strData
    txtStatus.Text = txtStatus.Text & strData & vbCrLf
End Sub

Private Sub tmrConnState_Timer()
    If sckIRC(0).State = 7 Then
        lblState.Caption = "IRC Client Connecting"
    Else
        lblState.Caption = "Unknown State"
    End If
End Sub

Private Sub tmrState_Timer()
    If sckIdent(0).State = 2 Then
        lblState.Caption = "IdentD Server Listening"
    Else
        lblState.Caption = "Unknown State"
    End If
End Sub