From 2426f2d6d1e87ad31f3210776b407a66daff7a32 Mon Sep 17 00:00:00 2001 From: Matt Goodall Date: Fri, 6 Jul 2012 11:04:59 +0100 Subject: [PATCH] Rename JID.Local to JID.Node to better match official XEP. --- src/xmpp/client.go | 2 +- src/xmpp/jid.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/xmpp/client.go b/src/xmpp/client.go index 0d63a04..2c1a0e2 100644 --- a/src/xmpp/client.go +++ b/src/xmpp/client.go @@ -49,7 +49,7 @@ func NewClient(jid JID, password string, config *ClientConfig) (*client, error) // Authentication if f.Mechanisms != nil { 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 } continue // Restart diff --git a/src/xmpp/jid.go b/src/xmpp/jid.go index c9ccbff..ef16cbf 100644 --- a/src/xmpp/jid.go +++ b/src/xmpp/jid.go @@ -10,8 +10,8 @@ Jabber Identifier - uniquely identifies an individual entity in a XMPP/Jabber network. */ type JID struct { - // Local component e.g. the alice of alice@example.com/foo. - Local string + // Node/local component e.g. the alice of alice@example.com/foo. + Node string // Domain component, e.g. the example.com of alice@example.com/foo for a // client or the whole JID of a component. @@ -23,10 +23,10 @@ type JID struct { // Return the "bare" JID, i.e. no resource component. func (jid JID) Bare() string { - if jid.Local == "" { + if jid.Node == "" { 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. @@ -34,7 +34,7 @@ func (jid JID) Full() string { if jid.Resource == "" { 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. @@ -55,7 +55,7 @@ func ParseJID(s string) (jid JID, err error) { if parts := strings.SplitN(s, "@", 2); len(parts) != 2 { jid.Domain = parts[0] } else { - jid.Local = parts[0] + jid.Node = parts[0] jid.Domain = parts[1] }