The last two arguments are port, then offset (as per the DCC ACCEPT CTCP
command). We don't really use these anyway - port is passed to dcc_create()
but for pre-existing DCC entries all that did was add it to the socketinfo,
which doesn't seem to have any real effect.
Also fix dcc_create() so it passes the actual remote port to add_socketread()
(as above, this doesn't seem to have any real effect but is consistent with
the other code).
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.
This also fixes a few others - eg /KBI now kicks-then-bans, and
/BKI bans-then-kicks (previously these were the wrong way around).
Reported by profiler.
The old code created a new stack frame in parse_line_alias_special(), then
another one in parse_line(). This prevented $functioncall() from working,
and made the output of CALL look odd.
|Rain| mentioned this years ago in starman.irc.
close_server() should call clear_server_queues() on the server that's being
closed, not from_server. This also lets us remove a few other calls to
clear_server_queues() that are right next to calls to close_server().
Channel WALL notices now have to match "[%Wall%/%] *", and have to be for
a channel that the client is actually on. Otherwise, they just appear as
ordinary NOTICEs.
We pass through ANSI just fine in PRIVMSGs, so we might as well treat
NOTICEs the same way too. The old code wasn't just stripping them out,
either - it was turning them into printable garbage.
stripansi() actually just munged control-characters, so it just turned ANSI
codes into visible junk.
stripansicodes() instead leaves control characters alone but removes complete
ANSI sequences from the string. I'm not sure if even that is necessary,
really - after all, we always allowed ^B, ^C etc style formatting in CTCP
replies.
get_reason() is then used only for the implementation of get_kick_reason()
and for the $getreason() scripting function. Add current nick as an
explicit argument for get_reason(), which pushes all use of from_server
out of the ransom reason functions.
Also switch a few instances of send_to_server() to my_send_to_server() where
the current server has been returned by prepare_command().
Previously only send_kill() used BitchX.kill - the other KILL commands (eg.
/WHOKILL) were using the random kick reasons. Standardise them all on
BitchX.kill, and add this file to the source so it can be installed along
with the other random reason files.
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.
Re-checking the command name to see if it's a timed ban means that the
compiler can't see that it's the same check.
This also makes sure you can't specify a negative timeout.
Initialise ip_str so that it isn't used uninitialised.
Don't strip server flags from user@ portion of the hostmask, so that it will
not miss matching bans.
Switch ip_str from alloca() to malloc_sprintf() / new_free() - there's no
particular need for alloca() here.
This silences a few compiler warnings.
This also cleans the function up by removing some always-true checks.
I'm not convinced that this function makes a whole lot of sense, though.
Will look into it further...
This function is only used by the GUI menu code, so we don't need to
build it for normal builds.
Also clean up some unsigned char / char mismatches that the compiler warned
about.
A few places created strings based on the terminal width, using fixed-sized
buffers and without checking for overflowing them. Fix those, and also
replace all other sprintf() calls with snprintf().
Reported by cpet.
Chatnet doesn't use the odd 310 numeric support anymore, it now uses 310 for
the same WHOIS_HELPFUL as Dalnet. They apparently use a pretty bog-standard
Unreal ircd now.
This code appears to be some kind of backstop so that the client will notice
a server connection that's died because of a network interruption. Checking
errno that was last set christ-knows-where is not the right way to do this,
though.
The normal write to the server for the lag check should eventually see the
host/net unreachable error if this happens.
Previously /STACK would not accept just the initial part of a /SET name
even if it wasn't ambiguous. Now it uses the same matching behaviour
as /SET.
This also removes an unused variable in do_stack_set().