Skip to content

Commit

Permalink
[gofumpt] Improve formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdosch committed Feb 1, 2024
1 parent d6e9a15 commit 0cc0a72
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
5 changes: 3 additions & 2 deletions _example/example-gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
24 changes: 14 additions & 10 deletions _example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions xmpp_information_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 6 additions & 5 deletions xmpp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0cc0a72

Please sign in to comment.