summaryrefslogtreecommitdiff
path: root/testing/toxic/chat.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-13 09:32:31 -0400
committerirungentoo <irungentoo@gmail.com>2013-08-13 09:32:31 -0400
commit97f449a2f1aa3e4fbe7f2d853efa0c7935ded967 (patch)
tree9896c268be528828617823d7b04da9f7a0d0386f /testing/toxic/chat.c
parent8fe1dec5d634a2bba214b9204bda8341e8b26ed5 (diff)
Fixed spam problem. (I broke the API so this will not build)
The friend address is what the byte string that you give away for people to add you will be called. 1. Every friend address now contains a number set by the friend. This is to prevent someone from randomly spamming people in the DHT with friend requests and makes it so you need the person to actually give you the address in some way to send the friend request. This number is expected to be encrypted with the friend request. All requests that do not contain this number will be rejected. This means the spammer can no longer use the DHT to collect lists of valid addresses to spam. It also enables users to quickly change the number in case a spammer gets hold of the address and starts spamming it. 2. A 2 byte checksum will be added (not implemented yet) to prevent people from accidentally adding random strings as friends. (NOTE that this has nothing to do with the spam problem I just decided to add a placeholder for it now.)
Diffstat (limited to 'testing/toxic/chat.c')
-rw-r--r--testing/toxic/chat.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c
index 35be3bd3..1b5e743d 100644
--- a/testing/toxic/chat.c
+++ b/testing/toxic/chat.c
@@ -307,11 +307,13 @@ void execute(ToxWindow *self, ChatContext *ctx, Messenger *m, char *cmd)
307 } 307 }
308 308
309 else if (!strcmp(cmd, "/myid")) { 309 else if (!strcmp(cmd, "/myid")) {
310 char id[KEY_SIZE_BYTES*2+1] = {0}; 310 char id[FRIEND_ADDRESS_SIZE*2+1] = {0};
311 int i; 311 int i;
312 for (i = 0; i < KEY_SIZE_BYTES; i++) { 312 uint8_t address[FRIEND_ADDRESS_SIZE];
313 getaddress(m, address);
314 for (i = 0; i < FRIEND_ADDRESS_SIZE; i++) {
313 char xx[3]; 315 char xx[3];
314 snprintf(xx, sizeof(xx), "%02x", self_public_key[i] & 0xff); 316 snprintf(xx, sizeof(xx), "%02X", address[i] & 0xff);
315 strcat(id, xx); 317 strcat(id, xx);
316 } 318 }
317 wprintw(ctx->history, "Your ID: %s\n", id); 319 wprintw(ctx->history, "Your ID: %s\n", id);