Rename JID.Local to JID.Node to better match official XEP.

This commit is contained in:
Matt Goodall 2012-07-06 11:04:59 +01:00
parent 6da9c080d4
commit 2426f2d6d1
2 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ func NewClient(jid JID, password string, config *ClientConfig) (*client, error)
// Authentication // Authentication
if f.Mechanisms != nil { if f.Mechanisms != nil {
log.Println("Authenticating") log.Println("Authenticating")
if err := authenticate(stream, f.Mechanisms.Mechanisms, jid.Local, password); err != nil { if err := authenticate(stream, f.Mechanisms.Mechanisms, jid.Node, password); err != nil {
return nil, err return nil, err
} }
continue // Restart continue // Restart

View File

@ -10,8 +10,8 @@ Jabber Identifier - uniquely identifies an individual entity in a XMPP/Jabber
network. network.
*/ */
type JID struct { type JID struct {
// Local component e.g. the alice of alice@example.com/foo. // Node/local component e.g. the alice of alice@example.com/foo.
Local string Node string
// Domain component, e.g. the example.com of alice@example.com/foo for a // Domain component, e.g. the example.com of alice@example.com/foo for a
// client or the whole JID of a component. // client or the whole JID of a component.
@ -23,10 +23,10 @@ type JID struct {
// Return the "bare" JID, i.e. no resource component. // Return the "bare" JID, i.e. no resource component.
func (jid JID) Bare() string { func (jid JID) Bare() string {
if jid.Local == "" { if jid.Node == "" {
return jid.Domain return jid.Domain
} }
return fmt.Sprintf("%s@%s", jid.Local, jid.Domain) return fmt.Sprintf("%s@%s", jid.Node, jid.Domain)
} }
// Return the full JID as a string. // Return the full JID as a string.
@ -34,7 +34,7 @@ func (jid JID) Full() string {
if jid.Resource == "" { if jid.Resource == "" {
return jid.Bare() return jid.Bare()
} }
return fmt.Sprintf("%s@%s/%s", jid.Local, jid.Domain, jid.Resource) return fmt.Sprintf("%s@%s/%s", jid.Node, jid.Domain, jid.Resource)
} }
// Return full JID as a string. // Return full JID as a string.
@ -55,7 +55,7 @@ func ParseJID(s string) (jid JID, err error) {
if parts := strings.SplitN(s, "@", 2); len(parts) != 2 { if parts := strings.SplitN(s, "@", 2); len(parts) != 2 {
jid.Domain = parts[0] jid.Domain = parts[0]
} else { } else {
jid.Local = parts[0] jid.Node = parts[0]
jid.Domain = parts[1] jid.Domain = parts[1]
} }