Diffstat (limited to 'noncore/net/opieirc/ircmessage.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircmessage.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/noncore/net/opieirc/ircmessage.cpp b/noncore/net/opieirc/ircmessage.cpp index d823ad1..d0b2652 100644 --- a/noncore/net/opieirc/ircmessage.cpp +++ b/noncore/net/opieirc/ircmessage.cpp | |||
@@ -1,2 +1,5 @@ | |||
1 | #include <qtextstream.h> | 1 | #include <qtextstream.h> |
2 | #include <qstring.h> | ||
3 | #include <qstringlist.h> | ||
4 | |||
2 | #include "ircmessage.h" | 5 | #include "ircmessage.h" |
@@ -66,4 +69,4 @@ IRCMessage::IRCMessage(QString line) { | |||
66 | 69 | ||
67 | /* | 70 | /* |
68 | -- Uncomment to debug -- | 71 | //-- Uncomment to debug -- |
69 | 72 | ||
@@ -78,3 +81,4 @@ IRCMessage::IRCMessage(QString line) { | |||
78 | printf("CTCP Destination : '%s'\n", m_ctcpDestination.latin1()); | 81 | printf("CTCP Destination : '%s'\n", m_ctcpDestination.latin1()); |
79 | printf("CTCP param count is : '%i'\n", m_parameters.count()); | 82 | printf("CTCP param count is : '%i'\n", m_parameters.count()); |
83 | |||
80 | */ | 84 | */ |
@@ -86,2 +90,27 @@ QString IRCMessage::param(int param) { | |||
86 | 90 | ||
91 | QStringList IRCMessage::params(const QString ¶mstring) const { | ||
92 | QStringList params, retvalue; | ||
93 | params = QStringList::split(',', paramstring); | ||
94 | QStringList::Iterator end = params.end(); | ||
95 | |||
96 | for (QStringList::Iterator it = params.begin(); it != end; ++it) { | ||
97 | int pos = (*it).find(':'); | ||
98 | if(pos < 0) { | ||
99 | if((*it).toInt() < m_parameters.count()) | ||
100 | retvalue << m_parameters[(*it).toInt()]; | ||
101 | } | ||
102 | |||
103 | else { | ||
104 | int start, end; | ||
105 | start = (*it).left(pos).toInt(); | ||
106 | end = (*it).mid(pos+1).toInt(); | ||
107 | for (int i=start;i<=end && i < m_parameters.count() ;++i) { | ||
108 | retvalue << m_parameters[i]; | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | return retvalue; | ||
114 | } | ||
115 | |||
87 | QString IRCMessage::prefix() { | 116 | QString IRCMessage::prefix() { |