summaryrefslogtreecommitdiff
authorskyhusker <skyhusker>2005-01-23 21:48:34 (UTC)
committer skyhusker <skyhusker>2005-01-23 21:48:34 (UTC)
commit2074382fccea58a55b68c51815abc5df463473aa (patch) (side-by-side diff)
treeb3b706369267d6dce93097997c3ee8e6bb4de1b5
parentdd410f1eb69e68f04cf26b6d3e6bca88f0987f71 (diff)
downloadopie-2074382fccea58a55b68c51815abc5df463473aa.zip
opie-2074382fccea58a55b68c51815abc5df463473aa.tar.gz
opie-2074382fccea58a55b68c51815abc5df463473aa.tar.bz2
Changed notation in escape characters to look better
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircoutput.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/opieirc/ircoutput.cpp b/noncore/net/opieirc/ircoutput.cpp
index d2c730f..26d90cb 100644
--- a/noncore/net/opieirc/ircoutput.cpp
+++ b/noncore/net/opieirc/ircoutput.cpp
@@ -1,68 +1,68 @@
#include <qtopia/stringutil.h>
#include "ircoutput.h"
IRCOutputEscapeSecuences IRCOutput::m_escapeSecuences[] = {
- { '', "<b>", "</b>"},
- { '', "<u>", "</u>"},
+ { '\002', "<b>", "</b>"},
+ { '\037', "<u>", "</u>"},
{ 0, 0, 0},
};
IRCOutput::IRCOutput(IRCOutputType type, QString message) {
m_type = type;
- /* Filter color, bold and underline escape sequences, since they aren't implemented yet */
- m_message = message.replace(QRegExp("[1-9]*,*[1-9]*"), "");
+ /* Filter color escape sequences, since they aren't implemented yet */
+ m_message = message.replace(QRegExp("\003[1-9]*,*[1-9]*"), "");
}
IRCOutputType IRCOutput::type() {
return m_type;
}
QString IRCOutput::message() {
return m_message;
}
void IRCOutput::setType(IRCOutputType type) {
m_type = type;
}
void IRCOutput::setMessage(const QString &message) {
m_message = message;
}
QString IRCOutput::htmlMessage() {
return toHTML(m_message);
}
QString IRCOutput::toHTML(const QString &message) {
QString htmlMessage = Qtopia::escapeString(message);
for(int i=0; m_escapeSecuences[i].escape != 0;++i) {
int pos = 0;
bool isOpen = false;
while( (pos = htmlMessage.find(m_escapeSecuences[i].escape, pos)) != -1) {
htmlMessage.remove(pos, 1);
if(isOpen)
htmlMessage.insert(pos, m_escapeSecuences[i].close);
else
htmlMessage.insert(pos, m_escapeSecuences[i].open);
isOpen = !isOpen;
}
if(isOpen)
htmlMessage.append(m_escapeSecuences[i].close);
}
htmlMessage = htmlMessage.replace(QRegExp("\n"), "<br>");
return htmlMessage;
}
void IRCOutput::addParam(void *data) {
m_parameters.append(data);
}
void *IRCOutput::getParam(int index) {
return m_parameters.at(index);
}