author | skyhusker <skyhusker> | 2005-05-31 21:08:33 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-05-31 21:08:33 (UTC) |
commit | b30f28de8d5fa29001bc73a0a0e56ef653f1269f (patch) (unidiff) | |
tree | bd6530f1ba36fb7bf96c1d8c2962446cab416da8 | |
parent | 89417179ed4d38875dc3edce0f4e184edf13f1f2 (diff) | |
download | opie-b30f28de8d5fa29001bc73a0a0e56ef653f1269f.zip opie-b30f28de8d5fa29001bc73a0a0e56ef653f1269f.tar.gz opie-b30f28de8d5fa29001bc73a0a0e56ef653f1269f.tar.bz2 |
Fix channel name validation. Thanks to hrw for reporting.
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index d3c0448..5eb1758 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp | |||
@@ -108,27 +108,28 @@ void IRCServerTab::settingsChanged() { | |||
108 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | 108 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { |
109 | QTextIStream stream(&line); | 109 | QTextIStream stream(&line); |
110 | QString command; | 110 | QString command; |
111 | stream >> command; | 111 | stream >> command; |
112 | command = command.upper().right(command.length()-1); | 112 | command = command.upper().right(command.length()-1); |
113 | 113 | ||
114 | //JOIN | 114 | //JOIN |
115 | if (command == "JOIN" || command == "J") { | 115 | if (command == "JOIN" || command == "J") { |
116 | QString channel; | 116 | QString channel; |
117 | stream >> channel; | 117 | stream >> channel; |
118 | /* According to RFC 1459 */ | 118 | /* According to RFC 1459 */ |
119 | if (channel.length() > 0 && channel.length() < 200 && | 119 | if (channel.length() > 0 && channel.length() < 200 && |
120 | channel.find(",") == -1 && channel.find("") == -1) { | 120 | channel.find(",") == -1 && channel.find('\007') == -1) { |
121 | 121 | ||
122 | if (!channel.startsWith("#") && !channel.startsWith("&")) { | 122 | if (!channel.startsWith("#") && !channel.startsWith("&") |
123 | && !channel.startsWith("+") && !channel.startsWith("!")) { | ||
123 | channel = channel.prepend("#"); | 124 | channel = channel.prepend("#"); |
124 | } | 125 | } |
125 | m_session->join(channel); | 126 | m_session->join(channel); |
126 | } else { | 127 | } else { |
127 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); | 128 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); |
128 | } | 129 | } |
129 | } | 130 | } |
130 | 131 | ||
131 | //KICK | 132 | //KICK |
132 | else if (command == "KICK"){ | 133 | else if (command == "KICK"){ |
133 | QString nickname; | 134 | QString nickname; |
134 | stream >> nickname; | 135 | stream >> nickname; |