Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes #58: wrong documentation for pubsub plugin.

Also made the code sligtly more robust.
  • Loading branch information...
commit f513ed3d90bdc446eec86582510107f0d8ff888e 1 parent ddce0fa
@metajack metajack authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 plugins/strophe.pubsub.js
View
15 plugins/strophe.pubsub.js
@@ -111,7 +111,7 @@ Strophe.addConnectionPlugin('pubsub', {
(String) jid - The node owner's jid.
(String) service - The name of the pubsub service.
(String) node - The name of the pubsub node.
- (Dictionary) options - The configuration options for the node.
+ (Array) options - The configuration options for the node.
(Function) event_cb - Used to recieve subscription events.
(Function) call_back - Used to determine if node
creation was sucessful.
@@ -134,14 +134,15 @@ Strophe.addConnectionPlugin('pubsub', {
form_field.appendChild(value);
x.appendChild(form_field);
- for (var i in options)
- {
- var val = options[i];
- x.appendChild(val);
- }
var sub = $iq({from:jid, to:service, type:'set', id:subid})
- if(options && options.length != 0)
+
+ if(options && options.length && options.length !== 0)
{
+ for (var i = 0; i < options.length; i++)
+ {
+ var val = options[i];
+ x.appendChild(val);
+ }
sub_options.appendChild(x);
sub.c('pubsub', { xmlns:Strophe.NS.PUBSUB }).c('subscribe',

0 comments on commit f513ed3

Please sign in to comment.
Something went wrong with that request. Please try again.