nTox.c:
- don't claim "Added friend" per default, check for returned ID first
- on '/q' SAVE... else everything but the keys is lost on each restart
- for that, split load_key() into load_data() and save_data()
- announce own nickname on startup
nTox.c:
- correct a message who claims we're going to exit when we actually aren't
- don't treat a failed close on reading the data file as failure of the reading
Merge remote-tracking branch 'upstream/master' into nTox
Merge remote-tracking branch 'upstream/master' into nTox
Made (load_/save_)data() functions static.
Rename load_old_key_or_save_new_one() to load_data_or_init().
State loading/saving: Instead of a blob, segment into sections marked with tags.

Primary rationale: The part that DHT saves changes if IP is expanded to IPv6. To let people keep their friends/name, change the datafile format now, while everybody is still on the same page.

Loading/Saving rewritten to allow a part of the file to be incomprehensible to the loading routine.
Added a magic cookie at the beginning to mark the file as tox's.
Changes in some part of the datafile can be skipped and the remaining parts still be consumed.
Allows a wide margin of forward compatibility (like the IP to IPv6 transition, but also e.g. a change in the key format).
As long as the file is not completely garbled, the routine will read as much as possible. Only the KEY section is considered mandatory: a malformed key section leads to a negative result.

util.*:
- holds the driving function which jumps from section to section and calls back with section length and tag (type)

Messenger.c,DHT.*:
- new loading functions call the util-function with a callback, which subsequently consumes the sections
- old routines are kept to fall back onto if the magic cookie at the beginning isn't present
- saving is still done in one local routine
Merge remote-tracking branch 'upstream/master' into MessengerLoadSave
Change sublength to 32 bits. Someone might have more than (sizeof(Friends) / 65536) friends...
Merge remote-tracking branch 'upstream/master' into nTox
Save datafile when adding a friend/accepting a friend request.
(Note to self: make clean is your friend. Those extra seconds are well spent.)
Fixed portablity problems.

struct in6_addr member names can differ per platform.
Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core
Fixed merge problems.
Fixed portability problems.
more portability fixes.
Merge remote-tracking branch 'upstream/master' into nTox
Fix leaks and null dereferences in net_crypto
Merge pull request #581 from stal888/csafixes

Fix leaks and null dereferences in net_crypto
Fix in ip_equal, plus testing code which led to that fix...

network.c:
- use the correct macro for IPv4-in-IPv6 test

network_test.c:
- bunch of tests for addr_resolve() and ip_equal()