summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchannel.cpp6
-rw-r--r--noncore/net/opieirc/ircchannel.h1
-rw-r--r--noncore/net/opieirc/ircservereditor.cpp7
3 files changed, 12 insertions, 2 deletions
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
@@ -37,12 +37,18 @@ QListIterator<IRCChannelPerson> IRCChannel::people() {
37} 37}
38 38
39IRCChannelPerson *IRCChannel::getPerson(QString nickname) { 39IRCChannelPerson *IRCChannel::getPerson(QString nickname) {
40 QListIterator<IRCChannelPerson> it(m_people); 40 QListIterator<IRCChannelPerson> it(m_people);
41 for (; it.current(); ++it) { 41 for (; it.current(); ++it) {
42 if (it.current()->nick() == nickname) { 42 if (it.current()->nick() == nickname) {
43 return it.current(); 43 return it.current();
44 } 44 }
45 } 45 }
46 return 0; 46 return 0;
47} 47}
48 48
49bool IRCChannel::isValid(const QString &channel)
50{
51 return ( channel.startsWith("#") || channel.startsWith("&")
52 || channel.startsWith("+") || channel.startsWith("!"));
53}
54
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
@@ -40,19 +40,20 @@ public:
40 40
41 void addPerson(IRCChannelPerson *person); 41 void addPerson(IRCChannelPerson *person);
42 void removePerson(IRCChannelPerson *person); 42 void removePerson(IRCChannelPerson *person);
43 IRCChannelPerson *getPerson(QString nickname); 43 IRCChannelPerson *getPerson(QString nickname);
44 QListIterator<IRCChannelPerson> people(); 44 QListIterator<IRCChannelPerson> people();
45 45
46 /* hasPeople identifies whether the irc channel is 46 /* hasPeople identifies whether the irc channel is
47 done synchronizing with the current state - 47 done synchronizing with the current state -
48 this is only relevant when joining a channel */ 48 this is only relevant when joining a channel */
49 void setHasPeople(bool hasPeople); 49 void setHasPeople(bool hasPeople);
50 QString channelname(); 50 QString channelname();
51 bool hasPeople(); 51 bool hasPeople();
52 static bool isValid(const QString &channel);
52protected: 53protected:
53 QList<IRCChannelPerson> m_people; 54 QList<IRCChannelPerson> m_people;
54 QString m_channelname; 55 QString m_channelname;
55 bool m_hasPeople; 56 bool m_hasPeople;
56}; 57};
57 58
58#endif /* __IRCCHANNEL_H */ 59#endif /* __IRCCHANNEL_H */
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,13 +1,14 @@
1#include "ircservereditor.h" 1#include "ircservereditor.h"
2#include "ircchannel.h"
2 3
3/* OPIE */ 4/* OPIE */
4#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
5 6
6/* QT */ 7/* QT */
7#include <qmessagebox.h> 8#include <qmessagebox.h>
8#include <qlayout.h> 9#include <qlayout.h>
9#include <qlabel.h> 10#include <qlabel.h>
10#include <qwhatsthis.h> 11#include <qwhatsthis.h>
11 12
12IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) { 13IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
13 QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5); 14 QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5);
@@ -60,26 +61,28 @@ void IRCServerEditor::accept() {
60 QMessageBox::critical(this, tr("Error"), tr("Host name required")); 61 QMessageBox::critical(this, tr("Error"), tr("Host name required"));
61 //else if (m_port->text().toInt()<=0) 62 //else if (m_port->text().toInt()<=0)
62 // QMessageBox::critical(this, tr("Error"), tr("Port required")); 63 // QMessageBox::critical(this, tr("Error"), tr("Port required"));
63 else if (m_nickname->text().length()==0) 64 else if (m_nickname->text().length()==0)
64 QMessageBox::critical(this, tr("Error"), tr("Nickname required")); 65 QMessageBox::critical(this, tr("Error"), tr("Nickname required"));
65 //else if (m_realname->text().length()==0) 66 //else if (m_realname->text().length()==0)
66 // QMessageBox::critical(this, tr("Error"), tr("Realname required")); 67 // QMessageBox::critical(this, tr("Error"), tr("Realname required"));
67 else { 68 else {
68 /* Now verify whether the channel list has a valid format */ 69 /* Now verify whether the channel list has a valid format */
69 QStringList channels = QStringList::split(QChar(','), m_channels->text()); 70 QStringList channels = QStringList::split(QChar(','), m_channels->text());
70 for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { 71 for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) {
71 QString channelName = (*it).stripWhiteSpace(); 72 QString channelName = (*it).stripWhiteSpace();
72 if (!channelName.startsWith("#") && !channelName.startsWith("+")) { 73 if (!IRCChannel::isValid(channelName)) {
73 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 '+'")); 74 QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma "
75 "separated list of valid\n channel names (starting \n"
76 "with one of '#' '+' '&' '!'"));
74 return; 77 return;
75 } 78 }
76 } 79 }
77 QDialog::accept(); 80 QDialog::accept();
78 } 81 }
79} 82}
80 83
81IRCServer IRCServerEditor::getServer() { 84IRCServer IRCServerEditor::getServer() {
82 IRCServer server; 85 IRCServer server;
83 server.setName(m_name->text()); 86 server.setName(m_name->text());
84 server.setHostname(m_hostname->text()); 87 server.setHostname(m_hostname->text());
85 server.setPort(m_port->text().toInt()); 88 server.setPort(m_port->text().toInt());