author | wazlaf <wazlaf> | 2002-09-20 23:28:14 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-20 23:28:14 (UTC) |
commit | 912092425248f7fc5155b4c7c46b7d00ec2676bc (patch) (unidiff) | |
tree | 5bbf746e83b2dffad89542c42031a573c34da751 /noncore/net/opieirc | |
parent | cd3df897c1b0ed93c2be3ab411011a0bdfe88bf9 (diff) | |
download | opie-912092425248f7fc5155b4c7c46b7d00ec2676bc.zip opie-912092425248f7fc5155b4c7c46b7d00ec2676bc.tar.gz opie-912092425248f7fc5155b4c7c46b7d00ec2676bc.tar.bz2 |
support for client commands (only /join implemented so far), crash bugfix, fixed 2 leaks, server browser now includes a channel list
-rw-r--r-- | noncore/net/opieirc/ircchannel.cpp | 5 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchannel.h | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 26 | ||||
-rw-r--r-- | noncore/net/opieirc/ircconnection.cpp | 8 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessage.cpp | 3 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 3 | ||||
-rw-r--r-- | noncore/net/opieirc/ircoutput.cpp | 7 | ||||
-rw-r--r-- | noncore/net/opieirc/ircoutput.h | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircserver.cpp | 12 | ||||
-rw-r--r-- | noncore/net/opieirc/ircserver.h | 6 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservereditor.cpp | 19 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservereditor.h | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircserverlist.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 70 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.h | 3 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsession.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.h | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircversion.h | 2 |
18 files changed, 151 insertions, 24 deletions
diff --git a/noncore/net/opieirc/ircchannel.cpp b/noncore/net/opieirc/ircchannel.cpp index 71ec03b..9814a26 100644 --- a/noncore/net/opieirc/ircchannel.cpp +++ b/noncore/net/opieirc/ircchannel.cpp | |||
@@ -3,12 +3,17 @@ | |||
3 | 3 | ||
4 | IRCChannel::IRCChannel(QString channelname) { | 4 | IRCChannel::IRCChannel(QString channelname) { |
5 | m_hasPeople = FALSE; | 5 | m_hasPeople = FALSE; |
6 | m_channelname = channelname; | 6 | m_channelname = channelname; |
7 | } | 7 | } |
8 | 8 | ||
9 | IRCChannel::~IRCChannel() { | ||
10 | /* We want this to get deleted */ | ||
11 | m_people.setAutoDelete(TRUE); | ||
12 | } | ||
13 | |||
9 | QString IRCChannel::channelname() { | 14 | QString IRCChannel::channelname() { |
10 | return m_channelname; | 15 | return m_channelname; |
11 | } | 16 | } |
12 | 17 | ||
13 | bool IRCChannel::hasPeople() { | 18 | bool IRCChannel::hasPeople() { |
14 | return m_hasPeople; | 19 | return m_hasPeople; |
diff --git a/noncore/net/opieirc/ircchannel.h b/noncore/net/opieirc/ircchannel.h index c800b99..e78f182 100644 --- a/noncore/net/opieirc/ircchannel.h +++ b/noncore/net/opieirc/ircchannel.h | |||
@@ -44,12 +44,13 @@ typedef struct IRCChannelPerson { | |||
44 | of an IRC channel. It basically acts as a container | 44 | of an IRC channel. It basically acts as a container |
45 | for IRCChannelPersons */ | 45 | for IRCChannelPersons */ |
46 | class IRCChannel : public QObject { | 46 | class IRCChannel : public QObject { |
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | public: | 48 | public: |
49 | IRCChannel(QString channelname); | 49 | IRCChannel(QString channelname); |
50 | ~IRCChannel(); | ||
50 | 51 | ||
51 | void addPerson(IRCChannelPerson *person); | 52 | void addPerson(IRCChannelPerson *person); |
52 | void removePerson(IRCChannelPerson *person); | 53 | void removePerson(IRCChannelPerson *person); |
53 | IRCChannelPerson *getPerson(QString nickname); | 54 | IRCChannelPerson *getPerson(QString nickname); |
54 | QListIterator<IRCChannelPerson> people(); | 55 | QListIterator<IRCChannelPerson> people(); |
55 | 56 | ||
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index c96a365..754442a 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -35,17 +35,29 @@ void IRCChannelTab::appendText(QString text) { | |||
35 | 35 | ||
36 | IRCChannelTab::~IRCChannelTab() { | 36 | IRCChannelTab::~IRCChannelTab() { |
37 | m_parentTab->removeChannelTab(this); | 37 | m_parentTab->removeChannelTab(this); |
38 | } | 38 | } |
39 | 39 | ||
40 | void IRCChannelTab::processCommand() { | 40 | void IRCChannelTab::processCommand() { |
41 | if (m_field->text().length()>0) { | 41 | QString text = m_field->text(); |
42 | session()->sendMessage(m_channel, m_field->text()); | 42 | if (text.length()>0) { |
43 | appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+m_field->text()+"<br>"); | 43 | if (session()->isSessionActive()) { |
44 | m_field->clear(); | 44 | if (text.startsWith("/") && !text.startsWith("//")) { |
45 | /* Command mode */ | ||
46 | m_parentTab->executeCommand(this, text);; | ||
47 | } else { | ||
48 | if (session()->isSessionActive()) { | ||
49 | session()->sendMessage(m_channel, m_field->text()); | ||
50 | appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+m_field->text()+"<br>"); | ||
51 | } | ||
52 | } | ||
53 | } else { | ||
54 | appendText("<font color=\"#ff0000\">"+tr("Disconnected")+"</font><br>"); | ||
55 | } | ||
45 | } | 56 | } |
57 | m_field->clear(); | ||
46 | } | 58 | } |
47 | 59 | ||
48 | void IRCChannelTab::toggleList() { | 60 | void IRCChannelTab::toggleList() { |
49 | if (m_listVisible) { | 61 | if (m_listVisible) { |
50 | m_list->setMaximumWidth(0); | 62 | m_list->setMaximumWidth(0); |
51 | m_listButton->setText("<"); | 63 | m_listButton->setText("<"); |
@@ -62,13 +74,17 @@ QString IRCChannelTab::title() { | |||
62 | 74 | ||
63 | IRCSession *IRCChannelTab::session() { | 75 | IRCSession *IRCChannelTab::session() { |
64 | return m_parentTab->session(); | 76 | return m_parentTab->session(); |
65 | } | 77 | } |
66 | 78 | ||
67 | void IRCChannelTab::remove() { | 79 | void IRCChannelTab::remove() { |
68 | session()->part(m_channel); | 80 | if (session()->isSessionActive()) { |
81 | session()->part(m_channel); | ||
82 | } else { | ||
83 | m_mainWindow->killTab(this); | ||
84 | } | ||
69 | } | 85 | } |
70 | 86 | ||
71 | IRCChannel *IRCChannelTab::channel() { | 87 | IRCChannel *IRCChannelTab::channel() { |
72 | return m_channel; | 88 | return m_channel; |
73 | } | 89 | } |
74 | 90 | ||
diff --git a/noncore/net/opieirc/ircconnection.cpp b/noncore/net/opieirc/ircconnection.cpp index 02c4897..5eb0cf2 100644 --- a/noncore/net/opieirc/ircconnection.cpp +++ b/noncore/net/opieirc/ircconnection.cpp | |||
@@ -57,12 +57,20 @@ void IRCConnection::login() { | |||
57 | 57 | ||
58 | /* Called when data arrives on the socket */ | 58 | /* Called when data arrives on the socket */ |
59 | void IRCConnection::dataReady() { | 59 | void IRCConnection::dataReady() { |
60 | while(m_socket->canReadLine()) { | 60 | while(m_socket->canReadLine()) { |
61 | IRCMessage message(m_socket->readLine()); | 61 | IRCMessage message(m_socket->readLine()); |
62 | if (!m_loggedIn && message.isNumerical() && message.commandNumber() == 1) { | 62 | if (!m_loggedIn && message.isNumerical() && message.commandNumber() == 1) { |
63 | /* Now autojoin all channels specified inside the server profile */ | ||
64 | QStringList channels = QStringList::split(QChar(','), m_server->channels()); | ||
65 | for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { | ||
66 | QString channelName = (*it).stripWhiteSpace(); | ||
67 | if (channelName.startsWith("#")) { | ||
68 | sendLine("JOIN "+ channelName); | ||
69 | } | ||
70 | } | ||
63 | m_loggedIn = TRUE; | 71 | m_loggedIn = TRUE; |
64 | emit outputReady(IRCOutput(OUTPUT_CLIENTMESSAGE, tr("Successfully logged in."))); | 72 | emit outputReady(IRCOutput(OUTPUT_CLIENTMESSAGE, tr("Successfully logged in."))); |
65 | } | 73 | } |
66 | emit messageArrived(&message); | 74 | emit messageArrived(&message); |
67 | } | 75 | } |
68 | } | 76 | } |
diff --git a/noncore/net/opieirc/ircmessage.cpp b/noncore/net/opieirc/ircmessage.cpp index 74e9c6f..9c2869c 100644 --- a/noncore/net/opieirc/ircmessage.cpp +++ b/noncore/net/opieirc/ircmessage.cpp | |||
@@ -21,24 +21,27 @@ IRCMessage::IRCMessage(QString line) { | |||
21 | m_command = temp.upper(); | 21 | m_command = temp.upper(); |
22 | m_allParameters = line.right(line.length() - m_prefix.length() - m_command.length() - 3); | 22 | m_allParameters = line.right(line.length() - m_prefix.length() - m_command.length() - 3); |
23 | } else { | 23 | } else { |
24 | m_command = temp.upper(); | 24 | m_command = temp.upper(); |
25 | m_allParameters = line.right(line.length() - m_command.length() - 1); | 25 | m_allParameters = line.right(line.length() - m_command.length() - 1); |
26 | } | 26 | } |
27 | |||
27 | /* Create a list of all parameters */ | 28 | /* Create a list of all parameters */ |
28 | while(!(stream.atEnd())) { | 29 | while(!(stream.atEnd())) { |
29 | stream >> temp; | 30 | stream >> temp; |
30 | if (temp.startsWith(":")) { | 31 | if (temp.startsWith(":")) { |
31 | /* last parameter */ | 32 | /* last parameter */ |
32 | m_trailing = line.right(line.length() - line.find(QChar(':'), 1) - 1); | 33 | m_trailing = line.right(line.length() - line.find(QChar(':'), 1) - 1); |
33 | m_parameters << m_trailing; | 34 | m_parameters << m_trailing; |
34 | break; | 35 | break; |
35 | } else { | 36 | } else { |
36 | m_parameters << temp; | 37 | m_parameters << temp; |
37 | } | 38 | } |
38 | } | 39 | } |
40 | |||
41 | |||
39 | m_commandNumber = m_command.toInt(&m_isNumerical); | 42 | m_commandNumber = m_command.toInt(&m_isNumerical); |
40 | /* Is this a CTCP command */ | 43 | /* Is this a CTCP command */ |
41 | if ((m_command == "PRIVMSG" || m_command == "NOTICE") && m_trailing.length()>0 && m_trailing.left(1) == QChar(1)) { | 44 | if ((m_command == "PRIVMSG" || m_command == "NOTICE") && m_trailing.length()>0 && m_trailing.left(1) == QChar(1)) { |
42 | m_ctcp = TRUE; | 45 | m_ctcp = TRUE; |
43 | /* Strip CTCP \001 characters */ | 46 | /* Strip CTCP \001 characters */ |
44 | m_allParameters = m_allParameters.replace(QRegExp(QChar(1)), ""); | 47 | m_allParameters = m_allParameters.replace(QRegExp(QChar(1)), ""); |
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index a2be5a4..4038673 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp | |||
@@ -23,12 +23,13 @@ IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = { | |||
23 | IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = { | 23 | IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = { |
24 | { "PING", FUNC(parseCTCPPing) }, | 24 | { "PING", FUNC(parseCTCPPing) }, |
25 | { "VERSION", FUNC(parseCTCPVersion) }, | 25 | { "VERSION", FUNC(parseCTCPVersion) }, |
26 | { "ACTION", FUNC(parseCTCPAction) }, | 26 | { "ACTION", FUNC(parseCTCPAction) }, |
27 | { 0 , 0 } | 27 | { 0 , 0 } |
28 | }; | 28 | }; |
29 | |||
29 | /* Lookup table for numerical commands */ | 30 | /* Lookup table for numerical commands */ |
30 | IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = { | 31 | IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = { |
31 | { 1, FUNC(parseNumerical001) }, // RPL_WELCOME | 32 | { 1, FUNC(parseNumerical001) }, // RPL_WELCOME |
32 | { 2, FUNC(parseNumerical002) }, // RPL_YOURHOST | 33 | { 2, FUNC(parseNumerical002) }, // RPL_YOURHOST |
33 | { 3, FUNC(parseNumerical003) }, // RPL_CREATED | 34 | { 3, FUNC(parseNumerical003) }, // RPL_CREATED |
34 | { 4, FUNC(parseNumerical004) }, // RPL_MYINFO | 35 | { 4, FUNC(parseNumerical004) }, // RPL_MYINFO |
@@ -225,17 +226,19 @@ void IRCMessageParser::parseLiteralQuit(IRCMessage *message) { | |||
225 | QList<IRCChannel> channels; | 226 | QList<IRCChannel> channels; |
226 | m_session->getChannelsByPerson(person, channels); | 227 | m_session->getChannelsByPerson(person, channels); |
227 | QListIterator<IRCChannel> it(channels); | 228 | QListIterator<IRCChannel> it(channels); |
228 | for (;it.current(); ++it) { | 229 | for (;it.current(); ++it) { |
229 | IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick()); | 230 | IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick()); |
230 | it.current()->removePerson(chanperson); | 231 | it.current()->removePerson(chanperson); |
232 | delete chanperson; | ||
231 | } | 233 | } |
232 | m_session->removePerson(person); | 234 | m_session->removePerson(person); |
233 | IRCOutput output(OUTPUT_QUIT, mask.nick() + tr(" has quit ") + "(" + message->param(0) + ")"); | 235 | IRCOutput output(OUTPUT_QUIT, mask.nick() + tr(" has quit ") + "(" + message->param(0) + ")"); |
234 | output.addParam(person); | 236 | output.addParam(person); |
235 | emit outputReady(output); | 237 | emit outputReady(output); |
238 | delete person; | ||
236 | } else { | 239 | } else { |
237 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?"))); | 240 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?"))); |
238 | } | 241 | } |
239 | } | 242 | } |
240 | 243 | ||
241 | void IRCMessageParser::parseLiteralError(IRCMessage *message) { | 244 | void IRCMessageParser::parseLiteralError(IRCMessage *message) { |
diff --git a/noncore/net/opieirc/ircoutput.cpp b/noncore/net/opieirc/ircoutput.cpp index aa57d86..878bc9b 100644 --- a/noncore/net/opieirc/ircoutput.cpp +++ b/noncore/net/opieirc/ircoutput.cpp | |||
@@ -10,12 +10,19 @@ IRCOutputType IRCOutput::type() { | |||
10 | } | 10 | } |
11 | 11 | ||
12 | QString IRCOutput::message() { | 12 | QString IRCOutput::message() { |
13 | return m_message; | 13 | return m_message; |
14 | } | 14 | } |
15 | 15 | ||
16 | QString IRCOutput::htmlMessage() { | ||
17 | QString htmlMessage =m_message.replace(QRegExp("&"), "&"); | ||
18 | htmlMessage = htmlMessage.replace(QRegExp(">"), ">"); | ||
19 | htmlMessage = htmlMessage.replace(QRegExp("<"), "<"); | ||
20 | return htmlMessage; | ||
21 | } | ||
22 | |||
16 | void IRCOutput::addParam(void *data) { | 23 | void IRCOutput::addParam(void *data) { |
17 | m_parameters.append(data); | 24 | m_parameters.append(data); |
18 | } | 25 | } |
19 | 26 | ||
20 | void *IRCOutput::getParam(int index) { | 27 | void *IRCOutput::getParam(int index) { |
21 | return m_parameters.at(index); | 28 | return m_parameters.at(index); |
diff --git a/noncore/net/opieirc/ircoutput.h b/noncore/net/opieirc/ircoutput.h index 4b757ed..72361d4 100644 --- a/noncore/net/opieirc/ircoutput.h +++ b/noncore/net/opieirc/ircoutput.h | |||
@@ -57,12 +57,14 @@ public: | |||
57 | /* Used to add a parameter to this IRCOutput. Parameters are dependent | 57 | /* Used to add a parameter to this IRCOutput. Parameters are dependent |
58 | on which IRCOutputType we are using (see above) */ | 58 | on which IRCOutputType we are using (see above) */ |
59 | void addParam(void *data); | 59 | void addParam(void *data); |
60 | 60 | ||
61 | IRCOutputType type(); | 61 | IRCOutputType type(); |
62 | QString message(); | 62 | QString message(); |
63 | /* Return the message with all HTML code escaped (for example < instead of '<') */ | ||
64 | QString htmlMessage(); | ||
63 | void *getParam(int index); | 65 | void *getParam(int index); |
64 | protected: | 66 | protected: |
65 | IRCOutputType m_type; | 67 | IRCOutputType m_type; |
66 | QString m_message; | 68 | QString m_message; |
67 | QList<void> m_parameters; | 69 | QList<void> m_parameters; |
68 | }; | 70 | }; |
diff --git a/noncore/net/opieirc/ircserver.cpp b/noncore/net/opieirc/ircserver.cpp index e16e2b2..e27e41d 100644 --- a/noncore/net/opieirc/ircserver.cpp +++ b/noncore/net/opieirc/ircserver.cpp | |||
@@ -1,12 +1,14 @@ | |||
1 | #include "ircserver.h" | 1 | #include "ircserver.h" |
2 | 2 | ||
3 | IRCServer::IRCServer() { | 3 | IRCServer::IRCServer() { |
4 | m_port = 6667; | 4 | m_port = 6667; |
5 | } | 5 | } |
6 | 6 | ||
7 | /* Setter implementations */ | ||
8 | |||
7 | void IRCServer::setHostname(QString hostname) { | 9 | void IRCServer::setHostname(QString hostname) { |
8 | m_hostname = hostname; | 10 | m_hostname = hostname; |
9 | } | 11 | } |
10 | 12 | ||
11 | void IRCServer::setName(QString name) { | 13 | void IRCServer::setName(QString name) { |
12 | m_name = name; | 14 | m_name = name; |
@@ -29,12 +31,18 @@ void IRCServer::setNick(QString nick) { | |||
29 | } | 31 | } |
30 | 32 | ||
31 | void IRCServer::setRealname(QString realname) { | 33 | void IRCServer::setRealname(QString realname) { |
32 | m_realname = realname; | 34 | m_realname = realname; |
33 | } | 35 | } |
34 | 36 | ||
37 | void IRCServer::setChannels(QString channels) { | ||
38 | m_channels = channels; | ||
39 | } | ||
40 | |||
41 | /* Getter implementations */ | ||
42 | |||
35 | QString IRCServer::hostname() { | 43 | QString IRCServer::hostname() { |
36 | return m_hostname; | 44 | return m_hostname; |
37 | } | 45 | } |
38 | 46 | ||
39 | QString IRCServer::name() { | 47 | QString IRCServer::name() { |
40 | return m_name; | 48 | return m_name; |
@@ -57,6 +65,10 @@ QString IRCServer::nick() { | |||
57 | } | 65 | } |
58 | 66 | ||
59 | QString IRCServer::realname() { | 67 | QString IRCServer::realname() { |
60 | return m_realname; | 68 | return m_realname; |
61 | } | 69 | } |
62 | 70 | ||
71 | QString IRCServer::channels() { | ||
72 | return m_channels; | ||
73 | } | ||
74 | |||
diff --git a/noncore/net/opieirc/ircserver.h b/noncore/net/opieirc/ircserver.h index f56f231..0bc7d4c 100644 --- a/noncore/net/opieirc/ircserver.h +++ b/noncore/net/opieirc/ircserver.h | |||
@@ -25,34 +25,40 @@ | |||
25 | 25 | ||
26 | /* IRCServer stores all information required to | 26 | /* IRCServer stores all information required to |
27 | establish a connection to a server. */ | 27 | establish a connection to a server. */ |
28 | 28 | ||
29 | class IRCServer { | 29 | class IRCServer { |
30 | public: | 30 | public: |
31 | /* Initialize to the default values */ | ||
31 | IRCServer(); | 32 | IRCServer(); |
32 | 33 | ||
34 | /* Setters */ | ||
33 | void setName(QString name); | 35 | void setName(QString name); |
34 | void setHostname(QString hostname); | 36 | void setHostname(QString hostname); |
35 | void setPort(int port); | 37 | void setPort(int port); |
36 | void setUsername(QString username); | 38 | void setUsername(QString username); |
37 | void setPassword(QString password); | 39 | void setPassword(QString password); |
38 | void setNick(QString nick); | 40 | void setNick(QString nick); |
39 | void setRealname(QString realname); | 41 | void setRealname(QString realname); |
42 | void setChannels(QString channels); | ||
40 | 43 | ||
44 | /* Getters */ | ||
41 | QString hostname(); | 45 | QString hostname(); |
42 | QString name(); | 46 | QString name(); |
43 | unsigned short int port(); | 47 | unsigned short int port(); |
44 | QString username(); | 48 | QString username(); |
45 | QString password(); | 49 | QString password(); |
46 | QString nick(); | 50 | QString nick(); |
47 | QString realname(); | 51 | QString realname(); |
52 | QString channels(); | ||
48 | protected: | 53 | protected: |
49 | QString m_hostname; | 54 | QString m_hostname; |
50 | QString m_name; | 55 | QString m_name; |
51 | unsigned short int m_port; | 56 | unsigned short int m_port; |
52 | QString m_username; | 57 | QString m_username; |
53 | QString m_password; | 58 | QString m_password; |
54 | QString m_nick; | 59 | QString m_nick; |
55 | QString m_realname; | 60 | QString m_realname; |
61 | QString m_channels; | ||
56 | }; | 62 | }; |
57 | 63 | ||
58 | #endif /* __IRCSERVER_H */ | 64 | #endif /* __IRCSERVER_H */ |
diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp index 798081f..c3a444d 100644 --- a/noncore/net/opieirc/ircservereditor.cpp +++ b/noncore/net/opieirc/ircservereditor.cpp | |||
@@ -1,13 +1,13 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include "ircservereditor.h" | 4 | #include "ircservereditor.h" |
5 | 5 | ||
6 | IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags f) : QDialog(parent, name, modal, f) { | 6 | IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags f) : QDialog(parent, name, modal, f) { |
7 | QGridLayout *layout = new QGridLayout(this, 6, 2, 5, 5); | 7 | QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5); |
8 | QLabel *label = new QLabel(tr("Profile name :"), this); | 8 | QLabel *label = new QLabel(tr("Profile name :"), this); |
9 | m_name = new QLineEdit(server.name(), this); | 9 | m_name = new QLineEdit(server.name(), this); |
10 | layout->addWidget(label, 0, 0); | 10 | layout->addWidget(label, 0, 0); |
11 | layout->addWidget(m_name, 0, 1); | 11 | layout->addWidget(m_name, 0, 1); |
12 | label = new QLabel(tr("Hostname :"), this); | 12 | label = new QLabel(tr("Hostname :"), this); |
13 | m_hostname = new QLineEdit(server.hostname(), this); | 13 | m_hostname = new QLineEdit(server.hostname(), this); |
@@ -26,12 +26,16 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* | |||
26 | layout->addWidget(label, 4, 0); | 26 | layout->addWidget(label, 4, 0); |
27 | layout->addWidget(m_realname, 4, 1); | 27 | layout->addWidget(m_realname, 4, 1); |
28 | label = new QLabel(tr("Password :"), this); | 28 | label = new QLabel(tr("Password :"), this); |
29 | m_password = new QLineEdit(server.password(), this); | 29 | m_password = new QLineEdit(server.password(), this); |
30 | layout->addWidget(label, 5, 0); | 30 | layout->addWidget(label, 5, 0); |
31 | layout->addWidget(m_password, 5, 1); | 31 | layout->addWidget(m_password, 5, 1); |
32 | label = new QLabel(tr("Channels :"), this); | ||
33 | m_channels = new QLineEdit(server.channels(), this); | ||
34 | layout->addWidget(label, 6, 0); | ||
35 | layout->addWidget(m_channels, 6, 1); | ||
32 | showMaximized(); | 36 | showMaximized(); |
33 | } | 37 | } |
34 | 38 | ||
35 | 39 | ||
36 | void IRCServerEditor::accept() { | 40 | void IRCServerEditor::accept() { |
37 | if (m_name->text().length()==0) | 41 | if (m_name->text().length()==0) |
@@ -41,21 +45,32 @@ void IRCServerEditor::accept() { | |||
41 | else if (m_port->text().toInt()<=0) | 45 | else if (m_port->text().toInt()<=0) |
42 | QMessageBox::critical(this, tr("Error"), tr("Port required")); | 46 | QMessageBox::critical(this, tr("Error"), tr("Port required")); |
43 | else if (m_nickname->text().length()==0) | 47 | else if (m_nickname->text().length()==0) |
44 | QMessageBox::critical(this, tr("Error"), tr("Nickname required")); | 48 | QMessageBox::critical(this, tr("Error"), tr("Nickname required")); |
45 | else if (m_realname->text().length()==0) | 49 | else if (m_realname->text().length()==0) |
46 | QMessageBox::critical(this, tr("Error"), tr("Realname required")); | 50 | QMessageBox::critical(this, tr("Error"), tr("Realname required")); |
47 | else | 51 | else { |
52 | /* Now verify whether the channel list has a valid format */ | ||
53 | QStringList channels = QStringList::split(QChar(','), m_channels->text()); | ||
54 | for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { | ||
55 | QString channelName = (*it).stripWhiteSpace(); | ||
56 | if (!channelName.startsWith("#")) { | ||
57 | QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with '#'")); | ||
58 | return; | ||
59 | } | ||
60 | } | ||
48 | QDialog::accept(); | 61 | QDialog::accept(); |
62 | } | ||
49 | } | 63 | } |
50 | 64 | ||
51 | IRCServer IRCServerEditor::getServer() { | 65 | IRCServer IRCServerEditor::getServer() { |
52 | IRCServer server; | 66 | IRCServer server; |
53 | server.setName(m_name->text()); | 67 | server.setName(m_name->text()); |
54 | server.setHostname(m_hostname->text()); | 68 | server.setHostname(m_hostname->text()); |
55 | server.setPort(m_port->text().toInt()); | 69 | server.setPort(m_port->text().toInt()); |
56 | server.setNick(m_nickname->text()); | 70 | server.setNick(m_nickname->text()); |
57 | server.setRealname(m_realname->text()); | 71 | server.setRealname(m_realname->text()); |
58 | server.setUsername(m_nickname->text()); | 72 | server.setUsername(m_nickname->text()); |
59 | server.setPassword(m_password->text()); | 73 | server.setPassword(m_password->text()); |
74 | server.setChannels(m_channels->text()); | ||
60 | return server; | 75 | return server; |
61 | } | 76 | } |
diff --git a/noncore/net/opieirc/ircservereditor.h b/noncore/net/opieirc/ircservereditor.h index 20c94f7..22311f7 100644 --- a/noncore/net/opieirc/ircservereditor.h +++ b/noncore/net/opieirc/ircservereditor.h | |||
@@ -36,9 +36,10 @@ protected: | |||
36 | QLineEdit *m_name; | 36 | QLineEdit *m_name; |
37 | QLineEdit *m_hostname; | 37 | QLineEdit *m_hostname; |
38 | QLineEdit *m_port; | 38 | QLineEdit *m_port; |
39 | QLineEdit *m_nickname; | 39 | QLineEdit *m_nickname; |
40 | QLineEdit *m_password; | 40 | QLineEdit *m_password; |
41 | QLineEdit *m_realname; | 41 | QLineEdit *m_realname; |
42 | QLineEdit *m_channels; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | #endif /* __IRCSERVEREDITOR_H */ | 45 | #endif /* __IRCSERVEREDITOR_H */ |
diff --git a/noncore/net/opieirc/ircserverlist.cpp b/noncore/net/opieirc/ircserverlist.cpp index b2d746a..e664ba1 100644 --- a/noncore/net/opieirc/ircserverlist.cpp +++ b/noncore/net/opieirc/ircserverlist.cpp | |||
@@ -56,12 +56,13 @@ IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFla | |||
56 | server.setHostname(m_config->readEntry("Hostname")); | 56 | server.setHostname(m_config->readEntry("Hostname")); |
57 | server.setPort(m_config->readNumEntry("Port")); | 57 | server.setPort(m_config->readNumEntry("Port")); |
58 | server.setUsername(m_config->readEntry("Username")); | 58 | server.setUsername(m_config->readEntry("Username")); |
59 | server.setPassword(m_config->readEntry("Password")); | 59 | server.setPassword(m_config->readEntry("Password")); |
60 | server.setNick(m_config->readEntry("Nick")); | 60 | server.setNick(m_config->readEntry("Nick")); |
61 | server.setRealname(m_config->readEntry("Realname")); | 61 | server.setRealname(m_config->readEntry("Realname")); |
62 | server.setChannels(m_config->readEntry("Channels")); | ||
62 | m_list->insertItem(new IRCListBoxServer(server)); | 63 | m_list->insertItem(new IRCListBoxServer(server)); |
63 | } | 64 | } |
64 | } | 65 | } |
65 | } | 66 | } |
66 | 67 | ||
67 | showMaximized(); | 68 | showMaximized(); |
@@ -111,12 +112,13 @@ int IRCServerList::exec() { | |||
111 | m_config->writeEntry("Hostname", server.hostname()); | 112 | m_config->writeEntry("Hostname", server.hostname()); |
112 | m_config->writeEntry("Port", QString::number(server.port())); | 113 | m_config->writeEntry("Port", QString::number(server.port())); |
113 | m_config->writeEntry("Username", server.username()); | 114 | m_config->writeEntry("Username", server.username()); |
114 | m_config->writeEntry("Password", server.password()); | 115 | m_config->writeEntry("Password", server.password()); |
115 | m_config->writeEntry("Nick", server.nick()); | 116 | m_config->writeEntry("Nick", server.nick()); |
116 | m_config->writeEntry("Realname", server.realname()); | 117 | m_config->writeEntry("Realname", server.realname()); |
118 | m_config->writeEntry("Channels", server.channels()); | ||
117 | } | 119 | } |
118 | return returncode; | 120 | return returncode; |
119 | } | 121 | } |
120 | 122 | ||
121 | bool IRCServerList::hasServer() { | 123 | bool IRCServerList::hasServer() { |
122 | return (m_list->currentItem() != -1); | 124 | return (m_list->currentItem() != -1); |
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 724f4bd..2ad56a8 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp | |||
@@ -1,7 +1,8 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <qtextstream.h> | ||
2 | #include "ircservertab.h" | 3 | #include "ircservertab.h" |
3 | 4 | ||
4 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 5 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
5 | m_server = server; | 6 | m_server = server; |
6 | m_session = new IRCSession(&m_server); | 7 | m_session = new IRCSession(&m_server); |
7 | m_mainWindow = mainWindow; | 8 | m_mainWindow = mainWindow; |
@@ -22,16 +23,12 @@ void IRCServerTab::appendText(QString text) { | |||
22 | /* not using append because it creates layout problems */ | 23 | /* not using append because it creates layout problems */ |
23 | m_textview->setText(m_textview->text() + text); | 24 | m_textview->setText(m_textview->text() + text); |
24 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 25 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
25 | } | 26 | } |
26 | 27 | ||
27 | IRCServerTab::~IRCServerTab() { | 28 | IRCServerTab::~IRCServerTab() { |
28 | QListIterator<IRCChannelTab> it(m_channelTabs); | ||
29 | for (; it.current(); ++it) { | ||
30 | m_mainWindow->killTab(it.current()); | ||
31 | } | ||
32 | delete m_session; | 29 | delete m_session; |
33 | } | 30 | } |
34 | 31 | ||
35 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { | 32 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { |
36 | m_channelTabs.remove(tab); | 33 | m_channelTabs.remove(tab); |
37 | } | 34 | } |
@@ -45,26 +42,56 @@ IRCSession *IRCServerTab::session() { | |||
45 | } | 42 | } |
46 | 43 | ||
47 | IRCServer *IRCServerTab::server() { | 44 | IRCServer *IRCServerTab::server() { |
48 | return &m_server; | 45 | return &m_server; |
49 | } | 46 | } |
50 | 47 | ||
48 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | ||
49 | QTextIStream stream(&line); | ||
50 | QString command; | ||
51 | stream >> command; | ||
52 | command = command.upper().right(command.length()-1); | ||
53 | |||
54 | if (command == "JOIN") { | ||
55 | QString channel; | ||
56 | stream >> channel; | ||
57 | if (channel.length() > 0 && channel.startsWith("#")) { | ||
58 | m_session->join(channel); | ||
59 | } else { | ||
60 | tab->appendText("<font color=\"#ff0000\">Unknown channel format!</font><br>"); | ||
61 | } | ||
62 | } else { | ||
63 | tab->appendText("<font color=\"#ff0000\">Unknown command</font><br>"); | ||
64 | } | ||
65 | } | ||
66 | |||
51 | void IRCServerTab::processCommand() { | 67 | void IRCServerTab::processCommand() { |
68 | QString text = m_field->text(); | ||
69 | if (text.startsWith("/") && !text.startsWith("//")) { | ||
70 | /* Command mode */ | ||
71 | executeCommand(this, text); | ||
72 | } | ||
52 | m_field->clear(); | 73 | m_field->clear(); |
53 | appendText("<font color=\"#ff0000\">Not supported yet</font><br>"); | ||
54 | } | 74 | } |
55 | 75 | ||
56 | void IRCServerTab::doConnect() { | 76 | void IRCServerTab::doConnect() { |
57 | m_session->beginSession(); | 77 | m_session->beginSession(); |
58 | } | 78 | } |
59 | 79 | ||
60 | void IRCServerTab::remove() { | 80 | void IRCServerTab::remove() { |
81 | /* Close requested */ | ||
61 | if (m_session->isSessionActive()) { | 82 | if (m_session->isSessionActive()) { |
83 | /* While there is a running session */ | ||
62 | m_close = TRUE; | 84 | m_close = TRUE; |
63 | m_session->endSession(); | 85 | m_session->endSession(); |
64 | } else { | 86 | } else { |
87 | /* Session has previously been closed */ | ||
88 | m_channelTabs.first(); | ||
89 | while (m_channelTabs.current() != 0) { | ||
90 | m_mainWindow->killTab(m_channelTabs.current()); | ||
91 | } | ||
65 | m_mainWindow->killTab(this); | 92 | m_mainWindow->killTab(this); |
66 | } | 93 | } |
67 | } | 94 | } |
68 | 95 | ||
69 | IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) { | 96 | IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) { |
70 | QListIterator<IRCChannelTab> it(m_channelTabs); | 97 | QListIterator<IRCChannelTab> it(m_channelTabs); |
@@ -74,73 +101,84 @@ IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) { | |||
74 | return it.current(); | 101 | return it.current(); |
75 | } | 102 | } |
76 | return 0; | 103 | return 0; |
77 | } | 104 | } |
78 | 105 | ||
79 | void IRCServerTab::display(IRCOutput output) { | 106 | void IRCServerTab::display(IRCOutput output) { |
107 | |||
108 | /* All messages to be displayed inside the GUI get here */ | ||
80 | switch (output.type()) { | 109 | switch (output.type()) { |
81 | case OUTPUT_CONNCLOSE: | 110 | case OUTPUT_CONNCLOSE: |
82 | if (m_close) | 111 | if (m_close) { |
112 | m_channelTabs.first(); | ||
113 | while (m_channelTabs.current() != 0) { | ||
114 | m_mainWindow->killTab(m_channelTabs.current()); | ||
115 | } | ||
83 | m_mainWindow->killTab(this); | 116 | m_mainWindow->killTab(this); |
84 | else | 117 | } else { |
85 | appendText("<font color=\"#0000dd\">" + output.message() +"</font><br>"); | 118 | appendText("<font color=\"#0000dd\">" + output.htmlMessage() +"</font><br>"); |
119 | QListIterator<IRCChannelTab> it(m_channelTabs); | ||
120 | for (; it.current(); ++it) { | ||
121 | it.current()->appendText("<font color=\"#0000dd\">" + output.htmlMessage() +"</font><br>"); | ||
122 | } | ||
123 | } | ||
86 | break; | 124 | break; |
87 | case OUTPUT_SELFJOIN: { | 125 | case OUTPUT_SELFJOIN: { |
88 | IRCChannelTab *channeltab = new IRCChannelTab((IRCChannel *)output.getParam(0), this, m_mainWindow, (QWidget *)parent()); | 126 | IRCChannelTab *channeltab = new IRCChannelTab((IRCChannel *)output.getParam(0), this, m_mainWindow, (QWidget *)parent()); |
89 | m_channelTabs.append(channeltab); | 127 | m_channelTabs.append(channeltab); |
90 | m_mainWindow->addTab(channeltab); | 128 | m_mainWindow->addTab(channeltab); |
91 | } | 129 | } |
92 | break; | 130 | break; |
93 | case OUTPUT_CHANPRIVMSG: { | 131 | case OUTPUT_CHANPRIVMSG: { |
94 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); | 132 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); |
95 | channelTab->appendText("<<font color=\"#0000dd\">"+((IRCChannelPerson *)output.getParam(1))->person->nick()+"</font>> "+output.message()+"<br>"); | 133 | channelTab->appendText("<<font color=\"#0000dd\">"+((IRCChannelPerson *)output.getParam(1))->person->nick()+"</font>> "+output.htmlMessage()+"<br>"); |
96 | } | 134 | } |
97 | break; | 135 | break; |
98 | case OUTPUT_SELFPART: { | 136 | case OUTPUT_SELFPART: { |
99 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); | 137 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); |
100 | if (channelTab) | 138 | if (channelTab) |
101 | m_mainWindow->killTab(channelTab); | 139 | m_mainWindow->killTab(channelTab); |
102 | } | 140 | } |
103 | break; | 141 | break; |
104 | case OUTPUT_SELFKICK: { | 142 | case OUTPUT_SELFKICK: { |
105 | appendText("<font color=\"#ff0000\">" + output.message() + "</font><br>"); | 143 | appendText("<font color=\"#ff0000\">" + output.htmlMessage() + "</font><br>"); |
106 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); | 144 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); |
107 | if (channelTab) | 145 | if (channelTab) |
108 | m_mainWindow->killTab(channelTab); | 146 | m_mainWindow->killTab(channelTab); |
109 | } | 147 | } |
110 | break; | 148 | break; |
111 | case OUTPUT_CHANACTION: { | 149 | case OUTPUT_CHANACTION: { |
112 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); | 150 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); |
113 | channelTab->appendText("<font color=\"#cc0000\">"+output.message()+"</font><br>"); | 151 | channelTab->appendText("<font color=\"#cc0000\">"+output.htmlMessage()+"</font><br>"); |
114 | } | 152 | } |
115 | break; | 153 | break; |
116 | case OUTPUT_QUIT: { | 154 | case OUTPUT_QUIT: { |
117 | QString nick = ((IRCPerson *)output.getParam(0))->nick(); | 155 | QString nick = ((IRCPerson *)output.getParam(0))->nick(); |
118 | QListIterator<IRCChannelTab> it(m_channelTabs); | 156 | QListIterator<IRCChannelTab> it(m_channelTabs); |
119 | for (; it.current(); ++it) { | 157 | for (; it.current(); ++it) { |
120 | if (it.current()->list()->hasPerson(nick)) { | 158 | if (it.current()->list()->hasPerson(nick)) { |
121 | it.current()->appendText("<font color=\"#aa3e00\">"+output.message()+"</font><br>"); | 159 | it.current()->appendText("<font color=\"#aa3e00\">"+output.htmlMessage()+"</font><br>"); |
122 | it.current()->list()->update(); | 160 | it.current()->list()->update(); |
123 | } | 161 | } |
124 | } | 162 | } |
125 | } | 163 | } |
126 | break; | 164 | break; |
127 | case OUTPUT_OTHERJOIN: | 165 | case OUTPUT_OTHERJOIN: |
128 | case OUTPUT_OTHERKICK: | 166 | case OUTPUT_OTHERKICK: |
129 | case OUTPUT_CHANPERSONMODE: | 167 | case OUTPUT_CHANPERSONMODE: |
130 | case OUTPUT_OTHERPART: { | 168 | case OUTPUT_OTHERPART: { |
131 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); | 169 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); |
132 | channelTab->appendText("<font color=\"#aa3e00\">"+output.message()+"</font><br>"); | 170 | channelTab->appendText("<font color=\"#aa3e00\">"+output.htmlMessage()+"</font><br>"); |
133 | channelTab->list()->update(); | 171 | channelTab->list()->update(); |
134 | } | 172 | } |
135 | break; | 173 | break; |
136 | case OUTPUT_CTCP: | 174 | case OUTPUT_CTCP: |
137 | appendText("<font color=\"#00bb00\">" + output.message() + "</font><br>"); | 175 | appendText("<font color=\"#00bb00\">" + output.htmlMessage() + "</font><br>"); |
138 | break; | 176 | break; |
139 | case OUTPUT_ERROR: | 177 | case OUTPUT_ERROR: |
140 | appendText("<font color=\"#ff0000\">" + output.message() + "</font><br>"); | 178 | appendText("<font color=\"#ff0000\">" + output.htmlMessage() + "</font><br>"); |
141 | break; | 179 | break; |
142 | default: | 180 | default: |
143 | appendText("<font color=\"#0000dd\">" + output.message() + "</font><br>"); | 181 | appendText("<font color=\"#0000dd\">" + output.htmlMessage() + "</font><br>"); |
144 | break; | 182 | break; |
145 | } | 183 | } |
146 | } | 184 | } |
diff --git a/noncore/net/opieirc/ircservertab.h b/noncore/net/opieirc/ircservertab.h index fa9a0a3..cfa0832 100644 --- a/noncore/net/opieirc/ircservertab.h +++ b/noncore/net/opieirc/ircservertab.h | |||
@@ -36,12 +36,15 @@ public: | |||
36 | IRCSession *session(); | 36 | IRCSession *session(); |
37 | IRCServer *server(); | 37 | IRCServer *server(); |
38 | 38 | ||
39 | /* Start the server session */ | 39 | /* Start the server session */ |
40 | void doConnect(); | 40 | void doConnect(); |
41 | void removeChannelTab(IRCChannelTab *tab); | 41 | void removeChannelTab(IRCChannelTab *tab); |
42 | |||
43 | /* Execute a user command such as /join */ | ||
44 | void executeCommand(IRCTab *tab, QString line); | ||
42 | protected: | 45 | protected: |
43 | void appendText(QString text); | 46 | void appendText(QString text); |
44 | IRCChannelTab *getTabForChannel(IRCChannel *channel); | 47 | IRCChannelTab *getTabForChannel(IRCChannel *channel); |
45 | public slots: | 48 | public slots: |
46 | void remove(); | 49 | void remove(); |
47 | void processCommand(); | 50 | void processCommand(); |
diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp index b81038f..89df68c 100644 --- a/noncore/net/opieirc/ircsession.cpp +++ b/noncore/net/opieirc/ircsession.cpp | |||
@@ -9,12 +9,16 @@ IRCSession::IRCSession(IRCServer *server) { | |||
9 | connect(m_connection, SIGNAL(messageArrived(IRCMessage *)), this, SLOT(handleMessage(IRCMessage *))); | 9 | connect(m_connection, SIGNAL(messageArrived(IRCMessage *)), this, SLOT(handleMessage(IRCMessage *))); |
10 | connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); | 10 | connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); |
11 | connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); | 11 | connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); |
12 | } | 12 | } |
13 | 13 | ||
14 | IRCSession::~IRCSession() { | 14 | IRCSession::~IRCSession() { |
15 | /* We want this to get deleted automatically */ | ||
16 | m_channels.setAutoDelete(TRUE); | ||
17 | m_people.setAutoDelete(TRUE); | ||
18 | |||
15 | delete m_parser; | 19 | delete m_parser; |
16 | delete m_connection; | 20 | delete m_connection; |
17 | } | 21 | } |
18 | 22 | ||
19 | void IRCSession::beginSession() { | 23 | void IRCSession::beginSession() { |
20 | m_connection->doConnect(); | 24 | m_connection->doConnect(); |
diff --git a/noncore/net/opieirc/irctab.h b/noncore/net/opieirc/irctab.h index 3124980..0ce9777 100644 --- a/noncore/net/opieirc/irctab.h +++ b/noncore/net/opieirc/irctab.h | |||
@@ -34,12 +34,13 @@ | |||
34 | class IRCTab : public QWidget { | 34 | class IRCTab : public QWidget { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | public: | 36 | public: |
37 | IRCTab(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 37 | IRCTab(QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
38 | virtual QString title() = 0; | 38 | virtual QString title() = 0; |
39 | virtual IRCSession *session() = 0; | 39 | virtual IRCSession *session() = 0; |
40 | virtual void appendText(QString text) = 0; | ||
40 | public slots: | 41 | public slots: |
41 | virtual void remove() = 0; | 42 | virtual void remove() = 0; |
42 | protected: | 43 | protected: |
43 | QLabel *m_description; | 44 | QLabel *m_description; |
44 | QVBoxLayout *m_layout; | 45 | QVBoxLayout *m_layout; |
45 | }; | 46 | }; |
diff --git a/noncore/net/opieirc/ircversion.h b/noncore/net/opieirc/ircversion.h index 0ef0d2f..f8510e6 100644 --- a/noncore/net/opieirc/ircversion.h +++ b/noncore/net/opieirc/ircversion.h | |||
@@ -18,10 +18,10 @@ | |||
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCVERSION_H | 21 | #ifndef __IRCVERSION_H |
22 | #define __IRCVERSION_H | 22 | #define __IRCVERSION_H |
23 | 23 | ||
24 | #define APP_VERSION "OpieIRC 0.1" | 24 | #define APP_VERSION "OpieIRC 0.2" |
25 | #define APP_COPYSTR "(c) 2002 by Wenzel Jakob" | 25 | #define APP_COPYSTR "(c) 2002 by Wenzel Jakob" |
26 | 26 | ||
27 | #endif /* __IRCVERSION_H */ | 27 | #endif /* __IRCVERSION_H */ |