[gofumpt] Improve formatting.

This commit is contained in:
Martin Dosch 2024-02-01 13:54:58 +08:00
parent d6e9a15f29
commit 0cc0a72c15
4 changed files with 28 additions and 20 deletions

View File

@ -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() {

View File

@ -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,

View File

@ -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.

View File

@ -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,6 +124,7 @@ var emptyPubSub = strings.TrimSpace(`
</pubsub>
</iq>
`)
func TestEmptyPubsub(t *testing.T) {
var c Client
c.conn = tConnect(emptyPubSub)