code: protected void processReceivedMessage (ChatMessage msg, String localtype)
      {
          String autoResponse = null;
          Name speaker = null;
          Name speakerDisplay = null;
          byte mode = (byte)-1;
  
          // figure out if the message was triggered by another user
          if (msg instanceof UserMessage) {
              UserMessage umsg = (UserMessage)msg;
              speaker = umsg.speaker;
              speakerDisplay = umsg.getSpeakerDisplayName();
              mode = umsg.mode;
  
          } else if (msg instanceof UserSystemMessage) {
              speaker = ((UserSystemMessage)msg).speaker;
              speakerDisplay = speaker;
          }
  
          // Translate and timestamp the message. This would happen during dispatch but we
          // need to do it ahead of filtering.
          setClientInfo(msg, localtype);
  
          // if there was an originating speaker, see if we want to hear it
          if (speaker != null) {
              if (shouldFilter(msg) && (msg.message = filter(msg.message, speaker, false)) == null) {
                  return;
              }
  
              if (USER_CHAT_TYPE.equals(localtype) &&
                  mode == ChatCodes.DEFAULT_MODE) {
                  // if it was a tell, add the speaker as a chatter
                  addChatter(speaker);
  
                  // note whether or not we have an auto-response
                  BodyObject self = (BodyObject)_ctx.getClient().getClientObject();
                  if (!StringUtil.isBlank(self.awayMessage)) {
                      autoResponse = self.awayMessage;
                  }
              }
          }
  
          // and send it off!
          dispatchMessage(msg, localtype);
  
          // if we auto-responded, report as much
          if (autoResponse != null) {
              String amsg = MessageBundle.tcompose(
                  "m.auto_responded", speakerDisplay, autoResponse);
              displayFeedback(_bundle, amsg);
          }
      }
docs: Processes and dispatches the specified chat message.