Use (void *userdata) in callbacks and drop ringing-callback

This saves a lot of LOC and is definitely easier to maintain.
Further simplify call-start-callbacks

using the udata-void pointers to pass data as a source of information.
Finish cleaning up av-callbacks

Now it's fun again to work with the code.
Merge branch 'master' into debian/unstable
prepare for release

Signed-off-by: Kill Your TV <killyourtv@i2pmail.org>
Fortify error-checks and FSM

Basically the direct calls to cancelcall() should be minimized
and only set off in a callback.
Additionally, tweak other error-cases and don't always quit fatally
but instead provide ways to get out of an error-condition.
Only send call-data when Tx transmission is ready

Due to a bug in toxcore the call is set to active too early,
leaving room for invocations of sendfriendcalldata() even though
the transmission has not yet been set up in cbcallstart.
Fix this with a small workaround keeping the transmission-state
in the client.
In the long run, this definitely needs to be fixed in toxcore
for consistency.
Merge branch 'master' into debian/unstable
prepare for release

Signed-off-by: Kill Your TV <killyourtv@i2pmail.org>
Merge branch 'debian/unstable' into ubuntu/precise
prepare for release

Signed-off-by: Kill Your TV <killyourtv@i2pmail.org>
Change the state-files

rename file_pending to file_state
rename call_pending to call_state
	0 = no call
	1 = call pending
	2 = call active
Merge branch 'master' into debian/unstable
prepare for release

Signed-off-by: Kill Your TV <killyourtv@i2pmail.org>
Fortify and optimize file-sending

Do this in two ways:

1) only allow ratox to stay in the file-sender for a certain amount
of time
2) Stop hammering tox_file_send_data(). When it returns -1, we put
the given friend into a cooldown-state, because all internal transmission
slots are full.

File sending thus now works in bursts, reading from file_in as long
as tox_do() allows or until tox_file_send_data() fails.

An easy way to see why we need to do the former is piping /dev/urandom
to file_in, which never blocks. Effectively, the user goes "offline"
after a while given he is trapped inside the loop.

Piping to /dev/urandom is not an unrealistic testcase. Imagine a
researcher who desperately needs true random data from his special
RNG in his lab using ratox and piping it through /dev/urandom.
Build with -g so users can provide meaningful backtraces
Update README
Only call toxav_kill_transmission() after toxav_prepare_transmission()

toxav_prepare_transmission() sets the internal toxav `call_active'
state variable.  This is checked in toxav_kill_transmission() and
only if set, proceeds to release the resources.
Only complain if errno is not EWOULDBLOCK
Remember to cool down the transfer for pending buffers as well

This change halves CPU usage on my system.