aboutsummaryrefslogtreecommitdiff
path: root/ssh/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/client.c')
-rw-r--r--ssh/client.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/ssh/client.c b/ssh/client.c
index 52f26c6..ad0f107 100644
--- a/ssh/client.c
+++ b/ssh/client.c
@@ -199,7 +199,7 @@ static bool handle_line(
if (state->focus_room != NULL) {
char *message = NULL;
sv_copy(line, &message);
- enum tomsg_retval ret = tomsg_send(client, state->focus_room, message, NULL);
+ enum tomsg_retval ret = tomsg_send(client, state->focus_room, message, -1, NULL);
free(message);
if (ret != TOMSG_OK) return true;
return false;
@@ -253,7 +253,15 @@ static bool handle_line(
} else if (sv_equals(command, "s") || sv_equals(command, "send")) {
if (parse_args(line, args, num_args = 2, true)) {
autocomplete_roomname(state, &args[0]);
- ret = tomsg_send(client, args[0], args[1], NULL);
+ ret = tomsg_send(client, args[0], args[1], -1, NULL);
+ }
+
+ } else if (sv_equals(command, "r") || sv_equals(command, "reply")) {
+ int64_t replyid;
+ if (parse_args(line, args, num_args = 3, true) &&
+ parse_i64(args[1], &replyid)) {
+ autocomplete_roomname(state, &args[0]);
+ ret = tomsg_send(client, args[0], args[2], replyid, NULL);
}
} else if (sv_equals(command, "ping")) {
@@ -314,6 +322,7 @@ static bool handle_line(
" create_room\n"
" invite <room> <user>\n"
" s/send <room> <message...>\n"
+ " r/reply <room> <msgid> <message...>\n"
" ping\n"
" hist/history <room> <count>\n"
" histb/history_before <room> <count> <before_msgid>\n"
@@ -365,8 +374,12 @@ static const char* event_type_descr(enum tomsg_event_type type) {
}
static void print_history_message(const struct history_message msg) {
- printf("%" PRIi64 " \x1B[90m%" PRIi64 "\x1B[0m <%s> %s\n",
- msg.msgid, msg.timestamp, msg.username, msg.message);
+ printf("%" PRIi64 " \x1B[90m%" PRIi64 "\x1B[0m <%s> ",
+ msg.msgid, msg.timestamp, msg.username);
+ if (msg.replyid != -1) {
+ printf("\x1B[32m[%" PRIi64 "<-]\x1B[0m ", msg.replyid);
+ }
+ printf("%s\n", msg.message);
}
static void handle_event(struct state *state, const struct tomsg_event event) {