summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircconnection.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircconnection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircconnection.cpp8
1 files changed, 8 insertions, 0 deletions
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
@@ -51,24 +51,32 @@ void IRCConnection::login() {
}
loginString += "NICK " + m_server->nick() + "\r\n" +
"USER " + m_server->username() + " " + hostname +
" " + m_server->hostname() + " :" + m_server->realname() + "\r\n";
sendLine(loginString);
}
/* Called when data arrives on the socket */
void IRCConnection::dataReady() {
while(m_socket->canReadLine()) {
IRCMessage message(m_socket->readLine());
if (!m_loggedIn && message.isNumerical() && message.commandNumber() == 1) {
+ /* Now autojoin all channels specified inside the server profile */
+ QStringList channels = QStringList::split(QChar(','), m_server->channels());
+ for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) {
+ QString channelName = (*it).stripWhiteSpace();
+ if (channelName.startsWith("#")) {
+ sendLine("JOIN "+ channelName);
+ }
+ }
m_loggedIn = TRUE;
emit outputReady(IRCOutput(OUTPUT_CLIENTMESSAGE, tr("Successfully logged in.")));
}
emit messageArrived(&message);
}
}
/* Called if any type of socket error occurs */
void IRCConnection::error(int num) {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Socket error : ") + strerror(num)));
}