From 3be7cf7b0bc8138ce844b7252faf171b48f0a593 Mon Sep 17 00:00:00 2001 From: Matt Goodall Date: Mon, 9 Jul 2012 02:16:25 +0100 Subject: [PATCH] Implement server-gererated resource binding. --- src/xmpp/client.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/xmpp/client.go b/src/xmpp/client.go index 27fe841..9a13c56 100644 --- a/src/xmpp/client.go +++ b/src/xmpp/client.go @@ -152,16 +152,13 @@ type saslAuth struct { } func bindResource(stream *Stream, jid JID) (JID, error) { - if jid.Resource == "" { - return bindResourceServer(stream) - } - return bindResourceClient(stream, jid) -} - -func bindResourceClient(stream *Stream, jid JID) (JID, error) { req := Iq{Id: "foo", Type: "set"} - req.PayloadEncode(bindIq{Resource: jid.Resource}) + if jid.Resource == "" { + req.PayloadEncode(bindIq{}) + } else { + req.PayloadEncode(bindIq{Resource: jid.Resource}) + } if err := stream.Send(req); err != nil { return JID{}, err } @@ -178,10 +175,6 @@ func bindResourceClient(stream *Stream, jid JID) (JID, error) { return boundJID, nil } -func bindResourceServer(stream *Stream) (JID, error) { - panic("bindResourceServer not implemented") -} - type bindIq struct { XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"` Resource string `xml:"resource,omitempty"` @@ -230,6 +223,4 @@ type saslFailure struct { Reason xml.Name `xml:",any"` } -// BUG(matt): Implement server-side resource binding. - // BUG(matt): Don't use "foo" as the id during resource binding.