Exemplo n.º 1
0
 def testProbe():
     if self.peer is not None:
         userid, resource = util.split_userid(self.peer)
         presence = xmppim.Presence(
             jid.JID(tuple=(userid, self.network, resource)), 'probe')
         presence['id'] = util.rand_str(8)
         xs.send(presence)
Exemplo n.º 2
0
        def testSubscribe():
            # subscription request
            self.index = 0
            if self.peer is not None:
                userid, resource = util.split_userid(self.peer)
                presence = xmppim.Presence(jid.JID(tuple=(userid, self.network, None)), 'subscribe')
                presence['id'] = util.rand_str(8)
                xs.send(presence)
            else:
                def pres():
                    self.index += 1
                    presence = xmppim.AvailablePresence(statuses={None: 'status message (%d)' % (self.index, )})
                    xs.send(presence)

                LoopingCall(pres).start(2, False)
Exemplo n.º 3
0
        def testMassProbe():
            global count, num
            num = 400
            count = 0
            def _presence(stanza):
                global count, num
                count += 1
                if count >= 400:
                    print 'received all presence'
            xs.addObserver('/presence', _presence)

            for n in range(num):
                userid = util.rand_str(util.USERID_LENGTH, util.CHARSBOX_HEX_LOWERCASE)
                presence = xmppim.Presence(jid.JID(tuple=(userid, self.network, None)), 'probe')
                xs.send(presence)
Exemplo n.º 4
0
 def subscribeReceived(self, entity):
     response = xmppim.Presence(to=entity, type='subscribed')
     self.xmlstream.send(response)
     response = xmppim.Presence(to=entity, type='subscribe')
     self.xmlstream.send(response)
     self.parent.log.info(u"Received and accepted subscription request from %s", entity.full())