author | kergoth <kergoth> | 2003-08-09 17:00:23 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:00:23 (UTC) |
commit | c33d5ec60361238e50a4a9d6e0eec03e396dce60 (patch) (side-by-side diff) | |
tree | 31c0c85dc4262044db90c7918014bc45265ef420 /noncore/net/opieirc | |
parent | 78c296d534589835801fb6374ac9d43d44b2b1c9 (diff) | |
download | opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.zip opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.tar.gz opie-c33d5ec60361238e50a4a9d6e0eec03e396dce60.tar.bz2 |
Merge from BRANCH_1_0
-rw-r--r-- | noncore/net/opieirc/config.in | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchannellist.cpp | 11 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchannellist.h | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 23 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 26 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsession.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsession.h | 1 |
8 files changed, 54 insertions, 15 deletions
diff --git a/noncore/net/opieirc/config.in b/noncore/net/opieirc/config.in index 30184a9..7c6949d 100644 --- a/noncore/net/opieirc/config.in +++ b/noncore/net/opieirc/config.in @@ -1,4 +1,4 @@ config OPIEIRC - boolean "opieirc" + boolean "opie-irc (chat via your favorite IRC server)" default "y" depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/noncore/net/opieirc/ircchannellist.cpp b/noncore/net/opieirc/ircchannellist.cpp index e592d05..566b223 100644 --- a/noncore/net/opieirc/ircchannellist.cpp +++ b/noncore/net/opieirc/ircchannellist.cpp @@ -35,3 +35,14 @@ bool IRCChannelList::hasPerson(QString nick) { } return FALSE; } + +bool IRCChannelList::removePerson(QString nick) { + for (unsigned int i=0; i<count(); i++) { + if (text(i) == nick){ + removeItem(i); + return TRUE; + } + } + return FALSE; +} + diff --git a/noncore/net/opieirc/ircchannellist.h b/noncore/net/opieirc/ircchannellist.h index fa3c8cd..deab649 100644 --- a/noncore/net/opieirc/ircchannellist.h +++ b/noncore/net/opieirc/ircchannellist.h @@ -29,6 +29,7 @@ public: IRCChannelList(IRCChannel *channel, QWidget *parent = 0, const char *name = 0, WFlags f = 0); void update(); bool hasPerson(QString nick); + bool removePerson(QString nick); protected: IRCChannel *m_channel; }; diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index beb8bce..2b8b65e 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp @@ -62,6 +62,7 @@ void IRCChannelTab::appendText(QString text) { } else { m_lines++; } + m_textview->ensureVisible(0, m_textview->contentsHeight()); m_textview->setText(txt); m_textview->ensureVisible(0, m_textview->contentsHeight()); emit changed(this); diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index 6b88f34..400ff41 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp @@ -206,8 +206,9 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) { } void IRCMessageParser::parseLiteralNick(IRCMessage *message) { + IRCPerson mask(message->prefix()); - + /* this way of handling nick changes really sucks */ if (mask.nick() == m_session->m_server->nick()) { /* We are changing our nickname */ m_session->m_server->setNick(message->param(0)); @@ -218,9 +219,22 @@ void IRCMessageParser::parseLiteralNick(IRCMessage *message) { /* Someone else is */ IRCPerson *person = m_session->getPerson(mask.nick()); if (person) { - IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0 ))); - output.addParam(person); - emit outputReady(output); + //IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0))); + + /* new code starts here -- this removes the person from all channels */ + QList<IRCChannel> channels; + m_session->getChannelsByPerson(person, channels); + QListIterator<IRCChannel> it(channels); + for (;it.current(); ++it) { + IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick()); + it.current()->removePerson(chanperson); + chanperson->person->setNick(message->param(0)); + it.current()->addPerson(chanperson); + IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0))); + output.addParam(person); + emit outputReady(output); + } + /* new code ends here */ } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person"))); } @@ -397,6 +411,7 @@ void IRCMessageParser::parseLiteralKick(IRCMessage *message) { output.addParam(channel); emit outputReady(output); } else { + /* someone else got kicked */ channel->removePerson(person); IRCOutput output(OUTPUT_OTHERKICK, person->person->nick() + tr(" was kicked from ") + channel->channelname() + tr(" by ") + mask.nick()+ " (" + message->param(2) + ")"); output.addParam(channel); diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 1d9520a..2c28507 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp @@ -122,19 +122,13 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { else if (command == "OP"){ QString nickname; stream >> nickname; - if (nickname.length() > 0) { - if (line.length() > 7 + nickname.length()) { - QString text = line.right(line.length()-nickname.length()-7); - IRCPerson person; - person.setNick(nickname); - m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text); - } else { + if (nickname.length() > 0) { + QString text = line.right(line.length()-nickname.length()-5); IRCPerson person; person.setNick(nickname); - m_session->kick(((IRCChannelTab *)tab)->channel(), &person); + m_session->op(((IRCChannelTab *)tab)->channel(), &person); } } - } //SEND MODES else if (command == "MODE"){ @@ -346,7 +340,19 @@ void IRCServerTab::display(IRCOutput output) { } } break; - case OUTPUT_OTHERJOIN: +/* case OUTPUT_NICKCHANGE: { + //WAS HERE + QString nick = ((IRCPerson *)output.getParam(0))->nick(); + QListIterator<IRCChannelTab> it(m_channelTabs); + for (; it.current(); ++it) { + if (it.current()->list()->hasPerson(nick)) { + it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); + it.current()->list()->update(); + } + } + } + break; + */ case OUTPUT_OTHERJOIN: case OUTPUT_OTHERKICK: case OUTPUT_CHANPERSONMODE: case OUTPUT_OTHERPART: { diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp index 1cc1ee2..6404d71 100644 --- a/noncore/net/opieirc/ircsession.cpp +++ b/noncore/net/opieirc/ircsession.cpp @@ -60,6 +60,10 @@ void IRCSession::kick(IRCChannel *channel, IRCPerson *person) { m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason"); } +void IRCSession::op(IRCChannel *channel, IRCPerson *person) { + m_connection->sendLine("MODE "+ channel->channelname() + " +ooo " + person->nick()); +} + void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) { m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message); } diff --git a/noncore/net/opieirc/ircsession.h b/noncore/net/opieirc/ircsession.h index a6a3e50..f6330d8 100644 --- a/noncore/net/opieirc/ircsession.h +++ b/noncore/net/opieirc/ircsession.h @@ -51,6 +51,7 @@ public: void mode(IRCPerson *person, QString message); void mode(QString message); void part(IRCChannel *channel); + void op(IRCChannel *channel, IRCPerson *person); void kick(IRCChannel *channel, IRCPerson *person); void kick(IRCChannel *channel, IRCPerson *person, QString message); void beginSession(); |