summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircconnection.cpp
Unidiff
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() {
51 } 51 }
52 loginString += "NICK " + m_server->nick() + "\r\n" + 52 loginString += "NICK " + m_server->nick() + "\r\n" +
53 "USER " + m_server->username() + " " + hostname + 53 "USER " + m_server->username() + " " + hostname +
54 " " + m_server->hostname() + " :" + m_server->realname() + "\r\n"; 54 " " + m_server->hostname() + " :" + m_server->realname() + "\r\n";
55 sendLine(loginString); 55 sendLine(loginString);
56} 56}
57 57
58/* Called when data arrives on the socket */ 58/* Called when data arrives on the socket */
59void IRCConnection::dataReady() { 59void 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}
69 77
70/* Called if any type of socket error occurs */ 78/* Called if any type of socket error occurs */
71void IRCConnection::error(int num) { 79void IRCConnection::error(int num) {
72 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Socket error : ") + strerror(num))); 80 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Socket error : ") + strerror(num)));
73} 81}
74 82