comparison src/core/sat_main.py @ 787:dd656d745d6a

test: added tests for XEP-0033
author souliane <souliane@mailoo.org>
date Sun, 05 Jan 2014 13:05:31 +0100
parents 5642939d254e
children 02ee9ef95277
comparison
equal deleted inserted replaced
786:c3acc1298a2f 787:dd656d745d6a
66 66
67 class MessageSentAndStored(Exception): 67 class MessageSentAndStored(Exception):
68 """ Exception to raise if the message has been already sent and stored in the 68 """ Exception to raise if the message has been already sent and stored in the
69 history by the trigger, so the rest of the process should be stopped. This 69 history by the trigger, so the rest of the process should be stopped. This
70 should normally be raised by the trigger with the minimal priority """ 70 should normally be raised by the trigger with the minimal priority """
71 pass 71 def __init__(self, reason, mess_data):
72 Exception(reason)
73 self.mess_data = mess_data # added for testing purpose
72 74
73 75
74 class AbortSendMessage(Exception): 76 class AbortSendMessage(Exception):
75 """ Exception to raise if sending the message should be aborted. This can be 77 """ Exception to raise if sending the message should be aborted. This can be
76 raised by any trigger but a side action should be planned by the trigger 78 raised by any trigger but a side action should be planned by the trigger
650 self.profiles[profile].presence.unsubscribe(to_jid) 652 self.profiles[profile].presence.unsubscribe(to_jid)
651 653
652 def requestServerDisco(self, feature, jid_=None, cache_only=False, profile_key="@NONE"): 654 def requestServerDisco(self, feature, jid_=None, cache_only=False, profile_key="@NONE"):
653 """Discover if a server or its items offer a given feature 655 """Discover if a server or its items offer a given feature
654 @param feature: the feature to check 656 @param feature: the feature to check
655 @param jid_: the jid of the server 657 @param jid_: the jid of the server, local server if None
656 @param cache_only: expect the result to be in cache and don't actually 658 @param cache_only: expect the result to be in cache and don't actually
657 make any request to avoid returning a Deferred. This can be used anytime 659 make any request. This can be used anytime for requesting a feature on
658 for requesting the local server because the data are cached for sure. 660 the local server because the data are cached for sure.
659 @result: the Deferred entity jid offering the feature, or None 661 @result: the Deferred entity jid offering the feature, or None
660 """ 662 """
661 profile = self.memory.getProfileName(profile_key) 663 profile = self.memory.getProfileName(profile_key)
662 664
663 if not profile: 665 if not profile: