func NewIMessage(parent *ChatWindow, msg *prot.Message) IMessage { contentType := msg.GetContentType() //TODO: Support content type switch contentType { case prot.ContentType_NONE: return handleTextMessage(parent, msg, msg.GetText()) case prot.ContentType_IMAGE: return handleImagePreviewMessage(parent, msg) case prot.ContentType_VIDEO: return handleImagePreviewMessage(parent, msg) case prot.ContentType_STICKER: return handleStickerMessage(parent, msg) case prot.ContentType_AUDIO: return handleTextPreviewMessage(parent, msg, "Content Type: Audio", ".mp4") case prot.ContentType_FILE: return handleTextPreviewMessage(parent, msg, "Content Type: File", "") default: return handleTextMessage(parent, msg, contentType.String()) } }