← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2846: make chat readable again - no RTF formatting yet

 

------------------------------------------------------------
revno: 2846
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2012-02-01 17:54:41 +0100
message:
  make chat readable again - no RTF formatting yet
modified:
  dcpp/ChatMessage.cpp
  win32/HtmlToRtf.cpp


--
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 'dcpp/ChatMessage.cpp'
--- dcpp/ChatMessage.cpp	2012-02-01 16:26:37 +0000
+++ dcpp/ChatMessage.cpp	2012-02-01 16:54:41 +0000
@@ -101,17 +101,16 @@
 	}
 
 	tmp = from->getIdentity().getNick();
-
 	// let's *not* obey the spec here and add a space after the star. :P
-	message += thirdPerson ? "* " + tmp + " " : "<" + tmp + "> ";
+	tmp = thirdPerson ? "* " + tmp + " " : "<" + tmp + "> ";
+	message += tmp;
 
 	auto style = from->getIdentity().getStyle();
 	string styleAttr;
 	if(!style.font.empty()) { styleAttr += "font: " + cssFont(style.font) + ";"; }
 	if(style.textColor != -1) { styleAttr += "color: #" + cssColor(style.textColor) + ";"; }
 	if(style.bgColor != -1) { styleAttr += "background-color: #" + cssColor(style.bgColor) + ";"; }
-	tmp = addSpan("nick", tmp, styleAttr);
-	htmlMessage += thirdPerson ? "* " + tmp + " " : "&lt;" + tmp + "&gt; ";
+	htmlMessage += addSpan("nick", tmp, styleAttr);
 
 	// Check all '<' and '[' after newlines as they're probably pastes...
 	tmp = text;

=== modified file 'win32/HtmlToRtf.cpp'
--- win32/HtmlToRtf.cpp	2012-02-01 16:26:37 +0000
+++ win32/HtmlToRtf.cpp	2012-02-01 16:54:41 +0000
@@ -79,8 +79,12 @@
 	return parser.finalize();
 }
 
+static const string styleAttr = "style";
+
 void Parser::startTag(const string& name, StringPairList& attribs, bool simple) {
-	ret += name;
+	if(!attribs.empty()) {
+		const auto& style = getAttrib(attribs, styleAttr, 0);
+	}
 }
 
 void Parser::endTag(const string& name, const string& data) {