1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 22:43:01 +01:00

Make test clients compatible with userstatus kinds

No features were added, just fixed callbacks.
This commit is contained in:
Sebastian Stal 2013-08-05 12:30:40 -07:00
parent 805eb0195a
commit 51598d626a
3 changed files with 8 additions and 8 deletions

2
chat.c
View File

@ -161,7 +161,7 @@ void execute(ToxWindow* self, ChatContext* ctx, char* cmd)
return; return;
} }
msg++; 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); wprintw(ctx->history, "Status set to: %s\n", msg);
} }
else if (!strncmp(cmd, "/nick ", strlen("/nick "))) { else if (!strncmp(cmd, "/nick ", strlen("/nick "))) {

6
main.c
View File

@ -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; size_t i;
wprintw(prompt->window, "\n(statuschange) %d: %s!\n", friendnumber, string); wprintw(prompt->window, "\n(statuschange) %d: %s!\n", friendnumber, string);
@ -201,7 +201,7 @@ static void load_data(char *path) {
Messenger_load(buf, len); Messenger_load(buf, len);
} }
else { else {
len = Messenger_size(); len = Messenger_size();
buf = malloc(len); buf = malloc(len);
@ -289,7 +289,7 @@ int main(int argc, char* argv[]) {
for(i = 0; i < argc; i++) { for(i = 0; i < argc; i++) {
if (argv[i] == NULL){ if (argv[i] == NULL){
break; break;
} else if(argv[i][0] == '-') { } else if(argv[i][0] == '-') {
if(argv[i][1] == 'f') { if(argv[i][1] == 'f') {
if(argv[i + 1] != NULL) if(argv[i + 1] != NULL)

View File

@ -91,7 +91,7 @@ static void execute(ToxWindow* self, char* cmd) {
dht.ip.i = resolved_address; dht.ip.i = resolved_address;
unsigned char *binary_string = hex_string_to_bin(key); unsigned char *binary_string = hex_string_to_bin(key);
DHT_bootstrap(dht, binary_string); DHT_bootstrap(dht, binary_string);
free(binary_string); free(binary_string);
} }
else if(!strncmp(cmd, "add ", strlen("add "))) { else if(!strncmp(cmd, "add ", strlen("add "))) {
uint8_t id_bin[32]; 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); num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1);
switch (num) { switch (num) {
case -1: case -1:
wprintw(self->window, "Message is too long.\n"); wprintw(self->window, "Message is too long.\n");
break; break;
case -2: case -2:
@ -151,7 +151,7 @@ static void execute(ToxWindow* self, char* cmd) {
break; break;
case -5: case -5:
wprintw(self->window, "Undefined error when adding friend.\n"); wprintw(self->window, "Undefined error when adding friend.\n");
break; break;
default: default:
wprintw(self->window, "Friend added as %d.\n", num); wprintw(self->window, "Friend added as %d.\n", num);
on_friendadded(num); on_friendadded(num);
@ -172,7 +172,7 @@ static void execute(ToxWindow* self, char* cmd) {
} }
msg++; 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); wprintw(self->window, "Status set to: %s\n", msg);
} }
else if(!strncmp(cmd, "nick ", strlen("nick "))) { else if(!strncmp(cmd, "nick ", strlen("nick "))) {