2 Slixmpp: The Slick XMPP Library
3 Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
4 This file is part of Slixmpp.
6 See the file LICENSE for copying permission.
11 from slixmpp
import Iq
12 from slixmpp
.plugins
import BasePlugin
13 from slixmpp
.xmlstream
.handler
import Callback
14 from slixmpp
.xmlstream
.matcher
import StanzaPath
15 from slixmpp
.xmlstream
import register_stanza_plugin
16 from slixmpp
.plugins
.xep_0049
import stanza
, PrivateXML
19 log
= logging
.getLogger(__name__
)
22 class XEP_0049(BasePlugin
):
25 description
= 'XEP-0049: Private XML Storage'
26 dependencies
= set([])
29 def plugin_init(self
):
30 register_stanza_plugin(Iq
, PrivateXML
)
32 def register(self
, stanza
):
33 register_stanza_plugin(PrivateXML
, stanza
, iterable
=True)
35 def store(self
, data
, ifrom
=None, block
=True, timeout
=None, callback
=None):
40 if not isinstance(data
, list):
44 iq
['private'].append(elem
)
46 return iq
.send(block
=block
, timeout
=timeout
, callback
=callback
)
48 def retrieve(self
, name
, ifrom
=None, block
=True, timeout
=None, callback
=None):
52 iq
['private'].enable(name
)
53 return iq
.send(block
=block
, timeout
=timeout
, callback
=callback
)