Diff between f70804bdb92bfafc2734186d85400df18f473fc6 and 84faeb47be70227f32d1c8276bac60f1899d34b7

Changed Files

File Additions Deletions Status
client/agent.c +9 -0 modified
client/main.c +3 -3 modified

Full Patch

diff --git a/client/agent.c b/client/agent.c
index 31bbdd5..5183238 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 0213bf0..d537582 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);