From b1a2af23e521f1b21a1013c6894987f410700496 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Wed, 7 Aug 2013 18:12:59 -0400 Subject: Modified clients to properly work with the changes --- testing/toxic/chat.c | 2 +- testing/toxic/friendlist.c | 4 ++-- testing/toxic/main.c | 4 ++-- testing/toxic/prompt.c | 20 ++++++++------------ 4 files changed, 13 insertions(+), 17 deletions(-) (limited to 'testing/toxic') diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index 20c01620..2563fa9c 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c @@ -162,7 +162,7 @@ void execute(ToxWindow *self, ChatContext *ctx, char *cmd) return; } msg++; - m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); + m_set_statusmessage((uint8_t*) msg, strlen(msg)+1); wprintw(ctx->history, "Status set to: %s\n", msg); } diff --git a/testing/toxic/friendlist.c b/testing/toxic/friendlist.c index f03914e6..159217b1 100644 --- a/testing/toxic/friendlist.c +++ b/testing/toxic/friendlist.c @@ -20,7 +20,7 @@ extern int active_window; typedef struct { uint8_t name[MAX_NAME_LENGTH]; - uint8_t status[MAX_USERSTATUS_LENGTH]; + uint8_t status[MAX_STATUSMESSAGE_LENGTH]; int num; int chatwin; } friend_t; @@ -74,7 +74,7 @@ void friendlist_onNickChange(ToxWindow *self, int num, uint8_t *str, uint16_t le void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len) { - if (len >= MAX_USERSTATUS_LENGTH || num >= num_friends) + if (len >= MAX_STATUSMESSAGE_LENGTH || num >= num_friends) return; memcpy((char*) &friends[num].status, (char*) str, len); diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 8de76244..59333004 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c @@ -68,7 +68,7 @@ void on_nickchange(int friendnumber, uint8_t *string, uint16_t length) } } -void on_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t *string, uint16_t length) +void on_statuschange(int friendnumber, uint8_t *string, uint16_t length) { wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string); int i; @@ -112,7 +112,7 @@ static void init_tox() m_callback_friendrequest(on_request); m_callback_friendmessage(on_message); m_callback_namechange(on_nickchange); - m_callback_userstatus(on_statuschange); + m_callback_statusmessage(on_statuschange); } void init_window_status() diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index d79d061f..01261cce 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c @@ -183,27 +183,22 @@ static void execute(ToxWindow *self, char *u_cmd) return; } status++; - USERSTATUS_KIND status_kind; + USERSTATUS status_kind; if (!strncmp(status, "online", strlen("online"))) { - status_kind = USERSTATUS_KIND_ONLINE; + status_kind = USERSTATUS_NONE; status_text = "ONLINE"; } else if (!strncmp(status, "away", strlen("away"))) { - status_kind = USERSTATUS_KIND_AWAY; + status_kind = USERSTATUS_AWAY; status_text = "AWAY"; } else if (!strncmp(status, "busy", strlen("busy"))) { - status_kind = USERSTATUS_KIND_BUSY; + status_kind = USERSTATUS_BUSY; status_text = "BUSY"; } - else if (!strncmp(status, "offline", strlen("offline"))) { - status_kind = USERSTATUS_KIND_OFFLINE; - status_text = "OFFLINE"; - } - else { wprintw(self->window, "Invalid status.\n"); @@ -212,12 +207,13 @@ static void execute(ToxWindow *self, char *u_cmd) msg = strchr(status, ' '); if (msg == NULL) { - m_set_userstatus_kind(status_kind); + m_set_userstatus(status_kind); wprintw(self->window, "Status set to: %s\n", status_text); } else { msg++; - m_set_userstatus(status_kind, (uint8_t*) msg, strlen(msg)+1); + m_set_userstatus(status_kind); + m_set_statusmessage((uint8_t*) msg, strlen(msg)+1); wprintw(self->window, "Status set to: %s, %s\n", status_text, msg); } } @@ -229,7 +225,7 @@ static void execute(ToxWindow *self, char *u_cmd) return; } msg++; - m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); + m_set_statusmessage((uint8_t*) msg, strlen(msg)+1); wprintw(self->window, "Status set to: %s\n", msg); } -- cgit v1.2.3