]> jfr.im git - irc/irssi/irssi.git/commitdiff
Parse the error string received by the server
authorLemonBoy <redacted>
Fri, 11 Sep 2015 21:20:07 +0000 (23:20 +0200)
committerLemonBoy <redacted>
Fri, 11 Sep 2015 21:20:07 +0000 (23:20 +0200)
So that in case of SASL failure the user sees a nice error message.

src/irc/core/sasl.c

index 8f3b823f6a0f3d9ede4a809505f579b115b155b9..874b67f3b6ddab594742426014809b9ba75a5d75 100644 (file)
@@ -41,16 +41,22 @@ static void sasl_start (IRC_SERVER_REC *server, const char *data, const char *fr
 
 static void sasl_fail (IRC_SERVER_REC *server, const char *data, const char *from)
 {
+       char *params, *error;
+
        /* Stop any pending timeout, if any */
        if (server->sasl_timeout != -1) {
                g_source_remove(server->sasl_timeout);
                server->sasl_timeout = -1;
        }
 
-       g_critical("Authentication failed with reason \"%s\"", data);
+       params = event_get_params(data, 2, NULL, &error);
+
+       g_critical("Authentication failed with reason \"%s\"", error);
 
        /* Terminate the negotiation */
        cap_finish_negotiation(server);
+
+       g_free(params);
 }
 
 static void sasl_already (IRC_SERVER_REC *server, const char *data, const char *from)