summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-09-12 20:29:30 -0400
committerirungentoo <irungentoo@gmail.com>2013-09-12 20:29:30 -0400
commitf8b979a92a8c316c49bed28e158a468a2f74346c (patch)
treedd139feb11dde83d1f16cc7be9f92c3d8e680dd1 /testing
parent41b162eb189d3631abba4c65ced3570c776e45a5 (diff)
Put group chat functions in the public API.
Group chats are not complete, they seem to work very well though. This means that the functions will change.
Diffstat (limited to 'testing')
-rw-r--r--testing/nTox.c16
-rw-r--r--testing/nTox.h1
2 files changed, 8 insertions, 9 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index d6e25ac0..fa3b5b8c 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -354,7 +354,7 @@ void line_eval(Tox *m, char *line)
354 new_lines(idstring); 354 new_lines(idstring);
355 } else if (inpt_command == 'g') { //create new group chat 355 } else if (inpt_command == 'g') { //create new group chat
356 char msg[256]; 356 char msg[256];
357 sprintf(msg, "[g] Created new group chat with number: %u", add_groupchat(m)); 357 sprintf(msg, "[g] Created new group chat with number: %u", tox_add_groupchat(m));
358 new_lines(msg); 358 new_lines(msg);
359 } else if (inpt_command == 'i') { //invite friendnum to groupnum 359 } else if (inpt_command == 'i') { //invite friendnum to groupnum
360 char *posi[1]; 360 char *posi[1];
@@ -362,7 +362,7 @@ void line_eval(Tox *m, char *line)
362 int groupnumber = strtoul(*posi + 1, NULL, 0); 362 int groupnumber = strtoul(*posi + 1, NULL, 0);
363 char msg[256]; 363 char msg[256];
364 sprintf(msg, "[g] Invited friend number %u to group number %u, returned: %u (0 means success)", friendnumber, 364 sprintf(msg, "[g] Invited friend number %u to group number %u, returned: %u (0 means success)", friendnumber,
365 groupnumber, invite_friend(m, friendnumber, groupnumber)); 365 groupnumber, tox_invite_friend(m, friendnumber, groupnumber));
366 new_lines(msg); 366 new_lines(msg);
367 } else if (inpt_command == 'z') { //send message to groupnum 367 } else if (inpt_command == 'z') { //send message to groupnum
368 char *posi[1]; 368 char *posi[1];
@@ -371,7 +371,7 @@ void line_eval(Tox *m, char *line)
371 if (**posi != 0) { 371 if (**posi != 0) {
372 char msg[256 + 1024]; 372 char msg[256 + 1024];
373 sprintf(msg, "[g] sent message: %s to group num: %u returned: %u (0 means success)", *posi + 1, groupnumber, 373 sprintf(msg, "[g] sent message: %s to group num: %u returned: %u (0 means success)", *posi + 1, groupnumber,
374 group_message_send(m, groupnumber, (uint8_t *)*posi + 1, strlen(*posi + 1) + 1)); 374 tox_group_message_send(m, groupnumber, (uint8_t *)*posi + 1, strlen(*posi + 1) + 1));
375 new_lines(msg); 375 new_lines(msg);
376 } 376 }
377 377
@@ -556,15 +556,15 @@ void print_help(void)
556 puts("\t-f\t-\tSpecify a keyfile to read (or write to) from."); 556 puts("\t-f\t-\tSpecify a keyfile to read (or write to) from.");
557} 557}
558 558
559void print_invite(Messenger *m, int friendnumber, uint8_t *group_public_key, void *userdata) 559void print_invite(Tox *m, int friendnumber, uint8_t *group_public_key, void *userdata)
560{ 560{
561 char msg[256]; 561 char msg[256];
562 sprintf(msg, "[i] recieved group chat invite from: %u, auto accepting and joining. group number: %u", friendnumber, 562 sprintf(msg, "[i] recieved group chat invite from: %u, auto accepting and joining. group number: %u", friendnumber,
563 join_groupchat(m, friendnumber, group_public_key)); 563 tox_join_groupchat(m, friendnumber, group_public_key));
564 new_lines(msg); 564 new_lines(msg);
565} 565}
566 566
567void print_groupmessage(Messenger *m, int groupnumber, uint8_t *message, uint16_t length, void *userdata) 567void print_groupmessage(Tox *m, int groupnumber, uint8_t *message, uint16_t length, void *userdata)
568{ 568{
569 char msg[256 + length]; 569 char msg[256 + length];
570 sprintf(msg, "[g] %u: %s", groupnumber, message); 570 sprintf(msg, "[g] %u: %s", groupnumber, message);
@@ -616,8 +616,8 @@ int main(int argc, char *argv[])
616 tox_callback_friendmessage(m, print_message, NULL); 616 tox_callback_friendmessage(m, print_message, NULL);
617 tox_callback_namechange(m, print_nickchange, NULL); 617 tox_callback_namechange(m, print_nickchange, NULL);
618 tox_callback_statusmessage(m, print_statuschange, NULL); 618 tox_callback_statusmessage(m, print_statuschange, NULL);
619 m_callback_group_invite(m, print_invite, NULL); 619 tox_callback_group_invite(m, print_invite, NULL);
620 m_callback_group_message(m, print_groupmessage, NULL); 620 tox_callback_group_message(m, print_groupmessage, NULL);
621 621
622 initscr(); 622 initscr();
623 noecho(); 623 noecho();
diff --git a/testing/nTox.h b/testing/nTox.h
index 8a41965b..2cd5db09 100644
--- a/testing/nTox.h
+++ b/testing/nTox.h
@@ -31,7 +31,6 @@
31#include <ctype.h> 31#include <ctype.h>
32 32
33#include "../toxcore/tox.h" 33#include "../toxcore/tox.h"
34#include "../toxcore/Messenger.h" //TODO: remove this
35#define STRING_LENGTH 256 34#define STRING_LENGTH 256
36#define HISTORY 50 35#define HISTORY 50
37#define PUB_KEY_BYTES 32 36#define PUB_KEY_BYTES 32