Add getUniqueId() method

Wed, 03 Feb 2010 21:00:04 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 03 Feb 2010 21:00:04 +0000
changeset 5
20a58dcf2323
parent 4
67b1d93509d3
child 6
ec839631a35f

Add getUniqueId() method

xmpp.js file | annotate | diff | comparison | revisions
--- a/xmpp.js	Wed Feb 03 19:29:21 2010 +0000
+++ b/xmpp.js	Wed Feb 03 21:00:04 2010 +0000
@@ -118,6 +118,8 @@
 		closed: recontext(this, this._stream_closed)
 	});
 	
+	this._uniqueId = 0;
+	
 	return this;
 };
 
@@ -145,6 +147,12 @@
 		this.socket.send(data.toString());
 	},
 	
+	
+	getUniqueId: function (suffix)
+	{
+		return ++this._uniqueId + (suffix?(":"+suffix):"");
+	},
+	
 	// Update the status of the connection, call connect_callback
 	_setStatus: function (status, condition)
 	{

mercurial