summaryrefslogtreecommitdiff
path: root/protocols/Tox/libtox/src/toxcore/friend_requests.c
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-01-17 22:34:45 +0300
committeraunsane <aunsane@gmail.com>2018-01-17 22:34:45 +0300
commitbf928bd6cfa3df39b4cfda0ff5a5825105cf4a56 (patch)
tree3c7ce179ea9f6a43e671c96186fcbec804170c9a /protocols/Tox/libtox/src/toxcore/friend_requests.c
parent5f96f1919d2d8210c4a67fe5a4fd9c0f84f9ee27 (diff)
Tox: updated libtox to 0.2.0
- support of message correction - version bump
Diffstat (limited to 'protocols/Tox/libtox/src/toxcore/friend_requests.c')
-rw-r--r--protocols/Tox/libtox/src/toxcore/friend_requests.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/protocols/Tox/libtox/src/toxcore/friend_requests.c b/protocols/Tox/libtox/src/toxcore/friend_requests.c
index ba782e2b01..4a06654deb 100644
--- a/protocols/Tox/libtox/src/toxcore/friend_requests.c
+++ b/protocols/Tox/libtox/src/toxcore/friend_requests.c
@@ -29,6 +29,24 @@
#include "util.h"
+struct Friend_Requests {
+ uint32_t nospam;
+ void (*handle_friendrequest)(void *, const uint8_t *, const uint8_t *, size_t, void *);
+ uint8_t handle_friendrequest_isset;
+ void *handle_friendrequest_object;
+
+ int (*filter_function)(const uint8_t *, void *);
+ void *filter_function_userdata;
+ /* NOTE: The following is just a temporary fix for the multiple friend requests received at the same time problem.
+ * TODO(irungentoo): Make this better (This will most likely tie in with the way we will handle spam.)
+ */
+
+#define MAX_RECEIVED_STORED 32
+
+ uint8_t received_requests[MAX_RECEIVED_STORED][CRYPTO_PUBLIC_KEY_SIZE];
+ uint16_t received_requests_index;
+};
+
/* Set and get the nospam variable used to prevent one type of friend request spam. */
void set_nospam(Friend_Requests *fr, uint32_t num)
{
@@ -150,3 +168,13 @@ void friendreq_init(Friend_Requests *fr, Friend_Connections *fr_c)
{
set_friend_request_callback(fr_c, &friendreq_handlepacket, fr);
}
+
+Friend_Requests *friendreq_new(void)
+{
+ return (Friend_Requests *)calloc(1, sizeof(Friend_Requests));
+}
+
+void friendreq_kill(Friend_Requests *fr)
+{
+ free(fr);
+}