summaryrefslogtreecommitdiff
authorskyhusker <skyhusker>2005-05-31 21:08:33 (UTC)
committer skyhusker <skyhusker>2005-05-31 21:08:33 (UTC)
commitb30f28de8d5fa29001bc73a0a0e56ef653f1269f (patch) (side-by-side diff)
treebd6530f1ba36fb7bf96c1d8c2962446cab416da8
parent89417179ed4d38875dc3edce0f4e184edf13f1f2 (diff)
downloadopie-b30f28de8d5fa29001bc73a0a0e56ef653f1269f.zip
opie-b30f28de8d5fa29001bc73a0a0e56ef653f1269f.tar.gz
opie-b30f28de8d5fa29001bc73a0a0e56ef653f1269f.tar.bz2
Fix channel name validation. Thanks to hrw for reporting.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircservertab.cpp5
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
@@ -72,99 +72,100 @@ IRCServerTab::~IRCServerTab() {
delete m_session;
}
void IRCServerTab::removeChannelTab(IRCChannelTab *tab) {
m_channelTabs.remove(tab);
}
void IRCServerTab::removeQueryTab(IRCQueryTab *tab) {
m_queryTabs.remove(tab);
}
void IRCServerTab::addQueryTab(IRCQueryTab *tab) {
m_queryTabs.append(tab);
}
QString IRCServerTab::title() {
return "Server";
}
IRCSession *IRCServerTab::session() {
return m_session;
}
/*
QString *IRCServerTab::mynick() {
return (*m_server->nick());
} */
IRCServer *IRCServerTab::server() {
return &m_server;
}
void IRCServerTab::settingsChanged() {
m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
m_lines = 0;
}
void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
QTextIStream stream(&line);
QString command;
stream >> command;
command = command.upper().right(command.length()-1);
//JOIN
if (command == "JOIN" || command == "J") {
QString channel;
stream >> channel;
/* According to RFC 1459 */
if (channel.length() > 0 && channel.length() < 200 &&
- channel.find(",") == -1 && channel.find("") == -1) {
+ channel.find(",") == -1 && channel.find('\007') == -1) {
- if (!channel.startsWith("#") && !channel.startsWith("&")) {
+ if (!channel.startsWith("#") && !channel.startsWith("&")
+ && !channel.startsWith("+") && !channel.startsWith("!")) {
channel = channel.prepend("#");
}
m_session->join(channel);
} else {
tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>");
}
}
//KICK
else if (command == "KICK"){
QString nickname;
stream >> nickname;
if (nickname.length() > 0) {
if (line.length() > 7 + nickname.length()) {
QString text = line.right(line.length()-nickname.length()-7);
IRCPerson person;
person.setNick(nickname);
m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text);
} else {
IRCPerson person;
person.setNick(nickname);
m_session->kick(((IRCChannelTab *)tab)->channel(), &person);
}
}
}
else if (command == "OP"){
QString nickname;
stream >> nickname;
if (nickname.length() > 0) {
QString text = line.right(line.length()-nickname.length()-5);
IRCPerson person;
person.setNick(nickname);
m_session->op(((IRCChannelTab *)tab)->channel(), &person);
}
}
//SEND MODES
else if (command == "MODE"){
QString text = line.right(line.length()-6);
if (text.length() > 0) {
m_session->mode(text);
} else {
tab->appendText("<font color=\"" + m_errorColor + "\">/mode channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask]<br>/mode nickname {[+|-]|i|w|s|o}</font><br>");
}
}
//SEND RAW MESSAGE TO SERVER, COMPLETELY UNCHECKED - anything in the RFC...or really anything you want
else if (command == "RAW"){