summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-11-14 19:05:36 +0100
committerCoren[m] <Break@Ocean>2013-11-14 19:05:53 +0100
commit0d8329b3a9b16cd6089810e61ce958fde00046b8 (patch)
treea86bc471393905c16e8a0d0151a7494784136d63 /toxcore/Messenger.c
parent3af83a6aecdbc719ef38986cba2f238eab3ba3ec (diff)
Significantly trimmed down version of an ID<=>IP cache.
Besides acknowledging timeouts, the module isn't trying to do anything fancy with the data besides storing and retrieving.
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r--toxcore/Messenger.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 57cafc3f..49cffc98 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -26,9 +26,11 @@
26#endif 26#endif
27 27
28#include "Messenger.h" 28#include "Messenger.h"
29#include "assoc.h"
29#include "network.h" 30#include "network.h"
30#include "util.h" 31#include "util.h"
31 32
33
32#define MIN(a,b) (((a)<(b))?(a):(b)) 34#define MIN(a,b) (((a)<(b))?(a):(b))
33 35
34 36
@@ -784,7 +786,7 @@ int add_groupchat(Messenger *m)
784 786
785 for (i = 0; i < m->numchats; ++i) { 787 for (i = 0; i < m->numchats; ++i) {
786 if (m->chats[i] == NULL) { 788 if (m->chats[i] == NULL) {
787 Group_Chat *newchat = new_groupchat(m->net); 789 Group_Chat *newchat = new_groupchat(m->net, m->dht->assoc);
788 790
789 if (newchat == NULL) 791 if (newchat == NULL)
790 return -1; 792 return -1;
@@ -803,7 +805,7 @@ int add_groupchat(Messenger *m)
803 if (temp == NULL) 805 if (temp == NULL)
804 return -1; 806 return -1;
805 807
806 temp[m->numchats] = new_groupchat(m->net); 808 temp[m->numchats] = new_groupchat(m->net, m->dht->assoc);
807 809
808 if (temp[m->numchats] == NULL) 810 if (temp[m->numchats] == NULL)
809 return -1; 811 return -1;
@@ -2006,6 +2008,9 @@ static int messenger_load_state_callback(void *outer, uint8_t *data, uint32_t le
2006 if (length == crypto_box_PUBLICKEYBYTES + crypto_box_SECRETKEYBYTES + sizeof(uint32_t)) { 2008 if (length == crypto_box_PUBLICKEYBYTES + crypto_box_SECRETKEYBYTES + sizeof(uint32_t)) {
2007 set_nospam(&(m->fr), *(uint32_t *)data); 2009 set_nospam(&(m->fr), *(uint32_t *)data);
2008 load_keys(m->net_crypto, &data[sizeof(uint32_t)]); 2010 load_keys(m->net_crypto, &data[sizeof(uint32_t)]);
2011
2012 if (m->dht->assoc)
2013 Assoc_self_client_id_changed(m->dht->assoc);
2009 } else 2014 } else
2010 return -1; /* critical */ 2015 return -1; /* critical */
2011 2016