From 90d05f4fc34d5ee81593ffacd6333a3ee3787072 Mon Sep 17 00:00:00 2001 From: Richard Maudsley Date: Wed, 22 Jan 2014 09:11:05 +0000 Subject: Preparing to add ChatMessage highlight rules. Change-Id: I71419e255b821dfaec9a8f23316f927193e975c5 diff --git a/Swift/Controllers/Chat/ChatMessageParser.cpp b/Swift/Controllers/Chat/ChatMessageParser.cpp index ce184ea..8449901 100644 --- a/Swift/Controllers/Chat/ChatMessageParser.cpp +++ b/Swift/Controllers/Chat/ChatMessageParser.cpp @@ -20,7 +20,8 @@ namespace Swift { - ChatMessageParser::ChatMessageParser(const std::map& emoticons) : emoticons_(emoticons) { + ChatMessageParser::ChatMessageParser(const std::map& emoticons, const std::vector& highlightRules) + : emoticons_(emoticons), highlightRules_(highlightRules) { } diff --git a/Swift/Controllers/Chat/ChatMessageParser.h b/Swift/Controllers/Chat/ChatMessageParser.h index c9b9456..dd0d1bd 100644 --- a/Swift/Controllers/Chat/ChatMessageParser.h +++ b/Swift/Controllers/Chat/ChatMessageParser.h @@ -14,10 +14,11 @@ namespace Swift { class ChatMessageParser { public: - ChatMessageParser(const std::map& emoticons); + ChatMessageParser(const std::map& emoticons, const std::vector& highlightRules); ChatWindow::ChatMessage parseMessageBody(const std::string& body); private: std::map emoticons_; + std::vector highlightRules_; }; } diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index a7e8b73..6c5d6d9 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -155,7 +155,7 @@ ChatsManager::ChatsManager( uiEventStream_ = uiEventStream; mucBookmarkManager_ = NULL; profileSettings_ = profileSettings; - chatMessageParser_ = new ChatMessageParser(emoticons); + chatMessageParser_ = new ChatMessageParser(emoticons, highlightManager->getRules()); presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1)); uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1)); diff --git a/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp index 44d7834..414fc8e 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp @@ -48,7 +48,7 @@ public: } void testFullBody() { - ChatMessageParser testling(emoticons_); + ChatMessageParser testling(emoticons_, std::vector()); ChatWindow::ChatMessage result = testling.parseMessageBody(":) shiny :( :) http://wonderland.lit/blah http://denmark.lit boom boom"); assertEmoticon(result, 0, smile1_, smile1Path_); assertText(result, 1, " shiny "); diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp index 3652e86..90a4740 100644 --- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp @@ -81,7 +81,7 @@ public: highlightManager_ = new HighlightManager(settings_); muc_ = boost::make_shared(mucJID_); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(muc_->getJID(), uiEventStream_).Return(window_); - chatMessageParser_ = new ChatMessageParser(std::map()); + chatMessageParser_ = new ChatMessageParser(std::map(), highlightManager_->getRules()); vcardStorage_ = new VCardMemoryStorage(crypto_.get()); vcardManager_ = new VCardManager(self_, iqRouter_, vcardStorage_); controller_ = new MUCController (self_, muc_, boost::optional(), nick_, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory, eventController_, entityCapsProvider_, NULL, NULL, mucRegistry_, highlightManager_, chatMessageParser_, false, NULL, vcardManager_); -- cgit v0.10.2-6-g49f6