changeset 25:06e3a883d3a3

Add a JID comparison function.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 27 Jan 2012 00:05:17 +0100
parents 119ceb121908
children 82bffc4a07a9
files jid.js
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;