diff options
Diffstat (limited to 'Swift/QtUI/ChatSnippet.cpp')
-rw-r--r-- | Swift/QtUI/ChatSnippet.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Swift/QtUI/ChatSnippet.cpp b/Swift/QtUI/ChatSnippet.cpp index 666dd00..3436531 100644 --- a/Swift/QtUI/ChatSnippet.cpp +++ b/Swift/QtUI/ChatSnippet.cpp @@ -4,9 +4,10 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ +#include <Swift/QtUI/ChatSnippet.h> + #include <QFile> -#include "ChatSnippet.h" #include <Swift/QtUI/QtSwiftUtil.h> namespace Swift { @@ -44,6 +45,18 @@ QString ChatSnippet::directionToCSS(Direction direction) { return direction == RTL ? QString("rtl") : QString("ltr"); } +ChatSnippet::Direction ChatSnippet::getDirection(const ChatWindow::ChatMessage& message) { + boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + std::string text = ""; + foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { + if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + text = textPart->text; + break; + } + } + return getDirection(text); +} + ChatSnippet::Direction ChatSnippet::getDirection(const std::string& message) { return getDirection(P2QSTRING(message)); } |