summaryrefslogtreecommitdiff
path: root/testing/tox_shell.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-03-18 15:32:53 -0400
committerirungentoo <irungentoo@gmail.com>2015-03-18 15:32:53 -0400
commitd71136262227d68b649ce9fd8e020597c69cce07 (patch)
tree3ac7150c848986e3d2043bb9ac074e679d82d27c /testing/tox_shell.c
parentb9e747fd50a81496626deaaf4878f06630abc75a (diff)
Merged normal message function and send action function into one
messaging function. This removes code duplication and allows us to easily add new message types to the api without having to add new functions.
Diffstat (limited to 'testing/tox_shell.c')
-rw-r--r--testing/tox_shell.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/testing/tox_shell.c b/testing/tox_shell.c
index 38fe6364..a7cef997 100644
--- a/testing/tox_shell.c
+++ b/testing/tox_shell.c
@@ -53,7 +53,8 @@ void print_online(Tox *tox, uint32_t friendnumber, TOX_CONNECTION status, void *
53 printf("\nOther went offline.\n"); 53 printf("\nOther went offline.\n");
54} 54}
55 55
56void print_message(Tox *tox, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata) 56void print_message(Tox *tox, uint32_t friendnumber, TOX_MESSAGE_TYPE type, const uint8_t *string, size_t length,
57 void *userdata)
57{ 58{
58 int master = *((int *)userdata); 59 int master = *((int *)userdata);
59 write(master, string, length); 60 write(master, string, length);
@@ -148,7 +149,7 @@ int main(int argc, char *argv[])
148 if (ret <= 0) 149 if (ret <= 0)
149 break; 150 break;
150 151
151 tox_friend_send_message(tox, num, buf, ret, 0); 152 tox_friend_send_message(tox, num, TOX_MESSAGE_TYPE_MESSAGE, buf, ret, 0);
152 } 153 }
153 154
154 tox_iterate(tox); 155 tox_iterate(tox);