Compare commits

..

No commits in common. "6465ebd169f4d996519c45d541b04146975f9ea9" and "5cfc61169b8d932f6306ccc0e10fe0e563ad40b7" have entirely different histories.

6 changed files with 25 additions and 16 deletions

View File

@ -3,7 +3,6 @@ package xmpp
import (
"fmt"
"net"
"strings"
)
const (
@ -28,8 +27,18 @@ func HomeServerAddrs(jid JID) (addr []string, err error) {
// Build list of "host:port" strings.
for _, a := range addrs {
target := strings.TrimRight(a.Target, ".")
target := parseTargetDomainName(a.Target)
addr = append(addr, fmt.Sprintf("%s:%d", target, a.Port))
}
return
}
// Remove the last dot in the domain name if exist
func parseTargetDomainName(domainName string) (ret string) {
if domainName[len(domainName)-1] == '.' {
ret = parseTargetDomainName(domainName[:len(domainName)-1])
} else {
ret = domainName
}
return
}

View File

@ -5,9 +5,9 @@ import (
)
const (
NSPing = "urn:xmpp:ping"
NSPing = "urn:xmpp:ping"
)
type Ping struct {
XMLName xml.Name `xml:"urn:xmpp:ping ping"`
XMLName xml.Name `xml:"urn:xmpp:ping ping"`
}

View File

@ -7,9 +7,9 @@ import (
const (
NSRemoteRosterManager = "urn:xmpp:tmp:roster-management:0"
RemoteRosterManagerTypeRequest = "request"
RemoteRosterManagerTypeAllowed = "allowed"
RemoteRosterManagerTypeRejected = "rejected"
RemoteRosterManagerTypeRequest = "request"
RemoteRosterManagerTypeAllowed = "allowed"
RemoteRosterManagerTypeRejected = "rejected"
)
// XEP-0321: Remote Roster Manager

View File

@ -5,7 +5,7 @@ import (
)
const (
NSRoster = "jabber:iq:roster"
NSRoster = "jabber:iq:roster"
RosterSubscriptionBoth = "both"
RosterSubscriptionFrom = "from"
@ -14,13 +14,13 @@ const (
)
type RosterQuery struct {
XMLName xml.Name `xml:"jabber:iq:roster query"`
Items []RosterItem `xml:"item"`
XMLName xml.Name `xml:"jabber:iq:roster query"`
Items []RosterItem `xml:"item"`
}
type RosterItem struct {
JID string `xml:"jid,attr"`
Name string `xml:"name,attr,omitempty"`
Subscription string `xml:"subscription,attr"`
Groupes []string `xml:"group"`
JID string `xml:"jid,attr"`
Name string `xml:"name,attr,omitempty"`
Subscription string `xml:"subscription,attr"`
Groupes []string `xml:"group"`
}

View File

@ -78,7 +78,7 @@ type Message struct {
Error *Error `xml:"error"`
Lang string `xml:"xml:lang,attr,omitempty"`
Confirm *Confirm `xml:"confirm"` // XEP-0070
Confir *Confirm `xml:"confirm"` // XEP-0070
Active *Active `xml:"active"` // XEP-0085
Composing *Composing `xml:"composing"` // XEP-0085

View File

@ -18,7 +18,7 @@ type StreamConfig struct {
// causes incoming stanzas to be XML-parsed a second time.
LogStanzas bool
// The dommain connection for certificate validation.
// The dommain connection for certificat validation.
ConnectionDomain string
}