diff --git a/_example/example-gui.go b/_example/example-gui.go index 70c250b..f8d3dbc 100644 --- a/_example/example-gui.go +++ b/_example/example-gui.go @@ -68,8 +68,8 @@ func main() { os.Exit(0) } - xmpp.DefaultConfig = tls.Config { - ServerName: "talk.google.com", + xmpp.DefaultConfig = tls.Config{ + ServerName: "talk.google.com", InsecureSkipVerify: false, } diff --git a/_example/example.go b/_example/example.go index e4834aa..9c01d45 100644 --- a/_example/example.go +++ b/_example/example.go @@ -14,6 +14,8 @@ import ( var server = flag.String("server", "talk.google.com:443", "server") var username = flag.String("username", "", "username") var password = flag.String("password", "", "password") +var status = flag.String("status", "xa", "status") +var statusMessage = flag.String("status-msg", "I for one welcome our new codebot overlords.", "status message") var notls = flag.Bool("notls", false, "No TLS") var debug = flag.Bool("debug", false, "debug output") var session = flag.Bool("session", false, "use server session") @@ -34,8 +36,8 @@ func main() { } if !*notls { - xmpp.DefaultConfig = tls.Config { - ServerName: serverName(*server), + xmpp.DefaultConfig = tls.Config{ + ServerName: serverName(*server), InsecureSkipVerify: false, } } @@ -43,11 +45,14 @@ func main() { var talk *xmpp.Client var err error options := xmpp.Options{Host: *server, - User: *username, - Password: *password, - NoTLS: *notls, - Debug: *debug, - Session: *session} + User: *username, + Password: *password, + NoTLS: *notls, + Debug: *debug, + Session: *session, + Status: *status, + StatusMessage: *statusMessage, + } talk, err = options.NewClient() diff --git a/xmpp.go b/xmpp.go index 08749e1..2b8a298 100644 --- a/xmpp.go +++ b/xmpp.go @@ -133,8 +133,14 @@ type Options struct { // Debug output Debug bool - //Use server sessions + // Use server sessions Session bool + + // Presence Status + Status string + + // Status message + StatusMessage string } // NewClient establishes a new Client connection based on a set of Options. @@ -407,7 +413,8 @@ func (c *Client) init(o *Options) error { } // We're connected and can now receive and send messages. - fmt.Fprintf(c.conn, "xaI for one welcome our new codebot overlords.") + fmt.Fprintf(c.conn, "%s%s", o.Status, o.StatusMessage) + return nil }