This improves the client messages - eg previously the message to tell you that
you could use /DCC RESUME never got shown due to a logic error.
It also won't try to auto-resume if the local file is already the same size or
bigger than the incoming file.
Mark DCC connections that we have requested RESUME on, so that we know
whether or not to act on a DCC ACCEPT that is received.
Also fixes up a slightly wrong message in /DCC RESUME.
DCC_CNCT_PEND was only ever set, not tested, so it was pointless.
There's no point only defining DCC_SSL when HAVE_SSL is defined: we can't
re-use that flag bit anyway, so might as well just define it always.
Also fixes a "flags && DCC_WAIT" that should have been "flags & DCC_WAIT".
This has no practical effect though I believe, since as far as I can tell
DCC_WAIT would always be set at that point anyway.
Rename randreason() to fread_random() to better reflect its function,
and change it to a one-pass algorithm. Have it write into a caller-provided
buffer instead of a static buffer. Fixes a file leak when an empty
file is given to this function.
Change freadln() so that it never returns an empty line - it only returns
0 at end-of-file now. This simplifies its callers.
Factor out some common code from the several get_reason()-type functions,
which greatly simplifies them.
Adding these in preparation for converting server->connect_time from time_t
to struct timeval. Also converts three existing open-coded versions over to
the new functions.
The code was calling random_number(65535 - 1024), but a non-zero argument
to random_number() is actually a seed to reseed the generator, and causes
random_number() to return zero.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@331 13b04d17-f746-0410-82c6-800466cd88b0
sprintf() as a format string, because there could (and usually are!) '%'
characters that will be interpreted by sprintf.
This also allows clean compilation under -Werror=format-security.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@246 13b04d17-f746-0410-82c6-800466cd88b0
on a socket.
I also added a wrapper function around strerror() for dgets_errno, since
we did the same thing in a few places. This all needs to be cleaned up
a little - the -1 value we use could in theory clash with an actual
errno error number.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@104 13b04d17-f746-0410-82c6-800466cd88b0
like x86-64, where sizeof(int) != sizeof (void *). This involves correctly
casting every function pointer from the global table to the correct
function type, which has the added benefit of allowing type-checking of
function arguments and return values.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@26 13b04d17-f746-0410-82c6-800466cd88b0