Update way we check if we're SASL authented when we attempt to send PASS command
authorJack Allnutt <m2ys4u@Gmail.com>
Fri, 2 Nov 2012 19:02:33 +0000 (19:02 +0000)
committerJack Allnutt <m2ys4u@Gmail.com>
Fri, 2 Nov 2012 19:02:33 +0000 (19:02 +0000)
Issue #110

server/irc/commands.js
server/irc/connection.js

index c5207eb51d900318e9996fc0eda890fd3e123fd1..3cbfedd16eb83cdf4170ca8b23a082500df62efd 100644 (file)
@@ -514,6 +514,7 @@ var listeners = {
     'RPL_SASLAUTHENTICATED':function (command) {
                 this.irc_connection.write('CAP END');
                 this.irc_connection.cap_negotation = false;
+                this.irc_connection.sasl = true;
                 this.irc_connection.register();
             },
     'RPL_SASLLOGGEDIN':     function (command) {
@@ -522,11 +523,10 @@ var listeners = {
     'ERR_SASLNOTAUTHORISED':function (command) {
                 this.irc_connection.write('CAP END');
                 this.irc_connection.cap_negotation = false;
-                this.irc_connection.cap.enabled = _.without(this.irc_connection.cap.enabled, 'sasl');
                 this.irc_connection.register();
             },
     'ERR_SASLABORTED':      function (command) {
-                this.irc_connection.cap.enabled = _.without(this.irc_connection.cap.enabled, 'sasl');
+                // noop
             },
     'ERR_SASLALREADYAUTHED':function (command) {
                 // noop
index 28e6519d9d20608f5decc5374d3562d58664e4c5..b9c130586a3596ba527d5fb44c97ccb2925b5a09 100644 (file)
@@ -111,7 +111,7 @@ IrcConnection.prototype.register = function () {
         clearTimeout(this.registeration_timeout);
         this.registration_timeout = null;
     }
-    if ((this.password) && (!_.contains(this.cap.enabled, 'sasl'))) {
+    if ((this.password) && (!this.sasl)) {
         this.write('PASS ' + this.password);
     }
     this.write('NICK ' + this.nick);