forked from jshiffer/go-xmpp
Merge pull request #182 from mdosch/gofumpt
[gofumpt] Improve formatting.
This commit is contained in:
commit
88855eac82
@ -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() {
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
11
xmpp_test.go
11
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: `
|
||||
<bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
|
||||
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
|
||||
@ -124,12 +124,13 @@ var emptyPubSub = strings.TrimSpace(`
|
||||
</pubsub>
|
||||
</iq>
|
||||
`)
|
||||
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user