コード例 #1
0
ファイル: pubsub.py プロジェクト: josejamilena/headstock
 def subscription(self, e):
     iq = Stanza.get_iq(self.client.jid, u"firehoser.superfeedr.com")
     E(u"query",
       namespace=XMPP_DISCO_ITEMS_NS,
       parent=iq,
       attributes={u'node': e.get_attribute_value('node')})
     self.client.send_stanza(iq)
コード例 #2
0
ファイル: pubsub.py プロジェクト: josejamilena/headstock
    def fetch(self, e):
        stanza_id = generate_unique()
        iq = Stanza.get_iq(self.client.jid,
                           u"firehoser.superfeedr.com",
                           stanza_id=stanza_id)

        pubsub = E(u"pubsub", namespace=XMPP_PUBSUB_NS, parent=iq)
        A(u"superfeedr",
          prefix=u"xmlns",
          namespace=XMLNS_NS,
          parent=pubsub,
          value=u"http://superfeedr.com/xmpp-pubsub-ext")
        sub = E(u"subscriptions",
                attributes={u"jid": unicode(self.client.jid)},
                parent=pubsub,
                namespace=XMPP_PUBSUB_NS)
        A(u"page",
          value=u"1",
          prefix=u"superfeedr",
          parent=sub,
          namespace=u"http://superfeedr.com/xmpp-pubsub-ext")

        self.client.register_on_iq(self.subscriptions,
                                   type="result",
                                   id=stanza_id,
                                   once=True)
        self.client.send_stanza(iq)
コード例 #3
0
ファイル: stream.py プロジェクト: AlexSnet/headstock
    def ask_roster(self):
        """
        Creates and returns the IQ stanza to query the entity's roster.
        """
        iq = Stanza.get_iq(from_jid=unicode(self.jid), stanza_id=generate_unique())
        E(u'query', namespace=XMPP_ROSTER_NS, parent=iq)   

        return iq
コード例 #4
0
    def ask_roster(self):
        """
        Creates and returns the IQ stanza to query the entity's roster.
        """
        iq = Stanza.get_iq(from_jid=unicode(self.jid),
                           stanza_id=generate_unique())
        E(u'query', namespace=XMPP_ROSTER_NS, parent=iq)

        return iq
コード例 #5
0
ファイル: register.py プロジェクト: josejamilena/headstock
    def register(self, e):
        """
        Handler called when the `<register xmlns="http://jabber.org/features/iq-register" />`
        stanza is received and the client required the registration process.

        Returns a stanza indicating the client is indeed requesting the
        registration process from the server.

        ``e`` :class:`bridge.Element` instance representing the dispatched stanza
        """
        iq = Stanza.get_iq(stanza_id=generate_unique())
        E(u'register', namespace=XMPP_IBR_NS, parent=iq)
        return iq
コード例 #6
0
ファイル: pubsub.py プロジェクト: AlexSnet/headstock
    def fetch(self, e):
        stanza_id = generate_unique()
        iq = Stanza.get_iq(self.client.jid, u"firehoser.superfeedr.com",
                           stanza_id=stanza_id)
        
        pubsub = E(u"pubsub", namespace=XMPP_PUBSUB_NS, parent=iq)
        A(u"superfeedr", prefix=u"xmlns", namespace=XMLNS_NS, parent=pubsub,
          value=u"http://superfeedr.com/xmpp-pubsub-ext")
        sub = E(u"subscriptions", attributes={u"jid": unicode(self.client.jid)},
                parent=pubsub, namespace=XMPP_PUBSUB_NS)
        A(u"page", value=u"1", prefix=u"superfeedr", parent=sub,
          namespace=u"http://superfeedr.com/xmpp-pubsub-ext")

        self.client.register_on_iq(self.subscriptions, type="result", id=stanza_id, once=True)
        self.client.send_stanza(iq)
コード例 #7
0
ファイル: pubsub.py プロジェクト: AlexSnet/headstock
 def subscription(self, e):
     iq = Stanza.get_iq(self.client.jid, u"firehoser.superfeedr.com")
     E(u"query", namespace=XMPP_DISCO_ITEMS_NS, parent=iq,
       attributes={u'node': e.get_attribute_value('node')})
     self.client.send_stanza(iq)
コード例 #8
0
ファイル: pubsub.py プロジェクト: AlexSnet/headstock
 def subscriptions(self, e):
     iq = Stanza.get_iq(self.client.jid, u"firehoser.superfeedr.com")
     E(u"query", namespace=XMPP_DISCO_ITEMS_NS, parent=iq)
     self.client.send_stanza(iq)
コード例 #9
0
ファイル: pubsub.py プロジェクト: josejamilena/headstock
 def subscriptions(self, e):
     iq = Stanza.get_iq(self.client.jid, u"firehoser.superfeedr.com")
     E(u"query", namespace=XMPP_DISCO_ITEMS_NS, parent=iq)
     self.client.send_stanza(iq)
コード例 #10
0
 def register(self, e):
     iq = Stanza.get_iq(stanza_id=generate_unique())
     E(u'register', namespace=XMPP_IBR_NS, parent=iq)
     self.client.send_stanza(iq)
コード例 #11
0
ファイル: __init__.py プロジェクト: Lawouach/conductor
 def register(self, e):
     iq = Stanza.get_iq(stanza_id=generate_unique())
     E(u'register', namespace=XMPP_IBR_NS, parent=iq)
     self.client.send_stanza(iq)
コード例 #12
0
ファイル: stanza_test.py プロジェクト: josejamilena/headstock
 def test_uniq_id(self):
     xml1 = Stanza.get_iq().xml()
     xml2 = Stanza.get_iq().xml()
     self.assertNotEqual(xml1, xml2)
コード例 #13
0
ファイル: stanza_test.py プロジェクト: josejamilena/headstock
    def test_get_iq(self):
        stanza = Stanza.get_iq(from_jid="bob", to_jid="alice", stanza_id="i")
        xml = """<?xml version="1.0" encoding="UTF-8"?>
<iq xmlns="jabber:client" to="alice" type="get" id="i" from="bob" />"""
        self.assertEqual(stanza.xml(), xml)