Example #1
0
File: presence.py Project: dax/jmc
 def handle(self, stanza, lang_class, accounts):
     result = DefaultSubscribeHandler.handle(self, stanza, lang_class, accounts)
     to_node = stanza.get_to().node
     to_email = to_node.replace('%', '@', 1)
     LegacyJID(legacy_address=to_email,
               jid=unicode(stanza.get_to()),
               account=accounts[0])
     return result
Example #2
0
File: presence.py Project: dax/jcl
class DefaultSubscribeHandler_TestCase(unittest.TestCase):
    def setUp(self):
        self.handler = DefaultSubscribeHandler(None)

    def test_handle(self):
        presence = Presence(from_jid="*****@*****.**",
                            to_jid="*****@*****.**",
                            stanza_type="subscribe")
        result = self.handler.handle(presence, None, [])
        self.assertEquals(len(result), 2)
        self.assertEquals(result[0].get_to(), "*****@*****.**")
        self.assertEquals(result[0].get_from(), "*****@*****.**")
        self.assertEquals(result[0].get_type(), "subscribe")
        self.assertEquals(result[1].get_to(), "*****@*****.**")
        self.assertEquals(result[1].get_from(), "*****@*****.**")
        self.assertEquals(result[1].get_type(), "subscribed")
Example #3
0
File: presence.py Project: dax/jmc
 def __init__(self, component):
     DefaultSubscribeHandler.__init__(self, component)
     MailHandler.__init__(self, component)
Example #4
0
File: presence.py Project: dax/jcl
 def setUp(self):
     self.handler = DefaultSubscribeHandler(None)