~samwhited/xmpp

8fb8d7def0c62a960ae1a0d95fa49646f303aedd — Sam Whited 5 years ago 4c30512
Make Bare() part of the JID interface
3 files changed, 4 insertions(+), 3 deletions(-)

M jid/jid.go
M jid/safejid.go
M jid/unsafejid.go
M jid/jid.go => jid/jid.go +1 -0
@@ 17,6 17,7 @@ type JID interface {
	Localpart() string
	Domainpart() string
	Resourcepart() string
	Bare() JID

	String() string
	Equal(other JID) bool

M jid/safejid.go => jid/safejid.go +2 -2
@@ 96,7 96,7 @@ func SafeFromParts(localpart, domainpart, resourcepart string) (*SafeJID, error)

// Bare returns a copy of the Jid without a resourcepart. This is sometimes
// called a "bare" JID.
func (j *SafeJID) Bare() *SafeJID {
func (j *SafeJID) Bare() JID {
	return &SafeJID{
		localpart:    j.localpart,
		domainpart:   j.domainpart,


@@ 119,7 119,7 @@ func (j *SafeJID) Resourcepart() string {
	return j.resourcepart
}

// Makes a copy of the given Jid. j.Equals(j.Copy()) will always return true.
// Makes a copy of the given Jid. j.Equal(j.Copy()) will always return true.
func (j *SafeJID) Copy() *SafeJID {
	return &SafeJID{
		localpart:    j.localpart,

M jid/unsafejid.go => jid/unsafejid.go +1 -1
@@ 45,7 45,7 @@ func UnsafeFromParts(localpart, domainpart, resourcepart string) (*UnsafeJID, er

// Bare returns a copy of the Jid without a resourcepart. This is sometimes
// called a "bare" JID.
func (j *UnsafeJID) Bare() *UnsafeJID {
func (j *UnsafeJID) Bare() JID {
	return &UnsafeJID{
		localpart:    j.localpart,
		domainpart:   j.domainpart,