diff --git a/_example/example-gui.go b/_example/example-gui.go
index f8d3dbc..632f19d 100644
--- a/_example/example-gui.go
+++ b/_example/example-gui.go
@@ -2,11 +2,12 @@ package main
import (
"crypto/tls"
- "github.com/mattn/go-gtk/gtk"
- "github.com/mattn/go-xmpp"
"log"
"os"
"strings"
+
+ "github.com/mattn/go-gtk/gtk"
+ "github.com/mattn/go-xmpp"
)
func main() {
diff --git a/_example/example.go b/_example/example.go
index 136af5a..11f5807 100644
--- a/_example/example.go
+++ b/_example/example.go
@@ -5,20 +5,23 @@ import (
"crypto/tls"
"flag"
"fmt"
- "github.com/mattn/go-xmpp"
"log"
"os"
"strings"
+
+ "github.com/mattn/go-xmpp"
)
-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")
+var (
+ server = flag.String("server", "talk.google.com:443", "server")
+ username = flag.String("username", "", "username")
+ password = flag.String("password", "", "password")
+ status = flag.String("status", "xa", "status")
+ statusMessage = flag.String("status-msg", "I for one welcome our new codebot overlords.", "status message")
+ notls = flag.Bool("notls", false, "No TLS")
+ debug = flag.Bool("debug", false, "debug output")
+ session = flag.Bool("session", false, "use server session")
+)
func serverName(host string) string {
return strings.Split(host, ":")[0]
@@ -48,7 +51,8 @@ func main() {
var talk *xmpp.Client
var err error
- options := xmpp.Options{Host: *server,
+ options := xmpp.Options{
+ Host: *server,
User: *username,
Password: *password,
NoTLS: *notls,
diff --git a/xmpp_information_query.go b/xmpp_information_query.go
index 3abac58..8e30a13 100644
--- a/xmpp_information_query.go
+++ b/xmpp_information_query.go
@@ -5,9 +5,11 @@ import (
"strconv"
)
-const IQTypeGet = "get"
-const IQTypeSet = "set"
-const IQTypeResult = "result"
+const (
+ IQTypeGet = "get"
+ IQTypeSet = "set"
+ IQTypeResult = "result"
+)
func (c *Client) Discovery() (string, error) {
// use getCookie for a pseudo random id.
diff --git a/xmpp_test.go b/xmpp_test.go
index ca7ec09..0463d33 100644
--- a/xmpp_test.go
+++ b/xmpp_test.go
@@ -85,14 +85,14 @@ func TestStanzaError(t *testing.T) {
"\n\t\t\n\t\t\n\t",
},
OtherElem: []XMLElement{
- XMLElement{
+ {
XMLName: xml.Name{Space: "google:mobile:data", Local: "gcm"},
- Attr: []xml.Attr{xml.Attr{Name:xml.Name{Space:"", Local:"xmlns"}, Value:"google:mobile:data"}},
+ Attr: []xml.Attr{{Name: xml.Name{Space: "", Local: "xmlns"}, Value: "google:mobile:data"}},
InnerXML: "\n\t\t{\"random\": \"<text>\"}\n\t",
},
- XMLElement{
+ {
XMLName: xml.Name{Space: "jabber:client", Local: "error"},
- Attr: []xml.Attr{xml.Attr{Name:xml.Name{Space:"", Local:"code"}, Value:"400"},xml.Attr{Name:xml.Name{Space:"", Local:"type"}, Value:"modify"}},
+ Attr: []xml.Attr{{Name: xml.Name{Space: "", Local: "code"}, Value: "400"}, {Name: xml.Name{Space: "", Local: "type"}, Value: "modify"}},
InnerXML: `
@@ -124,12 +124,13 @@ var emptyPubSub = strings.TrimSpace(`
`)
+
func TestEmptyPubsub(t *testing.T) {
var c Client
c.conn = tConnect(emptyPubSub)
c.p = xml.NewDecoder(c.conn)
m, err := c.Recv()
-
+
switch m.(type) {
case AvatarData:
if err == nil {