From 51598d626a21948e2a4ad80779b2edbbeaa028b7 Mon Sep 17 00:00:00 2001 From: Sebastian Stal Date: Mon, 5 Aug 2013 12:30:40 -0700 Subject: [PATCH] Make test clients compatible with userstatus kinds No features were added, just fixed callbacks. --- chat.c | 2 +- main.c | 6 +++--- prompt.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/chat.c b/chat.c index ff7a166..f28a6a3 100644 --- a/chat.c +++ b/chat.c @@ -161,7 +161,7 @@ void execute(ToxWindow* self, ChatContext* ctx, char* cmd) return; } msg++; - m_set_userstatus((uint8_t*) msg, strlen(msg)+1); + m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); wprintw(ctx->history, "Status set to: %s\n", msg); } else if (!strncmp(cmd, "/nick ", strlen("/nick "))) { diff --git a/main.c b/main.c index 45760b1..b322f95 100644 --- a/main.c +++ b/main.c @@ -69,7 +69,7 @@ void on_nickchange(int friendnumber, uint8_t* string, uint16_t length) { } } -void on_statuschange(int friendnumber, uint8_t* string, uint16_t length) { +void on_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t* string, uint16_t length) { size_t i; wprintw(prompt->window, "\n(statuschange) %d: %s!\n", friendnumber, string); @@ -201,7 +201,7 @@ static void load_data(char *path) { Messenger_load(buf, len); } - else { + else { len = Messenger_size(); buf = malloc(len); @@ -289,7 +289,7 @@ int main(int argc, char* argv[]) { for(i = 0; i < argc; i++) { if (argv[i] == NULL){ - break; + break; } else if(argv[i][0] == '-') { if(argv[i][1] == 'f') { if(argv[i + 1] != NULL) diff --git a/prompt.c b/prompt.c index 463b935..1ba1569 100644 --- a/prompt.c +++ b/prompt.c @@ -91,7 +91,7 @@ static void execute(ToxWindow* self, char* cmd) { dht.ip.i = resolved_address; unsigned char *binary_string = hex_string_to_bin(key); DHT_bootstrap(dht, binary_string); - free(binary_string); + free(binary_string); } else if(!strncmp(cmd, "add ", strlen("add "))) { uint8_t id_bin[32]; @@ -137,7 +137,7 @@ static void execute(ToxWindow* self, char* cmd) { num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); switch (num) { - case -1: + case -1: wprintw(self->window, "Message is too long.\n"); break; case -2: @@ -151,7 +151,7 @@ static void execute(ToxWindow* self, char* cmd) { break; case -5: wprintw(self->window, "Undefined error when adding friend.\n"); - break; + break; default: wprintw(self->window, "Friend added as %d.\n", num); on_friendadded(num); @@ -172,7 +172,7 @@ static void execute(ToxWindow* self, char* cmd) { } msg++; - m_set_userstatus((uint8_t*) msg, strlen(msg)+1); + m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); wprintw(self->window, "Status set to: %s\n", msg); } else if(!strncmp(cmd, "nick ", strlen("nick "))) {