Skip to content

Commit

Permalink
fix for metajack#71 - not tested
Browse files Browse the repository at this point in the history
  • Loading branch information
flosse committed Jun 9, 2012
1 parent c0671f7 commit 3c0bdf3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
21 changes: 18 additions & 3 deletions pep/strophe.pep.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This plugin is distributed under the terms of the MIT licence.
# Please see the LICENCE file for details.
#
# Copyright (c) Markus Kohlhase, 2011
# Copyright (c) Markus Kohlhase, 2011 - 2012

# A Strophe plugin for ( http://xmpp.org/extensions/xep-0115.html )

Expand Down Expand Up @@ -36,8 +36,23 @@ Strophe.addConnectionPlugin 'pep', (->
conn.caps.removeFeature "#{node}+notify"
conn.caps.sendPres()

publish = (node, items, callback ) ->
conn.pubsub.publish node, items, callback
# Publish and item to the given pubsub node.
# Parameters:
# (String) node - The name of the pubsub node.
# (Array) items - The list of items to be published.
# (Function) callback - Used to determine if node creation was sucessful.
publish = (node, items, callback) ->

# there are some problems with the pubsub plugin (see #71),
# so just build the iq stanza manually
iqid = conn.getUniqueId "pubsubpublishnode"
conn.addHandler callback, null, 'iq', null, iqid, null
conn.send $iq({from:conn.jid,type:'set', id:iqid})
.c('pubsub', { xmlns:Strophe.NS.PUBSUB })
.c('publish', { node:node, jid:conn.jid })
.list('item', items)
.tree()
iqid

# Public API
init: init
Expand Down
24 changes: 21 additions & 3 deletions pep/strophe.pep.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3c0bdf3

Please sign in to comment.