/***************************************************************************
- * Copyright (C) 2005-2013 by the Quassel Project *
+ * Copyright (C) 2005-2015 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
construct.append(net->saslAccount());
construct.append(QChar(QChar::Null));
construct.append(net->saslPassword());
- QByteArray saslData = QByteArray(construct.toAscii().toBase64());
+ QByteArray saslData = QByteArray(construct.toLatin1().toBase64());
saslData.prepend("AUTHENTICATE ");
net->putRawLine(saslData);
#ifdef HAVE_SSL
// additional CAP messages (ls, multi-prefix, et cetera).
if (e->params().count() == 3) {
- if (e->params().at(2).startsWith("sasl")) { // Freenode (at least) sends "sasl " with a trailing space for some reason!
- // FIXME use event
- // if the current identity has a cert set, use SASL EXTERNAL
+ if (e->params().at(1) == "NAK") {
+ // CAP REQ sasl was denied
+ coreNetwork(e)->putRawLine("CAP END");
+ }
+ else if (e->params().at(1) == "ACK") {
+ if (e->params().at(2).startsWith("sasl")) { // Freenode (at least) sends "sasl " with a trailing space for some reason!
+ // FIXME use event
+ // if the current identity has a cert set, use SASL EXTERNAL
#ifdef HAVE_SSL
- if (!coreNetwork(e)->identityPtr()->sslCert().isNull()) {
- coreNetwork(e)->putRawLine(coreNetwork(e)->serverEncode("AUTHENTICATE EXTERNAL"));
- } else {
+ if (!coreNetwork(e)->identityPtr()->sslCert().isNull()) {
+ coreNetwork(e)->putRawLine(coreNetwork(e)->serverEncode("AUTHENTICATE EXTERNAL"));
+ } else {
#endif
- // Only working with PLAIN atm, blowfish later
- coreNetwork(e)->putRawLine(coreNetwork(e)->serverEncode("AUTHENTICATE PLAIN"));
+ // Only working with PLAIN atm, blowfish later
+ coreNetwork(e)->putRawLine(coreNetwork(e)->serverEncode("AUTHENTICATE PLAIN"));
#ifdef HAVE_SSL
- }
+ }
#endif
+ }
}
}
}
{
QString param = e->params().count() ? e->params().first() : QString();
// FIXME use events
- coreNetwork(e)->putRawLine("PONG " + coreNetwork(e)->serverEncode(param));
+ // Take priority so this won't get stuck behind other queued messages.
+ coreNetwork(e)->putRawLine("PONG " + coreNetwork(e)->serverEncode(param), true);
}
}
}
+/* ERROR - "ERROR :reason"
+Example: ERROR :Closing Link: nickname[xxx.xxx.xxx.xxx] (Large base64 image paste.)
+See https://tools.ietf.org/html/rfc2812#section-3.7.4 */
+void CoreSessionEventProcessor::processIrcEventError(IrcEvent *e)
+{
+ if (!checkParamCount(e, 1))
+ return;
+
+ if (coreNetwork(e)->disconnectExpected()) {
+ // During QUIT, the server should send an error (often, but not always, "Closing Link"). As
+ // we're expecting it, don't show this to the user.
+ e->setFlag(EventManager::Silent);
+ }
+}
+
#ifdef HAVE_QCA2
void CoreSessionEventProcessor::processKeyEvent(KeyEvent *e)
/* RPL_WELCOME */
-void CoreSessionEventProcessor::processIrcEvent001(IrcEvent *e)
+void CoreSessionEventProcessor::processIrcEvent001(IrcEventNumeric *e)
{
- if (!checkParamCount(e, 1))
- return;
-
- QString myhostmask = e->params().at(0).section(' ', -1, -1);
e->network()->setCurrentServer(e->prefix());
- e->network()->setMyNick(nickFromMask(myhostmask));
+ e->network()->setMyNick(e->target());
}
switch (e->params().count()) {
case 3:
topic = e->params()[2];
+ [[clang::fallthrough]];
case 2:
userCount = e->params()[1].toUInt();
+ [[clang::fallthrough]];
case 1:
channelName = e->params()[0];
+ [[clang::fallthrough]];
default:
break;
}
void CoreSessionEventProcessor::handleCtcpVersion(CtcpEvent *e)
{
e->setReply(QString("Quassel IRC %1 (built on %2) -- http://www.quassel-irc.org")
- .arg(Quassel::buildInfo().plainVersionString).arg(Quassel::buildInfo().buildDate));
+ .arg(Quassel::buildInfo().plainVersionString).arg(Quassel::buildInfo().commitDate));
}