PubSub Nodes Management

108 views
Skip to first unread message

nofxx

unread,
Sep 21, 2009, 7:25:08 PM9/21/09
to Blather
Hi there,

Before anything, thanks for blather!! Hehe.. when I was in the need of
xmpp I saw xmpp4r and taught: Oh man, we need an EM based on....
search github and hapiness ^ 2 =D

I'm a lil lost with PubSub, does someone has an example how to create
and subscribe to a node?

Supossing my jid is ma...@dom.net I'm trying:

Blather::Stanza::PubSub::Create.new(:set, "pubsub.dom.net", "/home/
dom.net/mach")
p.create_node

But can't see it on Psi...
Using ejabberd.

Jeff Smick

unread,
Sep 22, 2009, 6:07:23 PM9/22/09
to xmpp-b...@googlegroups.com
Hey nofxx,

If you're using the DSL you can use the pubsub side of it:
pubsub.create("/home/dom.net/mach", "pubsub.dom.net")

docs: http://squishtech.rubyforge.org/blather/ (Blather::DSL::PubSub)

If not, you just need to make sure you're sending the stanza over the wire.

Marcos Piccinini

unread,
Sep 24, 2009, 8:04:13 AM9/24/09
to xmpp-b...@googlegroups.com
Hi Jeff,

Thanks for the reply, finally got it... client.write ::Stanza::

It's creating the nodes just fine! Thank you.

Sorry but allow me a last question, (yes pm your address for the beer &
pizza... ;)

When I try to publish something:

<iq from='pubsub.fi' to='msweet@fi' type='error' xml:lang='en'
id='blather002a'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='fxx'>
<item>foo</item>
</publish>
</pubsub>
<error code='400' type='modify'><bad-request
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><invalid-payload
xmlns='http://jabber.org/protocol/pubsub#errors'/></error></iq>

There is this forum thread, a guy saying it's a change in ejabberd 2.1:
http://www.ejabberd.im/node/3646#comment-54619

I didn't need to change the namespace, but adding the <entry> it works:

change:

<item>foo</item>

to

<item><entry>foo</entry></item>

it works:

<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="/fxx">
<item id="4E5C21D7EA087"/>
</publish>
</pubsub>
</iq>


I wish I could try a patch, but dunno how to workaround this version
thing =/

Jeff Smick

unread,
Sep 24, 2009, 12:02:37 PM9/24/09
to xmpp-b...@googlegroups.com
Hey Marcos,

Thanks for figuring this out. I've entered a ticket on Blather's
github page and will knock it out as soon as I have a couple minutes.
Should be in the next day or so.

BTW, the pubsub DSL in Blather is the newest bit. Please send over any
feedback you have on how I might be able to make it simpler/better to
use.

--Jeff

Marcos Piccinini

unread,
Sep 25, 2009, 5:43:17 AM9/25/09
to xmpp-b...@googlegroups.com
Hi Jeff,

Ha, no, thank you man.. you rock. I learned I lot from you(r code).... =D

To be honest with you, this thing I'm working had it's own daemonize way
and I taught the lib approach would fit better (dunno, I'll release it
soon, will link you the code so you have a look hehe). But I'm sure the
DSL is very handy, I'm tempted to rewrite a old thing I have that will
be perfect =D

Ah, allow me a off, did you get to any conclusion about text formatting?
Looks like pidgin uses <spans>, and <em>. Gtalk uses () and ** , and
xmpp don't have a XEP-DOLIKETHIS...
Hmm... and how to write raw ?? heh will check the code...

Jeff Smick

unread,
Sep 25, 2009, 8:42:56 PM9/25/09
to Blather
Hey Marcos,

I just pushed a fix to GH. I have a couple more tweaks and features in
mind before I push another gem, but you can clone the source and
install the gem locally with a quick rake command:
"rake install"

Re: the formatted message issue, I haven't really sat down to think
about the solution for it. It's difficult when there's no standard,
but maybe I'll just strip all the html and let the user deal with how
they want to format a non-markedup version of the message.

On Sep 25, 2:43 am, Marcos Piccinini <chad...@gmail.com> wrote:
> Hi Jeff,
>
> Ha, no, thank you man.. you rock. I learned I lot from you(r code).... =D
>
> To be honest with you, this thing I'm working had it's own daemonize way
> and I taught the lib approach would fit better (dunno, I'll release it
> soon, will link you the code so you have a look hehe). But I'm sure the
> DSL is very handy, I'm tempted to rewrite a old thing I have that will
> be perfect =D
>
> Ah, allow me a off, did you get to any conclusion about text formatting?
> Looks like pidgin uses <spans>, and <em>. Gtalk uses () and ** , and
> xmpp don't have a XEP-DOLIKETHIS...
> Hmm... and how to write raw ?? heh will check the code...
>
>
>
> Jeff Smick wrote:
> > Hey Marcos,
>
> > Thanks for figuring this out. I've entered a ticket on Blather's
> > github page and will knock it out as soon as I have a couple minutes.
> > Should be in the next day or so.
>
> > BTW, the pubsub DSL in Blather is the newest bit. Please send over any
> > feedback you have on how I might be able to make it simpler/better to
> > use.
>
> > --Jeff
>
> >>> docs:http://squishtech.rubyforge.org/blather/(Blather::DSL::PubSub)
>
> >>> If not, you just need to make sure you're sending the stanza over the wire.
>
> >>> On Mon, Sep 21, 2009 at 4:25 PM, nofxx <chad...@gmail.com> wrote:
>
> >>>> Hi there,
>
> >>>> Before anything, thanks for blather!! Hehe.. when I was in the need of
> >>>> xmpp I saw xmpp4r and taught: Oh man, we need an EM based on....
> >>>> search github and hapiness ^ 2 =D
>
> >>>> I'm a lil lost with PubSub, does someone has an example how to create
> >>>> and subscribe to a node?
>
> >>>> Supossing my jid is  m...@dom.net I'm trying:

Marcos Piccinini

unread,
Sep 25, 2009, 8:51:55 PM9/25/09
to xmpp-b...@googlegroups.com
Hey, you're coming with the flour, my cake is done (as my mom says)
Already up and running the new code, working fine =D
About the msg body, the escaping is nice.. how about another setter?
.write_raw "<foo>" for instance..

Thank you ;)

Marcos Piccinini

unread,
Sep 27, 2009, 2:26:18 PM9/27/09
to xmpp-b...@googlegroups.com
Hi Jeff,

Hm, now I realize write *is* pretty much raw.. hehe. Guess I mean
Stanza::Message...
Reply all
Reply to author
Forward
0 new messages