forked from jshiffer/go-xmpp
Status and status message
This commit is contained in:
parent
c9bbe151b2
commit
aa9390a115
@ -68,7 +68,7 @@ func main() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
xmpp.DefaultConfig = tls.Config {
|
||||
xmpp.DefaultConfig = tls.Config{
|
||||
ServerName: "talk.google.com",
|
||||
InsecureSkipVerify: false,
|
||||
}
|
||||
|
@ -14,7 +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", "", "status")
|
||||
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")
|
||||
@ -35,7 +36,7 @@ func main() {
|
||||
}
|
||||
|
||||
if !*notls {
|
||||
xmpp.DefaultConfig = tls.Config {
|
||||
xmpp.DefaultConfig = tls.Config{
|
||||
ServerName: serverName(*server),
|
||||
InsecureSkipVerify: false,
|
||||
}
|
||||
@ -50,6 +51,7 @@ func main() {
|
||||
Debug: *debug,
|
||||
Session: *session,
|
||||
Status: *status,
|
||||
StatusMessage: *statusMessage,
|
||||
}
|
||||
|
||||
talk, err = options.NewClient()
|
||||
|
8
xmpp.go
8
xmpp.go
@ -136,8 +136,11 @@ type Options struct {
|
||||
// Use server sessions
|
||||
Session bool
|
||||
|
||||
// Status message
|
||||
// Presence Status
|
||||
Status string
|
||||
|
||||
// Status message
|
||||
StatusMessage string
|
||||
}
|
||||
|
||||
// NewClient establishes a new Client connection based on a set of Options.
|
||||
@ -410,7 +413,8 @@ func (c *Client) init(o *Options) error {
|
||||
}
|
||||
|
||||
// We're connected and can now receive and send messages.
|
||||
fmt.Fprintf(c.conn, "<presence xml:lang='en'><show>xa</show><status>%s</status></presence>", o.Status)
|
||||
fmt.Fprintf(c.conn, "<presence xml:lang='en'><show>%s</show><status>%s</status></presence>", o.Status, o.StatusMessage)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user