comparison jid.js @ 25:06e3a883d3a3

Add a JID comparison function.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 27 Jan 2012 00:05:17 +0100
parents 6a6bb8ded046
children c06ec02217ee
comparison
equal deleted inserted replaced
24:119ceb121908 25:06e3a883d3a3
34 }; 34 };
35 35
36 Lightstring.JID.prototype = { 36 Lightstring.JID.prototype = {
37 toString: function() { 37 toString: function() {
38 return this.full; 38 return this.full;
39 },
40
41 equals: function(aJID) {
42 if (!(aJID instanceof Lightstring.JID))
43 aJID = new Lightstring.JID(aJID);
44
45 return (this.node === aJID.node &&
46 this.domain === aJID.domain &&
47 this.resource === aJID.resource)
39 }, 48 },
40 49
41 get bare() { 50 get bare() {
42 if (!this.domain) 51 if (!this.domain)
43 return null; 52 return null;