def processWgncNotification(self, notifID, item): def __updateAfterAction(): apps = self._cache[_CACHE_KEYS.APPS] or set() apps.discard(item.getClanId()) self._cache[_CACHE_KEYS.APPS] = apps count = self._vitalWebInfo[SYNC_KEYS.APPS] if count: self.__changeWebInfo(SYNC_KEYS.APPS, count - 1, 'onAccountAppsReceived') if item.getType() == WGNC_DATA_PROXY_TYPE.CLAN_INVITE: invites = self._cache[_CACHE_KEYS.INVITES] or set() invites.add(item.getClanId()) self._cache[_CACHE_KEYS.INVITES] = invites count = item.getActiveInvitesCount() if count != self._vitalWebInfo[SYNC_KEYS.INVITES]: self.__changeWebInfo(SYNC_KEYS.INVITES, count, 'onAccountInvitesReceived') self._syncState |= SYNC_KEYS.INVITES elif item.getType() == WGNC_DATA_PROXY_TYPE.CLAN_APP_ACCEPTED: __updateAfterAction() if self.isInClan(): showClanJoinAward(self.getClanAbbrev(), self.getClanName(), self.getClanDbID()) elif item.getType() == WGNC_DATA_PROXY_TYPE.CLAN_APP_DECLINED: __updateAfterAction() if self.isInClan(): self.getClanDossier().processWgncNotification(notifID, item)
def handleAction(self, model, entityID, action): super(_AcceptClanInviteHandler, self).handleAction(model, entityID, action) entity = model.getNotification(self.getNotType(), entityID).getEntity() clanName = entity.getClanName() clanTag = entity.getClanTag() result = yield showAcceptClanInviteDialog(clanName, clanTag) if result: reqResult = yield g_clanCtrl.sendRequest(clan_ctxs.AcceptInviteCtx(self._getInviteID(model, entityID)), allowDelay=True) if reqResult.isSuccess(): showClanJoinAward(clanName, clanTag, entity.getClanId())
def handleAction(self, model, entityID, action): super(_AcceptClanInviteHandler, self).handleAction(model, entityID, action) entity = model.getNotification(self.getNotType(), entityID).getEntity() clanName = entity.getClanName() clanTag = entity.getClanTag() result = yield showAcceptClanInviteDialog(clanName, clanTag) if result: reqResult = yield g_clanCtrl.sendRequest(clan_ctxs.AcceptInviteCtx( self._getInviteID(model, entityID)), allowDelay=True) if reqResult.isSuccess(): showClanJoinAward(clanName, clanTag, entity.getClanId())
def _resyncBwInfo(self, clanDbID = 0, clanBwInfo = None): needToRaiseEvent = self._clanDbID != clanDbID or self._clanBwInfo != clanBwInfo hasEnteredClan = False if self._clanDbID != clanDbID: self._syncState = 0 self._vitalWebInfo[SYNC_KEYS.CLAN_INFO] = None self._vitalWebInfo[SYNC_KEYS.INVITES] = None self._vitalWebInfo[SYNC_KEYS.APPS] = None if not self._clanDbID and clanDbID: hasEnteredClan = True self._clanDbID, self._clanBwInfo = clanDbID, clanBwInfo if needToRaiseEvent: self._clansCtrl.notify('onAccountClanProfileChanged', self) if hasEnteredClan: showClanJoinAward(self.getClanAbbrev(), self.getClanName(), self.getClanDbID()) return
def show(self, notID): showClanJoinAward(self.getClanTag(), self.getClanName(), self.getClanId()) super(ClanAppAcceptedItem, self).show(notID)
def __acceptedResponseCallback(result): if result.isSuccess(): showClanJoinAward(clanTag, clanName, clanInfo.getDbID())