forked from jshiffer/go-xmpp
[gofumpt] Improve formatting.
This commit is contained in:
parent
d6e9a15f29
commit
0cc0a72c15
@ -2,11 +2,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"github.com/mattn/go-gtk/gtk"
|
|
||||||
"github.com/mattn/go-xmpp"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/mattn/go-gtk/gtk"
|
||||||
|
"github.com/mattn/go-xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -5,20 +5,23 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mattn/go-xmpp"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/mattn/go-xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var server = flag.String("server", "talk.google.com:443", "server")
|
var (
|
||||||
var username = flag.String("username", "", "username")
|
server = flag.String("server", "talk.google.com:443", "server")
|
||||||
var password = flag.String("password", "", "password")
|
username = flag.String("username", "", "username")
|
||||||
var status = flag.String("status", "xa", "status")
|
password = flag.String("password", "", "password")
|
||||||
var statusMessage = flag.String("status-msg", "I for one welcome our new codebot overlords.", "status message")
|
status = flag.String("status", "xa", "status")
|
||||||
var notls = flag.Bool("notls", false, "No TLS")
|
statusMessage = flag.String("status-msg", "I for one welcome our new codebot overlords.", "status message")
|
||||||
var debug = flag.Bool("debug", false, "debug output")
|
notls = flag.Bool("notls", false, "No TLS")
|
||||||
var session = flag.Bool("session", false, "use server session")
|
debug = flag.Bool("debug", false, "debug output")
|
||||||
|
session = flag.Bool("session", false, "use server session")
|
||||||
|
)
|
||||||
|
|
||||||
func serverName(host string) string {
|
func serverName(host string) string {
|
||||||
return strings.Split(host, ":")[0]
|
return strings.Split(host, ":")[0]
|
||||||
@ -48,7 +51,8 @@ func main() {
|
|||||||
|
|
||||||
var talk *xmpp.Client
|
var talk *xmpp.Client
|
||||||
var err error
|
var err error
|
||||||
options := xmpp.Options{Host: *server,
|
options := xmpp.Options{
|
||||||
|
Host: *server,
|
||||||
User: *username,
|
User: *username,
|
||||||
Password: *password,
|
Password: *password,
|
||||||
NoTLS: *notls,
|
NoTLS: *notls,
|
||||||
|
@ -5,9 +5,11 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
const IQTypeGet = "get"
|
const (
|
||||||
const IQTypeSet = "set"
|
IQTypeGet = "get"
|
||||||
const IQTypeResult = "result"
|
IQTypeSet = "set"
|
||||||
|
IQTypeResult = "result"
|
||||||
|
)
|
||||||
|
|
||||||
func (c *Client) Discovery() (string, error) {
|
func (c *Client) Discovery() (string, error) {
|
||||||
// use getCookie for a pseudo random id.
|
// use getCookie for a pseudo random id.
|
||||||
|
@ -85,14 +85,14 @@ func TestStanzaError(t *testing.T) {
|
|||||||
"\n\t\t\n\t\t\n\t",
|
"\n\t\t\n\t\t\n\t",
|
||||||
},
|
},
|
||||||
OtherElem: []XMLElement{
|
OtherElem: []XMLElement{
|
||||||
XMLElement{
|
{
|
||||||
XMLName: xml.Name{Space: "google:mobile:data", Local: "gcm"},
|
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",
|
InnerXML: "\n\t\t{\"random\": \"<text>\"}\n\t",
|
||||||
},
|
},
|
||||||
XMLElement{
|
{
|
||||||
XMLName: xml.Name{Space: "jabber:client", Local: "error"},
|
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: `
|
InnerXML: `
|
||||||
<bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
|
<bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
|
||||||
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
|
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
|
||||||
@ -124,6 +124,7 @@ var emptyPubSub = strings.TrimSpace(`
|
|||||||
</pubsub>
|
</pubsub>
|
||||||
</iq>
|
</iq>
|
||||||
`)
|
`)
|
||||||
|
|
||||||
func TestEmptyPubsub(t *testing.T) {
|
func TestEmptyPubsub(t *testing.T) {
|
||||||
var c Client
|
var c Client
|
||||||
c.conn = tConnect(emptyPubSub)
|
c.conn = tConnect(emptyPubSub)
|
||||||
|
Loading…
Reference in New Issue
Block a user