linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #06253
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3117: allow plugins to use the Tagger hook and interface with system messages as well
------------------------------------------------------------
revno: 3117
committer: crise <crise@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2012-11-08 18:20:20 +0200
message:
allow plugins to use the Tagger hook and interface with system messages as well
modified:
win32/AspectChat.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/AspectChat.h'
--- win32/AspectChat.h 2012-07-12 20:31:30 +0000
+++ win32/AspectChat.h 2012-11-08 16:20:20 +0000
@@ -22,6 +22,7 @@
#include <dcpp/ChatMessage.h>
#include <dcpp/File.h>
#include <dcpp/SimpleXML.h>
+#include <dcpp/Tagger.h>
#include <dcpp/PluginManager.h>
#include <dwt/WidgetCreator.h>
@@ -74,14 +75,18 @@
/// add a chat message with some formatting and call addedChat.
void addChat(const tstring& message) {
- string tmp;
+ string xmlTmp, tmp = Text::fromT(message);
+ Tagger tags;
+
+ PluginManager::getInstance()->onChatTags(tmp, tags);
+
string htmlMessage = "<span id=\"message\" style=\"white-space: pre-wrap;\">"
- "<span id=\"timestamp\">" + SimpleXML::escape("[" + Util::getShortTimeString() + "]", tmp, false) + "</span> "
- "<span id=\"text\">" + SimpleXML::escape(Text::fromT(message), tmp, false) + "</span></span>";
-
- if(PluginManager::getInstance()->onChatDisplay(htmlMessage)) {
- addChatHTML(htmlMessage);
- } else addChatPlain(Text::toT("[" + Util::getShortTimeString() + "] ") + message);
+ "<span id=\"timestamp\">" + SimpleXML::escape("[" + Util::getShortTimeString() + "]", xmlTmp, false) + "</span> "
+ "<span id=\"text\">" + tags.merge(tmp, xmlTmp) + "</span></span>";
+
+ PluginManager::getInstance()->onChatDisplay(htmlMessage);
+
+ addChatHTML(htmlMessage);
t().addedChat(message);
}