aboutsummaryrefslogtreecommitdiff
path: root/ssh/tomsg_clientlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/tomsg_clientlib.c')
-rw-r--r--ssh/tomsg_clientlib.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ssh/tomsg_clientlib.c b/ssh/tomsg_clientlib.c
index c14d5c5..05ee09d 100644
--- a/ssh/tomsg_clientlib.c
+++ b/ssh/tomsg_clientlib.c
@@ -178,7 +178,7 @@ const char* tomsg_strerror(enum tomsg_retval code) {
static enum tomsg_retval version_negotiation(struct tomsg_client *client) {
if (!client->conn) return TOMSG_ERR_CLOSED;
- const enum sshnc_retval retssh = sshnc_send(client->conn, "ver version 1\n", 14);
+ const enum sshnc_retval retssh = sshnc_send(client->conn, "ver version 2\n", 14);
if (retssh == SSHNC_EOF) return TOMSG_ERR_CLOSED;
if (retssh != SSHNC_OK) return TOMSG_ERR_TRANSPORT;
@@ -691,6 +691,7 @@ static enum tomsg_retval handle_line(
PARSE_WORD(push_message.message.username);
PARSE_I64(push_message.message.timestamp);
PARSE_I64(push_message.message.msgid);
+ PARSE_I64(push_message.message.replyid);
PARSE_RESTSTRING(push_message.message.message);
return TOMSG_OK;
} else if (sv_equals(command, "online")) {
@@ -822,11 +823,12 @@ static enum tomsg_retval handle_line(
// (and everywhere): the messages buffer has been allocated with
// calloc(), so tomsg_event_nullify() will cleanup up precisely
// everything that we haven't filled in yet.
- struct history_message *msg = &inflight.event.history.messages[index];;
+ struct history_message *msg = &inflight.event.history.messages[index];
if (!sv_equals(sv_tokenise_word(&line), inflight.event.history.room_name)) CLEANUP_RETURN(TOMSG_ERR_PARSE);
if (!sv_copy(sv_tokenise_word(&line), &msg->username)) CLEANUP_RETURN(TOMSG_ERR_PARSE);
if (!sv_parse_i64(sv_tokenise_word(&line), &msg->timestamp)) CLEANUP_RETURN(TOMSG_ERR_PARSE);
if (!sv_parse_i64(sv_tokenise_word(&line), &msg->msgid)) CLEANUP_RETURN(TOMSG_ERR_PARSE);
+ if (!sv_parse_i64(sv_tokenise_word(&line), &msg->replyid)) CLEANUP_RETURN(TOMSG_ERR_PARSE);
if (!sv_copy(line, &msg->message)) CLEANUP_RETURN(TOMSG_ERR_PARSE);
// If there are more history_message events coming, re-add the tag for them
@@ -1018,13 +1020,15 @@ enum tomsg_retval tomsg_invite(
enum tomsg_retval tomsg_send(
struct tomsg_client *client, const char *room_name, const char *message,
+ int64_t replyid,
int64_t *tagp //output
) {
if (!client->conn) return TOMSG_ERR_CLOSED;
if (hasspacelf(room_name)) return TOMSG_ERR_SPACE;
if (haslf(message)) return TOMSG_ERR_SPACE;
const int64_t tag = client->next_tag++;
- SEND_FMT(client, tag, "send %s %s", room_name, message);
+ if (replyid < 0) replyid = -1;
+ SEND_FMT(client, tag, "send %s %" PRIi64 " %s", room_name, replyid, message);
const struct tomsg_event event = (struct tomsg_event){
.type = TOMSG_EV_SEND,
.send.tag = tag,