# HG changeset patch # User Emmanuel Gil Peyrot # Date 1327619117 -3600 # Node ID 06e3a883d3a39f633fb9d0b716178f578203d0a9 # Parent 119ceb121908f943cedab89e473f9d2dae6a3988 Add a JID comparison function. diff --git a/jid.js b/jid.js --- a/jid.js +++ b/jid.js @@ -38,6 +38,15 @@ Lightstring.JID.prototype = { return this.full; }, + equals: function(aJID) { + if (!(aJID instanceof Lightstring.JID)) + aJID = new Lightstring.JID(aJID); + + return (this.node === aJID.node && + this.domain === aJID.domain && + this.resource === aJID.resource) + }, + get bare() { if (!this.domain) return null;