public void onTokenizedMessagesReceived(ChatTokenizedMessage[] messages) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < messages.length; ++i) { ChatTokenizedMessage msg = messages[i]; sb.append(msg.displayName).append(": "); for (int t = 0; t < msg.tokenList.length; ++t) { ChatMessageToken token = msg.tokenList[t]; switch (token.type) { case TTV_CHAT_MSGTOKEN_TEXT: { ChatTextMessageToken mt = (ChatTextMessageToken) token; sb.append(mt.text); break; } case TTV_CHAT_MSGTOKEN_IMAGE: { // ChatImageMessageToken mt = (ChatImageMessageToken)token; sb.append("[emoticon]"); break; } } } sb.append("\n"); System.out.println(sb.toString()); } }
/** * Add a character to the message buffer * * @param c */ public void addChar(char c) { if (messageToSend.length() < 255) messageToSend.append(c); }