diff --git a/src/common/network.cpp b/src/common/network.cpp
index 0dae357..67ebe91 100644
--- a/src/common/network.cpp
+++ b/src/common/network.cpp
@@ -47,6 +47,7 @@ Network::Network(const NetworkId &networkid, QObject *parent)
     _prefixModes(QString()),
     _useRandomServer(false),
     _useAutoIdentify(false),
+    _useSasl(false),
     _useAutoReconnect(false),
     _autoReconnectInterval(60),
     _autoReconnectRetries(10),
@@ -87,6 +88,9 @@ NetworkInfo Network::networkInfo() const {
   info.useAutoIdentify = useAutoIdentify();
   info.autoIdentifyService = autoIdentifyService();
   info.autoIdentifyPassword = autoIdentifyPassword();
+  info.useSasl = useSasl();
+  info.saslAccount = saslAccount();
+  info.saslPassword = saslPassword();
   info.useAutoReconnect = useAutoReconnect();
   info.autoReconnectInterval = autoReconnectInterval();
   info.autoReconnectRetries = autoReconnectRetries();
@@ -108,6 +112,9 @@ void Network::setNetworkInfo(const NetworkInfo &info) {
   if(info.useAutoIdentify != useAutoIdentify()) setUseAutoIdentify(info.useAutoIdentify);
   if(info.autoIdentifyService != autoIdentifyService()) setAutoIdentifyService(info.autoIdentifyService);
   if(info.autoIdentifyPassword != autoIdentifyPassword()) setAutoIdentifyPassword(info.autoIdentifyPassword);
+  if(info.useSasl != useSasl()) setUseSasl(info.useSasl);
+  if(info.saslAccount != saslAccount()) setSaslAccount(info.saslAccount);
+  if(info.saslPassword != saslPassword()) setSaslPassword(info.saslPassword);
   if(info.useAutoReconnect != useAutoReconnect()) setUseAutoReconnect(info.useAutoReconnect);
   if(info.autoReconnectInterval != autoReconnectInterval()) setAutoReconnectInterval(info.autoReconnectInterval);
   if(info.autoReconnectRetries != autoReconnectRetries()) setAutoReconnectRetries(info.autoReconnectRetries);
@@ -566,6 +573,24 @@ void Network::setAutoIdentifyPassword(const QString &password) {
   emit configChanged();
 }
 
+void Network::setUseSasl(bool use) {
+    _useSasl = use;
+    SYNC(ARG(use))
+    emit configChanged();
+}
+
+void Network::setSaslAccount(const QString &account) {
+    _saslAccount = account;
+    SYNC(ARG(account))
+    emit configChanged();
+}
+
+void Network::setSaslPassword(const QString &password) {
+    _saslPassword = password;
+    SYNC(ARG(password))
+    emit configChanged();
+}
+
 void Network::setUseAutoReconnect(bool use) {
   _useAutoReconnect = use;
   SYNC(ARG(use))
@@ -758,6 +783,7 @@ NetworkInfo::NetworkInfo()
   useRandomServer(false),
   useAutoIdentify(false),
   autoIdentifyService("NickServ"),
+  useSasl(false),
   useAutoReconnect(true),
   autoReconnectInterval(60),
   autoReconnectRetries(20),
@@ -780,6 +806,9 @@ bool NetworkInfo::operator==(const NetworkInfo &other) const {
   if(useAutoIdentify != other.useAutoIdentify) return false;
   if(autoIdentifyService != other.autoIdentifyService) return false;
   if(autoIdentifyPassword != other.autoIdentifyPassword) return false;
+  if(useSasl != other.useSasl) return false;
+  if(saslAccount != other.saslAccount) return false;
+  if(saslPassword != other.saslPassword) return false;
   if(useAutoReconnect != other.useAutoReconnect) return false;
   if(autoReconnectInterval != other.autoReconnectInterval) return false;
   if(autoReconnectRetries != other.autoReconnectRetries) return false;
@@ -806,6 +835,9 @@ QDataStream &operator<<(QDataStream &out, const NetworkInfo &info) {
   i["UseAutoIdentify"] = info.useAutoIdentify;
   i["AutoIdentifyService"] = info.autoIdentifyService;
   i["AutoIdentifyPassword"] = info.autoIdentifyPassword;
+  i["UseSasl"] = info.useSasl;
+  i["SaslAccount"] = info.saslAccount;
+  i["SaslPassword"] = info.saslPassword;
   i["UseAutoReconnect"] = info.useAutoReconnect;
   i["AutoReconnectInterval"] = info.autoReconnectInterval;
   i["AutoReconnectRetries"] = info.autoReconnectRetries;
@@ -830,6 +862,9 @@ QDataStream &operator>>(QDataStream &in, NetworkInfo &info) {
   info.useAutoIdentify = i["UseAutoIdentify"].toBool();
   info.autoIdentifyService = i["AutoIdentifyService"].toString();
   info.autoIdentifyPassword = i["AutoIdentifyPassword"].toString();
+  info.useSasl = i["UseSasl"].toBool();
+  info.saslAccount = i["SaslAccount"].toString();
+  info.saslPassword = i["SaslPassword"].toString();
   info.useAutoReconnect = i["UseAutoReconnect"].toBool();
   info.autoReconnectInterval = i["AutoReconnectInterval"].toUInt();
   info.autoReconnectRetries = i["AutoReconnectRetries"].toInt();
@@ -843,7 +878,8 @@ QDebug operator<<(QDebug dbg, const NetworkInfo &i) {
 		<< " codecForServer = " << i.codecForServer << " codecForEncoding = " << i.codecForEncoding << " codecForDecoding = " << i.codecForDecoding
 		<< " serverList = " << i.serverList << " useRandomServer = " << i.useRandomServer << " perform = " << i.perform
 		<< " useAutoIdentify = " << i.useAutoIdentify << " autoIdentifyService = " << i.autoIdentifyService << " autoIdentifyPassword = " << i.autoIdentifyPassword
-		<< " useAutoReconnect = " << i.useAutoReconnect << " autoReconnectInterval = " << i.autoReconnectInterval
+                << " useSasl = " << i.useSasl << " saslAccount = " << i.saslAccount << " saslPassword = " << i.saslPassword
+                << " useAutoReconnect = " << i.useAutoReconnect << " autoReconnectInterval = " << i.autoReconnectInterval
 		<< " autoReconnectRetries = " << i.autoReconnectRetries << " unlimitedReconnectRetries = " << i.unlimitedReconnectRetries
 		<< " rejoinChannels = " << i.rejoinChannels << ")";
   return dbg.space();
diff --git a/src/common/network.h b/src/common/network.h
index 4c5baf6..f0bd112 100644
--- a/src/common/network.h
+++ b/src/common/network.h
@@ -64,6 +64,9 @@ class Network : public SyncableObject {
   Q_PROPERTY(bool useAutoIdentify READ useAutoIdentify WRITE setUseAutoIdentify STORED false)
   Q_PROPERTY(QString autoIdentifyService READ autoIdentifyService WRITE setAutoIdentifyService STORED false)
   Q_PROPERTY(QString autoIdentifyPassword READ autoIdentifyPassword WRITE setAutoIdentifyPassword STORED false)
+  Q_PROPERTY(bool useSasl READ useSasl WRITE setUseSasl STORED false)
+  Q_PROPERTY(QString saslAccount READ saslAccount WRITE setSaslAccount STORED false)
+  Q_PROPERTY(QString saslPassword READ saslPassword WRITE setSaslPassword STORED false)
   Q_PROPERTY(bool useAutoReconnect READ useAutoReconnect WRITE setUseAutoReconnect STORED false)
   Q_PROPERTY(quint32 autoReconnectInterval READ autoReconnectInterval WRITE setAutoReconnectInterval STORED false)
   Q_PROPERTY(quint16 autoReconnectRetries READ autoReconnectRetries WRITE setAutoReconnectRetries STORED false)
@@ -153,6 +156,9 @@ public:
   inline bool useAutoIdentify() const { return _useAutoIdentify; }
   inline const QString &autoIdentifyService() const { return _autoIdentifyService; }
   inline const QString &autoIdentifyPassword() const { return _autoIdentifyPassword; }
+  inline bool useSasl() const { return _useSasl; }
+  inline const QString &saslAccount() const { return _saslAccount; }
+  inline const QString &saslPassword() const { return _saslPassword; }
   inline bool useAutoReconnect() const { return _useAutoReconnect; }
   inline quint32 autoReconnectInterval() const { return _autoReconnectInterval; }
   inline quint16 autoReconnectRetries() const { return _autoReconnectRetries; }
@@ -223,6 +229,9 @@ public slots:
   void setUseAutoIdentify(bool);
   void setAutoIdentifyService(const QString &);
   void setAutoIdentifyPassword(const QString &);
+  void setUseSasl(bool);
+  void setSaslAccount(const QString &);
+  void setSaslPassword(const QString &);
   virtual void setUseAutoReconnect(bool);
   virtual void setAutoReconnectInterval(quint32);
   virtual void setAutoReconnectRetries(quint16);
@@ -339,6 +348,10 @@ private:
   QString _autoIdentifyService;
   QString _autoIdentifyPassword;
 
+  bool _useSasl;
+  QString _saslAccount;
+  QString _saslPassword;
+
   bool _useAutoReconnect;
   quint32 _autoReconnectInterval;
   quint16 _autoReconnectRetries;
@@ -386,6 +399,10 @@ struct NetworkInfo {
   QString autoIdentifyService;
   QString autoIdentifyPassword;
 
+  bool useSasl;
+  QString saslAccount;
+  QString saslPassword;
+
   bool useAutoReconnect;
   quint32 autoReconnectInterval;
   quint16 autoReconnectRetries;
diff --git a/src/core/SQL/PostgreSQL/16/insert_network.sql b/src/core/SQL/PostgreSQL/16/insert_network.sql
index 4f94b43..56fbef8 100644
--- a/src/core/SQL/PostgreSQL/16/insert_network.sql
+++ b/src/core/SQL/PostgreSQL/16/insert_network.sql
@@ -1,3 +1,3 @@
-INSERT INTO network (userid, networkname, identityid, servercodec, encodingcodec, decodingcodec, userandomserver, perform, useautoidentify, autoidentifyservice, autoidentifypassword, useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels)
-VALUES (:userid, :networkname, :identityid, :servercodec, :encodingcodec, :decodingcodec, :userandomserver, :perform, :useautoidentify, :autoidentifyservice, :autoidentifypassword, :useautoreconnect, :autoreconnectinterval, :autoreconnectretries, :unlimitedconnectretries, :rejoinchannels)
+INSERT INTO network (userid, networkname, identityid, servercodec, encodingcodec, decodingcodec, userandomserver, perform, useautoidentify, autoidentifyservice, autoidentifypassword, useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels, usesasl, saslaccount, saslpassword)
+VALUES (:userid, :networkname, :identityid, :servercodec, :encodingcodec, :decodingcodec, :userandomserver, :perform, :useautoidentify, :autoidentifyservice, :autoidentifypassword, :useautoreconnect, :autoreconnectinterval, :autoreconnectretries, :unlimitedconnectretries, :rejoinchannels, :usesasl, :saslaccount, :saslpassword)
 RETURNING networkid
diff --git a/src/core/SQL/PostgreSQL/16/migrate_write_network.sql b/src/core/SQL/PostgreSQL/16/migrate_write_network.sql
index eeae51a..45576ee 100644
--- a/src/core/SQL/PostgreSQL/16/migrate_write_network.sql
+++ b/src/core/SQL/PostgreSQL/16/migrate_write_network.sql
@@ -1,2 +1,2 @@
-INSERT INTO network (networkid, userid, networkname, identityid, encodingcodec, decodingcodec, servercodec, userandomserver, perform, useautoidentify, autoidentifyservice, autoidentifypassword, useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels, connected, usermode, awaymessage, attachperform, detachperform)
-VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+INSERT INTO network (networkid, userid, networkname, identityid, encodingcodec, decodingcodec, servercodec, userandomserver, perform, useautoidentify, autoidentifyservice, autoidentifypassword, useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels, connected, usermode, awaymessage, attachperform, detachperform, usesasl, saslaccount, saslpassword)
+VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
diff --git a/src/core/SQL/PostgreSQL/16/select_networks_for_user.sql b/src/core/SQL/PostgreSQL/16/select_networks_for_user.sql
index 08855c9..9bef405 100644
--- a/src/core/SQL/PostgreSQL/16/select_networks_for_user.sql
+++ b/src/core/SQL/PostgreSQL/16/select_networks_for_user.sql
@@ -1,5 +1,6 @@
 SELECT networkid, networkname, identityid, servercodec, encodingcodec, decodingcodec,
        userandomserver, perform, useautoidentify, autoidentifyservice, autoidentifypassword,
-       useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels
+       useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels,
+       usesasl, saslaccount, saslpassword
 FROM network
-WHERE userid = :userid
\ No newline at end of file
+WHERE userid = :userid
diff --git a/src/core/SQL/PostgreSQL/16/setup_040_network.sql b/src/core/SQL/PostgreSQL/16/setup_040_network.sql
index 87f48b4..8515c95 100644
--- a/src/core/SQL/PostgreSQL/16/setup_040_network.sql
+++ b/src/core/SQL/PostgreSQL/16/setup_040_network.sql
@@ -11,6 +11,9 @@ CREATE TABLE network (
        useautoidentify boolean NOT NULL DEFAULT FALSE,
        autoidentifyservice varchar(128),
        autoidentifypassword varchar(128),
+       usesasl boolean NOT NULL DEFAULT FALSE,
+       saslaccount varchar(128),
+       saslpassword varchar(128),
        useautoreconnect boolean NOT NULL DEFAULT TRUE,
        autoreconnectinterval integer NOT NULL DEFAULT 0,
        autoreconnectretries integer NOT NULL DEFAULT 0,
diff --git a/src/core/SQL/PostgreSQL/16/update_network.sql b/src/core/SQL/PostgreSQL/16/update_network.sql
index 8d5a462..a000f61 100644
--- a/src/core/SQL/PostgreSQL/16/update_network.sql
+++ b/src/core/SQL/PostgreSQL/16/update_network.sql
@@ -13,5 +13,8 @@ useautoreconnect = :useautoreconnect,
 autoreconnectinterval = :autoreconnectinterval,
 autoreconnectretries = :autoreconnectretries,
 unlimitedconnectretries = :unlimitedconnectretries,
-rejoinchannels = :rejoinchannels
+rejoinchannels = :rejoinchannels,
+usesasl = :usesasl,
+saslaccount = :saslaccount,
+saslpassword = :saslpassword
 WHERE networkid = :networkid
diff --git a/src/core/SQL/SQLite/14/upgrade_010_create_networktable.sql b/src/core/SQL/SQLite/14/upgrade_010_create_networktable.sql
index c4e864e..c48694b 100644
--- a/src/core/SQL/SQLite/14/upgrade_010_create_networktable.sql
+++ b/src/core/SQL/SQLite/14/upgrade_010_create_networktable.sql
@@ -11,6 +11,9 @@ CREATE TABLE network (
        useautoidentify INTEGER NOT NULL DEFAULT 0, -- BOOL
        autoidentifyservice TEXT,
        autoidentifypassword TEXT,
+       usesasl INTEGER NOTNULL DEFAULT 0, -- BOOL
+       saslaccount TEXT,
+       saslpassword TEXT,
        useautoreconnect INTEGER NOT NULL DEFAULT 0, -- BOOL
        autoreconnectinterval INTEGER NOT NULL DEFAULT 0,
        autoreconnectretries INTEGER NOT NULL DEFAULT 0,
diff --git a/src/core/SQL/SQLite/17/insert_network.sql b/src/core/SQL/SQLite/17/insert_network.sql
index c64cbe1..4d9ff01 100644
--- a/src/core/SQL/SQLite/17/insert_network.sql
+++ b/src/core/SQL/SQLite/17/insert_network.sql
@@ -1,4 +1,4 @@
 INSERT INTO network (userid, networkname, identityid, servercodec, encodingcodec, decodingcodec, userandomserver,
-                     perform, useautoidentify, autoidentifyservice, autoidentifypassword, useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels)
+                     perform, useautoidentify, autoidentifyservice, autoidentifypassword, useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels, usesasl, saslaccount, saslpassword)
 VALUES (:userid, :networkname, :identityid, :servercodec, :encodingcodec, :decodingcodec, :userandomserver,
-        :perform, :useautoidentify, :autoidentifyservice, :autoidentifypassword, :useautoreconnect, :autoreconnectinterval, :autoreconnectretries, :unlimitedconnectretries, :rejoinchannels)
+        :perform, :useautoidentify, :autoidentifyservice, :autoidentifypassword, :useautoreconnect, :autoreconnectinterval, :autoreconnectretries, :unlimitedconnectretries, :rejoinchannels, :usesasl, :saslaccount, :saslpassword)
diff --git a/src/core/SQL/SQLite/17/select_networks_for_user.sql b/src/core/SQL/SQLite/17/select_networks_for_user.sql
index 08855c9..9bef405 100644
--- a/src/core/SQL/SQLite/17/select_networks_for_user.sql
+++ b/src/core/SQL/SQLite/17/select_networks_for_user.sql
@@ -1,5 +1,6 @@
 SELECT networkid, networkname, identityid, servercodec, encodingcodec, decodingcodec,
        userandomserver, perform, useautoidentify, autoidentifyservice, autoidentifypassword,
-       useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels
+       useautoreconnect, autoreconnectinterval, autoreconnectretries, unlimitedconnectretries, rejoinchannels,
+       usesasl, saslaccount, saslpassword
 FROM network
-WHERE userid = :userid
\ No newline at end of file
+WHERE userid = :userid
diff --git a/src/core/SQL/SQLite/17/setup_020_network.sql b/src/core/SQL/SQLite/17/setup_020_network.sql
index c4e864e..efa1f8d 100644
--- a/src/core/SQL/SQLite/17/setup_020_network.sql
+++ b/src/core/SQL/SQLite/17/setup_020_network.sql
@@ -11,6 +11,9 @@ CREATE TABLE network (
        useautoidentify INTEGER NOT NULL DEFAULT 0, -- BOOL
        autoidentifyservice TEXT,
        autoidentifypassword TEXT,
+       usesasl INTEGER NOT NULL DEFAULT 0, -- BOOL
+       saslaccount TEXT,
+       saslpassword TEXT,
        useautoreconnect INTEGER NOT NULL DEFAULT 0, -- BOOL
        autoreconnectinterval INTEGER NOT NULL DEFAULT 0,
        autoreconnectretries INTEGER NOT NULL DEFAULT 0,
diff --git a/src/core/SQL/SQLite/17/update_network.sql b/src/core/SQL/SQLite/17/update_network.sql
index 21afc3f..84c8195 100644
--- a/src/core/SQL/SQLite/17/update_network.sql
+++ b/src/core/SQL/SQLite/17/update_network.sql
@@ -13,5 +13,8 @@ useautoreconnect = :useautoreconnect,
 autoreconnectinterval = :autoreconnectinterval,
 autoreconnectretries = :autoreconnectretries,
 unlimitedconnectretries = :unlimitedconnectretries,
-rejoinchannels = :rejoinchannels
+rejoinchannels = :rejoinchannels,
+usesasl = :usesasl,
+saslaccount = :saslaccount,
+saslpassword = :saslpassword
 WHERE networkid = :networkid AND userid = :userid
diff --git a/src/core/SQL/SQLite/5/upgrade_010_create_newnetworktable.sql b/src/core/SQL/SQLite/5/upgrade_010_create_newnetworktable.sql
index 33a6fb8..7d2b86e 100644
--- a/src/core/SQL/SQLite/5/upgrade_010_create_newnetworktable.sql
+++ b/src/core/SQL/SQLite/5/upgrade_010_create_newnetworktable.sql
@@ -11,6 +11,9 @@ CREATE TABLE network (
        useautoidentify INTEGER NOT NULL DEFAULT 0, -- BOOL
        autoidentifyservice TEXT,
        autoidentifypassword TEXT,
+       usesasl INTEGER NOT NULL DEFAULT 0, -- BOOL
+       saslaccount TEXT,
+       saslpassword TEXT,
        useautoreconnect INTEGER NOT NULL DEFAULT 0, -- BOOL
        autoreconnectinterval INTEGER NOT NULL DEFAULT 0,
        autoreconnectretries INTEGER NOT NULL DEFAULT 0,
diff --git a/src/core/SQL/SQLite/7/upgrade_010_create_newnetworktable.sql b/src/core/SQL/SQLite/7/upgrade_010_create_newnetworktable.sql
index 1043576..3759721 100644
--- a/src/core/SQL/SQLite/7/upgrade_010_create_newnetworktable.sql
+++ b/src/core/SQL/SQLite/7/upgrade_010_create_newnetworktable.sql
@@ -11,6 +11,9 @@ CREATE TABLE network (
        useautoidentify INTEGER NOT NULL DEFAULT 0, -- BOOL
        autoidentifyservice TEXT,
        autoidentifypassword TEXT,
+       usesasl INTEGER NOT NULL DEFAULT 0, --BOOL
+       saslaccount TEXT,
+       saslpassword TEXT,
        useautoreconnect INTEGER NOT NULL DEFAULT 0, -- BOOL
        autoreconnectinterval INTEGER NOT NULL DEFAULT 0,
        autoreconnectretries INTEGER NOT NULL DEFAULT 0,
diff --git a/src/core/SQL/upgradeSchema.sh b/src/core/SQL/upgradeSchema.sh
index d475307..3e5e9a5 100755
--- a/src/core/SQL/upgradeSchema.sh
+++ b/src/core/SQL/upgradeSchema.sh
@@ -23,4 +23,4 @@ fi
 
 mkdir $NEW_VERSION
 git add $NEW_VERSION
-find $CURRENT_VERSION -depth 1 \! -name "upgrade_*" \! -name ".*" -exec git mv {} $NEW_VERSION \;
+find $CURRENT_VERSION -maxdepth 1 -type f \! -name "upgrade_*" \! -name ".*"
diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp
index 596a598..959b3c4 100644
--- a/src/core/corenetwork.cpp
+++ b/src/core/corenetwork.cpp
@@ -333,6 +333,9 @@ void CoreNetwork::socketInitialized() {
   _tokenBucket = _burstSize; // init with a full bucket
   _tokenBucketTimer.start(_messageDelay);
 
+  if(networkInfo().useSasl) {
+    putRawLine(serverEncode(QString("CAP REQ :sasl")));
+  }
   if(!server.password.isEmpty()) {
     putRawLine(serverEncode(QString("PASS %1").arg(server.password)));
   }
diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp
index 97e0058..445ca7c 100644
--- a/src/core/ircserverhandler.cpp
+++ b/src/core/ircserverhandler.cpp
@@ -84,6 +84,12 @@ void IrcServerHandler::handleServerMsg(QByteArray msg) {
 
   QString foo = serverDecode(params.takeFirst());
 
+  // with SASL, the command is 'AUTHENTICATE +' and we should check for this here.
+  if(foo == QString("AUTHENTICATE +")) {
+    handleAuthenticate();
+    return;
+  }
+
   // a colon as the first chars indicates the existence of a prefix
   if(foo[0] == ':') {
     foo.remove(0, 1);
@@ -160,6 +166,11 @@ void IrcServerHandler::defaultHandler(QString cmd, const QString &prefix, const
       case 321: case 366: case 376:
         break;
 
+      case 903: case 904: case 905: case 906: case 907:
+      {
+        network()->putRawLine("CAP END");
+        emit displayMsg(Message::Info, BufferInfo::StatusBuffer, "", "CAP: " + params.join(""));
+      }
       // Everything else will be marked in red, so we can add them somewhere.
       default:
         if(_whois) {
@@ -542,6 +553,31 @@ void IrcServerHandler::handleTopic(const QString &prefix, const QList<QByteArray
   emit displayMsg(Message::Topic, BufferInfo::ChannelBuffer, channel->name(), tr("%1 has changed topic for %2 to: \"%3\"").arg(ircuser->nick()).arg(channel->name()).arg(topic));
 }
 
+void IrcServerHandler::handleCap(const QString &prefix, const QList<QByteArray> &params) {
+    // for SASL, there will only be a single param of 'sasl', however you can check here for
+    // additional CAP messages (ls, multi-prefix, et cetera).
+
+    Q_UNUSED(prefix);
+
+    if(params.size() == 3) {
+        QString param = serverDecode(params[2]);
+        if(param == QString("sasl")) {  // SASL Ready
+            network()->putRawLine(serverEncode("AUTHENTICATE PLAIN"));  // Only working with PLAIN atm, blowfish later
+        }
+    }
+}
+
+void IrcServerHandler::handleAuthenticate() {
+    QString construct = network()->saslAccount();
+    construct.append(QChar(QChar::Null));
+    construct.append(network()->saslAccount());
+    construct.append(QChar(QChar::Null));
+    construct.append(network()->saslPassword());
+    QByteArray saslData = QByteArray(construct.toAscii().toBase64());
+    saslData.prepend(QString("AUTHENTICATE ").toAscii());
+    network()->putRawLine(saslData);
+}
+
 /* RPL_WELCOME */
 void IrcServerHandler::handle001(const QString &prefix, const QList<QByteArray> &params) {
   network()->setCurrentServer(prefix);
diff --git a/src/core/ircserverhandler.h b/src/core/ircserverhandler.h
index 86eaff2..018fbb6 100644
--- a/src/core/ircserverhandler.h
+++ b/src/core/ircserverhandler.h
@@ -45,7 +45,8 @@ public slots:
   void handlePrivmsg(const QString &prefix, const QList<QByteArray> &params);
   void handleQuit(const QString &prefix, const QList<QByteArray> &params);
   void handleTopic(const QString &prefix, const QList<QByteArray> &params);
-
+  void handleCap(const QString &prefix, const QList<QByteArray> &params);   // CAP framework
+  void handleAuthenticate();                                                // SASL auth - no params
   void handle001(const QString &prefix, const QList<QByteArray> &params);   // RPL_WELCOME
   void handle005(const QString &prefix, const QList<QByteArray> &params);   // RPL_ISUPPORT
   void handle221(const QString &prefix, const QList<QByteArray> &params);   // RPL_UMODEIS
@@ -78,7 +79,7 @@ public slots:
   void handle353(const QString &prefix, const QList<QByteArray> &params);   // RPL_NAMREPLY
   void handle369(const QString &prefix, const QList<QByteArray> &params);   // RPL_ENDOFWHOWAS
   void handle432(const QString &prefix, const QList<QByteArray> &params);   // ERR_ERRONEUSNICKNAME
-  void handle433(const QString &prefix, const QList<QByteArray> &params);   // ERR_NICKNAMEINUSE
+  void handle433(const QString &prefix, const QList<QByteArray> &params);   // ERR_NICKNAMEINUS
 
   void defaultHandler(QString cmd, const QString &prefix, const QList<QByteArray> &params);
 
diff --git a/src/core/postgresqlstorage.cpp b/src/core/postgresqlstorage.cpp
index 2505373..c942b4a 100644
--- a/src/core/postgresqlstorage.cpp
+++ b/src/core/postgresqlstorage.cpp
@@ -568,6 +568,9 @@ void PostgreSqlStorage::bindNetworkInfo(QSqlQuery &query, const NetworkInfo &inf
   query.bindValue(":useautoidentify", info.useAutoIdentify);
   query.bindValue(":autoidentifyservice", info.autoIdentifyService);
   query.bindValue(":autoidentifypassword", info.autoIdentifyPassword);
+  query.bindValue(":usesasl", info.useSasl);
+  query.bindValue(":saslaccount", info.saslAccount);
+  query.bindValue(":saslpassword", info.saslPassword);
   query.bindValue(":useautoreconnect", info.useAutoReconnect);
   query.bindValue(":autoreconnectinterval", info.autoReconnectInterval);
   query.bindValue(":autoreconnectretries", info.autoReconnectRetries);
@@ -707,6 +710,9 @@ QList<NetworkInfo> PostgreSqlStorage::networks(UserId user) {
     net.autoReconnectRetries = networksQuery.value(13).toInt();
     net.unlimitedReconnectRetries = networksQuery.value(14).toBool();
     net.rejoinChannels = networksQuery.value(15).toBool();
+    net.useSasl = networksQuery.value(16).toBool();
+    net.saslAccount = networksQuery.value(17).toString();
+    net.saslPassword = networksQuery.value(18).toString();
 
     serversQuery.bindValue(":networkid", net.networkId.toInt());
     safeExec(serversQuery);
diff --git a/src/core/sql.qrc b/src/core/sql.qrc
index 07c1fdf..262289f 100644
--- a/src/core/sql.qrc
+++ b/src/core/sql.qrc
@@ -1,243 +1,245 @@
 <!DOCTYPE RCC><RCC version="1.0">
 <qresource>
-    <file>./SQL/PostgreSQL/15/delete_backlog_by_uid.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_backlog_for_buffer.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_backlog_for_network.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_buffer_for_bufferid.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_buffers_by_uid.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_buffers_for_network.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_identity.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_ircservers_for_network.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_network.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_networks_by_uid.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_nicks.sql</file>
-    <file>./SQL/PostgreSQL/15/delete_quasseluser.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_buffer.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_identity.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_message.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_network.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_nick.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_quasseluser.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_sender.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_server.sql</file>
-    <file>./SQL/PostgreSQL/15/insert_user_setting.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_backlog.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_buffer.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_identity.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_identity_nick.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_ircserver.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_network.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_quasseluser.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_sender.sql</file>
-    <file>./SQL/PostgreSQL/15/migrate_write_usersetting.sql</file>
-    <file>./SQL/PostgreSQL/15/select_authuser.sql</file>
-    <file>./SQL/PostgreSQL/15/select_buffer_by_id.sql</file>
-    <file>./SQL/PostgreSQL/15/select_buffer_lastseen_messages.sql</file>
-    <file>./SQL/PostgreSQL/15/select_buffer_markerlinemsgids.sql</file>
-    <file>./SQL/PostgreSQL/15/select_bufferByName.sql</file>
-    <file>./SQL/PostgreSQL/15/select_bufferExists.sql</file>
-    <file>./SQL/PostgreSQL/15/select_buffers.sql</file>
-    <file>./SQL/PostgreSQL/15/select_buffers_for_network.sql</file>
-    <file>./SQL/PostgreSQL/15/select_checkidentity.sql</file>
-    <file>./SQL/PostgreSQL/15/select_connected_networks.sql</file>
-    <file>./SQL/PostgreSQL/15/select_identities.sql</file>
-    <file>./SQL/PostgreSQL/15/select_internaluser.sql</file>
-    <file>./SQL/PostgreSQL/15/select_messages.sql</file>
-    <file>./SQL/PostgreSQL/15/select_messagesAll.sql</file>
-    <file>./SQL/PostgreSQL/15/select_messagesAllNew.sql</file>
-    <file>./SQL/PostgreSQL/15/select_messagesNewerThan.sql</file>
-    <file>./SQL/PostgreSQL/15/select_messagesRange.sql</file>
-    <file>./SQL/PostgreSQL/15/select_network_awaymsg.sql</file>
-    <file>./SQL/PostgreSQL/15/select_network_usermode.sql</file>
-    <file>./SQL/PostgreSQL/15/select_networkExists.sql</file>
-    <file>./SQL/PostgreSQL/15/select_networks_for_user.sql</file>
-    <file>./SQL/PostgreSQL/15/select_nicks.sql</file>
-    <file>./SQL/PostgreSQL/15/select_persistent_channels.sql</file>
-    <file>./SQL/PostgreSQL/15/select_servers_for_network.sql</file>
-    <file>./SQL/PostgreSQL/15/select_user_setting.sql</file>
-    <file>./SQL/PostgreSQL/15/select_userid.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_000_quasseluser.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_010_sender.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_020_identity.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_030_identity_nick.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_040_network.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_050_buffer.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_060_backlog.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_070_coreinfo.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_080_ircservers.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_090_backlog_idx.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_100_user_setting.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_110_alter_sender_seq.sql</file>
-    <file>./SQL/PostgreSQL/15/setup_120_alter_messageid_seq.sql</file>
-    <file>./SQL/PostgreSQL/15/update_backlog_bufferid.sql</file>
-    <file>./SQL/PostgreSQL/15/update_buffer_lastseen.sql</file>
-    <file>./SQL/PostgreSQL/15/update_buffer_markerlinemsgid.sql</file>
-    <file>./SQL/PostgreSQL/15/update_buffer_name.sql</file>
-    <file>./SQL/PostgreSQL/15/update_buffer_persistent_channel.sql</file>
-    <file>./SQL/PostgreSQL/15/update_buffer_set_channel_key.sql</file>
-    <file>./SQL/PostgreSQL/15/update_identity.sql</file>
-    <file>./SQL/PostgreSQL/15/update_network.sql</file>
-    <file>./SQL/PostgreSQL/15/update_network_connected.sql</file>
-    <file>./SQL/PostgreSQL/15/update_network_set_awaymsg.sql</file>
-    <file>./SQL/PostgreSQL/15/update_network_set_usermode.sql</file>
-    <file>./SQL/PostgreSQL/15/update_user_setting.sql</file>
-    <file>./SQL/PostgreSQL/15/update_username.sql</file>
-    <file>./SQL/PostgreSQL/15/update_userpassword.sql</file>
-    <file>./SQL/PostgreSQL/15/upgrade_000_alter_buffer_add_markerlinemsgid.sql</file>
+    <file>./SQL/SQLite/15/upgrade_000_fix_ircservers.sql</file>
+    <file>./SQL/SQLite/15/upgrade_000_fix_network.sql</file>
+    <file>./SQL/SQLite/1/upgrade_020_update_schemaversion.sql</file>
     <file>./SQL/SQLite/1/upgrade_000_drop_coreinfo.sql</file>
     <file>./SQL/SQLite/1/upgrade_010_create_coreinfo.sql</file>
-    <file>./SQL/SQLite/1/upgrade_020_update_schemaversion.sql</file>
+    <file>./SQL/SQLite/7/upgrade_020_copy_networktable.sql</file>
+    <file>./SQL/SQLite/7/upgrade_010_create_newnetworktable.sql</file>
+    <file>./SQL/SQLite/7/upgrade_000_rename_networktable.sql</file>
+    <file>./SQL/SQLite/7/upgrade_030_drop_oldnetworktable.sql</file>
+    <file>./SQL/SQLite/7/upgrade_040_alter_buffer_add_lastseen.sql</file>
     <file>./SQL/SQLite/10/upgrade_000_switch_to_msgid.sql</file>
     <file>./SQL/SQLite/10/upgrade_010_rename_buffer_table.sql</file>
-    <file>./SQL/SQLite/10/upgrade_020_create_buffer_table.sql</file>
     <file>./SQL/SQLite/10/upgrade_030_copy_buffer_table.sql</file>
     <file>./SQL/SQLite/10/upgrade_040_drop_buffer_old_table.sql</file>
+    <file>./SQL/SQLite/10/upgrade_020_create_buffer_table.sql</file>
     <file>./SQL/SQLite/11/upgrade_000_create_user_setting.sql</file>
-    <file>./SQL/SQLite/12/upgrade_000_create_identity.sql</file>
-    <file>./SQL/SQLite/12/upgrade_010_create_identity_nick.sql</file>
-    <file>./SQL/SQLite/12/upgrade_020_rename_servertable.sql</file>
-    <file>./SQL/SQLite/12/upgrade_030_create_ircserver.sql</file>
-    <file>./SQL/SQLite/12/upgrade_040_copy_ircserver.sql</file>
-    <file>./SQL/SQLite/12/upgrade_050_drop_ircserverold.sql</file>
+    <file>./SQL/SQLite/9/upgrade_020_create_buffer_idx.sql</file>
+    <file>./SQL/SQLite/9/upgrade_010_create_backlog_idx2.sql</file>
+    <file>./SQL/SQLite/9/upgrade_000_create_backlog_idx.sql</file>
+    <file>./SQL/SQLite/16/upgrade_010_alter_network_add_sasl.sql</file>
+    <file>./SQL/SQLite/16/upgrade_000_alter_buffer_add_markerlinemsgid.sql</file>
+    <file>./SQL/SQLite/17/select_messagesAllNew.sql</file>
+    <file>./SQL/SQLite/17/select_userid.sql</file>
+    <file>./SQL/SQLite/17/update_identity.sql</file>
+    <file>./SQL/SQLite/17/select_buffer_lastseen_messages.sql</file>
+    <file>./SQL/SQLite/17/select_messagesNewerThan.sql</file>
+    <file>./SQL/SQLite/17/select_messagesNewestK.sql</file>
+    <file>./SQL/SQLite/17/setup_030_buffer.sql</file>
+    <file>./SQL/SQLite/17/setup_020_network.sql</file>
+    <file>./SQL/SQLite/17/select_servers_for_network.sql</file>
+    <file>./SQL/SQLite/17/insert_server.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_buffer.sql</file>
+    <file>./SQL/SQLite/17/delete_backlog_for_network.sql</file>
+    <file>./SQL/SQLite/17/select_bufferExists.sql</file>
+    <file>./SQL/SQLite/17/select_nicks.sql</file>
+    <file>./SQL/SQLite/17/setup_140_identity_nick.sql</file>
+    <file>./SQL/SQLite/17/update_buffer_lastseen.sql</file>
+    <file>./SQL/SQLite/17/delete_buffer_for_bufferid.sql</file>
+    <file>./SQL/SQLite/17/select_connected_networks.sql</file>
+    <file>./SQL/SQLite/17/select_buffer_markerlinemsgids.sql</file>
+    <file>./SQL/SQLite/17/select_buffers.sql</file>
+    <file>./SQL/SQLite/17/setup_000_quasseluser.sql</file>
+    <file>./SQL/SQLite/17/update_buffer_set_channel_key.sql</file>
+    <file>./SQL/SQLite/17/delete_networks_by_uid.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_identity.sql</file>
+    <file>./SQL/SQLite/17/setup_120_user_setting.sql</file>
+    <file>./SQL/SQLite/17/setup_080_ircservers.sql</file>
+    <file>./SQL/SQLite/17/setup_070_coreinfo.sql</file>
+    <file>./SQL/SQLite/17/select_network_usermode.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_quasseluser.sql</file>
+    <file>./SQL/SQLite/17/insert_message.sql</file>
+    <file>./SQL/SQLite/17/select_persistent_channels.sql</file>
+    <file>./SQL/SQLite/17/update_network_connected.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_backlog.sql</file>
+    <file>./SQL/SQLite/17/delete_network.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_ircserver.sql</file>
+    <file>./SQL/SQLite/17/update_backlog_bufferid.sql</file>
+    <file>./SQL/SQLite/17/insert_quasseluser.sql</file>
+    <file>./SQL/SQLite/17/select_network_awaymsg.sql</file>
+    <file>./SQL/SQLite/17/select_checkidentity.sql</file>
+    <file>./SQL/SQLite/17/delete_quasseluser.sql</file>
+    <file>./SQL/SQLite/17/insert_user_setting.sql</file>
+    <file>./SQL/SQLite/17/select_messagesAll.sql</file>
+    <file>./SQL/SQLite/17/delete_nicks.sql</file>
+    <file>./SQL/SQLite/17/select_user_setting.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_sender.sql</file>
+    <file>./SQL/SQLite/17/select_buffer_by_id.sql</file>
+    <file>./SQL/SQLite/17/select_identities.sql</file>
+    <file>./SQL/SQLite/17/select_networks_for_user.sql</file>
+    <file>./SQL/SQLite/17/select_buffers_for_network.sql</file>
+    <file>./SQL/SQLite/17/delete_backlog_for_buffer.sql</file>
+    <file>./SQL/SQLite/17/setup_050_buffer_cname_idx.sql</file>
+    <file>./SQL/SQLite/17/setup_060_backlog.sql</file>
+    <file>./SQL/SQLite/17/setup_090_backlog_idx.sql</file>
+    <file>./SQL/SQLite/17/insert_nick.sql</file>
+    <file>./SQL/SQLite/17/update_userpassword.sql</file>
+    <file>./SQL/SQLite/17/delete_identity.sql</file>
+    <file>./SQL/SQLite/17/insert_network.sql</file>
+    <file>./SQL/SQLite/17/delete_ircservers_for_network.sql</file>
+    <file>./SQL/SQLite/17/select_bufferByName.sql</file>
+    <file>./SQL/SQLite/17/insert_buffer.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_identity_nick.sql</file>
+    <file>./SQL/SQLite/17/update_buffer_persistent_channel.sql</file>
+    <file>./SQL/SQLite/17/select_authuser.sql</file>
+    <file>./SQL/SQLite/17/select_internaluser.sql</file>
+    <file>./SQL/SQLite/17/update_buffer_markerlinemsgid.sql</file>
+    <file>./SQL/SQLite/17/delete_backlog_by_uid.sql</file>
+    <file>./SQL/SQLite/17/delete_buffers_for_network.sql</file>
+    <file>./SQL/SQLite/17/update_user_setting.sql</file>
+    <file>./SQL/SQLite/17/select_buffers_for_merge.sql</file>
+    <file>./SQL/SQLite/17/setup_110_buffer_user_idx.sql</file>
+    <file>./SQL/SQLite/17/update_buffer_name.sql</file>
+    <file>./SQL/SQLite/17/setup_010_sender.sql</file>
+    <file>./SQL/SQLite/17/delete_buffers_by_uid.sql</file>
+    <file>./SQL/SQLite/17/select_messages.sql</file>
+    <file>./SQL/SQLite/17/insert_identity.sql</file>
+    <file>./SQL/SQLite/17/update_username.sql</file>
+    <file>./SQL/SQLite/17/update_network_set_usermode.sql</file>
+    <file>./SQL/SQLite/17/update_network_set_awaymsg.sql</file>
+    <file>./SQL/SQLite/17/setup_100_backlog_idx2.sql</file>
+    <file>./SQL/SQLite/17/insert_sender.sql</file>
+    <file>./SQL/SQLite/17/setup_130_identity.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_usersetting.sql</file>
+    <file>./SQL/SQLite/17/update_network.sql</file>
+    <file>./SQL/SQLite/17/setup_040_buffer_idx.sql</file>
+    <file>./SQL/SQLite/17/migrate_read_network.sql</file>
+    <file>./SQL/SQLite/17/select_networkExists.sql</file>
+    <file>./SQL/SQLite/13/upgrade_020_create_buffer_cname_idx.sql</file>
     <file>./SQL/SQLite/13/upgrade_000_create_buffer_user_idx.sql</file>
     <file>./SQL/SQLite/13/upgrade_010_create_buffer_cname_idx.sql</file>
-    <file>./SQL/SQLite/13/upgrade_020_create_buffer_cname_idx.sql</file>
+    <file>./SQL/SQLite/3/upgrade_000_update_backlog_flags.sql</file>
+    <file>./SQL/SQLite/3/upgrade_010_update_schemaversion.sql</file>
     <file>./SQL/SQLite/14/upgrade_000_rename_networktable.sql</file>
-    <file>./SQL/SQLite/14/upgrade_010_create_networktable.sql</file>
     <file>./SQL/SQLite/14/upgrade_030_copy_networktable.sql</file>
     <file>./SQL/SQLite/14/upgrade_040_drop_networkold.sql</file>
-    <file>./SQL/SQLite/15/upgrade_000_fix_ircservers.sql</file>
-    <file>./SQL/SQLite/15/upgrade_000_fix_network.sql</file>
-    <file>./SQL/SQLite/16/delete_backlog_by_uid.sql</file>
-    <file>./SQL/SQLite/16/delete_backlog_for_buffer.sql</file>
-    <file>./SQL/SQLite/16/delete_backlog_for_network.sql</file>
-    <file>./SQL/SQLite/16/delete_buffer_for_bufferid.sql</file>
-    <file>./SQL/SQLite/16/delete_buffers_by_uid.sql</file>
-    <file>./SQL/SQLite/16/delete_buffers_for_network.sql</file>
-    <file>./SQL/SQLite/16/delete_identity.sql</file>
-    <file>./SQL/SQLite/16/delete_ircservers_for_network.sql</file>
-    <file>./SQL/SQLite/16/delete_network.sql</file>
-    <file>./SQL/SQLite/16/delete_networks_by_uid.sql</file>
-    <file>./SQL/SQLite/16/delete_nicks.sql</file>
-    <file>./SQL/SQLite/16/delete_quasseluser.sql</file>
-    <file>./SQL/SQLite/16/insert_buffer.sql</file>
-    <file>./SQL/SQLite/16/insert_identity.sql</file>
-    <file>./SQL/SQLite/16/insert_message.sql</file>
-    <file>./SQL/SQLite/16/insert_network.sql</file>
-    <file>./SQL/SQLite/16/insert_nick.sql</file>
-    <file>./SQL/SQLite/16/insert_quasseluser.sql</file>
-    <file>./SQL/SQLite/16/insert_sender.sql</file>
-    <file>./SQL/SQLite/16/insert_server.sql</file>
-    <file>./SQL/SQLite/16/insert_user_setting.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_backlog.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_buffer.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_identity.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_identity_nick.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_ircserver.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_network.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_quasseluser.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_sender.sql</file>
-    <file>./SQL/SQLite/16/migrate_read_usersetting.sql</file>
-    <file>./SQL/SQLite/16/select_authuser.sql</file>
-    <file>./SQL/SQLite/16/select_buffer_by_id.sql</file>
-    <file>./SQL/SQLite/16/select_buffer_lastseen_messages.sql</file>
-    <file>./SQL/SQLite/16/select_buffer_markerlinemsgids.sql</file>
-    <file>./SQL/SQLite/16/select_bufferByName.sql</file>
-    <file>./SQL/SQLite/16/select_bufferExists.sql</file>
-    <file>./SQL/SQLite/16/select_buffers.sql</file>
-    <file>./SQL/SQLite/16/select_buffers_for_merge.sql</file>
-    <file>./SQL/SQLite/16/select_buffers_for_network.sql</file>
-    <file>./SQL/SQLite/16/select_checkidentity.sql</file>
-    <file>./SQL/SQLite/16/select_connected_networks.sql</file>
-    <file>./SQL/SQLite/16/select_identities.sql</file>
-    <file>./SQL/SQLite/16/select_internaluser.sql</file>
-    <file>./SQL/SQLite/16/select_messages.sql</file>
-    <file>./SQL/SQLite/16/select_messagesAll.sql</file>
-    <file>./SQL/SQLite/16/select_messagesAllNew.sql</file>
-    <file>./SQL/SQLite/16/select_messagesNewerThan.sql</file>
-    <file>./SQL/SQLite/16/select_messagesNewestK.sql</file>
-    <file>./SQL/SQLite/16/select_network_awaymsg.sql</file>
-    <file>./SQL/SQLite/16/select_network_usermode.sql</file>
-    <file>./SQL/SQLite/16/select_networkExists.sql</file>
-    <file>./SQL/SQLite/16/select_networks_for_user.sql</file>
-    <file>./SQL/SQLite/16/select_nicks.sql</file>
-    <file>./SQL/SQLite/16/select_persistent_channels.sql</file>
-    <file>./SQL/SQLite/16/select_servers_for_network.sql</file>
-    <file>./SQL/SQLite/16/select_user_setting.sql</file>
-    <file>./SQL/SQLite/16/select_userid.sql</file>
-    <file>./SQL/SQLite/16/setup_000_quasseluser.sql</file>
-    <file>./SQL/SQLite/16/setup_010_sender.sql</file>
-    <file>./SQL/SQLite/16/setup_020_network.sql</file>
-    <file>./SQL/SQLite/16/setup_030_buffer.sql</file>
-    <file>./SQL/SQLite/16/setup_040_buffer_idx.sql</file>
-    <file>./SQL/SQLite/16/setup_050_buffer_cname_idx.sql</file>
-    <file>./SQL/SQLite/16/setup_060_backlog.sql</file>
-    <file>./SQL/SQLite/16/setup_070_coreinfo.sql</file>
-    <file>./SQL/SQLite/16/setup_080_ircservers.sql</file>
-    <file>./SQL/SQLite/16/setup_090_backlog_idx.sql</file>
-    <file>./SQL/SQLite/16/setup_100_backlog_idx2.sql</file>
-    <file>./SQL/SQLite/16/setup_110_buffer_user_idx.sql</file>
-    <file>./SQL/SQLite/16/setup_120_user_setting.sql</file>
-    <file>./SQL/SQLite/16/setup_130_identity.sql</file>
-    <file>./SQL/SQLite/16/setup_140_identity_nick.sql</file>
-    <file>./SQL/SQLite/16/update_backlog_bufferid.sql</file>
-    <file>./SQL/SQLite/16/update_buffer_lastseen.sql</file>
-    <file>./SQL/SQLite/16/update_buffer_markerlinemsgid.sql</file>
-    <file>./SQL/SQLite/16/update_buffer_name.sql</file>
-    <file>./SQL/SQLite/16/update_buffer_persistent_channel.sql</file>
-    <file>./SQL/SQLite/16/update_buffer_set_channel_key.sql</file>
-    <file>./SQL/SQLite/16/update_identity.sql</file>
-    <file>./SQL/SQLite/16/update_network.sql</file>
-    <file>./SQL/SQLite/16/update_network_connected.sql</file>
-    <file>./SQL/SQLite/16/update_network_set_awaymsg.sql</file>
-    <file>./SQL/SQLite/16/update_network_set_usermode.sql</file>
-    <file>./SQL/SQLite/16/update_user_setting.sql</file>
-    <file>./SQL/SQLite/16/update_username.sql</file>
-    <file>./SQL/SQLite/16/update_userpassword.sql</file>
-    <file>./SQL/SQLite/16/upgrade_000_alter_buffer_add_markerlinemsgid.sql</file>
+    <file>./SQL/SQLite/14/upgrade_010_create_networktable.sql</file>
     <file>./SQL/SQLite/2/upgrade_000_drop_buffergroup.sql</file>
     <file>./SQL/SQLite/2/upgrade_010_update_schemaversion.sql</file>
-    <file>./SQL/SQLite/3/upgrade_000_update_backlog_flags.sql</file>
-    <file>./SQL/SQLite/3/upgrade_010_update_schemaversion.sql</file>
-    <file>./SQL/SQLite/4/upgrade_000_rename_buffertable.sql</file>
-    <file>./SQL/SQLite/4/upgrade_010_create_buffertable.sql</file>
-    <file>./SQL/SQLite/4/upgrade_020_copy_buffertable.sql</file>
-    <file>./SQL/SQLite/4/upgrade_030_drop_oldbuffertable.sql</file>
-    <file>./SQL/SQLite/4/upgrade_040_create_buffer_idx.sql</file>
-    <file>./SQL/SQLite/4/upgrade_050_create_buffer_cname_idx.sql</file>
-    <file>./SQL/SQLite/5/upgrade_000_rename_networktable.sql</file>
-    <file>./SQL/SQLite/5/upgrade_010_create_newnetworktable.sql</file>
     <file>./SQL/SQLite/5/upgrade_020_copy_networktable.sql</file>
+    <file>./SQL/SQLite/5/upgrade_010_create_newnetworktable.sql</file>
+    <file>./SQL/SQLite/5/upgrade_000_rename_networktable.sql</file>
     <file>./SQL/SQLite/5/upgrade_030_drop_oldnetworktable.sql</file>
     <file>./SQL/SQLite/5/upgrade_180_create_ircservers.sql</file>
-    <file>./SQL/SQLite/6/upgrade_000_alter_buffertable.sql</file>
+    <file>./SQL/SQLite/8/upgrade_000_alter_network_add_connected.sql</file>
+    <file>./SQL/SQLite/8/upgrade_020_alter_buffer_add_joined.sql</file>
+    <file>./SQL/SQLite/8/upgrade_010_alter_buffer_add_key.sql</file>
+    <file>./SQL/SQLite/8/upgrade_030_update_buffer_set_joined_for_channels.sql</file>
     <file>./SQL/SQLite/6/upgrade_010_set_statusbuffertype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_020_set_channelbuffertype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_030_set_querybuffertype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_040_update_msgtype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_050_update_msgtype.sql</file>
+    <file>./SQL/SQLite/6/upgrade_120_update_msgtype.sql</file>
     <file>./SQL/SQLite/6/upgrade_060_update_msgtype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_070_update_msgtype.sql</file>
     <file>./SQL/SQLite/6/upgrade_080_update_msgtype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_090_update_msgtype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_100_update_msgtype.sql</file>
+    <file>./SQL/SQLite/6/upgrade_040_update_msgtype.sql</file>
+    <file>./SQL/SQLite/6/upgrade_020_set_channelbuffertype.sql</file>
     <file>./SQL/SQLite/6/upgrade_110_update_msgtype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_120_update_msgtype.sql</file>
+    <file>./SQL/SQLite/6/upgrade_000_alter_buffertable.sql</file>
+    <file>./SQL/SQLite/6/upgrade_160_update_msgtype.sql</file>
     <file>./SQL/SQLite/6/upgrade_130_update_msgtype.sql</file>
+    <file>./SQL/SQLite/6/upgrade_030_set_querybuffertype.sql</file>
+    <file>./SQL/SQLite/6/upgrade_100_update_msgtype.sql</file>
+    <file>./SQL/SQLite/6/upgrade_050_update_msgtype.sql</file>
+    <file>./SQL/SQLite/6/upgrade_070_update_msgtype.sql</file>
     <file>./SQL/SQLite/6/upgrade_140_update_msgtype.sql</file>
     <file>./SQL/SQLite/6/upgrade_150_update_msgtype.sql</file>
-    <file>./SQL/SQLite/6/upgrade_160_update_msgtype.sql</file>
-    <file>./SQL/SQLite/7/upgrade_000_rename_networktable.sql</file>
-    <file>./SQL/SQLite/7/upgrade_010_create_newnetworktable.sql</file>
-    <file>./SQL/SQLite/7/upgrade_020_copy_networktable.sql</file>
-    <file>./SQL/SQLite/7/upgrade_030_drop_oldnetworktable.sql</file>
-    <file>./SQL/SQLite/7/upgrade_040_alter_buffer_add_lastseen.sql</file>
-    <file>./SQL/SQLite/8/upgrade_000_alter_network_add_connected.sql</file>
-    <file>./SQL/SQLite/8/upgrade_010_alter_buffer_add_key.sql</file>
-    <file>./SQL/SQLite/8/upgrade_020_alter_buffer_add_joined.sql</file>
-    <file>./SQL/SQLite/8/upgrade_030_update_buffer_set_joined_for_channels.sql</file>
-    <file>./SQL/SQLite/9/upgrade_000_create_backlog_idx.sql</file>
-    <file>./SQL/SQLite/9/upgrade_010_create_backlog_idx2.sql</file>
-    <file>./SQL/SQLite/9/upgrade_020_create_buffer_idx.sql</file>
+    <file>./SQL/SQLite/6/upgrade_090_update_msgtype.sql</file>
+    <file>./SQL/SQLite/12/upgrade_020_rename_servertable.sql</file>
+    <file>./SQL/SQLite/12/upgrade_050_drop_ircserverold.sql</file>
+    <file>./SQL/SQLite/12/upgrade_030_create_ircserver.sql</file>
+    <file>./SQL/SQLite/12/upgrade_040_copy_ircserver.sql</file>
+    <file>./SQL/SQLite/12/upgrade_000_create_identity.sql</file>
+    <file>./SQL/SQLite/12/upgrade_010_create_identity_nick.sql</file>
+    <file>./SQL/SQLite/4/upgrade_040_create_buffer_idx.sql</file>
+    <file>./SQL/SQLite/4/upgrade_020_copy_buffertable.sql</file>
+    <file>./SQL/SQLite/4/upgrade_030_drop_oldbuffertable.sql</file>
+    <file>./SQL/SQLite/4/upgrade_010_create_buffertable.sql</file>
+    <file>./SQL/SQLite/4/upgrade_050_create_buffer_cname_idx.sql</file>
+    <file>./SQL/SQLite/4/upgrade_000_rename_buffertable.sql</file>
+    <file>./SQL/PostgreSQL/15/upgrade_010_alter_network_add_sasl.sql</file>
+    <file>./SQL/PostgreSQL/15/upgrade_000_alter_buffer_add_markerlinemsgid.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_sender.sql</file>
+    <file>./SQL/PostgreSQL/16/select_messagesAllNew.sql</file>
+    <file>./SQL/PostgreSQL/16/select_userid.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_identity.sql</file>
+    <file>./SQL/PostgreSQL/16/update_identity.sql</file>
+    <file>./SQL/PostgreSQL/16/select_buffer_lastseen_messages.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_030_identity_nick.sql</file>
+    <file>./SQL/PostgreSQL/16/select_messagesNewerThan.sql</file>
+    <file>./SQL/PostgreSQL/16/select_servers_for_network.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_server.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_040_network.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_backlog_for_network.sql</file>
+    <file>./SQL/PostgreSQL/16/select_bufferExists.sql</file>
+    <file>./SQL/PostgreSQL/16/select_nicks.sql</file>
+    <file>./SQL/PostgreSQL/16/update_buffer_lastseen.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_buffer_for_bufferid.sql</file>
+    <file>./SQL/PostgreSQL/16/select_connected_networks.sql</file>
+    <file>./SQL/PostgreSQL/16/select_buffer_markerlinemsgids.sql</file>
+    <file>./SQL/PostgreSQL/16/select_buffers.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_000_quasseluser.sql</file>
+    <file>./SQL/PostgreSQL/16/update_buffer_set_channel_key.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_networks_by_uid.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_080_ircservers.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_070_coreinfo.sql</file>
+    <file>./SQL/PostgreSQL/16/select_network_usermode.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_message.sql</file>
+    <file>./SQL/PostgreSQL/16/select_persistent_channels.sql</file>
+    <file>./SQL/PostgreSQL/16/update_network_connected.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_network.sql</file>
+    <file>./SQL/PostgreSQL/16/update_backlog_bufferid.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_ircserver.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_quasseluser.sql</file>
+    <file>./SQL/PostgreSQL/16/select_network_awaymsg.sql</file>
+    <file>./SQL/PostgreSQL/16/select_checkidentity.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_quasseluser.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_user_setting.sql</file>
+    <file>./SQL/PostgreSQL/16/select_messagesAll.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_nicks.sql</file>
+    <file>./SQL/PostgreSQL/16/select_user_setting.sql</file>
+    <file>./SQL/PostgreSQL/16/select_buffer_by_id.sql</file>
+    <file>./SQL/PostgreSQL/16/select_identities.sql</file>
+    <file>./SQL/PostgreSQL/16/select_networks_for_user.sql</file>
+    <file>./SQL/PostgreSQL/16/select_buffers_for_network.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_backlog_for_buffer.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_usersetting.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_060_backlog.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_090_backlog_idx.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_nick.sql</file>
+    <file>./SQL/PostgreSQL/16/update_userpassword.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_identity.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_network.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_ircservers_for_network.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_120_alter_messageid_seq.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_110_alter_sender_seq.sql</file>
+    <file>./SQL/PostgreSQL/16/select_bufferByName.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_buffer.sql</file>
+    <file>./SQL/PostgreSQL/16/update_buffer_persistent_channel.sql</file>
+    <file>./SQL/PostgreSQL/16/select_authuser.sql</file>
+    <file>./SQL/PostgreSQL/16/select_internaluser.sql</file>
+    <file>./SQL/PostgreSQL/16/select_messagesRange.sql</file>
+    <file>./SQL/PostgreSQL/16/update_buffer_markerlinemsgid.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_backlog_by_uid.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_buffers_for_network.sql</file>
+    <file>./SQL/PostgreSQL/16/update_user_setting.sql</file>
+    <file>./SQL/PostgreSQL/16/update_buffer_name.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_010_sender.sql</file>
+    <file>./SQL/PostgreSQL/16/delete_buffers_by_uid.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_020_identity.sql</file>
+    <file>./SQL/PostgreSQL/16/select_messages.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_identity.sql</file>
+    <file>./SQL/PostgreSQL/16/update_username.sql</file>
+    <file>./SQL/PostgreSQL/16/update_network_set_usermode.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_network.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_backlog.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_100_user_setting.sql</file>
+    <file>./SQL/PostgreSQL/16/update_network_set_awaymsg.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_identity_nick.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_quasseluser.sql</file>
+    <file>./SQL/PostgreSQL/16/insert_sender.sql</file>
+    <file>./SQL/PostgreSQL/16/migrate_write_buffer.sql</file>
+    <file>./SQL/PostgreSQL/16/setup_050_buffer.sql</file>
+    <file>./SQL/PostgreSQL/16/update_network.sql</file>
+    <file>./SQL/PostgreSQL/16/select_networkExists.sql</file>
 </qresource>
 </RCC>
diff --git a/src/core/sqlitestorage.cpp b/src/core/sqlitestorage.cpp
index 6462a97..c962e8f 100644
--- a/src/core/sqlitestorage.cpp
+++ b/src/core/sqlitestorage.cpp
@@ -591,6 +591,9 @@ void SqliteStorage::bindNetworkInfo(QSqlQuery &query, const NetworkInfo &info) {
   query.bindValue(":useautoidentify", info.useAutoIdentify ? 1 : 0);
   query.bindValue(":autoidentifyservice", info.autoIdentifyService);
   query.bindValue(":autoidentifypassword", info.autoIdentifyPassword);
+  query.bindValue(":usesasl", info.useSasl ? 1 : 0);
+  query.bindValue(":saslaccount", info.saslAccount);
+  query.bindValue(":saslpassword", info.saslPassword);
   query.bindValue(":useautoreconnect", info.useAutoReconnect ? 1 : 0);
   query.bindValue(":autoreconnectinterval", info.autoReconnectInterval);
   query.bindValue(":autoreconnectretries", info.autoReconnectRetries);
@@ -780,6 +783,9 @@ QList<NetworkInfo> SqliteStorage::networks(UserId user) {
         net.autoReconnectRetries = networksQuery.value(13).toInt();
         net.unlimitedReconnectRetries = networksQuery.value(14).toInt() == 1 ? true : false;
         net.rejoinChannels = networksQuery.value(15).toInt() == 1 ? true : false;
+        net.useSasl = networksQuery.value(16).toInt() == 1 ? true : false;
+        net.saslAccount = networksQuery.value(17).toString();
+        net.saslPassword = networksQuery.value(18).toString();
 
         serversQuery.bindValue(":networkid", net.networkId.toInt());
         safeExec(serversQuery);
diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp
index 1b20c2a..2ea60db 100644
--- a/src/qtui/settingspages/networkssettingspage.cpp
+++ b/src/qtui/settingspages/networkssettingspage.cpp
@@ -78,6 +78,9 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent)
   connect(ui.autoIdentify, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
   connect(ui.autoIdentifyService, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
   connect(ui.autoIdentifyPassword, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged()));
+  connect(ui.sasl, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
+  connect(ui.saslAccount, SIGNAL(textEdited(QString)), this, SLOT(widgetHasChanged()));
+  connect(ui.saslPassword, SIGNAL(textEdited(QString)), this, SLOT(widgetHasChanged()));
   connect(ui.useCustomEncodings, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged()));
   connect(ui.sendEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));
   connect(ui.recvEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));
@@ -429,6 +432,9 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) {
     ui.autoIdentify->setChecked(info.useAutoIdentify);
     ui.autoIdentifyService->setText(info.autoIdentifyService);
     ui.autoIdentifyPassword->setText(info.autoIdentifyPassword);
+    ui.sasl->setChecked(info.useSasl);
+    ui.saslAccount->setText(info.saslAccount);
+    ui.saslPassword->setText(info.saslPassword);
     if(info.codecForEncoding.isEmpty()) {
       ui.sendEncoding->setCurrentIndex(ui.sendEncoding->findText(Network::defaultCodecForEncoding()));
       ui.recvEncoding->setCurrentIndex(ui.recvEncoding->findText(Network::defaultCodecForDecoding()));
@@ -452,6 +458,8 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) {
     ui.performEdit->clear();
     ui.autoIdentifyService->clear();
     ui.autoIdentifyPassword->clear();
+    ui.saslAccount->clear();
+    ui.saslPassword->clear();
     setWidgetStates();
   }
   _ignoreWidgetChanges = false;
@@ -465,6 +473,9 @@ void NetworksSettingsPage::saveToNetworkInfo(NetworkInfo &info) {
   info.useAutoIdentify = ui.autoIdentify->isChecked();
   info.autoIdentifyService = ui.autoIdentifyService->text();
   info.autoIdentifyPassword = ui.autoIdentifyPassword->text();
+  info.useSasl = ui.sasl->isChecked();
+  info.saslAccount = ui.saslAccount->text();
+  info.saslPassword = ui.saslPassword->text();
   if(!ui.useCustomEncodings->isChecked()) {
     info.codecForEncoding.clear();
     info.codecForDecoding.clear();
diff --git a/src/qtui/settingspages/networkssettingspage.ui b/src/qtui/settingspages/networkssettingspage.ui
index 41bcfb9..4bbafba 100644
--- a/src/qtui/settingspages/networkssettingspage.ui
+++ b/src/qtui/settingspages/networkssettingspage.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>515</width>
-    <height>453</height>
+    <height>503</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -548,6 +548,64 @@ Note that Quassel IRC automatically rejoins channels, so /join will rarely be ne
            </widget>
           </item>
           <item>
+           <widget class="QGroupBox" name="sasl">
+            <property name="enabled">
+             <bool>true</bool>
+            </property>
+            <property name="title">
+             <string>Use SASL Authentication</string>
+            </property>
+            <property name="checkable">
+             <bool>true</bool>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+            <layout class="QGridLayout" name="gridLayout_2">
+             <item row="0" column="1">
+              <widget class="QLineEdit" name="saslAccount">
+               <property name="enabled">
+                <bool>true</bool>
+               </property>
+               <property name="text">
+                <string/>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="1">
+              <widget class="QLineEdit" name="saslPassword">
+               <property name="enabled">
+                <bool>true</bool>
+               </property>
+               <property name="echoMode">
+                <enum>QLineEdit::Password</enum>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="0">
+              <widget class="QLabel" name="label_11">
+               <property name="enabled">
+                <bool>true</bool>
+               </property>
+               <property name="text">
+                <string>Password:</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="0">
+              <widget class="QLabel" name="label_10">
+               <property name="enabled">
+                <bool>true</bool>
+               </property>
+               <property name="text">
+                <string>Account:</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+          <item>
            <spacer name="verticalSpacer_2">
             <property name="orientation">
              <enum>Qt::Vertical</enum>
@@ -718,7 +776,6 @@ Unless you *really* know what you do, leave this as ISO-8859-1!</string>
   <tabstop>reconnectRetries</tabstop>
   <tabstop>unlimitedRetries</tabstop>
   <tabstop>rejoinOnReconnect</tabstop>
-  <tabstop>autoIdentify</tabstop>
   <tabstop>autoIdentifyService</tabstop>
   <tabstop>autoIdentifyPassword</tabstop>
   <tabstop>useCustomEncodings</tabstop>
@@ -735,12 +792,12 @@ Unless you *really* know what you do, leave this as ISO-8859-1!</string>
    <slot>setDisabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>173</x>
-     <y>296</y>
+     <x>317</x>
+     <y>331</y>
     </hint>
     <hint type="destinationlabel">
-     <x>118</x>
-     <y>294</y>
+     <x>209</x>
+     <y>334</y>
     </hint>
    </hints>
   </connection>
