How to use the nbxmpp.simplexml.XML2Node function in nbxmpp

To help you get started, we’ve selected a few nbxmpp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gajim / gajim / test / broken / no_gui / test_protocol_caps.py View on Github external
def test_capsPresenceCB(self):
        fjid = "user@server.com/a"

        xml = """
            
            
        """ % (fjid)
        msg = nbxmpp.protocol.Presence(node=nbxmpp.simplexml.XML2Node(xml))
        self.module._presence_received(None, msg)
github gajim / gajim / test / broken / integration / test_gui_event_integration.py View on Github external
def contact_goes_offline(self, account, jid, resource, prio,
    still_exists = True):
        '''a remote contact goes offline.'''
        xml = """
            %s
            
            Goodbye!
            
        """ % (jid, resource, prio)
        msg = nbxmpp.protocol.Presence(node=nbxmpp.simplexml.XML2Node(xml))
        gajim.connections[account]._presenceCB(None, msg)

        contact = None
        for c in gajim.contacts.get_contacts(account, jid):
            if c.resource == resource:
                contact = c
                break

        if not still_exists:
            self.assertTrue(contact is None)
            return

        self.assertEqual('offline', contact.show)
        self.assertEqual('Goodbye!', contact.status)
        self.assertEqual(prio, contact.priority)
github gajim / gajim / test / broken / unit / test_sessions.py View on Github external
def receive_chat_msg(self, jid, msgtxt):
        '''simulate receiving a chat message from jid'''
        msg = nbxmpp.Message()
        msg.setBody(msgtxt)
        msg.setType('chat')

        xml = """%s
            123""" % (jid, msgtxt)
        stanza = nbxmpp.protocol.Message(node=nbxmpp.simplexml.XML2Node(xml))
        self.conn._messageCB(None, stanza)
github gajim / gajim / test / broken / integration / test_gui_event_integration.py View on Github external
def contact_comes_online(self, account, jid, resource, prio,
    should_popup=True):
        '''a remote contact comes online'''
        xml = """%s
            
            I'm back!
            
        """ % (jid, resource, prio)
        msg = nbxmpp.protocol.Presence(node=nbxmpp.simplexml.XML2Node(xml))
        gajim.connections[account]._presenceCB(None, msg)

        contact = None
        for c in gajim.contacts.get_contacts(account, jid):
            if c.resource == resource:
                contact = c
                break

        self.assertEqual('online', contact.show)
        self.assertEqual("I'm back!", contact.status)
        self.assertEqual(prio, contact.priority)

        # the most recent notification is that the contact connected
        if should_popup:
            self.assertEqual('Contact Signed In',
                notify.notifications[-1].popup_event_type)