changeset 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 60c80751cfa5
children ec7cea92fe8a
files nodes.js
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
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,