Skip to content

Commit

Permalink
lib-smtp: smtp-server-reply - Add smtp_server_reply_is_success() and …
Browse files Browse the repository at this point in the history
…use it.
  • Loading branch information
stephanbosch committed Mar 2, 2019
1 parent 4fc917e commit 03ba35d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib-smtp/smtp-server-command.c
Expand Up @@ -613,8 +613,7 @@ bool smtp_server_command_replied_success(struct smtp_server_command *cmd)
array_idx(&cmd->replies, i);
if (!reply->submitted)
return FALSE;
i_assert(reply->content != NULL);
if (reply->content->status / 100 == 2)
if (smtp_server_reply_is_success(reply))
success = TRUE;
}

Expand Down
6 changes: 6 additions & 0 deletions src/lib-smtp/smtp-server-reply.c
Expand Up @@ -488,6 +488,12 @@ int smtp_server_reply_send(struct smtp_server_reply *reply)
return ret;
}

bool smtp_server_reply_is_success(const struct smtp_server_reply *reply)
{
i_assert(reply->content != NULL);
return (reply->content->status / 100 == 2);
}

/*
* EHLO reply
*/
Expand Down
2 changes: 2 additions & 0 deletions src/lib-smtp/smtp-server.h
Expand Up @@ -650,6 +650,8 @@ void smtp_server_reply_early(struct smtp_server_cmd_ctx *_cmd,
/* Reply the command with a 221 bye message */
void smtp_server_reply_quit(struct smtp_server_cmd_ctx *_cmd);

bool smtp_server_reply_is_success(const struct smtp_server_reply *reply);

/* EHLO */

struct smtp_server_reply *
Expand Down

0 comments on commit 03ba35d

Please sign in to comment.