jabber/google talk authenticating/connecting

Just starting out? Need help? Post your questions and find answers here.
epidemicz
User
User
Posts: 86
Joined: Thu Jan 22, 2009 8:05 am
Location: USA
Contact:

jabber/google talk authenticating/connecting

Post by epidemicz »

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.

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
Image
ehowington
Enthusiast
Enthusiast
Posts: 115
Joined: Sat Sep 12, 2009 3:06 pm

Re: jabber/google talk authenticating/connecting

Post by ehowington »

epidemicz
User
User
Posts: 86
Joined: Thu Jan 22, 2009 8:05 am
Location: USA
Contact:

Re: jabber/google talk authenticating/connecting

Post by epidemicz »

ehowington wrote:this may shed some light ?
http://www.cs.illinois.edu/class/sp11/c ... ts/mp1.pdf
Wow, very nice find. Much appreciated, ehowington!
Image
ehowington
Enthusiast
Enthusiast
Posts: 115
Joined: Sat Sep 12, 2009 3:06 pm

Re: jabber/google talk authenticating/connecting

Post by ehowington »

Your very welcome hope it helps would like to see the end result on what your working on send a pm if you like ;)
Post Reply