chat clean up
This commit is contained in:
parent
3d41e250e3
commit
589f014a2e
3 changed files with 11 additions and 11 deletions
|
@ -14,10 +14,7 @@ class WhiteList:
|
|||
self.numWords = len(self.words)
|
||||
|
||||
def cleanText(self, text):
|
||||
if type(text) == bytes:
|
||||
text = text.decode('utf-8').strip('.,?!')
|
||||
else:
|
||||
text = text.strip('.,?!')
|
||||
text = text.strip('.,?!')
|
||||
text = text.lower().encode('utf-8')
|
||||
return text
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame):
|
|||
flag = 1
|
||||
|
||||
for word in words:
|
||||
if word == '' or self.whiteList.isWord(word.encode('utf-8')) or not base.cr.whiteListChatEnabled:
|
||||
if word == '' or self.whiteList.isWord(word) or not base.cr.whiteListChatEnabled:
|
||||
newwords.append(word)
|
||||
else:
|
||||
if self.checkBeforeSend:
|
||||
|
@ -206,7 +206,7 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame):
|
|||
|
||||
if not strict:
|
||||
lastword = words[-1]
|
||||
if lastword == '' or self.whiteList.isPrefix(lastword.encode('utf-8')) or not base.cr.whiteListChatEnabled:
|
||||
if lastword == '' or self.whiteList.isPrefix(lastword) or not base.cr.whiteListChatEnabled:
|
||||
newwords[-1] = lastword
|
||||
elif flag:
|
||||
newwords[-1] = '\x01WLDisplay\x01' + lastword + '\x02'
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import os
|
||||
import datetime
|
||||
from panda3d.core import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed import DistributedObject
|
||||
from direct.showbase.DirectObject import DirectObject
|
||||
from otp.chat.WhiteList import WhiteList
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
|
||||
class TTWhiteList(WhiteList, DirectObject):
|
||||
RedownloadTaskName = 'RedownloadWhitelistTask'
|
||||
WhitelistBaseDir = ConfigVariableString('whitelist-base-dir', '').value
|
||||
WhitelistStageDir = ConfigVariableString('whitelist-stage-dir', 'whitelist').value
|
||||
|
@ -14,6 +13,7 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
|
|||
WhitelistFileName = ConfigVariableString('whitelist-filename', 'twhitelist.dat').value
|
||||
|
||||
def __init__(self):
|
||||
DirectObject.__init__(self)
|
||||
self.redownloadingWhitelist = False
|
||||
self.startRedownload = datetime.datetime.now()
|
||||
self.endRedownload = datetime.datetime.now()
|
||||
|
@ -36,10 +36,13 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
|
|||
self.accept('updateWhitelist', self.handleNewWhitelist)
|
||||
|
||||
def unload(self):
|
||||
self.ignore('updateWhitelist')
|
||||
self.removeDownloadingTextTask()
|
||||
if self.WhitelistOverHttp:
|
||||
self.ignore('updateWhitelist')
|
||||
self.removeDownloadingTextTask()
|
||||
|
||||
def redownloadWhitelist(self):
|
||||
if not self.WhitelistOverHttp:
|
||||
return
|
||||
self.percentDownload = 0.0
|
||||
self.notify.info('starting redownloadWhitelist')
|
||||
self.startRedownload = datetime.datetime.now()
|
||||
|
|
Loading…
Reference in a new issue