コード例 #1
0
 def sendInvites(self, accountsToInvite, comment):
     self.as_showWaitingS(WAITING.CLANS_INVITES_SEND, {})
     accountsToInvite = [int(userDbID) for userDbID in accountsToInvite]
     ctx = clan_ctx.CreateInviteCtx(self.__clanDbID, accountsToInvite,
                                    comment)
     self.as_onReceiveSendInvitesCooldownS(ctx.getCooldown())
     result = yield self.clansCtrl.sendRequest(ctx)
     successAccounts = [
         item.getAccountDbID() for item in ctx.getDataObj(result.data)
     ]
     failedAccounts = set(accountsToInvite) - set(successAccounts)
     if len(accountsToInvite) > 1:
         if successAccounts:
             accountNames = [
                 self.getUserName(userDbID) for userDbID in successAccounts
             ]
             SystemMessages.pushMessage(
                 clans_fmts.getInvitesSentSysMsg(accountNames))
         if failedAccounts:
             accountNames = [
                 self.getUserName(userDbID) for userDbID in failedAccounts
             ]
             SystemMessages.pushMessage(
                 clans_fmts.getInvitesNotSentSysMsg(accountNames),
                 type=SystemMessages.SM_TYPE.Error)
     else:
         showClanInviteSystemMsg(self.getUserName(accountsToInvite[0]),
                                 result.isSuccess(), result.getCode())
     self.as_hideWaitingS()
コード例 #2
0
 def userAddToClan(self):
     self.as_showWaitingS(backport.msgid(R.strings.waiting.clans.invites.send()), {})
     profile = self.webCtrl.getAccountProfile()
     context = CreateInviteCtx(profile.getClanDbID(), [self.__databaseID])
     result = yield self.webCtrl.sendRequest(context, allowDelay=True)
     showClanInviteSystemMsg(self.__userName, result.isSuccess(), result.getCode(), result.data)
     self.__updateAddToClanBtn()
     self.as_hideWaitingS()
コード例 #3
0
ファイル: profileprofilewindow.py プロジェクト: Difrex/wotsdk
 def userAddToClan(self):
     self.as_showWaitingS(WAITING.CLANS_INVITES_SEND, {})
     profile = g_clanCtrl.getAccountProfile()
     context = CreateInviteCtx(profile.getClanDbID(), [self.__databaseID])
     result = yield g_clanCtrl.sendRequest(context, allowDelay=True)
     showClanInviteSystemMsg(self.__userName, result.isSuccess(), result.getCode())
     self.__updateAddToClanBtn()
     self.as_hideWaitingS()
コード例 #4
0
 def userAddToClan(self):
     self.as_showWaitingS(WAITING.CLANS_INVITES_SEND, {})
     profile = g_clanCtrl.getAccountProfile()
     context = CreateInviteCtx(profile.getClanDbID(), [self.__databaseID])
     result = yield g_clanCtrl.sendRequest(context, allowDelay=True)
     showClanInviteSystemMsg(self.__userName, result.isSuccess(), result.getCode())
     self.__updateAddToClanBtn()
     self.as_hideWaitingS()
コード例 #5
0
    def _onListItemsUpdated(self, paginator, items):
        currentPaginator = self._getCurrentPaginator()
        if currentPaginator == paginator:
            self.dataProvider.refreshItems(items)
        for item in items:
            status = item.getStatus()
            msgArgs = None
            if status == CLAN_INVITE_STATES.EXPIRED_RESENT or status == CLAN_INVITE_STATES.DECLINED_RESENT:
                msgArgs = (True, None)
            elif status == CLAN_INVITE_STATES.ERROR:
                msgArgs = (False, item.getStatusCode())
            if msgArgs:
                showClanInviteSystemMsg(item.getAccountName(), *msgArgs)

        return
コード例 #6
0
    def _onListItemsUpdated(self, paginator, items):
        currentPaginator = self._getCurrentPaginator()
        if currentPaginator == paginator:
            self.dataProvider.refreshItems(items)
        for item in items:
            status = item.getStatus()
            msgArgs = None
            if status == CLAN_INVITE_STATES.EXPIRED_RESENT or status == CLAN_INVITE_STATES.DECLINED_RESENT:
                msgArgs = (True, None)
            elif status == CLAN_INVITE_STATES.ERROR:
                msgArgs = (False, item.getStatusCode())
            if msgArgs:
                showClanInviteSystemMsg(item.getAccountName(), *msgArgs)

        return
コード例 #7
0
 def sendInvites(self, accountsToInvite, comment):
     self.as_showWaitingS(WAITING.CLANS_INVITES_SEND, {})
     accountsToInvite = [ int(userDbID) for userDbID in accountsToInvite ]
     ctx = clan_ctx.CreateInviteCtx(self.__clanDbID, accountsToInvite, comment)
     self.as_onReceiveSendInvitesCooldownS(ctx.getCooldown())
     result = yield self.clansCtrl.sendRequest(ctx)
     successAccounts = [ item.getAccountDbID() for item in ctx.getDataObj(result.data) ]
     failedAccounts = set(accountsToInvite) - set(successAccounts)
     if len(accountsToInvite) > 1:
         if successAccounts:
             accountNames = [ self.getUserName(userDbID) for userDbID in successAccounts ]
             SystemMessages.pushMessage(clans_fmts.getInvitesSentSysMsg(accountNames))
         if failedAccounts:
             accountNames = [ self.getUserName(userDbID) for userDbID in failedAccounts ]
             SystemMessages.pushMessage(clans_fmts.getInvitesNotSentSysMsg(accountNames), type=SystemMessages.SM_TYPE.Error)
     else:
         showClanInviteSystemMsg(self.getUserName(accountsToInvite[0]), result.isSuccess(), result.getCode())
     self.as_hideWaitingS()
コード例 #8
0
 def sendInvites(self, accountsToInvite, comment):
     self.as_showWaitingS(backport.msgid(R.strings.waiting.clans.invites.send()), {})
     accountsToInvite = [ int(userDbID) for userDbID in accountsToInvite ]
     ctx = clan_ctx.CreateInviteCtx(self.__clanDbID, accountsToInvite, comment)
     self.as_onReceiveSendInvitesCooldownS(ctx.getCooldown())
     result = yield self.webCtrl.sendRequest(ctx)
     expectedCodes = (ResponseCodes.ACCOUNT_ALREADY_APPLIED, ResponseCodes.ACCOUNT_ALREADY_INVITED, ResponseCodes.NO_ERRORS)
     if result.getCode() in expectedCodes:
         successAccounts = [ item.getAccountDbID() for item in ctx.getDataObj(result.data) ]
         failedAccounts = set(accountsToInvite) - set(successAccounts)
     else:
         successAccounts = []
         failedAccounts = accountsToInvite
     if len(accountsToInvite) > 1:
         if successAccounts:
             accountNames = [ self.getUserName(userDbID) for userDbID in successAccounts ]
             SystemMessages.pushMessage(clans_fmts.getInvitesSentSysMsg(accountNames))
         if failedAccounts:
             accountNames = [ self.getUserName(userDbID) for userDbID in failedAccounts ]
             SystemMessages.pushMessage(clans_fmts.getInvitesNotSentSysMsg(accountNames), type=SystemMessages.SM_TYPE.Error)
     else:
         showClanInviteSystemMsg(self.getUserName(accountsToInvite[0]), result.isSuccess(), result.getCode(), result.data)
     self.as_hideWaitingS()
コード例 #9
0
 def sendClanInvite(self):
     profile = self.clanCtrl.getAccountProfile()
     userName = self.userName
     context = CreateInviteCtx(profile.getClanDbID(), [self.databaseID])
     result = yield self.clanCtrl.sendRequest(context, allowDelay=True)
     showClanInviteSystemMsg(userName, result.isSuccess(), result.getCode(), result.data)
コード例 #10
0
 def sendClanInvite(self):
     profile = g_clanCtrl.getAccountProfile()
     userName = self.userName
     context = CreateInviteCtx(profile.getClanDbID(), [self.databaseID])
     result = yield g_clanCtrl.sendRequest(context, allowDelay=True)
     showClanInviteSystemMsg(userName, result.isSuccess(), result.getCode())