fix syntax errors (#145)

* Fix syntax errors.

* gofmt
This commit is contained in:
Martin 2023-03-02 16:20:58 +01:00 committed by GitHub
parent d72a0f3154
commit 9129a110df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

48
xmpp.go
View File

@ -568,9 +568,9 @@ func (c *Client) startStream(o *Options, domain string) (*streamFeatures, error)
StanzaWriter = c.conn StanzaWriter = c.conn
} }
_, err := fmt.Fprintf(StanzaWriter, "<?xml version='1.0'?>\n"> _, err := fmt.Fprintf(StanzaWriter, "<?xml version='1.0'?>"+
"<stream:stream to='%s' xmlns='%s'"+ "<stream:stream to='%s' xmlns='%s'"+
" xmlns:stream='%s' version='1.0'>\n", " xmlns:stream='%s' version='1.0'>",
xmlEscape(domain), nsClient, nsStream) xmlEscape(domain), nsClient, nsStream)
if err != nil { if err != nil {
return nil, err return nil, err
@ -809,29 +809,29 @@ func (c *Client) Recv() (stanza interface{}, err error) {
return PubsubItems{}, err return PubsubItems{}, err
} }
switch p.Node { switch p.Node {
case XMPPNS_AVATAR_PEP_DATA: case XMPPNS_AVATAR_PEP_DATA:
if len(p.Items) == 0 { if len(p.Items) == 0 {
return AvatarData{}, errors.New("No avatar data items available") return AvatarData{}, errors.New("No avatar data items available")
} }
return handleAvatarData(p.Items[0].Body, return handleAvatarData(p.Items[0].Body,
v.From, v.From,
p.Items[0].ID) p.Items[0].ID)
case XMPPNS_AVATAR_PEP_METADATA: case XMPPNS_AVATAR_PEP_METADATA:
if len(p.Items) == 0 { if len(p.Items) == 0 {
return AvatarMetadata{}, errors.New("No avatar metadata items available") return AvatarMetadata{}, errors.New("No avatar metadata items available")
} }
return handleAvatarMetadata(p.Items[0].Body, return handleAvatarMetadata(p.Items[0].Body,
v.From) v.From)
default: default:
return PubsubItems{ return PubsubItems{
p.Node, p.Node,
pubsubItemsToReturn(p.Items), pubsubItemsToReturn(p.Items),
}, nil }, nil
}
} }
// Note: XEP-0084 states that metadata and data // Note: XEP-0084 states that metadata and data
// should be fetched with an id of retrieve1. // should be fetched with an id of retrieve1.
// Since we already have PubSub implemented, we // Since we already have PubSub implemented, we
@ -997,7 +997,7 @@ type saslAbort struct {
type saslSuccess struct { type saslSuccess struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl success"` XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl success"`
Text string `xml:",chardata"` Text string `xml:",chardata"`
} }
type saslFailure struct { type saslFailure struct {
@ -1046,7 +1046,7 @@ func (m *clientMessage) OtherStrings() []string {
type XMLElement struct { type XMLElement struct {
XMLName xml.Name XMLName xml.Name
Attr []xml.Attr `xml:",any,attr"` // Save the attributes of the xml element Attr []xml.Attr `xml:",any,attr"` // Save the attributes of the xml element
InnerXML string `xml:",innerxml"` InnerXML string `xml:",innerxml"`
} }
func (e *XMLElement) String() string { func (e *XMLElement) String() string {