diff --git a/client.go b/client.go index 9c05376..4f32383 100644 --- a/client.go +++ b/client.go @@ -17,11 +17,11 @@ func main() { jid, _ := xmpp.ParseJID(*jid) password := *password - c, err := xmpp.NewClient(jid, password, &xmpp.ClientConfig{}) + stream, err := xmpp.ClientStream(jid, password, &xmpp.ClientConfig{}) if err != nil { log.Fatal(err) } - log.Println(c) + log.Println(stream) select {} } diff --git a/component.go b/component.go index ff273a1..4784cc0 100644 --- a/component.go +++ b/component.go @@ -16,11 +16,11 @@ func main() { jid, _ := xmpp.ParseJID(*jid) secret := *secret - c, err := xmpp.NewComponent("localhost:5347", jid, secret) + stream, err := xmpp.ComponentStream("localhost:5347", jid, secret) if err != nil { log.Fatal(err) } - log.Println(c) + log.Println(stream) select {} } diff --git a/src/xmpp/client.go b/src/xmpp/client.go index 0129201..7ca18d5 100644 --- a/src/xmpp/client.go +++ b/src/xmpp/client.go @@ -8,11 +8,6 @@ import ( "log" ) -type client struct { - JID JID - stream *Stream -} - // Config structure used to create a new XMPP client connection. type ClientConfig struct { // Don't upgrade the connection to TLS, even if the server supports it. If @@ -24,7 +19,7 @@ type ClientConfig struct { InsecureSkipVerify bool } -func NewClient(jid JID, password string, config *ClientConfig) (*client, error) { +func ClientStream(jid JID, password string, config *ClientConfig) (*Stream, error) { stream, err := NewStream(jid.Domain + ":5222") if err != nil { @@ -64,7 +59,7 @@ func NewClient(jid JID, password string, config *ClientConfig) (*client, error) break } - return &client{jid, stream}, nil + return stream, nil } func startClient(stream *Stream, jid JID) error { diff --git a/src/xmpp/component.go b/src/xmpp/component.go index fe2fb58..0bc57df 100644 --- a/src/xmpp/component.go +++ b/src/xmpp/component.go @@ -8,12 +8,7 @@ import ( "log" ) -type component struct { - jid JID - stream *Stream -} - -func NewComponent(addr string, jid JID, secret string) (*component, error) { +func ComponentStream(addr string, jid JID, secret string) (*Stream, error) { stream, err := NewStream(addr) if err != nil { @@ -29,7 +24,7 @@ func NewComponent(addr string, jid JID, secret string) (*component, error) { return nil, err } - return &component{jid, stream}, nil + return stream, nil } func startComponent(stream *Stream, jid JID) (string, error) {