コード例 #1
0
 def __isCooldown(self, actionID):
     if self.__cooldown.isInProcess(actionID):
         error = ChatCoolDownError(actionID,
                                   self.__cooldown.getDefaultCoolDown())
         g_messengerEvents.onErrorReceived(error)
         return True
     return False
コード例 #2
0
 def sendChatMessage(self, jid, body):
     if self.__cooldown.isInProcess(CLIENT_ACTION_ID.SEND_MESSAGE):
         g_messengerEvents.onErrorReceived(ChatCoolDownError(CLIENT_ACTION_ID.SEND_MESSAGE, self.__limits.getBroadcastCoolDown()))
         return
     body = self.__msgFilters.chainOut(body, self.__limits)
     if not body:
         return
     self.__chatSessions.sendMessage(jid.getBareJID(), body, self.__msgFilters)
     self.__cooldown.process(CLIENT_ACTION_ID.SEND_MESSAGE)
コード例 #3
0
 def __checkCooldown(self, actionID):
     """
     Check if cooldown was set for action
     :param actionID: action id
     :return: None, if cooldown was not set, else return ChatCoolDownError object
     """
     error = None
     if self.__cooldown.isInProcess(actionID):
         error = ChatCoolDownError(actionID, self.__cooldown.getDefaultCoolDown())
     return error
コード例 #4
0
 def _checkCooldown(self, actionID):
     error = None
     if self.__cooldown.isInProcess(actionID):
         error = ChatCoolDownError(actionID,
                                   self.__cooldown.getDefaultCoolDown())
     return error