jabber/google talk authenticating/connecting
Posted: Thu Apr 01, 2010 6:04 pm
Hey all,
Been playing with connecting to google talk, and I've got the first few messages to come across properly. But, for some reason I can't get past the part where it says proceed after I send starttls. Been going off of the documentation found at http://xmpp.org/rfcs/rfc3920.html#tls. Is anyone familiar with jabber/xmpp that might be able to give me a clue as to what I need to do after I get the proceed message?
Perhaps I'm going about something incorrectly, I'd appreciate any help you guys can offer. Here's my test code.
Been playing with connecting to google talk, and I've got the first few messages to come across properly. But, for some reason I can't get past the part where it says proceed after I send starttls. Been going off of the documentation found at http://xmpp.org/rfcs/rfc3920.html#tls. Is anyone familiar with jabber/xmpp that might be able to give me a clue as to what I need to do after I get the proceed message?
Perhaps I'm going about something incorrectly, I'd appreciate any help you guys can offer. Here's my test code.
Code: Select all
Procedure.s NetRequest(cid, req$)
response$ = ""
SendNetworkString(cid, req$)
Repeat
cEvent = NetworkClientEvent(cid)
Select cEvent
Case #PB_NetworkEvent_Data
*Buffer = AllocateMemory(3000)
ReceiveNetworkData(cid, *Buffer, 3000)
response$ = PeekS(*Buffer)
FreeMemory(*Buffer)
Debug response$
EndSelect
Delay(200)
;Until cEvent = #PB_NetworkEvent_Data
Until response$ <> ""
ProcedureReturn response$
EndProcedure
InitNetwork()
OpenWindow(1, 0, 0, 200, 200, "test")
connid = OpenNetworkConnection("talk.google.com", 5222)
If connid
;send inital string
request$ = "<stream:stream" + Chr(10)
request$ + " xmlns='jabber:server'" + Chr(10)
request$ + " xmlns:stream='http://etherx.jabber.org/streams'" + Chr(10)
request$ + " to='gmail.com'" + Chr(10)
request$ + " version='1.0'>"
If NetRequest(connid, request$)
Debug "...got initial response. sending starttls msg.."
request$ = "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"
If NetRequest(connid, request$)
Debug "...got proceed msg. sending initial again.."
;send inital string (again)?
request$ = "<stream:stream" + Chr(10)
request$ + " xmlns='jabber:server'" + Chr(10)
request$ + " xmlns:stream='http://etherx.jabber.org/streams'" + Chr(10)
request$ + " to='gmail.com'" + Chr(10)
request$ + " version='1.0'>" + Chr(10)
If NetRequest(connid, request$)
Debug "... omg got something back"
EndIf
EndIf
EndIf
Else
Debug "no connection id.. ending."
End
EndIf
Repeat
cEvent = NetworkClientEvent(connid)
event = WaitWindowEvent()
Select cEvent
Case #PB_NetworkEvent_Data
*Buffer = AllocateMemory(3000)
ReceiveNetworkData(connid, *Buffer, 3000)
response$ = PeekS(*Buffer)
FreeMemory(*Buffer)
Debug response$
EndSelect
Delay(1)
Until event = #PB_Event_CloseWindow