Private Sub Command1_Click()
Winsock1.Close
Winsock1.Connect
End Sub
Private Sub Command2_Click()
Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
Winsock1.SendData "<stream:stream xmlns='jabber:client' to='nimbuzz.com' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' xml:lang='ar' >"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Getdata As String
Winsock1.Getdata Getdata
Getdata = Replace(Getdata, """", "'")
If InStr(Getdata, "stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/></stream:features>") Then
Winsock1.SendData "<iq type='set' xml:lang='en' id='NLgn' to='nimbuzz.com'><query xmlns='jabber:iq:auth'><username>" & txtUser.Text & "</username><password>" & txtPassword.Text & "</password><resource>" & txtResource.Text & "</resource></query></iq>"
End If
''''' Events
If InStr(Getdata, "<iq type='result' from='nimbuzz.com' xml:lang='en' id='NLgn'/>") Then
MsgBox " Login Success "
Winsock1.SendData "<presence><c node='http://exodus.jabberstudio.org/caps' ver='0.9.1.0' xmlns='http://jabber.org/protocol/caps'/><priority>1</priority></presence>"
End If
If InStr(Getdata, "<iq type='error' from='nimbuzz.com' xml:lang='en' id='NLgn'><query xmlns='jabber:iq:auth'><username>" & txtUser.Text & "</username><password>" & txtPassword.Text & "</password><resource>" & txtResource.Text & "</resource></query><error code='401' type='auth'><not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>") Then
MsgBox " Wrong password "
End If
End Sub