aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-08 12:00:14 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-08 12:00:14 +0200
commit249858b4af8e5cf8e03ca1e4d061a6097aba8318 (patch)
treecac49c4a5d5183d8c38da89040da81bed29994ef
parentimplement echoing (diff)
downloadmds-249858b4af8e5cf8e03ca1e4d061a6097aba8318.tar.gz
mds-249858b4af8e5cf8e03ca1e4d061a6097aba8318.tar.bz2
mds-249858b4af8e5cf8e03ca1e4d061a6097aba8318.tar.xz
mds-echo: include message id + do not require respawn status
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-echo.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mds-echo.c b/src/mds-echo.c
index 592b5b3..8d1fae0 100644
--- a/src/mds-echo.c
+++ b/src/mds-echo.c
@@ -22,7 +22,7 @@
#include <libmdsserver/mds-message.h>
#include <errno.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -44,7 +44,7 @@ server_characteristics_t server_characteristics =
{
.require_privileges = 0,
.require_display = 1,
- .require_respawn_info = 1,
+ .require_respawn_info = 0,
.sanity_check_argc = 1
};
@@ -287,7 +287,8 @@ int echo_message(void)
return 0;
}
- n = 1 + strlen("To: \nIn response to: \n\n") + strlen(recv_client_id) + strlen(recv_message_id);
+ n = 1 + strlen("To: \nIn response to: \nMessage ID: \n\n");
+ n += strlen(recv_client_id) + strlen(recv_message_id) + 10;
if (recv_length)
n += strlen(recv_length) + 1;
@@ -301,11 +302,15 @@ int echo_message(void)
}
}
- sprintf(echo_buffer, "To: %s\nIn response to:%s\n%s%s\n",
- recv_client_id, recv_message_id,
+ sprintf(echo_buffer, "To: %s\nIn response to:%s\nMessage ID: " PRIi32 "\n%s%s\n",
+ recv_client_id, recv_message_id, message_id,
recv_length == NULL ? "" : recv_length,
recv_length == NULL ? "" : "\n");
+ message_id += 1;
+ if (message_id < 0)
+ message_id = 0;
+
if (full_send(echo_buffer, n - 1))
return 1;
return full_send(received.payload, received.payload_size);