Rename JID.Local to JID.Node to better match official XEP.
This commit is contained in:
parent
6da9c080d4
commit
2426f2d6d1
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue