From 57fd872f148d64d7a66bbede5f04cbad56f9f87b Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Mon, 22 Jun 2009 19:38:24 +0200 Subject: [PATCH] Added a state check for protocol negotiation. Will be used to negotiate SSL. --- src/user.c | 7 +++++++ src/user.h | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/user.c b/src/user.c index cbc990f..3960567 100644 --- a/src/user.c +++ b/src/user.c @@ -286,6 +286,13 @@ int user_is_connecting(struct user* user) return 0; } +int user_is_protocol_negotiating(struct user* user) +{ + if (user->state == state_protocol) + return 1; + return 0; +} + int user_is_disconnecting(struct user* user) { if (user->state == state_cleanup || user->state == state_disconnected) diff --git a/src/user.h b/src/user.h index a15ab53..b72369d 100644 --- a/src/user.h +++ b/src/user.h @@ -191,6 +191,12 @@ extern void user_set_state(struct user* user, enum user_state); */ extern int user_is_logged_in(struct user* user); +/** + * Returns 1 if the user is in state_protocol. + * Returns 0 otherwise. + */ +extern int user_is_protocol_negotiating(struct user* user); + /** * Returns 1 if the user is in state_protocol, state_identify or state_verify. * Returns 0 otherwise.