diff options
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/chat.c | 2 | ||||
-rw-r--r-- | testing/toxic/friendlist.c | 4 | ||||
-rw-r--r-- | testing/toxic/main.c | 4 | ||||
-rw-r--r-- | testing/toxic/prompt.c | 20 |
4 files changed, 13 insertions, 17 deletions
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index b870e9c2..28c5de6c 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c | |||
@@ -161,7 +161,7 @@ void execute(ToxWindow *self, ChatContext *ctx, char *cmd) | |||
161 | return; | 161 | return; |
162 | } | 162 | } |
163 | msg++; | 163 | msg++; |
164 | m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); | 164 | m_set_statusmessage((uint8_t*) msg, strlen(msg)+1); |
165 | wprintw(ctx->history, "Status set to: %s\n", msg); | 165 | wprintw(ctx->history, "Status set to: %s\n", msg); |
166 | } | 166 | } |
167 | 167 | ||
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; | |||
20 | 20 | ||
21 | typedef struct { | 21 | typedef struct { |
22 | uint8_t name[MAX_NAME_LENGTH]; | 22 | uint8_t name[MAX_NAME_LENGTH]; |
23 | uint8_t status[MAX_USERSTATUS_LENGTH]; | 23 | uint8_t status[MAX_STATUSMESSAGE_LENGTH]; |
24 | int num; | 24 | int num; |
25 | int chatwin; | 25 | int chatwin; |
26 | } friend_t; | 26 | } friend_t; |
@@ -74,7 +74,7 @@ void friendlist_onNickChange(ToxWindow *self, int num, uint8_t *str, uint16_t le | |||
74 | 74 | ||
75 | void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len) | 75 | void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len) |
76 | { | 76 | { |
77 | if (len >= MAX_USERSTATUS_LENGTH || num >= num_friends) | 77 | if (len >= MAX_STATUSMESSAGE_LENGTH || num >= num_friends) |
78 | return; | 78 | return; |
79 | 79 | ||
80 | memcpy((char*) &friends[num].status, (char*) str, len); | 80 | memcpy((char*) &friends[num].status, (char*) str, len); |
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 27e3d858..b2310c80 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -69,7 +69,7 @@ void on_nickchange(int friendnumber, uint8_t *string, uint16_t length) | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | void on_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t *string, uint16_t length) | 72 | void on_statuschange(int friendnumber, uint8_t *string, uint16_t length) |
73 | { | 73 | { |
74 | wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string); | 74 | wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string); |
75 | int i; | 75 | int i; |
@@ -113,7 +113,7 @@ static void init_tox() | |||
113 | m_callback_friendrequest(on_request); | 113 | m_callback_friendrequest(on_request); |
114 | m_callback_friendmessage(on_message); | 114 | m_callback_friendmessage(on_message); |
115 | m_callback_namechange(on_nickchange); | 115 | m_callback_namechange(on_nickchange); |
116 | m_callback_userstatus(on_statuschange); | 116 | m_callback_statusmessage(on_statuschange); |
117 | } | 117 | } |
118 | 118 | ||
119 | void init_window_status() | 119 | void init_window_status() |
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 486273d3..661d881f 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -193,27 +193,22 @@ static void execute(ToxWindow *self, char *u_cmd) | |||
193 | return; | 193 | return; |
194 | } | 194 | } |
195 | status++; | 195 | status++; |
196 | USERSTATUS_KIND status_kind; | 196 | USERSTATUS status_kind; |
197 | if (!strncmp(status, "online", strlen("online"))) { | 197 | if (!strncmp(status, "online", strlen("online"))) { |
198 | status_kind = USERSTATUS_KIND_ONLINE; | 198 | status_kind = USERSTATUS_NONE; |
199 | status_text = "ONLINE"; | 199 | status_text = "ONLINE"; |
200 | } | 200 | } |
201 | 201 | ||
202 | else if (!strncmp(status, "away", strlen("away"))) { | 202 | else if (!strncmp(status, "away", strlen("away"))) { |
203 | status_kind = USERSTATUS_KIND_AWAY; | 203 | status_kind = USERSTATUS_AWAY; |
204 | status_text = "AWAY"; | 204 | status_text = "AWAY"; |
205 | } | 205 | } |
206 | 206 | ||
207 | else if (!strncmp(status, "busy", strlen("busy"))) { | 207 | else if (!strncmp(status, "busy", strlen("busy"))) { |
208 | status_kind = USERSTATUS_KIND_BUSY; | 208 | status_kind = USERSTATUS_BUSY; |
209 | status_text = "BUSY"; | 209 | status_text = "BUSY"; |
210 | } | 210 | } |
211 | 211 | ||
212 | else if (!strncmp(status, "offline", strlen("offline"))) { | ||
213 | status_kind = USERSTATUS_KIND_OFFLINE; | ||
214 | status_text = "OFFLINE"; | ||
215 | } | ||
216 | |||
217 | else | 212 | else |
218 | { | 213 | { |
219 | wprintw(self->window, "Invalid status.\n"); | 214 | wprintw(self->window, "Invalid status.\n"); |
@@ -222,12 +217,13 @@ static void execute(ToxWindow *self, char *u_cmd) | |||
222 | 217 | ||
223 | msg = strchr(status, ' '); | 218 | msg = strchr(status, ' '); |
224 | if (msg == NULL) { | 219 | if (msg == NULL) { |
225 | m_set_userstatus_kind(status_kind); | 220 | m_set_userstatus(status_kind); |
226 | wprintw(self->window, "Status set to: %s\n", status_text); | 221 | wprintw(self->window, "Status set to: %s\n", status_text); |
227 | } | 222 | } |
228 | else { | 223 | else { |
229 | msg++; | 224 | msg++; |
230 | m_set_userstatus(status_kind, (uint8_t*) msg, strlen(msg)+1); | 225 | m_set_userstatus(status_kind); |
226 | m_set_statusmessage((uint8_t*) msg, strlen(msg)+1); | ||
231 | wprintw(self->window, "Status set to: %s, %s\n", status_text, msg); | 227 | wprintw(self->window, "Status set to: %s, %s\n", status_text, msg); |
232 | } | 228 | } |
233 | } | 229 | } |
@@ -239,7 +235,7 @@ static void execute(ToxWindow *self, char *u_cmd) | |||
239 | return; | 235 | return; |
240 | } | 236 | } |
241 | msg++; | 237 | msg++; |
242 | m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); | 238 | m_set_statusmessage((uint8_t*) msg, strlen(msg)+1); |
243 | wprintw(self->window, "Status set to: %s\n", msg); | 239 | wprintw(self->window, "Status set to: %s\n", msg); |
244 | } | 240 | } |
245 | 241 | ||