On Wed, Jan 28, 2009 at 20:41, Remko Tronçon <[email protected]> wrote:
>> Has anybody used SleekXMPP [1] (or SleekBot [2]) to handle forms with
>> XEP-0004 [3] (+ XEP-0050 [4])?
>
> Yes, it's even used in the book ;-)
Great to hear that. It's a really nice lib IMHO. :)
>> My question is how to get JID of sender in command handler - the only thing
>> that it gets is 'form' and 'sessionid' (and none of this can point out to
>> full jid of sender).
>
> self.xmpp.plugin['xep_0050'].sessions[sessionId]['jid']
Unfortunately, this does not work for me. I get KeyError (no 'jid').
Here's what's in my self.bot.plugin['xep_0050'].sessions[sessionID]:
{'next':
<bound method memberbot.votingHandler of
<plugins.memberbot.memberbot object at 0x339fa90>>,
'past':
[(<sleekxmpp.plugins.xep_0004.Form object at 0x33c9a10>, None)]}
Item at 'next' key is my command handler. At 'past' I have Form object from
which I cannot however JID (as stated in previous posts). I get these at
breakpoint in my handler method.
These values are set in xep_0050.handler_command (or
xep_0050.handler_command_next) in xep_0050.py plugin file.
I think I've pretty much investigated all surroundings of 'sessions'
dictionary and I cannot find sender JID.
I've checked out latest SleekXMPP version from SVN to see whether I don't have
some old version, but the code is pretty much the same in that file.
Maybe I'm missing something?
Of course, I could add code to above metioned xep_0050 methods (patching
SleekXMPP), like this one (to make your code work):
self.sessions[sessionid]['jid'] = xml.attrib['from']
However, I want to avoid changing libs code locally. Other approach would be
patch SleekXMPP officially - I don't have anything against it, but (once
again) maybe I'm missing something :)
--
Regards,
Mateusz Biliński
_______________________________________________
JDev mailing list
Forum: http://www.jabberforum.org/forumdisplay.php?f=20
Info: http://mail.jabber.org/mailman/listinfo/jdev
Unsubscribe: [email protected]
_______________________________________________