author | wazlaf <wazlaf> | 2002-09-29 21:45:16 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-29 21:45:16 (UTC) |
commit | a54430dbebd980109afdf604c7bfc9b0e15c4fdb (patch) (side-by-side diff) | |
tree | b81722f654163301c67e98b4d210b1bcf068c20b | |
parent | 75c85d30c3f7de8d2785f70e0f28ef838ea7f419 (diff) | |
download | opie-a54430dbebd980109afdf604c7bfc9b0e15c4fdb.zip opie-a54430dbebd980109afdf604c7bfc9b0e15c4fdb.tar.gz opie-a54430dbebd980109afdf604c7bfc9b0e15c4fdb.tar.bz2 |
modeless channel support
-rw-r--r-- | noncore/net/opieirc/ircconnection.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservereditor.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/noncore/net/opieirc/ircconnection.cpp b/noncore/net/opieirc/ircconnection.cpp index 5eb0cf2..2325cca 100644 --- a/noncore/net/opieirc/ircconnection.cpp +++ b/noncore/net/opieirc/ircconnection.cpp @@ -43,49 +43,49 @@ void IRCConnection::login() { emit outputReady(IRCOutput(OUTPUT_CLIENTMESSAGE, tr("Connected, logging in .."))); m_connected = TRUE; gethostname(hostname, sizeof(hostname)-1); hostname[sizeof (hostname) - 1] = 0; /* Create a logon string and send it */ if (m_server->password().length()>0) { loginString += "PASS " + m_server->password() + "\r\n"; } 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("#")) { + if (channelName.startsWith("#") || 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))); } void IRCConnection::disconnect() { m_connected = FALSE; m_loggedIn = FALSE; emit outputReady(IRCOutput(OUTPUT_CONNCLOSE, tr("Connection closed"))); } bool IRCConnection::isConnected() { return m_connected; } diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index 2b77414..a95c64e 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp @@ -162,49 +162,49 @@ void IRCMessageParser::parseLiteralPart(IRCMessage *message) { emit outputReady(output); delete person; } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Parting person not found - desynchronized?"))); } } } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel for part not found - desynchronized?"))); } } void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) { if (m_session->m_server->nick() == message->param(0)) { /* IRC Query message detected, verify sender and display it */ IRCPerson mask(message->prefix()); IRCPerson *person = m_session->getPerson(mask.nick()); if (!person) { /* Person not yet known, create and add to the current session */ person = new IRCPerson(message->prefix()); m_session->addPerson(person); } IRCOutput output(OUTPUT_QUERYPRIVMSG, message->param(1)); output.addParam(person); emit outputReady(output); - } else if (message->param(0).at(0) == '#') { + } else if (message->param(0).at(0) == '#' || message->param(0).at(0) == '+') { /* IRC Channel message detected, verify sender, channel and display it */ IRCChannel *channel = m_session->getChannel(message->param(0).lower()); if (channel) { IRCPerson mask(message->prefix()); IRCChannelPerson *person = channel->getPerson(mask.nick()); if (person) { IRCOutput output(OUTPUT_CHANPRIVMSG, message->param(1)); output.addParam(channel); output.addParam(person); emit outputReady(output); } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender"))); } } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel ") + message->param(0).lower())); } } else { emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type"))); } } void IRCMessageParser::parseLiteralNick(IRCMessage *message) { IRCPerson mask(message->prefix()); diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp index 5e916ae..f976c84 100644 --- a/noncore/net/opieirc/ircservereditor.cpp +++ b/noncore/net/opieirc/ircservereditor.cpp @@ -33,45 +33,45 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* m_channels = new QLineEdit(server.channels(), this); layout->addWidget(label, 6, 0); layout->addWidget(m_channels, 6, 1); setCaption(tr("Edit server information")); showMaximized(); } void IRCServerEditor::accept() { if (m_name->text().length()==0) QMessageBox::critical(this, tr("Error"), tr("Profile name required")); else if (m_hostname->text().length()==0) QMessageBox::critical(this, tr("Error"), tr("Host name required")); else if (m_port->text().toInt()<=0) QMessageBox::critical(this, tr("Error"), tr("Port required")); else if (m_nickname->text().length()==0) QMessageBox::critical(this, tr("Error"), tr("Nickname required")); else if (m_realname->text().length()==0) QMessageBox::critical(this, tr("Error"), tr("Realname required")); else { /* Now verify whether the channel list has a valid format */ QStringList channels = QStringList::split(QChar(','), m_channels->text()); for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { QString channelName = (*it).stripWhiteSpace(); - if (!channelName.startsWith("#")) { - QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with '#'")); + if (!channelName.startsWith("#") && !channelName.startsWith("+")) { + QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with either '#' or '+'")); return; } } QDialog::accept(); } } IRCServer IRCServerEditor::getServer() { IRCServer server; server.setName(m_name->text()); server.setHostname(m_hostname->text()); server.setPort(m_port->text().toInt()); server.setNick(m_nickname->text()); server.setRealname(m_realname->text()); server.setUsername(m_nickname->text()); server.setPassword(m_password->text()); server.setChannels(m_channels->text()); return server; } diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index aea58a3..d16c05f 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp @@ -47,49 +47,49 @@ QString IRCServerTab::title() { return "Server"; } IRCSession *IRCServerTab::session() { return m_session; } IRCServer *IRCServerTab::server() { return &m_server; } void IRCServerTab::settingsChanged() { m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); } void IRCServerTab::executeCommand(IRCTab *tab, QString line) { QTextIStream stream(&line); QString command; stream >> command; command = command.upper().right(command.length()-1); if (command == "JOIN") { QString channel; stream >> channel; - if (channel.length() > 0 && channel.startsWith("#")) { + if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { m_session->join(channel); } else { tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); } } else if (command == "ME") { QString text = line.right(line.length()-4); if (text.length() > 0) { if (tab->isA("IRCChannelTab")) { tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); } else if (tab->isA("IRCQueryTab")) { tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); m_session->sendAction(((IRCQueryTab *)tab)->person(), text); } else { tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>"); } } } else if (command == "MSG") { QString nickname; stream >> nickname; if (nickname.length() > 0) { if (line.length() > 6 + nickname.length()) { QString text = line.right(line.length()-nickname.length()-6); IRCPerson person; |