summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Stal <stal@pyboard.net>2013-08-05 12:30:40 -0700
committerSebastian Stal <stal@pyboard.net>2013-08-05 12:30:40 -0700
commit5ec3b2330e1b6a9d4cda0eef74aca2408bec5250 (patch)
tree26a636e1b207e1653256210a2c60409011f51af5
parentb7f989266df854fcd7772bec58e408c7359087ff (diff)
Make test clients compatible with userstatus kinds
No features were added, just fixed callbacks.
-rw-r--r--testing/nTox.c6
-rw-r--r--testing/toxic/chat.c2
-rw-r--r--testing/toxic/main.c6
-rw-r--r--testing/toxic/prompt.c8
4 files changed, 11 insertions, 11 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index fe91b1fa..63d0c32e 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -228,7 +228,7 @@ void line_eval(char *line)
228 status[i-3] = line[i]; 228 status[i-3] = line[i];
229 } 229 }
230 status[i-3] = 0; 230 status[i-3] = 0;
231 m_set_userstatus(status, strlen((char*)status) + 1); 231 m_set_userstatus(USERSTATUS_KIND_ONLINE, status, strlen((char*)status) + 1);
232 char numstring[100]; 232 char numstring[100];
233 sprintf(numstring, "[i] changed status to %s", (char*)status); 233 sprintf(numstring, "[i] changed status to %s", (char*)status);
234 new_lines(numstring); 234 new_lines(numstring);
@@ -364,7 +364,7 @@ void print_nickchange(int friendnumber, uint8_t *string, uint16_t length)
364 } 364 }
365} 365}
366 366
367void print_statuschange(int friendnumber, uint8_t *string, uint16_t length) 367void print_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t *string, uint16_t length)
368{ 368{
369 char name[MAX_NAME_LENGTH]; 369 char name[MAX_NAME_LENGTH];
370 if(getname(friendnumber, (uint8_t*)name) != -1) { 370 if(getname(friendnumber, (uint8_t*)name) != -1) {
@@ -392,7 +392,7 @@ void load_key(char *path)
392 } 392 }
393 Messenger_load(data, size); 393 Messenger_load(data, size);
394 394
395 } else { 395 } else {
396 //else save new keys 396 //else save new keys
397 int size = Messenger_size(); 397 int size = Messenger_size();
398 uint8_t data[size]; 398 uint8_t data[size];
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c
index ff7a1667..f28a6a30 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((uint8_t*) msg, strlen(msg)+1); 164 m_set_userstatus(USERSTATUS_KIND_RETAIN, (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 else if (!strncmp(cmd, "/nick ", strlen("/nick "))) { 167 else if (!strncmp(cmd, "/nick ", strlen("/nick "))) {
diff --git a/testing/toxic/main.c b/testing/toxic/main.c
index 45760b1c..b322f95c 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
72void on_statuschange(int friendnumber, uint8_t* string, uint16_t length) { 72void on_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t* string, uint16_t length) {
73 size_t i; 73 size_t i;
74 74
75 wprintw(prompt->window, "\n(statuschange) %d: %s!\n", friendnumber, string); 75 wprintw(prompt->window, "\n(statuschange) %d: %s!\n", friendnumber, string);
@@ -201,7 +201,7 @@ static void load_data(char *path) {
201 201
202 Messenger_load(buf, len); 202 Messenger_load(buf, len);
203 } 203 }
204 else { 204 else {
205 len = Messenger_size(); 205 len = Messenger_size();
206 buf = malloc(len); 206 buf = malloc(len);
207 207
@@ -289,7 +289,7 @@ int main(int argc, char* argv[]) {
289 289
290 for(i = 0; i < argc; i++) { 290 for(i = 0; i < argc; i++) {
291 if (argv[i] == NULL){ 291 if (argv[i] == NULL){
292 break; 292 break;
293 } else if(argv[i][0] == '-') { 293 } else if(argv[i][0] == '-') {
294 if(argv[i][1] == 'f') { 294 if(argv[i][1] == 'f') {
295 if(argv[i + 1] != NULL) 295 if(argv[i + 1] != NULL)
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c
index 463b9352..1ba15695 100644
--- a/testing/toxic/prompt.c
+++ b/testing/toxic/prompt.c
@@ -91,7 +91,7 @@ static void execute(ToxWindow* self, char* cmd) {
91 dht.ip.i = resolved_address; 91 dht.ip.i = resolved_address;
92 unsigned char *binary_string = hex_string_to_bin(key); 92 unsigned char *binary_string = hex_string_to_bin(key);
93 DHT_bootstrap(dht, binary_string); 93 DHT_bootstrap(dht, binary_string);
94 free(binary_string); 94 free(binary_string);
95 } 95 }
96 else if(!strncmp(cmd, "add ", strlen("add "))) { 96 else if(!strncmp(cmd, "add ", strlen("add "))) {
97 uint8_t id_bin[32]; 97 uint8_t id_bin[32];
@@ -137,7 +137,7 @@ static void execute(ToxWindow* self, char* cmd) {
137 137
138 num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); 138 num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1);
139 switch (num) { 139 switch (num) {
140 case -1: 140 case -1:
141 wprintw(self->window, "Message is too long.\n"); 141 wprintw(self->window, "Message is too long.\n");
142 break; 142 break;
143 case -2: 143 case -2:
@@ -151,7 +151,7 @@ static void execute(ToxWindow* self, char* cmd) {
151 break; 151 break;
152 case -5: 152 case -5:
153 wprintw(self->window, "Undefined error when adding friend.\n"); 153 wprintw(self->window, "Undefined error when adding friend.\n");
154 break; 154 break;
155 default: 155 default:
156 wprintw(self->window, "Friend added as %d.\n", num); 156 wprintw(self->window, "Friend added as %d.\n", num);
157 on_friendadded(num); 157 on_friendadded(num);
@@ -172,7 +172,7 @@ static void execute(ToxWindow* self, char* cmd) {
172 } 172 }
173 msg++; 173 msg++;
174 174
175 m_set_userstatus((uint8_t*) msg, strlen(msg)+1); 175 m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1);
176 wprintw(self->window, "Status set to: %s\n", msg); 176 wprintw(self->window, "Status set to: %s\n", msg);
177 } 177 }
178 else if(!strncmp(cmd, "nick ", strlen("nick "))) { 178 else if(!strncmp(cmd, "nick ", strlen("nick "))) {