Exemplo n.º 1
0
    def __onPeriodicTimer(self):
        self.__timerID = BigWorld.callback(_PERIODIC_TIMER_SEC,
                                           self.__onPeriodicTimer)
        currTime = BigWorld.time()
        reqs = self.__reqs
        if reqs:
            toTimeout = []
            for reqID, descr in reqs.iteritems():
                if descr[0] <= currTime:
                    toTimeout.append(reqID)

            for reqID in toTimeout:
                callback = reqs.pop(reqID)[1]
                if callback is not None:
                    try:
                        callback(
                            False,
                            makeArgs(
                                int32Arg1=MESSENGER_ACTION_ERRORS.TIMEOUT))
                    except:
                        LOG_CURRENT_EXCEPTION()

        reqs = self.__nicknameReqs
        if reqs:
            delay, maxNum = _NICKNAME_BY_ID_REQ_CONFIG
            maxNum = int(maxNum * _PERIODIC_TIMER_SEC)
            maxNum = min(maxNum, len(reqs))
            send = BigWorld.player().base.messenger_onActionByClient
            while maxNum and reqs[0][1] <= currTime - delay:
                maxNum -= 1
                send(MESSENGER_ACTION_IDS.GET_NICKNAME_BY_ID, 0,
                     makeArgs(int64Arg1=reqs.popleft()[0]))

        return
Exemplo n.º 2
0
 def requestUserlistByName(self, name, maxCount, callback):
     reqID = self.__addRequest(MESSENGER_TIMEOUTS.GET_USERLIST_BY_NAME,
                               partial(_onUserlistResult, callback))
     BigWorld.player().base.messenger_onActionByClient(
         MESSENGER_ACTION_IDS.GET_USERLIST_BY_NAME, reqID,
         makeArgs(int32Arg1=maxCount, strArg1=name))
Exemplo n.º 3
0
 def getInitParams(self):
     BigWorld.player().base.messenger_onActionByClient(
         MESSENGER_ACTION_IDS.GET_INIT_PARAMS, 0, makeArgs())
Exemplo n.º 4
0
 def syncClanChatChannel(self, callback):
     reqID = self.__addRequest(MESSENGER_TIMEOUTS.SYNC_CLAN_CHAT_CHANNEL,
                               partial(_onInt32Result, callback))
     BigWorld.player().base.messenger_onActionByClient(
         MESSENGER_ACTION_IDS.SYNC_CLAN_CHAT_CHANNEL, reqID, makeArgs())
Exemplo n.º 5
0
 def requestXmppPassword(self, callback):
     reqID = self.__addRequest(MESSENGER_TIMEOUTS.XMPP_GET_PASSWORD,
                               partial(_onStringResult, callback))
     BigWorld.player().base.messenger_onActionByClient(
         MESSENGER_ACTION_IDS.XMPP_GET_PASSWORD, reqID, makeArgs())