3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-03 01:48:49 +02:00

client: Consolidate cancelation replies

This commit is contained in:
Tim Kourt 2019-10-25 13:32:04 -07:00 committed by Denis Kenzior
parent d164923e7c
commit ceeab83fa8

View File

@ -50,6 +50,15 @@ static struct pending_op {
struct l_queue *saved_input; struct l_queue *saved_input;
} pending_op; } pending_op;
static struct l_dbus_message *agent_reply_canceled(
struct l_dbus_message *message,
const char *text)
{
return l_dbus_message_new_error(message,
IWD_AGENT_INTERFACE ".Error.Canceled",
"Error: %s", text);
}
static struct l_dbus_message *agent_error(const char *text) static struct l_dbus_message *agent_error(const char *text)
{ {
display_error(text); display_error(text);
@ -342,8 +351,7 @@ static void process_input_username_password(const char *prompt)
if (l_queue_isempty(pending_op.saved_input)) { if (l_queue_isempty(pending_op.saved_input)) {
/* received username */ /* received username */
if (!strlen(prompt)) { if (!strlen(prompt)) {
reply = l_dbus_message_new_error(pending_message, reply = agent_reply_canceled(pending_message,
IWD_AGENT_INTERFACE ".Error.Canceled",
"Canceled by user"); "Canceled by user");
goto send_reply; goto send_reply;
} }
@ -372,8 +380,7 @@ static void process_input_passphrase(const char *prompt)
struct l_dbus_message *reply; struct l_dbus_message *reply;
if (!strlen(prompt)) { if (!strlen(prompt)) {
reply = l_dbus_message_new_error(pending_message, reply = agent_reply_canceled(pending_message,
IWD_AGENT_INTERFACE ".Error.Canceled",
"Canceled by user"); "Canceled by user");
goto send_reply; goto send_reply;
} }