sum7
/
yaja
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
yaja/xmpp/base/jid_is.go

25 lines
757 B
Go
Raw Normal View History

2018-02-15 22:03:49 +01:00
package xmppbase
// IsDomain checks if jid has only domain but no local and resource
func (jid *JID) IsDomain() bool {
return jid != nil && jid.Local == "" && jid.Domain != "" && jid.Resource == ""
}
// IsBare checks if jid has local and domain but no resource
func (jid *JID) IsBare() bool {
return jid != nil && jid.Local != "" && jid.Domain != "" && jid.Resource == ""
}
// IsFull checks if jid has all three parts of a JID
func (jid *JID) IsFull() bool {
return jid != nil && jid.Local != "" && jid.Domain != "" && jid.Resource != ""
}
// IsEqual to check if two jid has same values
func (a *JID) IsEqual(b *JID) bool {
if a == nil || b == nil {
return false
}
return a.Local == b.Local && a.Domain == b.Domain && a.Resource == b.Resource
}