diff options
-rw-r--r-- | auto_tests/tox_test.c | 2 | ||||
-rw-r--r-- | other/apidsl/tox.in.h | 2 | ||||
-rw-r--r-- | testing/Messenger_test.c | 2 | ||||
-rw-r--r-- | testing/irc_syncbot.c | 2 | ||||
-rw-r--r-- | testing/nTox.c | 2 | ||||
-rw-r--r-- | testing/tox_shell.c | 4 | ||||
-rw-r--r-- | toxcore/Messenger.c | 8 | ||||
-rw-r--r-- | toxcore/Messenger.h | 3 | ||||
-rw-r--r-- | toxcore/tox.c | 4 | ||||
-rw-r--r-- | toxcore/tox.h | 2 |
10 files changed, 15 insertions, 16 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 6bd619c3..22a1354d 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -477,7 +477,7 @@ START_TEST(test_few_clients) | |||
477 | ck_assert_msg(connected_t1, "Tox1 isn't connected. %u", connected_t1); | 477 | ck_assert_msg(connected_t1, "Tox1 isn't connected. %u", connected_t1); |
478 | printf("tox clients connected took %llu seconds\n", time(NULL) - con_time); | 478 | printf("tox clients connected took %llu seconds\n", time(NULL) - con_time); |
479 | to_compare = 974536; | 479 | to_compare = 974536; |
480 | tox_callback_friend_message(tox3, print_message, &to_compare); | 480 | tox_callback_friend_message(tox3, print_message); |
481 | uint8_t msgs[TOX_MAX_MESSAGE_LENGTH + 1]; | 481 | uint8_t msgs[TOX_MAX_MESSAGE_LENGTH + 1]; |
482 | memset(msgs, 'G', sizeof(msgs)); | 482 | memset(msgs, 'G', sizeof(msgs)); |
483 | TOX_ERR_FRIEND_SEND_MESSAGE errm; | 483 | TOX_ERR_FRIEND_SEND_MESSAGE errm; |
diff --git a/other/apidsl/tox.in.h b/other/apidsl/tox.in.h index c0695d54..bb97174a 100644 --- a/other/apidsl/tox.in.h +++ b/other/apidsl/tox.in.h | |||
@@ -1479,7 +1479,7 @@ namespace friend { | |||
1479 | /** | 1479 | /** |
1480 | * This event is triggered when a message from a friend is received. | 1480 | * This event is triggered when a message from a friend is received. |
1481 | */ | 1481 | */ |
1482 | event message { | 1482 | event message const { |
1483 | /** | 1483 | /** |
1484 | * @param friend_number The friend number of the friend who sent the message. | 1484 | * @param friend_number The friend number of the friend who sent the message. |
1485 | * @param time_delta Time between composition and sending. | 1485 | * @param time_delta Time between composition and sending. |
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 0c439a05..44b9fc48 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -148,7 +148,7 @@ int main(int argc, char *argv[]) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | m_callback_friendrequest(m, print_request, NULL); | 150 | m_callback_friendrequest(m, print_request, NULL); |
151 | m_callback_friendmessage(m, print_message, NULL); | 151 | m_callback_friendmessage(m, print_message); |
152 | 152 | ||
153 | printf("OUR ID: "); | 153 | printf("OUR ID: "); |
154 | uint32_t i; | 154 | uint32_t i; |
diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c index be4cf620..8ee28d80 100644 --- a/testing/irc_syncbot.c +++ b/testing/irc_syncbot.c | |||
@@ -228,7 +228,7 @@ Tox *init_tox(int argc, char *argv[]) | |||
228 | exit(1); | 228 | exit(1); |
229 | 229 | ||
230 | tox_self_set_name(tox, (uint8_t *)IRC_NAME, sizeof(IRC_NAME) - 1, 0); | 230 | tox_self_set_name(tox, (uint8_t *)IRC_NAME, sizeof(IRC_NAME) - 1, 0); |
231 | tox_callback_friend_message(tox, &callback_friend_message, 0); | 231 | tox_callback_friend_message(tox, &callback_friend_message); |
232 | tox_callback_group_invite(tox, &callback_group_invite, 0); | 232 | tox_callback_group_invite(tox, &callback_group_invite, 0); |
233 | tox_callback_group_message(tox, ©_groupmessage, 0); | 233 | tox_callback_group_message(tox, ©_groupmessage, 0); |
234 | tox_callback_group_action(tox, ©_groupmessage, 0); | 234 | tox_callback_group_action(tox, ©_groupmessage, 0); |
diff --git a/testing/nTox.c b/testing/nTox.c index 5e70e728..8cc633bc 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -1291,7 +1291,7 @@ int main(int argc, char *argv[]) | |||
1291 | save_data_file(m, filename); | 1291 | save_data_file(m, filename); |
1292 | 1292 | ||
1293 | tox_callback_friend_request(m, print_request, NULL); | 1293 | tox_callback_friend_request(m, print_request, NULL); |
1294 | tox_callback_friend_message(m, print_message, NULL); | 1294 | tox_callback_friend_message(m, print_message); |
1295 | tox_callback_friend_name(m, print_nickchange); | 1295 | tox_callback_friend_name(m, print_nickchange); |
1296 | tox_callback_friend_status_message(m, print_statuschange); | 1296 | tox_callback_friend_status_message(m, print_statuschange); |
1297 | tox_callback_group_invite(m, print_invite, NULL); | 1297 | tox_callback_group_invite(m, print_invite, NULL); |
diff --git a/testing/tox_shell.c b/testing/tox_shell.c index d045f798..9c71a2d7 100644 --- a/testing/tox_shell.c +++ b/testing/tox_shell.c | |||
@@ -98,7 +98,7 @@ int main(int argc, char *argv[]) | |||
98 | 98 | ||
99 | Tox *tox = tox_new(0, 0); | 99 | Tox *tox = tox_new(0, 0); |
100 | tox_callback_friend_connection_status(tox, print_online, NULL); | 100 | tox_callback_friend_connection_status(tox, print_online, NULL); |
101 | tox_callback_friend_message(tox, print_message, master); | 101 | tox_callback_friend_message(tox, print_message); |
102 | 102 | ||
103 | 103 | ||
104 | uint16_t port = atoi(argv[argvoffset + 2]); | 104 | uint16_t port = atoi(argv[argvoffset + 2]); |
@@ -153,7 +153,7 @@ int main(int argc, char *argv[]) | |||
153 | tox_friend_send_message(tox, num, TOX_MESSAGE_TYPE_NORMAL, buf, ret, 0); | 153 | tox_friend_send_message(tox, num, TOX_MESSAGE_TYPE_NORMAL, buf, ret, 0); |
154 | } | 154 | } |
155 | 155 | ||
156 | tox_iterate(tox, NULL); | 156 | tox_iterate(tox, master); |
157 | c_sleep(1); | 157 | c_sleep(1); |
158 | } | 158 | } |
159 | 159 | ||
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 2eb6cfd8..ac885310 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -771,10 +771,9 @@ void m_callback_friendrequest(Messenger *m, void (*function)(Messenger *m, const | |||
771 | 771 | ||
772 | /* Set the function that will be executed when a message from a friend is received. */ | 772 | /* Set the function that will be executed when a message from a friend is received. */ |
773 | void m_callback_friendmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, unsigned int, const uint8_t *, | 773 | void m_callback_friendmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, unsigned int, const uint8_t *, |
774 | size_t, void *), void *userdata) | 774 | size_t, void *)) |
775 | { | 775 | { |
776 | m->friend_message = function; | 776 | m->friend_message = function; |
777 | m->friend_message_userdata = userdata; | ||
778 | } | 777 | } |
779 | 778 | ||
780 | void m_callback_namechange(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *)) | 779 | void m_callback_namechange(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *)) |
@@ -2007,8 +2006,9 @@ static int handle_packet(void *object, int i, uint8_t *temp, uint16_t len, void | |||
2007 | message_terminated[message_length] = 0; | 2006 | message_terminated[message_length] = 0; |
2008 | uint8_t type = packet_id - PACKET_ID_MESSAGE; | 2007 | uint8_t type = packet_id - PACKET_ID_MESSAGE; |
2009 | 2008 | ||
2010 | if (m->friend_message) | 2009 | if (m->friend_message) { |
2011 | (*m->friend_message)(m, i, type, message_terminated, message_length, m->friend_message_userdata); | 2010 | (*m->friend_message)(m, i, type, message_terminated, message_length, userdata); |
2011 | } | ||
2012 | 2012 | ||
2013 | break; | 2013 | break; |
2014 | } | 2014 | } |
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 113df796..2a421bba 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h | |||
@@ -237,7 +237,6 @@ struct Messenger { | |||
237 | Node_format loaded_relays[NUM_SAVED_TCP_RELAYS]; // Relays loaded from config | 237 | Node_format loaded_relays[NUM_SAVED_TCP_RELAYS]; // Relays loaded from config |
238 | 238 | ||
239 | void (*friend_message)(struct Messenger *m, uint32_t, unsigned int, const uint8_t *, size_t, void *); | 239 | void (*friend_message)(struct Messenger *m, uint32_t, unsigned int, const uint8_t *, size_t, void *); |
240 | void *friend_message_userdata; | ||
241 | void (*friend_namechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *); | 240 | void (*friend_namechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *); |
242 | void (*friend_statusmessagechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *); | 241 | void (*friend_statusmessagechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *); |
243 | void (*friend_userstatuschange)(struct Messenger *m, uint32_t, unsigned int, void *); | 242 | void (*friend_userstatuschange)(struct Messenger *m, uint32_t, unsigned int, void *); |
@@ -475,7 +474,7 @@ void m_callback_friendrequest(Messenger *m, void (*function)(Messenger *m, const | |||
475 | * Function format is: function(uint32_t friendnumber, unsigned int type, uint8_t * message, uint32_t length) | 474 | * Function format is: function(uint32_t friendnumber, unsigned int type, uint8_t * message, uint32_t length) |
476 | */ | 475 | */ |
477 | void m_callback_friendmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, unsigned int, const uint8_t *, | 476 | void m_callback_friendmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, unsigned int, const uint8_t *, |
478 | size_t, void *), void *userdata); | 477 | size_t, void *)); |
479 | 478 | ||
480 | /* Set the callback for name changes. | 479 | /* Set the callback for name changes. |
481 | * Function(uint32_t friendnumber, uint8_t *newname, size_t length) | 480 | * Function(uint32_t friendnumber, uint8_t *newname, size_t length) |
diff --git a/toxcore/tox.c b/toxcore/tox.c index 6b36c115..2733a22f 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -902,10 +902,10 @@ void tox_callback_friend_request(Tox *tox, tox_friend_request_cb *function, void | |||
902 | m_callback_friendrequest(m, function, user_data); | 902 | m_callback_friendrequest(m, function, user_data); |
903 | } | 903 | } |
904 | 904 | ||
905 | void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *function, void *user_data) | 905 | void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *function) |
906 | { | 906 | { |
907 | Messenger *m = tox; | 907 | Messenger *m = tox; |
908 | m_callback_friendmessage(m, function, user_data); | 908 | m_callback_friendmessage(m, function); |
909 | } | 909 | } |
910 | 910 | ||
911 | bool tox_hash(uint8_t *hash, const uint8_t *data, size_t length) | 911 | bool tox_hash(uint8_t *hash, const uint8_t *data, size_t length) |
diff --git a/toxcore/tox.h b/toxcore/tox.h index c2b14eec..dab8ac08 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -1580,7 +1580,7 @@ typedef void tox_friend_message_cb(Tox *tox, uint32_t friend_number, TOX_MESSAGE | |||
1580 | * | 1580 | * |
1581 | * This event is triggered when a message from a friend is received. | 1581 | * This event is triggered when a message from a friend is received. |
1582 | */ | 1582 | */ |
1583 | void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *callback, void *user_data); | 1583 | void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *callback); |
1584 | 1584 | ||
1585 | 1585 | ||
1586 | /******************************************************************************* | 1586 | /******************************************************************************* |