summaryrefslogtreecommitdiff
authorwazlaf <wazlaf>2002-09-29 21:45:16 (UTC)
committer wazlaf <wazlaf>2002-09-29 21:45:16 (UTC)
commita54430dbebd980109afdf604c7bfc9b0e15c4fdb (patch) (side-by-side diff)
treeb81722f654163301c67e98b4d210b1bcf068c20b
parent75c85d30c3f7de8d2785f70e0f28ef838ea7f419 (diff)
downloadopie-a54430dbebd980109afdf604c7bfc9b0e15c4fdb.zip
opie-a54430dbebd980109afdf604c7bfc9b0e15c4fdb.tar.gz
opie-a54430dbebd980109afdf604c7bfc9b0e15c4fdb.tar.bz2
modeless channel support
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircconnection.cpp2
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp2
-rw-r--r--noncore/net/opieirc/ircservereditor.cpp4
-rw-r--r--noncore/net/opieirc/ircservertab.cpp2
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
@@ -51,33 +51,33 @@ 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("#")) {
+ 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() {
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
@@ -170,33 +170,33 @@ void IRCMessageParser::parseLiteralPart(IRCMessage *message) {
}
}
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()));
}
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
@@ -41,34 +41,34 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char*
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());
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
@@ -55,33 +55,33 @@ 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>");
}