]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap-client: invoke state change callback on "authentication success"
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Wed, 15 Feb 2017 14:13:05 +0000 (09:13 -0500)
committerGitLab <gitlab@git.dovecot.net>
Wed, 15 Feb 2017 15:05:58 +0000 (17:05 +0200)
src/lib-imap-client/imapc-client.h
src/lib-imap-client/imapc-connection.c

index 0a0ecda94b593a76e70d13a598e68e7bb6043eed..04f49b258f1dfe3380205c7ea24625fe2b438f08 100644 (file)
@@ -147,6 +147,7 @@ struct imapc_untagged_reply {
 };
 
 enum imapc_state_change_event {
+       IMAPC_STATE_CHANGE_AUTH_OK,
        IMAPC_STATE_CHANGE_AUTH_FAILED,
 };
 
index 59c4d8fab18294db6bc063e90400bad59714bf6e..43524bc98b224cb85fafcbf06af8999ece52b713 100644 (file)
@@ -141,6 +141,19 @@ static int imapc_connection_ssl_init(struct imapc_connection *conn);
 static void imapc_command_free(struct imapc_command *cmd);
 static void imapc_command_send_more(struct imapc_connection *conn);
 
+static void
+imapc_auth_ok(struct imapc_connection *conn)
+{
+       if (conn->client->set.debug)
+               i_debug("imapc(%s): Authenticated successfully", conn->name);
+
+       if (conn->client->state_change_callback == NULL)
+               return;
+
+       conn->client->state_change_callback(conn->client->state_change_context,
+                                           IMAPC_STATE_CHANGE_AUTH_OK, NULL);
+}
+
 static void
 imapc_auth_failed(struct imapc_connection *conn,
                  const char *error)
@@ -784,8 +797,7 @@ imapc_connection_auth_finish(struct imapc_connection *conn,
                return;
        }
 
-       if (conn->client->set.debug)
-               i_debug("imapc(%s): Authenticated successfully", conn->name);
+       imapc_auth_ok(conn);
 
        timeout_remove(&conn->to);
        imapc_connection_set_state(conn, IMAPC_CONNECTION_STATE_DONE);