author | skyhusker <skyhusker> | 2005-01-23 21:48:34 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-01-23 21:48:34 (UTC) |
commit | 2074382fccea58a55b68c51815abc5df463473aa (patch) (unidiff) | |
tree | b3b706369267d6dce93097997c3ee8e6bb4de1b5 | |
parent | dd410f1eb69e68f04cf26b6d3e6bca88f0987f71 (diff) | |
download | opie-2074382fccea58a55b68c51815abc5df463473aa.zip opie-2074382fccea58a55b68c51815abc5df463473aa.tar.gz opie-2074382fccea58a55b68c51815abc5df463473aa.tar.bz2 |
Changed notation in escape characters to look better
-rw-r--r-- | noncore/net/opieirc/ircoutput.cpp | 8 |
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 @@ | |||
1 | #include <qtopia/stringutil.h> | 1 | #include <qtopia/stringutil.h> |
2 | 2 | ||
3 | #include "ircoutput.h" | 3 | #include "ircoutput.h" |
4 | 4 | ||
5 | 5 | ||
6 | IRCOutputEscapeSecuences IRCOutput::m_escapeSecuences[] = { | 6 | IRCOutputEscapeSecuences IRCOutput::m_escapeSecuences[] = { |
7 | { '', "<b>", "</b>"}, | 7 | { '\002', "<b>", "</b>"}, |
8 | { '', "<u>", "</u>"}, | 8 | { '\037', "<u>", "</u>"}, |
9 | { 0, 0, 0}, | 9 | { 0, 0, 0}, |
10 | }; | 10 | }; |
11 | 11 | ||
12 | IRCOutput::IRCOutput(IRCOutputType type, QString message) { | 12 | IRCOutput::IRCOutput(IRCOutputType type, QString message) { |
13 | m_type = type; | 13 | m_type = type; |
14 | /* Filter color, bold and underline escape sequences, since they aren't implemented yet */ | 14 | /* Filter color escape sequences, since they aren't implemented yet */ |
15 | m_message = message.replace(QRegExp("[1-9]*,*[1-9]*"), ""); | 15 | m_message = message.replace(QRegExp("\003[1-9]*,*[1-9]*"), ""); |
16 | } | 16 | } |
17 | 17 | ||
18 | IRCOutputType IRCOutput::type() { | 18 | IRCOutputType IRCOutput::type() { |
19 | return m_type; | 19 | return m_type; |
20 | } | 20 | } |
21 | 21 | ||
22 | QString IRCOutput::message() { | 22 | QString IRCOutput::message() { |
23 | return m_message; | 23 | return m_message; |
24 | } | 24 | } |
25 | 25 | ||
26 | void IRCOutput::setType(IRCOutputType type) { | 26 | void IRCOutput::setType(IRCOutputType type) { |
27 | m_type = type; | 27 | m_type = type; |
28 | } | 28 | } |
29 | 29 | ||
30 | void IRCOutput::setMessage(const QString &message) { | 30 | void IRCOutput::setMessage(const QString &message) { |
31 | m_message = message; | 31 | m_message = message; |
32 | } | 32 | } |
33 | 33 | ||
34 | QString IRCOutput::htmlMessage() { | 34 | QString IRCOutput::htmlMessage() { |
35 | return toHTML(m_message); | 35 | return toHTML(m_message); |
36 | } | 36 | } |
37 | 37 | ||
38 | QString IRCOutput::toHTML(const QString &message) { | 38 | QString IRCOutput::toHTML(const QString &message) { |
39 | QString htmlMessage = Qtopia::escapeString(message); | 39 | QString htmlMessage = Qtopia::escapeString(message); |
40 | 40 | ||
41 | for(int i=0; m_escapeSecuences[i].escape != 0;++i) { | 41 | for(int i=0; m_escapeSecuences[i].escape != 0;++i) { |
42 | int pos = 0; | 42 | int pos = 0; |
43 | bool isOpen = false; | 43 | bool isOpen = false; |
44 | while( (pos = htmlMessage.find(m_escapeSecuences[i].escape, pos)) != -1) { | 44 | while( (pos = htmlMessage.find(m_escapeSecuences[i].escape, pos)) != -1) { |
45 | htmlMessage.remove(pos, 1); | 45 | htmlMessage.remove(pos, 1); |
46 | if(isOpen) | 46 | if(isOpen) |
47 | htmlMessage.insert(pos, m_escapeSecuences[i].close); | 47 | htmlMessage.insert(pos, m_escapeSecuences[i].close); |
48 | else | 48 | else |
49 | htmlMessage.insert(pos, m_escapeSecuences[i].open); | 49 | htmlMessage.insert(pos, m_escapeSecuences[i].open); |
50 | 50 | ||
51 | isOpen = !isOpen; | 51 | isOpen = !isOpen; |
52 | } | 52 | } |
53 | if(isOpen) | 53 | if(isOpen) |
54 | htmlMessage.append(m_escapeSecuences[i].close); | 54 | htmlMessage.append(m_escapeSecuences[i].close); |
55 | } | 55 | } |
56 | 56 | ||
57 | htmlMessage = htmlMessage.replace(QRegExp("\n"), "<br>"); | 57 | htmlMessage = htmlMessage.replace(QRegExp("\n"), "<br>"); |
58 | return htmlMessage; | 58 | return htmlMessage; |
59 | } | 59 | } |
60 | 60 | ||
61 | void IRCOutput::addParam(void *data) { | 61 | void IRCOutput::addParam(void *data) { |
62 | m_parameters.append(data); | 62 | m_parameters.append(data); |
63 | } | 63 | } |
64 | 64 | ||
65 | void *IRCOutput::getParam(int index) { | 65 | void *IRCOutput::getParam(int index) { |
66 | return m_parameters.at(index); | 66 | return m_parameters.at(index); |
67 | } | 67 | } |
68 | 68 | ||