本文整理汇总了Python中messenger.proto.xmpp.XmppCooldownManager.XmppCooldownManager.getDefaultCoolDown方法的典型用法代码示例。如果您正苦于以下问题:Python XmppCooldownManager.getDefaultCoolDown方法的具体用法?Python XmppCooldownManager.getDefaultCoolDown怎么用?Python XmppCooldownManager.getDefaultCoolDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messenger.proto.xmpp.XmppCooldownManager.XmppCooldownManager
的用法示例。
在下文中一共展示了XmppCooldownManager.getDefaultCoolDown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ContactsManager
# 需要导入模块: from messenger.proto.xmpp.XmppCooldownManager import XmppCooldownManager [as 别名]
# 或者: from messenger.proto.xmpp.XmppCooldownManager.XmppCooldownManager import getDefaultCoolDown [as 别名]
#.........这里部分代码省略.........
return self.__addTasks(CLIENT_ACTION_ID.SET_NOTE, jid, note_tasks.RemoveNoteTask(jid))
def __makeChangeGroupsChain(self, exclude, include = None):
chain = []
for contact in self.usersStorage.getList(GroupFindCriteria(exclude)):
jid = contact.getJID()
groups = contact.getGroups()
groups.discard(exclude)
if include:
groups.add(include)
chain.append((jid, contact.getName(), groups))
return roster_tasks.ChangeRosterItemsGroupsChain(chain)
def __makeRemoveItemsByGroupChain(self, name):
chain = []
for contact in self.usersStorage.getList(GroupFindCriteria(name)):
groups = contact.getGroups()
groups.discard(name)
chain.append((contact.getJID(), contact.getName(), groups))
return roster_tasks.RemoveRosterItemsGroupsChain(chain)
def __addTasks(self, actionID, jid, *tasks):
if self.__tasks.addTasks(jid, *tasks):
self.__tasks.runFirstTask(jid)
else:
return (False, ClientActionError(actionID, CLIENT_ERROR_ID.LOCKED))
return (True, None)
def __checkCooldown(self, actionID):
error = None
if self.__cooldown.isInProcess(actionID):
error = ChatCoolDownError(actionID, self.__cooldown.getDefaultCoolDown())
return error
def __checkRosterSize(self):
length = self.usersStorage.getCount(ItemsFindCriteria((XMPP_ITEM_TYPE.ROSTER_ITEM,)))
if length >= CONTACT_LIMIT.ROSTER_MAX_COUNT:
return ClientIntLimitError(LIMIT_ERROR_ID.MAX_ROSTER_ITEMS, CONTACT_LIMIT.ROSTER_MAX_COUNT)
else:
return None
def __handleConnected(self):
self.__tasks.suspend()
self.__seq.onInited += self.__onSeqsInited
tasks = [roster_tasks.RosterResultTask(), block_tasks.BlockListResultTask()]
if GUI_SETTINGS.isXmppNotesEnabled:
tasks.append(note_tasks.NotesListTask())
self.__seq.init(*tasks)
def __handleDisconnected(self, reason, description):
self.__seq.fini()
self.__tasks.clear()
for contact in self.usersStorage.getList(ProtoFindCriteria(PROTO_TYPE.XMPP)):
resources = contact.getItem().getResources()
if not resources.isEmpty():
resources.clear()
g_messengerEvents.users.onUserStatusUpdated(contact)
def __handleIQ(self, iqID, iqType, pyGlooxTag):
if not self.__seq.handleIQ(iqID, iqType, pyGlooxTag):
self.__tasks.handleIQ(iqID, iqType, pyGlooxTag)
def __handleRosterQuery(self, iqID, jid, context):
self.__tasks.setIQ(iqID, jid, context)