Esempio n. 1
0
    def sendChatString(self, message):
        """
        message is a string.

        Send chat message update
        """
        assert self.notify.debugStateCall(self)
        chatFlags = CFSpeech | CFTimeout

        if base.cr.wantSwitchboardHacks:
            from otp.switchboard import badwordpy
            badwordpy.init("", "")
            message = badwordpy.scrub(message)

        if isThought(message):
            # If it's intended to be a thought message, send it as
            # one.  This means we don't include a timeout.
            message = removeThoughtPrefix(message)
            chatFlags = CFThought

        #messenger.send("chatUpdate", [message, chatFlags])
        #base.chatAssistant.sendAvatarOpenTypedChat(message)

        messenger.send(NormalChatEvent)
        self.announceChat()
Esempio n. 2
0
 def sendChatString(self, message):
     chatFlags = CFSpeech | CFTimeout
     if base.cr.wantSwitchboardHacks:
         from otp.switchboard import badwordpy
         badwordpy.init('', '')
         message = badwordpy.scrub(message)
     if isThought(message):
         message = removeThoughtPrefix(message)
         chatFlags = CFThought
     messenger.send(NormalChatEvent)
     self.announceChat()
 def b_setChat(self, chatString, chatFlags):
     if self.cr.wantMagicWords and len(chatString) > 0 and chatString[0] == '~':
         messenger.send('magicWord', [chatString])
     else:
         if base.config.GetBool('want-chatfilter-hacks', 0):
             if base.config.GetBool('want-chatfilter-drop-offending', 0):
                 if badwordpy.test(chatString):
                     return
             else:
                 chatString = badwordpy.scrub(chatString)
         messenger.send('wakeup')
         self.setChatAbsolute(chatString, chatFlags)
         self.d_setChat(chatString, chatFlags)
 def b_setChat(self, chatString, chatFlags):
     if self.cr.wantMagicWords and len(chatString) > 0 and chatString[0] == "~":
         messenger.send("magicWord", [chatString])
     else:
         if config.GetBool("want-chatfilter-hacks", 0):
             if config.GetBool("want-chatfilter-drop-offending", 0):
                 if badwordpy.test(chatString):
                     return
             else:
                 chatString = badwordpy.scrub(chatString)
         messenger.send("wakeup")
         self.setChatAbsolute(chatString, chatFlags)
         self.d_setChat(chatString, chatFlags)
Esempio n. 5
0
 def b_setChat(self, chatString, chatFlags):
     magicWordPrefix = '~'
     magicWordActivatorIndex = base.settings.getInt('game', 'magic-word-activator', 0)
     MW_PREFIX_ALLOWED = ['~', '?', '/', '<', ':', ';']
     if not config.GetBool('exec-chat', 0):
         MW_PREFIX_ALLOWED.append('>')
     if 0 <= magicWordActivatorIndex <= len(MW_PREFIX_ALLOWED) - 1:
         magicWordPrefix = MW_PREFIX_ALLOWED[magicWordActivatorIndex]
     if self.cr.wantMagicWords and len(chatString) > 0 and chatString[0] == magicWordPrefix:
         messenger.send('magicWord', [chatString])
     else:
         if base.config.GetBool('want-chatfilter-hacks', 0):
             if base.config.GetBool('want-chatfilter-drop-offending', 0):
                 if badwordpy.test(chatString):
                     return
             else:
                 chatString = badwordpy.scrub(chatString)
         messenger.send('wakeup')
         self.setChatAbsolute(chatString, chatFlags)
         self.d_setChat(chatString, chatFlags)
Esempio n. 6
0
    def b_setChat(self, chatString, chatFlags):
        # Is this a magic word? All magic words begin with a ~
        if (self.cr.wantMagicWords and
            (len(chatString) > 0) and (chatString[0] == "~")):
            # Tell the magic word manager we just said a magic word
            messenger.send("magicWord", [chatString])
        else:
            # HACK for demo - Outgoing dirty word check.  NEVER RELY ON THIS.
            if base.config.GetBool('want-chatfilter-hacks',0):
                if base.config.GetBool('want-chatfilter-drop-offending',0):
                    if badwordpy.test(chatString):
                        return
                else:
                    chatString = badwordpy.scrub(chatString)

            # Local
            # avoid having to check if this is the local toon
            messenger.send("wakeup")
            self.setChatAbsolute(chatString, chatFlags)
            # Distributed
            self.d_setChat(chatString, chatFlags)