summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auto_tests/tox_test.c2
-rw-r--r--other/apidsl/tox.in.h2
-rw-r--r--testing/nTox.c2
-rw-r--r--toxcore/Messenger.c7
-rw-r--r--toxcore/Messenger.h4
-rw-r--r--toxcore/tox.c4
-rw-r--r--toxcore/tox.h2
7 files changed, 9 insertions, 14 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c
index 00146318..2146bdcf 100644
--- a/auto_tests/tox_test.c
+++ b/auto_tests/tox_test.c
@@ -560,7 +560,7 @@ START_TEST(test_few_clients)
560 tox_friend_get_name(tox3, 0, temp_name, 0); 560 tox_friend_get_name(tox3, 0, temp_name, 0);
561 ck_assert_msg(memcmp(temp_name, "Gentoo", sizeof("Gentoo")) == 0, "Name not correct"); 561 ck_assert_msg(memcmp(temp_name, "Gentoo", sizeof("Gentoo")) == 0, "Name not correct");
562 562
563 tox_callback_friend_status_message(tox3, print_status_m_change, &to_compare); 563 tox_callback_friend_status_message(tox3, print_status_m_change);
564 succ = tox_self_set_status_message(tox2, (uint8_t *)"Installing Gentoo", sizeof("Installing Gentoo"), &err_n); 564 succ = tox_self_set_status_message(tox2, (uint8_t *)"Installing Gentoo", sizeof("Installing Gentoo"), &err_n);
565 ck_assert_msg(succ && err_n == TOX_ERR_SET_INFO_OK, "tox_self_set_status_message failed because %u\n", err_n); 565 ck_assert_msg(succ && err_n == TOX_ERR_SET_INFO_OK, "tox_self_set_status_message failed because %u\n", err_n);
566 566
diff --git a/other/apidsl/tox.in.h b/other/apidsl/tox.in.h
index 2af19172..0aca1716 100644
--- a/other/apidsl/tox.in.h
+++ b/other/apidsl/tox.in.h
@@ -1240,7 +1240,7 @@ namespace friend {
1240 /** 1240 /**
1241 * This event is triggered when a friend changes their status message. 1241 * This event is triggered when a friend changes their status message.
1242 */ 1242 */
1243 event status_message { 1243 event status_message const {
1244 /** 1244 /**
1245 * @param friend_number The friend number of the friend whose status message 1245 * @param friend_number The friend number of the friend whose status message
1246 * changed. 1246 * changed.
diff --git a/testing/nTox.c b/testing/nTox.c
index ba7c2399..5e70e728 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -1293,7 +1293,7 @@ int main(int argc, char *argv[])
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, NULL);
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, NULL); 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);
1298 tox_callback_group_message(m, print_groupmessage, NULL); 1298 tox_callback_group_message(m, print_groupmessage, NULL);
1299 tox_callback_file_recv_chunk(m, write_file, NULL); 1299 tox_callback_file_recv_chunk(m, write_file, NULL);
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index e5779fb6..d7fa8e64 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -782,11 +782,9 @@ void m_callback_namechange(Messenger *m, void (*function)(Messenger *m, uint32_t
782 m->friend_namechange = function; 782 m->friend_namechange = function;
783} 783}
784 784
785void m_callback_statusmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *), 785void m_callback_statusmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *))
786 void *userdata)
787{ 786{
788 m->friend_statusmessagechange = function; 787 m->friend_statusmessagechange = function;
789 m->friend_statusmessagechange_userdata = userdata;
790} 788}
791 789
792void m_callback_userstatus(Messenger *m, void (*function)(Messenger *m, uint32_t, unsigned int, void *), void *userdata) 790void m_callback_userstatus(Messenger *m, void (*function)(Messenger *m, uint32_t, unsigned int, void *), void *userdata)
@@ -1959,8 +1957,7 @@ static int handle_packet(void *object, int i, uint8_t *temp, uint16_t len, void
1959 data_terminated[data_length] = 0; 1957 data_terminated[data_length] = 0;
1960 1958
1961 if (m->friend_statusmessagechange) 1959 if (m->friend_statusmessagechange)
1962 m->friend_statusmessagechange(m, i, data_terminated, data_length, 1960 m->friend_statusmessagechange(m, i, data_terminated, data_length, userdata);
1963 m->friend_statusmessagechange_userdata);
1964 1961
1965 set_friend_statusmessage(m, i, data_terminated, data_length); 1962 set_friend_statusmessage(m, i, data_terminated, data_length);
1966 break; 1963 break;
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h
index 5af9e274..9dae8446 100644
--- a/toxcore/Messenger.h
+++ b/toxcore/Messenger.h
@@ -241,7 +241,6 @@ struct Messenger {
241 void *friend_message_userdata; 241 void *friend_message_userdata;
242 void (*friend_namechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *); 242 void (*friend_namechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *);
243 void (*friend_statusmessagechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *); 243 void (*friend_statusmessagechange)(struct Messenger *m, uint32_t, const uint8_t *, size_t, void *);
244 void *friend_statusmessagechange_userdata;
245 void (*friend_userstatuschange)(struct Messenger *m, uint32_t, unsigned int, void *); 244 void (*friend_userstatuschange)(struct Messenger *m, uint32_t, unsigned int, void *);
246 void *friend_userstatuschange_userdata; 245 void *friend_userstatuschange_userdata;
247 void (*friend_typingchange)(struct Messenger *m, uint32_t, _Bool, void *); 246 void (*friend_typingchange)(struct Messenger *m, uint32_t, _Bool, void *);
@@ -491,8 +490,7 @@ void m_callback_namechange(Messenger *m, void (*function)(Messenger *m, uint32_t
491 * 490 *
492 * You are not responsible for freeing newstatus 491 * You are not responsible for freeing newstatus
493 */ 492 */
494void m_callback_statusmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *), 493void m_callback_statusmessage(Messenger *m, void (*function)(Messenger *m, uint32_t, const uint8_t *, size_t, void *));
495 void *userdata);
496 494
497/* Set the callback for status type changes. 495/* Set the callback for status type changes.
498 * Function(uint32_t friendnumber, USERSTATUS kind) 496 * Function(uint32_t friendnumber, USERSTATUS kind)
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 2d3c97a9..51307fc1 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -761,10 +761,10 @@ bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8
761 return 1; 761 return 1;
762} 762}
763 763
764void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *function, void *user_data) 764void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *function)
765{ 765{
766 Messenger *m = tox; 766 Messenger *m = tox;
767 m_callback_statusmessage(m, function, user_data); 767 m_callback_statusmessage(m, function);
768} 768}
769 769
770TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) 770TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
diff --git a/toxcore/tox.h b/toxcore/tox.h
index 5e6de408..1bb98a76 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -1327,7 +1327,7 @@ typedef void tox_friend_status_message_cb(Tox *tox, uint32_t friend_number, cons
1327 * 1327 *
1328 * This event is triggered when a friend changes their status message. 1328 * This event is triggered when a friend changes their status message.
1329 */ 1329 */
1330void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *callback, void *user_data); 1330void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *callback);
1331 1331
1332/** 1332/**
1333 * Return the friend's user status (away/busy/...). If the friend number is 1333 * Return the friend's user status (away/busy/...). If the friend number is