From 84faeb47be70227f32d1c8276bac60f1899d34b7 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 18 Dec 2012 05:18:40 +0100 Subject: [PATCH] client: Handle accepting/rejecting confirmation requests --- client/agent.c | 9 +++++++++ client/main.c | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/client/agent.c b/client/agent.c index 31bbdd5ad..518323831 100644 --- a/client/agent.c +++ b/client/agent.c @@ -53,6 +53,15 @@ dbus_bool_t agent_input(DBusConnection *conn, const char *input) if (!pending_message) return FALSE; + if (!strcmp(input, "yes")) + g_dbus_send_reply(conn, pending_message, DBUS_TYPE_INVALID); + else if (!strcmp(input, "no")) + g_dbus_send_error(conn, pending_message, + "org.bluez.Error.Rejected", NULL); + else + g_dbus_send_error(conn, pending_message, + "org.bluez.Error.Canceled", NULL); + g_dbus_send_reply(conn, pending_message, DBUS_TYPE_INVALID); dbus_message_unref(pending_message); diff --git a/client/main.c b/client/main.c index 0213bf0ab..d537582b5 100644 --- a/client/main.c +++ b/client/main.c @@ -844,9 +844,6 @@ static void rl_handler(char *input) char *cmd, *arg; int i; - if (agent_input(dbus_conn, input) == TRUE) - goto done; - if (!input) { rl_insert_text("quit"); rl_redisplay(); @@ -858,6 +855,9 @@ static void rl_handler(char *input) if (!strlen(input)) goto done; + if (agent_input(dbus_conn, input) == TRUE) + goto done; + add_history(input); cmd = strtok_r(input, " ", &arg); -- 2.47.3