Diffstat (limited to 'noncore/net/opieirc/ircsession.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircsession.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp index ca0df50..80a327a 100644 --- a/noncore/net/opieirc/ircsession.cpp +++ b/noncore/net/opieirc/ircsession.cpp | |||
@@ -1,14 +1,16 @@ | |||
1 | |||
1 | #include "ircsession.h" | 2 | #include "ircsession.h" |
2 | #include "ircmessageparser.h" | 3 | #include "ircmessageparser.h" |
4 | #include "ircchannelperson.h" | ||
3 | #include "ircversion.h" | 5 | #include "ircversion.h" |
4 | 6 | ||
5 | IRCSession::IRCSession(IRCServer *server) { | 7 | IRCSession::IRCSession(IRCServer *server) { |
6 | m_server = server; | 8 | m_server = server; |
7 | m_connection = new IRCConnection(m_server); | 9 | m_connection = new IRCConnection(m_server); |
8 | m_parser = new IRCMessageParser(this); | 10 | m_parser = new IRCMessageParser(this); |
9 | connect(m_connection, SIGNAL(messageArrived(IRCMessage*)), this, SLOT(handleMessage(IRCMessage*))); | 11 | connect(m_connection, SIGNAL(messageArrived(IRCMessage*)), this, SLOT(handleMessage(IRCMessage*))); |
10 | connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); | 12 | connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); |
11 | connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); | 13 | connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput))); |
12 | } | 14 | } |
13 | 15 | ||
14 | IRCSession::~IRCSession() { | 16 | IRCSession::~IRCSession() { |
@@ -128,25 +130,25 @@ void IRCSession::updateNickname(const QString &oldNickname, const QString &newNi | |||
128 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person"))); | 130 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person"))); |
129 | return; | 131 | return; |
130 | } | 132 | } |
131 | 133 | ||
132 | getChannelsByPerson(person, channels); | 134 | getChannelsByPerson(person, channels); |
133 | output = IRCOutput(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg(oldNickname).arg(newNickname)); | 135 | output = IRCOutput(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg(oldNickname).arg(newNickname)); |
134 | } | 136 | } |
135 | 137 | ||
136 | QListIterator<IRCChannel> it(channels); | 138 | QListIterator<IRCChannel> it(channels); |
137 | for (;it.current(); ++it) { | 139 | for (;it.current(); ++it) { |
138 | IRCChannelPerson *chanperson = it.current()->getPerson(oldNickname); | 140 | IRCChannelPerson *chanperson = it.current()->getPerson(oldNickname); |
139 | it.current()->removePerson(chanperson); | 141 | it.current()->removePerson(chanperson); |
140 | chanperson->person->setNick(newNickname); | 142 | chanperson->setNick(newNickname); |
141 | it.current()->addPerson(chanperson); | 143 | it.current()->addPerson(chanperson); |
142 | } | 144 | } |
143 | 145 | ||
144 | emit updateChannels(); | 146 | emit updateChannels(); |
145 | output.addParam(new QString(newNickname)); | 147 | output.addParam(new QString(newNickname)); |
146 | emit outputReady(output); | 148 | emit outputReady(output); |
147 | } | 149 | } |
148 | 150 | ||
149 | IRCChannel *IRCSession::getChannel(QString channelname) { | 151 | IRCChannel *IRCSession::getChannel(QString channelname) { |
150 | QListIterator<IRCChannel> it(m_channels); | 152 | QListIterator<IRCChannel> it(m_channels); |
151 | for (; it.current(); ++it) { | 153 | for (; it.current(); ++it) { |
152 | if (it.current()->channelname() == channelname) { | 154 | if (it.current()->channelname() == channelname) { |
@@ -185,12 +187,28 @@ void IRCSession::addChannel(IRCChannel *channel) { | |||
185 | 187 | ||
186 | void IRCSession::removeChannel(IRCChannel *channel) { | 188 | void IRCSession::removeChannel(IRCChannel *channel) { |
187 | m_channels.remove(channel); | 189 | m_channels.remove(channel); |
188 | } | 190 | } |
189 | 191 | ||
190 | void IRCSession::removePerson(IRCPerson *person) { | 192 | void IRCSession::removePerson(IRCPerson *person) { |
191 | m_people.remove(person); | 193 | m_people.remove(person); |
192 | } | 194 | } |
193 | 195 | ||
194 | void IRCSession::handleMessage(IRCMessage *message) { | 196 | void IRCSession::handleMessage(IRCMessage *message) { |
195 | m_parser->parse(message); | 197 | m_parser->parse(message); |
196 | } | 198 | } |
199 | |||
200 | void IRCSession::whois(const QString &nickname) { | ||
201 | m_connection->whois(nickname); | ||
202 | } | ||
203 | |||
204 | void IRCSession::sendCTCPPing(const QString &nickname) { | ||
205 | m_connection->sendCTCPPing(nickname); | ||
206 | } | ||
207 | |||
208 | void IRCSession::sendCTCPRequest(const QString &nickname, const QString &type, const QString &args) { | ||
209 | m_connection->sendCTCPRequest(nickname, type, args); | ||
210 | } | ||
211 | |||
212 | void IRCSession::sendCTCPReply(const QString &nickname, const QString &type, const QString &args) { | ||
213 | m_connection->sendCTCPReply(nickname, type, args); | ||
214 | } | ||