From 6be140832d97bb485ba98bc9ea0f5cf622330595 Mon Sep 17 00:00:00 2001 From: skyhusker Date: Thu, 09 Jun 2005 17:16:59 +0000 Subject: Fix bug 1666 --- (limited to 'noncore/net') diff --git a/noncore/net/opieirc/ircchannel.cpp b/noncore/net/opieirc/ircchannel.cpp index 5d81596..b9e377d 100644 --- a/noncore/net/opieirc/ircchannel.cpp +++ b/noncore/net/opieirc/ircchannel.cpp @@ -46,3 +46,9 @@ IRCChannelPerson *IRCChannel::getPerson(QString nickname) { return 0; } +bool IRCChannel::isValid(const QString &channel) +{ + return ( channel.startsWith("#") || channel.startsWith("&") + || channel.startsWith("+") || channel.startsWith("!")); +} + diff --git a/noncore/net/opieirc/ircchannel.h b/noncore/net/opieirc/ircchannel.h index a276f10..001f5bb 100644 --- a/noncore/net/opieirc/ircchannel.h +++ b/noncore/net/opieirc/ircchannel.h @@ -49,6 +49,7 @@ public: void setHasPeople(bool hasPeople); QString channelname(); bool hasPeople(); + static bool isValid(const QString &channel); protected: QList m_people; QString m_channelname; diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp index 1fda868..e5c9ab5 100644 --- a/noncore/net/opieirc/ircservereditor.cpp +++ b/noncore/net/opieirc/ircservereditor.cpp @@ -1,4 +1,5 @@ #include "ircservereditor.h" +#include "ircchannel.h" /* OPIE */ #include @@ -69,8 +70,10 @@ void IRCServerEditor::accept() { QStringList channels = QStringList::split(QChar(','), m_channels->text()); for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { QString channelName = (*it).stripWhiteSpace(); - if (!channelName.startsWith("#") && !channelName.startsWith("+")) { - QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with either '#' or '+'")); + if (!IRCChannel::isValid(channelName)) { + QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma " + "separated list of valid\n channel names (starting \n" + "with one of '#' '+' '&' '!'")); return; } } -- cgit v0.9.0.2