Poodletooth-iLand/otp/chat/TalkHandle.py

44 lines
1.7 KiB
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
from otp.avatar.AvatarHandle import AvatarHandle
class TalkHandle(AvatarHandle):
def __init__(self, doId, message):
self.avatarId = doId
self.avatarName = None
self.accountId = None
self.accountName = None
self.addMessageInfo(message)
return
def getName(self):
return self.avatarName
def isUnderstandable(self):
return False
def isOnline(self):
return False
def addMessageInfo(self, message):
if self.avatarId == message.getSenderAvatarId():
if not self.avatarName and message.getSenderAvatarName():
self.avatarName = message.getSenderAvatarName()
if not self.accountId and message.getSenderAccountId():
self.accountId = message.getSenderAccountId()
if not self.accountName and message.getSenderAccountName():
self.accountName = message.getSenderAccountName()
elif self.avatarId == message.getReceiverAvatarId():
if not self.avatarName and message.getReceiverAvatarName():
self.avatarName = message.getReceiverAvatarName()
if not self.accountId and message.getReceiverAccountId():
self.accountId = message.getReceiverAccountId()
if not self.accountName and message.getReceiverAccountName():
self.accountName = message.getReceiverAccountName()
def setTalkWhisper(self, fromAV, fromAC, avatarName, chat, mods, flags):
2015-04-07 13:43:25 -05:00
if base.localAvatar.isIgnored(fromAV):
return
2015-03-03 16:10:12 -06:00
newText, scrubbed = localAvatar.scrubTalk(chat, mods)
base.talkAssistant.receiveWhisperTalk(fromAV, avatarName, fromAC, None, self.avatarId, self.getName(), newText, scrubbed)
return