aboutsummaryrefslogtreecommitdiff
path: root/ssh/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/client.c')
-rw-r--r--ssh/client.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ssh/client.c b/ssh/client.c
index ad0f107..a262d6f 100644
--- a/ssh/client.c
+++ b/ssh/client.c
@@ -285,6 +285,14 @@ static bool handle_line(
ret = tomsg_history(client, args[0], count, msgid);
}
+ } else if (sv_equals(command, "get") ||
+ sv_equals(command, "get_message")) {
+ int64_t msgid;
+ if (parse_args(line, args, num_args = 1, false) &&
+ parse_i64(args[0], &msgid)) {
+ ret = tomsg_get_message(client, msgid);
+ }
+
} else if (sv_equals(command, "on") ||
sv_equals(command, "is_online")) {
if (parse_args(line, args, num_args = 1, false)) {
@@ -326,6 +334,7 @@ static bool handle_line(
" ping\n"
" hist/history <room> <count>\n"
" histb/history_before <room> <count> <before_msgid>\n"
+ " get/get_message <msgid>\n"
" on/is_online <user>\n"
" act/user_active <y/n>\n"
" help\n"
@@ -361,6 +370,7 @@ static const char* event_type_descr(enum tomsg_event_type type) {
case TOMSG_EV_INVITE: return "invite";
case TOMSG_EV_SEND: return "send";
case TOMSG_EV_HISTORY: return "history";
+ case TOMSG_EV_GET_MESSAGE: return "get_message";
case TOMSG_EV_PING: return "ping";
case TOMSG_EV_IS_ONLINE: return "is_online";
case TOMSG_EV_USER_ACTIVE: return "user_active";
@@ -451,6 +461,12 @@ static void handle_event(struct state *state, const struct tomsg_event event) {
}
break;
+ case TOMSG_EV_GET_MESSAGE:
+ printf(" %" PRIi64 " is in room %s:\n ",
+ event.get_message.message.msgid, event.get_message.room_name);
+ print_history_message(event.get_message.message);
+ break;
+
case TOMSG_EV_PING:
printf(" Pong\n");
break;