example now allows passing of server to connect to as argument\nrm line ending space

This commit is contained in:
Kissaki 2011-05-10 16:57:36 +02:00
parent fca5966193
commit 7ff519ae8c
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import (
"strings" "strings"
) )
var server = flag.String("server", "talk.google.com:443", "server")
var username = flag.String("username", "", "username") var username = flag.String("username", "", "username")
var password = flag.String("password", "", "password") var password = flag.String("password", "", "password")
@ -24,7 +25,7 @@ func main() {
flag.Usage() flag.Usage()
} }
talk, err := xmpp.NewClient("talk.google.com:443", *username, *password) talk, err := xmpp.NewClient(*server, *username, *password)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -46,7 +46,7 @@ type Client struct {
// NewClient creates a new connection to a host given as "hostname" or "hostname:port". // NewClient creates a new connection to a host given as "hostname" or "hostname:port".
// If host is not specified, the DNS SRV should be used to find the host from the domainpart of the JID. // If host is not specified, the DNS SRV should be used to find the host from the domainpart of the JID.
// Default the port to 5222. // Default the port to 5222.
func NewClient(host, user, passwd string) (*Client, os.Error) { func NewClient(host, user, passwd string) (*Client, os.Error) {
addr := host addr := host