This was broken in commit [07cdd587], where 'sizeof' was used on a pointer
instead of the buffer pointed-to.
Fix this by having the caller of ircop_flags_to_str() supply a buffer and
length, since there's only two callers and both can use happily use stack
objects.
Remove the extra space in the default /fset SERVER_NOTICE, and similarly
the extra space in the HUMBLE /set SERVER_PROMPT.
The code in the client always _intended_ to add a space between SERVER_PROMPT
and SERVER_NOTICE_FSET but a bug in 75p3 and below meant it that it didn't.
This bug was fixed in 1.0b but the formats were never updated.
Also remove replace the embedded ANSI in the default SERVER_PROMPT with
% color code.
We don't know the server's proper name until registration, so the test against
that isn't reliable. We shouldn't be able to receive messages from anyone else
until we're registered, so this should be safe.
This requires changing serversay() to accept the from name instead of the
from_server. While we're there, replace the use of alloca() with simpler
logic based on m_sprintf().
The old code would return "omain" rather than "domain" in this case.
Also remove unneccesary checks on the return value of get_server_itsname() -
this function already falls back to 'name' if 'itsname' isn't set yet.
This hook and format are used for NOTICEs where the destination isn't
a channel and isn't yourself - eg. global targets like $$*.org. This was
already the case for PRIVMSGs (using the MSG_GROUP hook and format).
Previously these were being routed like a normal NOTICE, and those don't
display the target, so it looked exactly like a private NOTICE to you.
This will also catch server notices sent before you're registered.
Functions display_msg() and check_sync() are only used in numbers.c, so they
can be static.
Remove inclusions of <numbers.h> from .c files that don't need it.
Some systems need <sys/sockio.h> for the SIOCGIFCONF ioctl - this switches
to using a proper configure check for that header rather than just assuming
it'll be there if we can't find SIOCGIFCONF. Should be more robust.
Only include <netinet/in.h> and <sys/socket.h> if the system supplies them.
This is necessary to try and get the mingw32 build working again.
No need to include <sys/types.h> and <netinet/in.h> from cdns.c - these are
already included by <irc.h>.
Instead of showing a meaningless pointer value for Screen:, we show the
screen number and ttyname.
Also take the CO, LI values from the window's screen.
Don't show the Prompt: unless one is set.
Someone reported being unable to connect with the error "Address family not
supported", which is probably being returned by socket(). It is likely a
system where getaddrinfo() is returning AF_INET6 addresses, but socket()
won't create AF_INET6 sockets.
To handle this case, we loop over all the addresses returned by getaddrinfo()
until we find one that socket() will accept.
This ensures that the saved-set-gid is also set, although this shouldn't
matter in practice since we always call execve() soon after, which
overwrites the saved-set-gid with the effective gid anyway.
Change the all: target in the toplevel Makefile so that it doesn't try to
resolve build dependencies at the top level - instead, it just recursively
builds the all: target in source/ and dll/.
Change the all: target in the source/Makefile so that it builds the EXTRAS
(scr-bx and wserv) as well as the main client binary.
The upshot of all this is that one "make" invocation is responsible for both
scr-bx and wserv, which is necessary for parallel make (make -j) to work
correctly as these binaries share some object files.
There's several different types of DCC offers, all of which need slightly
different handling. Previously they were all handled by the monster function
register_dcc_type() - this breaks them out into seperate functions for handling
SEND, RESEND, CHAT and BOT offers, moves common code into static helper
functions and renames the entry point from ctcp.c to handle_dcc_offer().
This will allow adding a way for modules to register DCC offer types that
they're interested in.
This also moves rename_file() from misc.c into dcc.c, where its only user is.
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.