summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-13 18:43:51 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-14 09:41:14 (GMT)
commita83ddaace71688abc7f2b6a6dd1b821f2194e890 (patch)
treee654cefc1ac259296519230e78821872b9e993d7 /Swift/Controllers/UIInterfaces
parentb9ad76af13fc1d253845e027f91f22039bf14f9c (diff)
downloadswift-a83ddaace71688abc7f2b6a6dd1b821f2194e890.zip
swift-a83ddaace71688abc7f2b6a6dd1b821f2194e890.tar.bz2
Fix bug of /me commands not being shown as actions
Test-Information: Added a test case that verifies this behavior. This test case succeeded before the refactoring in 74e5131 and now succeeds again. Tested Swift UI 1-to-1 and MUC messages with /me commands. Tested on OS X 10.11.4 with open-source clang. Change-Id: I270a0b4e2ddc595919646bddcc5e1f27074c9e1f
Diffstat (limited to 'Swift/Controllers/UIInterfaces')
-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 {