summaryrefslogtreecommitdiff
path: root/testing/toxic
diff options
context:
space:
mode:
Diffstat (limited to 'testing/toxic')
-rw-r--r--testing/toxic/chat.c2
-rw-r--r--testing/toxic/friendlist.c4
-rw-r--r--testing/toxic/main.c4
-rw-r--r--testing/toxic/prompt.c20
4 files changed, 13 insertions, 17 deletions
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)
162 return; 162 return;
163 } 163 }
164 msg++; 164 msg++;
165 m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); 165 m_set_statusmessage((uint8_t*) msg, strlen(msg)+1);
166 wprintw(ctx->history, "Status set to: %s\n", msg); 166 wprintw(ctx->history, "Status set to: %s\n", msg);
167 } 167 }
168 168
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
21typedef struct { 21typedef 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
75void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len) 75void 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 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)
68 } 68 }
69} 69}
70 70
71void on_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t *string, uint16_t length) 71void on_statuschange(int friendnumber, uint8_t *string, uint16_t length)
72{ 72{
73 wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string); 73 wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string);
74 int i; 74 int i;
@@ -112,7 +112,7 @@ static void init_tox()
112 m_callback_friendrequest(on_request); 112 m_callback_friendrequest(on_request);
113 m_callback_friendmessage(on_message); 113 m_callback_friendmessage(on_message);
114 m_callback_namechange(on_nickchange); 114 m_callback_namechange(on_nickchange);
115 m_callback_userstatus(on_statuschange); 115 m_callback_statusmessage(on_statuschange);
116} 116}
117 117
118void init_window_status() 118void 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)
183 return; 183 return;
184 } 184 }
185 status++; 185 status++;
186 USERSTATUS_KIND status_kind; 186 USERSTATUS status_kind;
187 if (!strncmp(status, "online", strlen("online"))) { 187 if (!strncmp(status, "online", strlen("online"))) {
188 status_kind = USERSTATUS_KIND_ONLINE; 188 status_kind = USERSTATUS_NONE;
189 status_text = "ONLINE"; 189 status_text = "ONLINE";
190 } 190 }
191 191
192 else if (!strncmp(status, "away", strlen("away"))) { 192 else if (!strncmp(status, "away", strlen("away"))) {
193 status_kind = USERSTATUS_KIND_AWAY; 193 status_kind = USERSTATUS_AWAY;
194 status_text = "AWAY"; 194 status_text = "AWAY";
195 } 195 }
196 196
197 else if (!strncmp(status, "busy", strlen("busy"))) { 197 else if (!strncmp(status, "busy", strlen("busy"))) {
198 status_kind = USERSTATUS_KIND_BUSY; 198 status_kind = USERSTATUS_BUSY;
199 status_text = "BUSY"; 199 status_text = "BUSY";
200 } 200 }
201 201
202 else if (!strncmp(status, "offline", strlen("offline"))) {
203 status_kind = USERSTATUS_KIND_OFFLINE;
204 status_text = "OFFLINE";
205 }
206
207 else 202 else
208 { 203 {
209 wprintw(self->window, "Invalid status.\n"); 204 wprintw(self->window, "Invalid status.\n");
@@ -212,12 +207,13 @@ static void execute(ToxWindow *self, char *u_cmd)
212 207
213 msg = strchr(status, ' '); 208 msg = strchr(status, ' ');
214 if (msg == NULL) { 209 if (msg == NULL) {
215 m_set_userstatus_kind(status_kind); 210 m_set_userstatus(status_kind);
216 wprintw(self->window, "Status set to: %s\n", status_text); 211 wprintw(self->window, "Status set to: %s\n", status_text);
217 } 212 }
218 else { 213 else {
219 msg++; 214 msg++;
220 m_set_userstatus(status_kind, (uint8_t*) msg, strlen(msg)+1); 215 m_set_userstatus(status_kind);
216 m_set_statusmessage((uint8_t*) msg, strlen(msg)+1);
221 wprintw(self->window, "Status set to: %s, %s\n", status_text, msg); 217 wprintw(self->window, "Status set to: %s, %s\n", status_text, msg);
222 } 218 }
223 } 219 }
@@ -229,7 +225,7 @@ static void execute(ToxWindow *self, char *u_cmd)
229 return; 225 return;
230 } 226 }
231 msg++; 227 msg++;
232 m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); 228 m_set_statusmessage((uint8_t*) msg, strlen(msg)+1);
233 wprintw(self->window, "Status set to: %s\n", msg); 229 wprintw(self->window, "Status set to: %s\n", msg);
234 } 230 }
235 231