changeset 13512:bc87c8da3efb

< and > get replaced, so it is no longer possible to use HTML tags in the IRC client.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Mon, 18 Jul 2011 18:29:21 +0200
parents 9d7b0043fa4b
children e19c454ed485
files gui/src/IRCWidget.cpp gui/src/qirc/IRCClient.cpp
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gui/src/IRCWidget.cpp
+++ b/gui/src/IRCWidget.cpp
@@ -160,6 +160,8 @@
 {
   Q_UNUSED (destination);
   QString msg (message);
+  msg.replace ("<", "&lt;");
+  msg.replace (">", "&gt;");
   if (msg.contains (m_ircClient->nickInUse ()))
     {
       msg =
@@ -189,8 +191,11 @@
 IRCWidget::showTopic (const char *nick, const char *channel,
 		      const char *message)
 {
+  QString msg (message);
+  msg.replace ("<", "&lt;");
+  msg.replace (">", "&gt;");
   m_chatWindow->append (QString ("Topic for %2 was set by %1: %3").arg (nick).
-			arg (channel).arg (message));
+                        arg (channel).arg (msg));
 }
 
 void
@@ -275,8 +280,10 @@
   else
     {
       m_ircClient->sendPublicMessage (message);
+      message.replace ("<", "&lt;");
+      message.replace (">", "&gt;");
       m_chatWindow->append (QString ("<b>%1:</b> %2").
-			    arg (m_ircClient->nickInUse ()).arg (message));
+                            arg (m_ircClient->nickInUse ()).arg (message));
     }
 }
 
--- a/gui/src/qirc/IRCClient.cpp
+++ b/gui/src/qirc/IRCClient.cpp
@@ -284,7 +284,7 @@
 IRCClient::sendPublicMessage (QString message)
 {
   sendCommand (2, COMMAND_PRIVMSG, m_recentChannel.toStdString ().c_str (),
-	       message.toStdString ().c_str ());
+               message.toStdString ().c_str ());
 }
 
 void