author | skyhusker <skyhusker> | 2005-01-23 21:10:39 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-01-23 21:10:39 (UTC) |
commit | d3d14d324442d05a8f135590c70237657ef1bab0 (patch) (unidiff) | |
tree | 9e8ec698557a9ef7387df064a17055af5590333c /noncore | |
parent | be26adf324ea0b723cabcd735b0833e16410ceea (diff) | |
download | opie-d3d14d324442d05a8f135590c70237657ef1bab0.zip opie-d3d14d324442d05a8f135590c70237657ef1bab0.tar.gz opie-d3d14d324442d05a8f135590c70237657ef1bab0.tar.bz2 |
Removed some unnecesary castings, changed printf() to odebug
-rw-r--r-- | noncore/net/opieirc/ircmessage.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/noncore/net/opieirc/ircmessage.cpp b/noncore/net/opieirc/ircmessage.cpp index 41386ee..d19e9e6 100644 --- a/noncore/net/opieirc/ircmessage.cpp +++ b/noncore/net/opieirc/ircmessage.cpp | |||
@@ -1,12 +1,17 @@ | |||
1 | #include <opie2/odebug.h> | ||
2 | |||
3 | using namespace Opie::Core; | ||
4 | |||
5 | |||
1 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
2 | #include <qstring.h> | 7 | #include <qstring.h> |
3 | #include <qstringlist.h> | 8 | #include <qstringlist.h> |
4 | #include <qregexp.h> | 9 | #include <qregexp.h> |
5 | 10 | ||
6 | #include "ircmessage.h" | 11 | #include "ircmessage.h" |
7 | 12 | ||
8 | /* | 13 | /* |
9 | * Create a new IRCMessage by evaluating | 14 | * Create a new IRCMessage by evaluating |
10 | * a received string | 15 | * a received string |
11 | */ | 16 | */ |
12 | 17 | ||
@@ -60,61 +65,58 @@ IRCMessage::IRCMessage(QString line) { | |||
60 | length -= m_ctcpDestination.length() + 1; | 65 | length -= m_ctcpDestination.length() + 1; |
61 | if (length <= 0) { | 66 | if (length <= 0) { |
62 | m_allParameters = ""; | 67 | m_allParameters = ""; |
63 | } else { | 68 | } else { |
64 | m_allParameters = m_allParameters.right(length); | 69 | m_allParameters = m_allParameters.right(length); |
65 | m_parameters << m_allParameters; | 70 | m_parameters << m_allParameters; |
66 | } | 71 | } |
67 | } else { | 72 | } else { |
68 | m_ctcp = FALSE; | 73 | m_ctcp = FALSE; |
69 | } | 74 | } |
70 | 75 | ||
71 | 76 | ||
72 | //-- Uncomment to debug -- | 77 | odebug << "Parsed: " << line << oendl; |
73 | /* | 78 | odebug << "Prefix: " << m_prefix << oendl; |
74 | printf("Parsed : '%s'\n", line.ascii()); | 79 | odebug << "Command: " << m_command << oendl; |
75 | printf("Prefix : '%s'\n", m_prefix.ascii()); | 80 | odebug << "Allparameters: " << m_allParameters << oendl; |
76 | printf("Command : '%s'\n", m_command.ascii()); | ||
77 | printf("Allparameters : '%s'\n", m_allParameters.ascii()); | ||
78 | for (unsigned int i=0; i<m_parameters.count(); i++) { | 81 | for (unsigned int i=0; i<m_parameters.count(); i++) { |
79 | printf("Parameter %i : '%s'\n", i, m_parameters[i].ascii()); | 82 | odebug << "Parameter " << i << ":" << m_parameters[i] << oendl; |
80 | } | 83 | } |
81 | printf("CTCP Command : '%s'\n", m_ctcpCommand.latin1()); | 84 | odebug << "CTCP Command: " << m_ctcpCommand << oendl; |
82 | printf("CTCP Destination : '%s'\n", m_ctcpDestination.latin1()); | 85 | odebug << "CTCP Destination: " << m_ctcpDestination << oendl; |
83 | printf("CTCP param count is : '%i'\n", m_parameters.count()); | 86 | odebug << "CTCP param count is: " << m_parameters.count() << oendl; |
84 | */ | 87 | |
85 | |||
86 | } | 88 | } |
87 | 89 | ||
88 | QString IRCMessage::param(int param) { | 90 | QString IRCMessage::param(int param) { |
89 | return m_parameters[param]; | 91 | return m_parameters[param]; |
90 | } | 92 | } |
91 | 93 | ||
92 | QStringList IRCMessage::params(const QString ¶mstring) const { | 94 | QStringList IRCMessage::params(const QString ¶mstring) const { |
93 | QStringList params, retvalue; | 95 | QStringList params, retvalue; |
94 | params = QStringList::split(',', paramstring); | 96 | params = QStringList::split(',', paramstring); |
95 | QStringList::Iterator end = params.end(); | 97 | QStringList::Iterator end = params.end(); |
96 | 98 | ||
97 | for (QStringList::Iterator it = params.begin(); it != end; ++it) { | 99 | for (QStringList::Iterator it = params.begin(); it != end; ++it) { |
98 | int pos = (*it).find(':'); | 100 | int pos = (*it).find(':'); |
99 | if(pos < 0) { | 101 | if(pos < 0) { |
100 | if(static_cast<unsigned int>((*it).toInt()) < m_parameters.count()) | 102 | if((*it).toUInt() < m_parameters.count()) |
101 | retvalue << m_parameters[(*it).toInt()]; | 103 | retvalue << m_parameters[(*it).toUInt()]; |
102 | } | 104 | } |
103 | 105 | ||
104 | else { | 106 | else { |
105 | int start, end; | 107 | unsigned int start, end; |
106 | start = (*it).left(pos).toInt(); | 108 | start = (*it).left(pos).toUInt(); |
107 | end = (*it).mid(pos+1).toInt(); | 109 | end = (*it).mid(pos+1).toUInt(); |
108 | for (int i=start;i<=end && i < static_cast<int>(m_parameters.count()) ;++i) { | 110 | for (unsigned int i=start;i<=end && i < m_parameters.count() ;++i) { |
109 | retvalue << m_parameters[i]; | 111 | retvalue << m_parameters[i]; |
110 | } | 112 | } |
111 | } | 113 | } |
112 | } | 114 | } |
113 | 115 | ||
114 | return retvalue; | 116 | return retvalue; |
115 | } | 117 | } |
116 | 118 | ||
117 | QString IRCMessage::prefix() { | 119 | QString IRCMessage::prefix() { |
118 | return m_prefix; | 120 | return m_prefix; |
119 | } | 121 | } |
120 | 122 | ||