summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/UIInterfaces/ChatWindow.h')
-rw-r--r--Swift/Controllers/UIInterfaces/ChatWindow.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h
index 2636bda..3aa1c7e 100644
--- a/Swift/Controllers/UIInterfaces/ChatWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatWindow.h
@@ -45,9 +45,11 @@ namespace Swift {
class ChatMessage {
public:
ChatMessage() {}
+
ChatMessage(const std::string& text) {
append(std::make_shared<ChatTextMessagePart>(text));
}
+
void append(const std::shared_ptr<ChatMessagePart>& part) {
parts_.push_back(part);
}
@@ -56,6 +58,10 @@ namespace Swift {
return parts_;
}
+ void setParts(const std::vector<std::shared_ptr<ChatMessagePart> >& parts) {
+ parts_ = parts;
+ }
+
void setFullMessageHighlightAction(const HighlightAction& action) {
fullMessageHighlightAction_ = action;
}
@@ -65,21 +71,17 @@ namespace Swift {
}
bool isMeCommand() const {
- bool isMeCommand = false;
- if (!parts_.empty()) {
- std::shared_ptr<ChatTextMessagePart> textPart = std::dynamic_pointer_cast<ChatTextMessagePart>(parts_[0]);
- if (textPart) {
- if (boost::starts_with(textPart->text, "/me ")) {
- isMeCommand = true;
- }
- }
- }
- return isMeCommand;
+ return isMeCommand_;
+ }
+
+ void setIsMeCommand(bool isMeCommand) {
+ isMeCommand_ = isMeCommand;
}
private:
std::vector<std::shared_ptr<ChatMessagePart> > parts_;
HighlightAction fullMessageHighlightAction_;
+ bool isMeCommand_ = false;
};
class ChatTextMessagePart : public ChatMessagePart {