def __systemMessageTimeProcessor(self, actionData): isSystemMessage = CHAT_ACTIONS[actionData['action']] in ( CHAT_ACTIONS.personalSysMessage, CHAT_ACTIONS.sysMessage) if isSystemMessage: if actionData.has_key('data'): messageData = actionData['data'] messageType = messageData['type'] if 'created_at' in messageData: messageData['created_at'] = tm.makeLocalServerDatetime( messageData['created_at']) if 'finished_at' in messageData: messageData['finished_at'] = tm.makeLocalServerDatetime( messageData['finished_at']) if 'started_at' in messageData: messageData['started_at'] = tm.makeLocalServerDatetime( messageData['started_at']) if messageType == SYS_MESSAGE_TYPE.serverReboot.index(): messageData['data'] = tm.makeLocalServerDatetime( messageData['data']) elif messageType == SYS_MESSAGE_TYPE.battleResults.index(): messageData['data'][ 'arenaCreateTime'] = tm.makeLocalServerTime( messageData['data']['arenaCreateTime']) elif messageType == SYS_MESSAGE_TYPE.goldReceived.index(): messageData['data']['date'] = tm.makeLocalServerTime( messageData['data']['date']) elif messageType in ( SYS_MESSAGE_TYPE.accountTypeChanged.index(), SYS_MESSAGE_TYPE.premiumBought.index(), SYS_MESSAGE_TYPE.premiumExtended.index(), SYS_MESSAGE_TYPE.premiumExpired.index()): if 'expiryTime' in messageData['data']: messageData['data'][ 'expiryTime'] = tm.makeLocalServerTime( messageData['data']['expiryTime'])
def __systemMessageTimeProcessor(self, actionData): isSystemMessage = CHAT_ACTIONS[actionData['action']] in (CHAT_ACTIONS.personalSysMessage, CHAT_ACTIONS.sysMessage) if isSystemMessage: if actionData.has_key('data'): messageData = actionData['data'] messageType = messageData['type'] if 'created_at' in messageData: messageData['created_at'] = tm.makeLocalServerDatetime(messageData['created_at']) if 'finished_at' in messageData: messageData['finished_at'] = tm.makeLocalServerDatetime(messageData['finished_at']) if 'started_at' in messageData: messageData['started_at'] = tm.makeLocalServerDatetime(messageData['started_at']) if messageType == SYS_MESSAGE_TYPE.serverReboot.index(): messageData['data'] = tm.makeLocalServerDatetime(messageData['data']) elif messageType == SYS_MESSAGE_TYPE.battleResults.index(): for value in messageData['data'].itervalues(): value['arenaCreateTime'] = tm.makeLocalServerTime(value['arenaCreateTime']) elif messageType == SYS_MESSAGE_TYPE.goldReceived.index(): messageData['data']['date'] = tm.makeLocalServerTime(messageData['data']['date']) elif messageType in (SYS_MESSAGE_TYPE.accountTypeChanged.index(), SYS_MESSAGE_TYPE.premiumBought.index(), SYS_MESSAGE_TYPE.premiumExtended.index(), SYS_MESSAGE_TYPE.premiumExpired.index()): if 'expiryTime' in messageData['data']: messageData['data']['expiryTime'] = tm.makeLocalServerTime(messageData['data']['expiryTime'])
def __inviteDataTimeProcessor(self, actionData): isInviteAction = CHAT_ACTIONS[actionData['action']] in (CHAT_ACTIONS.createInvite, CHAT_ACTIONS.receiveInvite, CHAT_ACTIONS.receiveArchiveInvite) if isInviteAction: if actionData.has_key('data'): inviteData = actionData['data'] if 'sent_at' in inviteData: inviteData['sent_at'] = tm.utcToLocalDatetime(tm.makeLocalServerDatetime(inviteData['sent_at'])) if 'received_at' in inviteData: inviteData['received_at'] = tm.utcToLocalDatetime(tm.makeLocalServerDatetime(inviteData['received_at'])) if 'processed_at' in inviteData: inviteData['processed_at'] = tm.utcToLocalDatetime(tm.makeLocalServerDatetime(inviteData['processed_at']))