当前位置: 首页>>代码示例>>Python>>正文


Python XmppCooldownManager.XmppCooldownManager类代码示例

本文整理汇总了Python中messenger.proto.xmpp.XmppCooldownManager.XmppCooldownManager的典型用法代码示例。如果您正苦于以下问题:Python XmppCooldownManager类的具体用法?Python XmppCooldownManager怎么用?Python XmppCooldownManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了XmppCooldownManager类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, limits):
     super(_ChatHistoryRequester, self).__init__()
     self.__cooldown = XmppCooldownManager(limits.getBroadcastCoolDown())
     self.__limit = limits.getHistoryMaxLength()
     self.__iqID = ''
     self.__pool = []
     self.__history = []
     self.__callbackID = None
     self.__state = _HISTORY_RQ_STATE.FREE
开发者ID:kblw,项目名称:wot_client,代码行数:9,代码来源:messages.py

示例2: __init__

 def __init__(self):
     super(MessagesManager, self).__init__()
     self.__msgFilters = None
     self.__chatSessions = _ChatSessions()
     self.__isInited = False
     self.__receivedTags = set()
     self.__pending = []
     self.__cooldown = XmppCooldownManager(MESSAGE_LIMIT.COOLDOWN)
     self.channelsStorage.onRestoredFromCache += self.__cs_onChannelsRestoredFromCache
     return
开发者ID:webiumsk,项目名称:WoT,代码行数:10,代码来源:messages.py

示例3: __init__

 def __init__(self):
     super(ContactsManager, self).__init__()
     self.__seq = SeqTaskQueue()
     self.__tasks = ContactTaskQueue()
     self.__cooldown = XmppCooldownManager()
     self.__presence = _UserPresence()
     self.__presence.addListeners()
     self.__voip = _VoipHandler()
     self.__voip.addListeners()
     g_messengerEvents.onPluginConnectFailed += self.__me_onPluginConnectFailed
     self.usersStorage.onRestoredFromCache += self.__us_onRestoredFromCache
开发者ID:webiumsk,项目名称:WoT,代码行数:11,代码来源:__init__.py

示例4: __init__

 def __init__(self):
     super(ContactsManager, self).__init__()
     self.__seq = SeqTaskQueue()
     self.__seq.suspend()
     self.__tasks = ContactTaskQueue([block_tasks.SyncBlockItemTask()])
     self.__cooldown = XmppCooldownManager()
     self.__subsBatch = sub_helper.InboundSubscriptionsBatch()
     self.__subsRestrictions = sub_helper.SubscriptionsRestrictions()
     self.__presence = _UserPresence()
     self.__presence.addListeners()
     self.__voip = _VoipHandler()
     self.__voip.addListeners()
     g_messengerEvents.onPluginConnectFailed += self.__me_onPluginConnectFailed
     self.usersStorage.onRestoredFromCache += self.__us_onRestoredFromCache
     g_settings.onUserPreferencesUpdated += self.__ms_onUserPreferencesUpdated
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:15,代码来源:__init__.py

示例5: MessagesManager

class MessagesManager(ClientEventsHandler):
    __slots__ = ('__msgFilters', '__chatSessions', '__receivedTags', '__pending')

    def __init__(self):
        super(MessagesManager, self).__init__()
        self.__msgFilters = None
        self.__chatSessions = _ChatSessions()
        self.__isInited = False
        self.__receivedTags = set()
        self.__pending = []
        self.__cooldown = XmppCooldownManager(MESSAGE_LIMIT.COOLDOWN)
        self.channelsStorage.onRestoredFromCache += self.__cs_onChannelsRestoredFromCache
        return

    @storage_getter('channels')
    def channelsStorage(self):
        return None

    def clear(self):
        self.channelsStorage.onRestoredFromCache -= self.__cs_onChannelsRestoredFromCache
        self.__clearData()
        super(MessagesManager, self).clear()

    def registerHandlers(self):
        register = self.client().registerHandler
        register(_EVENT.CONNECTED, self.__handleConnected)
        register(_EVENT.DISCONNECTED, self.__handleDisconnected)
        register(_EVENT.MESSAGE, self.__handleMessage)
        events = g_messengerEvents.users
        events.onUsersListReceived += self.__me_onUsersListReceived
        events.onUserActionReceived += self.__me_onUserActionReceived
        events.onUserStatusUpdated += self.__me_onUserStatusUpdated

    def unregisterHandlers(self):
        unregister = self.client().unregisterHandler
        unregister(_EVENT.CONNECTED, self.__handleConnected)
        unregister(_EVENT.DISCONNECTED, self.__handleDisconnected)
        unregister(_EVENT.MESSAGE, self.__handleMessage)
        events = g_messengerEvents.users
        events.onUsersListReceived -= self.__me_onUsersListReceived
        events.onUserActionReceived -= self.__me_onUserActionReceived
        events.onUserStatusUpdated -= self.__me_onUserStatusUpdated

    def setFilters(self, msgFilters):
        self.__msgFilters = msgFilters

    def isInCooldown(self):
        return self.__cooldown.isInProcess(CLIENT_ACTION_ID.SEND_MESSAGE)

    @xmpp_query(QUERY_SIGN.DATABASE_ID, QUERY_SIGN.ACCOUNT_NAME)
    def startChatSession(self, dbID, name):
        self.__chatSessions.startSession(makeContactJID(dbID), name)
        return (True, None)

    def stopChatSession(self, jid):
        self.__chatSessions.stopSession(ContactBareJID(jid))

    def sendChatMessage(self, jid, body):
        if self.__cooldown.isInProcess(CLIENT_ACTION_ID.SEND_MESSAGE):
            g_messengerEvents.onErrorReceived(ChatCoolDownError(CLIENT_ACTION_ID.SEND_MESSAGE, MESSAGE_LIMIT.COOLDOWN))
            return
        self.__chatSessions.sendMessage(ContactBareJID(jid), body)
        self.__cooldown.process(CLIENT_ACTION_ID.SEND_MESSAGE)

    def __clearData(self):
        self.__chatSessions.clear()
        self.__receivedTags.clear()
        self.__pending = []

    def __setChannelsState(self, isJoined):
        channels = self.channelsStorage.getChannelsByCriteria(find_criteria.XMPPChannelFindCriteria())
        for channel in channels:
            channel.setJoined(isJoined)

    def __handleConnected(self):
        self.__setChannelsState(True)

    def __handleDisconnected(self, reason, description):
        self.__clearData()
        self.__setChannelsState(False)

    def __handleMessage(self, _, msgType, body, jid, pyGlooxTag):
        if msgType == MESSAGE_TYPE.CHAT:
            state, info, sentAt = ChatMessageHandler().handleTag(pyGlooxTag)
            if info:
                dbID = info['dbID']
                name = info['name']
            else:
                LOG_ERROR('Can not find sender info', pyGlooxTag.getXml())
                return
            if body:
                body = self.__msgFilters.chainIn(dbID, body)
            if _REQUIRED_USER_TAGS.issubset(self.__receivedTags):
                self.__chatSessions.onMessageReceived(jid, body, state, dbID, name, sentAt)
            else:
                self.__pending.insert(0, (msgType, (jid,
                  body,
                  state,
                  dbID,
                  name,
#.........这里部分代码省略.........
开发者ID:webiumsk,项目名称:WoT,代码行数:101,代码来源:messages.py

示例6: ContactsManager

class ContactsManager(ClientEventsHandler):
    __slots__ = ('__seq', '__tasks', '__cooldown', '__presence', '__voip')

    def __init__(self):
        super(ContactsManager, self).__init__()
        self.__seq = SeqTaskQueue()
        self.__tasks = ContactTaskQueue()
        self.__cooldown = XmppCooldownManager()
        self.__presence = _UserPresence()
        self.__presence.addListeners()
        self.__voip = _VoipHandler()
        self.__voip.addListeners()
        g_messengerEvents.onPluginConnectFailed += self.__me_onPluginConnectFailed
        self.usersStorage.onRestoredFromCache += self.__us_onRestoredFromCache

    @storage_getter('users')
    def usersStorage(self):
        return None

    @storage_getter('playerCtx')
    def playerCtx(self):
        return None

    def isInited(self):
        return self.__seq.isInited()

    def clear(self):
        g_messengerEvents.onPluginConnectFailed -= self.__me_onPluginConnectFailed
        self.usersStorage.onRestoredFromCache -= self.__us_onRestoredFromCache
        self.__presence.removeListeners()
        self.__voip.removeListeners()
        super(ContactsManager, self).clear()

    def switch(self, scope):
        self.__presence.switch(scope)

    @notations.contacts(PROTO_TYPE.XMPP, log=False)
    def registerHandlers(self):
        register = self.client().registerHandler
        register(_EVENT.CONNECTED, self.__handleConnected)
        register(_EVENT.DISCONNECTED, self.__handleDisconnected)
        register(_EVENT.IQ, self.__handleIQ)
        register(_EVENT.ROSTER_QUERY, self.__handleRosterQuery)
        register(_EVENT.ROSTER_RESULT, self.__handleRosterResult)
        register(_EVENT.ROSTER_ITEM_SET, self.__handleRosterItemSet)
        register(_EVENT.ROSTER_ITEM_REMOVED, self.__handleRosterItemRemoved)
        register(_EVENT.ROSTER_RESOURCE_ADDED, self.__handleRosterResourceAdded)
        register(_EVENT.ROSTER_RESOURCE_REMOVED, self.__handleRosterResourceRemoved)
        register(_EVENT.SUBSCRIPTION_REQUEST, self.__handleSubscriptionRequest)
        register(_EVENT.IGR, self.__handlePresenceWithIGR)

    @notations.contacts(PROTO_TYPE.XMPP, log=False)
    def unregisterHandlers(self):
        unregister = self.client().unregisterHandler
        unregister(_EVENT.CONNECTED, self.__handleConnected)
        unregister(_EVENT.DISCONNECTED, self.__handleDisconnected)
        unregister(_EVENT.IQ, self.__handleIQ)
        unregister(_EVENT.ROSTER_QUERY, self.__handleRosterQuery)
        unregister(_EVENT.ROSTER_RESULT, self.__handleRosterResult)
        unregister(_EVENT.ROSTER_ITEM_SET, self.__handleRosterItemSet)
        unregister(_EVENT.ROSTER_ITEM_REMOVED, self.__handleRosterItemRemoved)
        unregister(_EVENT.ROSTER_RESOURCE_ADDED, self.__handleRosterResourceAdded)
        unregister(_EVENT.ROSTER_RESOURCE_REMOVED, self.__handleRosterResourceRemoved)
        unregister(_EVENT.SUBSCRIPTION_REQUEST, self.__handleSubscriptionRequest)
        unregister(_EVENT.IGR, self.__handlePresenceWithIGR)
        self.__tasks.clear()

    @xmpp_query(QUERY_SIGN.DATABASE_ID, QUERY_SIGN.ACCOUNT_NAME, QUERY_SIGN.OPT_GROUP_NAME)
    def addFriend(self, dbID, name, group = None):
        error = self.__checkCooldown(CLIENT_ACTION_ID.ADD_FRIEND)
        if error:
            return (False, error)
        else:
            if group:
                if not self.usersStorage.isGroupExists(group):
                    return (False, ClientContactError(CONTACT_ERROR_ID.GROUP_NOT_FOUND, group))
                groups = {group}
            else:
                groups = None
            contact = self.usersStorage.getUser(dbID, PROTO_TYPE.XMPP)
            tasks, itemType = [], XMPP_ITEM_TYPE.EMPTY_ITEM
            if contact:
                if contact.isCurrentPlayer():
                    return (False, ClientActionError(CLIENT_ACTION_ID.ADD_FRIEND, CLIENT_ERROR_ID.GENERIC))
                jid = contact.getJID()
                itemType = contact.getItemType()
                if itemType == XMPP_ITEM_TYPE.ROSTER_ITEM:
                    return (False, ClientContactError(CONTACT_ERROR_ID.ROSTER_ITEM_EXISTS, contact.getFullName()))
                subTo = contact.getSubscription()[0]
            else:
                jid = makeContactJID(dbID)
                subTo = _SUB.OFF
            error = self.__checkRosterSize()
            if error:
                return (False, error)
            if itemType == XMPP_ITEM_TYPE.BLOCK_ITEM:
                tasks.append(block_tasks.RemoveBlockItemTask(jid, name))
                tasks.append(roster_tasks.AddRosterItemTask(jid, name, groups))
            elif itemType == XMPP_ITEM_TYPE.ROSTER_BLOCK_ITEM:
                tasks.append(block_tasks.RemoveBlockItemTask(jid, name))
#.........这里部分代码省略.........
开发者ID:webiumsk,项目名称:WoT,代码行数:101,代码来源:__init__.py

示例7: MessagesManager

class MessagesManager(ClientEventsHandler):
    __slots__ = ('__msgFilters', '__limits', '__chatSessions', '__muc', '__receivedTags', '__pending', '__cooldown')

    def __init__(self):
        super(MessagesManager, self).__init__()
        self.__msgFilters = None
        self.__limits = _MessageLimits()
        self.__chatSessions = ChatSessionsProvider(self.__limits)
        self.__muc = MUCProvider()
        self.__receivedTags = set()
        self.__pending = []
        self.__cooldown = XmppCooldownManager(self.__limits.getBroadcastCoolDown())
        self.channelsStorage.onRestoredFromCache += self.__cs_onChannelsRestoredFromCache
        return

    @storage_getter('channels')
    def channelsStorage(self):
        return None

    def clear(self):
        self.channelsStorage.onRestoredFromCache -= self.__cs_onChannelsRestoredFromCache
        self.__clearData()
        super(MessagesManager, self).clear()

    def registerHandlers(self):
        register = self.client().registerHandler
        register(_EVENT.DISCONNECTED, self.__handleDisconnected)
        register(_EVENT.LOGIN, self.__handleLogin)
        register(_EVENT.PRESENCE, self.__handlePresence)
        register(_EVENT.PRESENCE_ERROR, self.__handlePresenceError)
        register(_EVENT.IQ, self.__handleIQ)
        register(_EVENT.MESSAGE, self.__handleMessage)
        events = g_messengerEvents.users
        events.onUsersListReceived += self.__me_onUsersListReceived
        events.onUserActionReceived += self.__me_onUserActionReceived
        events.onUserStatusUpdated += self.__me_onUserStatusUpdated

    def unregisterHandlers(self):
        unregister = self.client().unregisterHandler
        unregister(_EVENT.DISCONNECTED, self.__handleDisconnected)
        unregister(_EVENT.LOGIN, self.__handleLogin)
        unregister(_EVENT.PRESENCE, self.__handlePresence)
        unregister(_EVENT.PRESENCE_ERROR, self.__handlePresenceError)
        unregister(_EVENT.IQ, self.__handleIQ)
        unregister(_EVENT.MESSAGE, self.__handleMessage)
        events = g_messengerEvents.users
        events.onUsersListReceived -= self.__me_onUsersListReceived
        events.onUserActionReceived -= self.__me_onUserActionReceived
        events.onUserStatusUpdated -= self.__me_onUserStatusUpdated

    def setFilters(self, msgFilters):
        self.__msgFilters = msgFilters

    def isInCooldown(self):
        return self.__cooldown.isInProcess(CLIENT_ACTION_ID.SEND_MESSAGE)

    @xmpp_query(QUERY_SIGN.DATABASE_ID, QUERY_SIGN.ACCOUNT_NAME)
    def startChatSession(self, dbID, name):
        self.__chatSessions.startSession(jid_entity.makeContactJID(dbID), name)
        return (True, None)

    def stopChatSession(self, jid):
        self.__chatSessions.stopSession(jid.getBareJID())

    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)

    def requestChatSessionHistory(self, jid):
        contactId = int(jid.getBareJID().getNode())
        self.__msgFilters.reset(contactId)
        self.__chatSessions.requestHistory(jid.getBareJID())

    @xmpp_query()
    def createUserRoom(self, name, password = ''):
        return self.__muc.createRoom(name, password=password)

    @xmpp_query()
    def joinToMUC(self, jid, password = ''):
        return self.__muc.joinToRoom(jid.getBareJID(), password=password)

    def leaveFromMUC(self, jid):
        self.__muc.leaveFromRoom(jid.getBareJID())

    def sendGroupChatMessage(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.__muc.sendMessage(jid_entity.ContactBareJID(jid), body, self.__msgFilters)
        self.__cooldown.process(CLIENT_ACTION_ID.SEND_MESSAGE)

#.........这里部分代码省略.........
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:101,代码来源:manager.py

示例8: ChatSessionHistoryRequester

class ChatSessionHistoryRequester(ClientHolder):

    def __init__(self, limits):
        super(ChatSessionHistoryRequester, self).__init__()
        self.__cooldown = XmppCooldownManager(limits.getBroadcastCoolDown())
        self.__limit = limits.getHistoryMaxLength()
        self.__iqID = ''
        self.__pool = []
        self.__history = []
        self.__callbackID = None
        self.__state = _HISTORY_RQ_STATE.FREE
        self.__isSuspend = True
        return

    @storage_getter('channels')
    def channelsStorage(self):
        return None

    def release(self):
        if self.__isSuspend:
            self.__isSuspend = False
            self.__doNextRequest()

    def suspend(self):
        if not self.__isSuspend:
            self.__isSuspend = True
            if self.__callbackID is not None:
                BigWorld.cancelCallback(self.__callbackID)
                self.__callbackID = None
            self.__state = _HISTORY_RQ_STATE.FREE
            self.__iqID = ''
            self.__history = []
        return

    def clear(self):
        if self.__callbackID is not None:
            BigWorld.cancelCallback(self.__callbackID)
            self.__callbackID = None
        self.__iqID = ''
        self.__pool = []
        self.__state = _HISTORY_RQ_STATE.FREE
        return

    def request(self, jid):
        if self.__state == _HISTORY_RQ_STATE.UNAVAILABLE:
            self.__setChannelHistory(jid)
            return
        if jid not in self.__pool:
            self.__pool.append(jid)
        if self.__isSuspend:
            return
        if self.__state == _HISTORY_RQ_STATE.FREE:
            self.__doNextRequest()

    def cancel(self, jid):
        if jid in self.__pool:
            if jid == self.__pool[0]:
                if self.__callbackID is not None:
                    BigWorld.cancelCallback(self.__callbackID)
                    self.__callbackID = None
                self.__state = _HISTORY_RQ_STATE.FREE
                self.__pool.pop(0)
                self.__iqID = ''
                self.__history = []
                self.__doNextRequest()
            else:
                self.__pool.remove(jid)
        return

    def handleIQ(self, iqID, iqType, tag):
        if iqID == self.__iqID:
            if iqType == IQ_TYPE.RESULT:
                self.__state = _HISTORY_RQ_STATE.RESULT
            elif iqType == IQ_TYPE.ERROR:
                self.__state = _HISTORY_RQ_STATE.UNAVAILABLE
                error = errors.createServerActionIQError(CLIENT_ACTION_ID.RQ_HISTORY, tag)
                if error:
                    g_messengerEvents.onErrorReceived(error)
                while self.__pool:
                    self.__setChannelHistory(self.__pool.pop(0))

            result = True
        else:
            result = False
        return result

    def addHistory(self, message):
        if not self.__state == _HISTORY_RQ_STATE.RESULT:
            raise AssertionError
            if message.body:
                self.__history.append(message)
            message.isFinalInHistory and self.__setChannelHistory(self.__pool.pop(0))
            self.__history = []
            self.__state = _HISTORY_RQ_STATE.FREE
            self.__doNextRequest()

    def __setChannelHistory(self, jid):
        channel = self.channelsStorage.getChannel(entities.XMPPChatChannelEntity(jid))
        if channel:
            g_messengerEvents.channels.onHistoryReceived(sorted(self.__history, key=operator.attrgetter('sentAt')), channel)
#.........这里部分代码省略.........
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:101,代码来源:chat_session.py

示例9: MessagesManager

class MessagesManager(ClientEventsHandler):
    __slots__ = ('__msgFilters', '__limits', '__chatSessions', '__receivedTags', '__pending')

    def __init__(self):
        super(MessagesManager, self).__init__()
        self.__msgFilters = None
        self.__limits = _MessageLimits()
        self.__chatSessions = _ChatSessions(self.__limits)
        self.__isInited = False
        self.__receivedTags = set()
        self.__pending = []
        self.__cooldown = XmppCooldownManager(self.__limits.getBroadcastCoolDown())
        self.channelsStorage.onRestoredFromCache += self.__cs_onChannelsRestoredFromCache

    @storage_getter('channels')
    def channelsStorage(self):
        return None

    def clear(self):
        self.channelsStorage.onRestoredFromCache -= self.__cs_onChannelsRestoredFromCache
        self.__clearData()
        super(MessagesManager, self).clear()

    def registerHandlers(self):
        register = self.client().registerHandler
        register(_EVENT.DISCONNECTED, self.__handleDisconnected)
        register(_EVENT.IQ, self.__handleIQ)
        register(_EVENT.MESSAGE, self.__handleMessage)
        events = g_messengerEvents.users
        events.onUsersListReceived += self.__me_onUsersListReceived
        events.onUserActionReceived += self.__me_onUserActionReceived
        events.onUserStatusUpdated += self.__me_onUserStatusUpdated

    def unregisterHandlers(self):
        unregister = self.client().unregisterHandler
        unregister(_EVENT.DISCONNECTED, self.__handleDisconnected)
        unregister(_EVENT.IQ, self.__handleIQ)
        unregister(_EVENT.MESSAGE, self.__handleMessage)
        events = g_messengerEvents.users
        events.onUsersListReceived -= self.__me_onUsersListReceived
        events.onUserActionReceived -= self.__me_onUserActionReceived
        events.onUserStatusUpdated -= self.__me_onUserStatusUpdated

    def setFilters(self, msgFilters):
        self.__msgFilters = msgFilters

    def isInCooldown(self):
        return self.__cooldown.isInProcess(CLIENT_ACTION_ID.SEND_MESSAGE)

    @xmpp_query(QUERY_SIGN.DATABASE_ID, QUERY_SIGN.ACCOUNT_NAME)
    def startChatSession(self, dbID, name):
        self.__chatSessions.startSession(makeContactJID(dbID), name)
        return (True, None)

    def stopChatSession(self, jid):
        self.__chatSessions.stopSession(ContactBareJID(jid))

    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(ContactBareJID(jid), body, self.__msgFilters)
        self.__cooldown.process(CLIENT_ACTION_ID.SEND_MESSAGE)

    def requestChatHistory(self, jid):
        self.__chatSessions.requestHistory(ContactBareJID(jid))

    def __clearData(self):
        self.__chatSessions.clear()
        self.__receivedTags.clear()
        self.__pending = []

    def __handleDisconnected(self, reason, description):
        self.__clearData()
        channels = self.channelsStorage.getChannelsByCriteria(find_criteria.XMPPChannelFindCriteria())
        for channel in channels:
            channel.setJoined(False)

    def __handleIQ(self, iqID, iqType, pyGlooxTag):
        self.__chatSessions.handleIQ(iqID, iqType, pyGlooxTag)

    def __handleMessage(self, _, msgType, body, jid, pyGlooxTag):
        if msgType not in MESSAGE_TYPE_TO_ATTR:
            return
        message = MessageHandler(MESSAGE_TYPE_TO_ATTR[msgType]).handleTag(pyGlooxTag)
        if not message.accountDBID:
            g_logOutput.error(CLIENT_LOG_AREA.MESSAGE, 'Can not find sender info', pyGlooxTag.getXml())
            return
        if body:
            message.body = self.__msgFilters.chainIn(message.accountDBID, body)
        if not _REQUIRED_USER_TAGS.issubset(self.__receivedTags):
            self.__pending.insert(0, (msgType, (jid, message)))
            return
        if msgType == MESSAGE_TYPE.CHAT or msgType == MESSAGE_TYPE.NORMAL and message.isHistory():
            self.__chatSessions.addMessage(jid, message)

    def __me_onUsersListReceived(self, tags):
#.........这里部分代码省略.........
开发者ID:kblw,项目名称:wot_client,代码行数:101,代码来源:messages.py


注:本文中的messenger.proto.xmpp.XmppCooldownManager.XmppCooldownManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。