diff nodes.js @ 16:95fc43d1bd54

Don’t regenerate a subid if there is already one.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 19 Oct 2010 18:45:07 +0200
parents 9a6b8b3357c6
children 6697f394301f
line wrap: on
line diff
--- a/nodes.js
+++ b/nodes.js
@@ -88,8 +88,12 @@ exports.Node.prototype = {
 			return errors.success;
 		}
 
-		if (!subid)
-			subid = makeRandomId();
+		if (!subid) {
+			if (this.subscribers[jid])
+				subid = this.subscribers[jid].subid;
+			else
+				subid = makeRandomId();
+		}
 
 		this.subscribers[jid] = {
 			type: type,