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.
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.
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.
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.
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.
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.
Previously the server lag check was run by update_clock() if the number of
seconds since client startup was a multiple of 20 (unless it had already been
done this second). This meant that if update_clock() was not being called
frequently (eg. if your IRC connection was very quiet), it might go a long
time between lag checks.
This commit adds a /set LAG_CHECK_INTERVAL (defaulting to 30). For each
server, a lag check ping is scheduled for every LAG_CHECK_INTERVAL seconds
after the connection is finalised/registered. Setting this value to 0
disables the lag check pings entirely.
The old code set the lag to 'unknown' immediately after sending out a ping,
which meant that it was quite unpredictable how long the lag value would
stay around for. The new code only sets this once the current lag value
has become stale (ie. a ping reply is overdue based on the current lag
value). If your lag is staying the same or reducing, you shouldn't see
the [Lag ??] at all.
<fcntl.h> is the name used by POSIX, so we prefer this and only fall back to
<sys/fcntl.h> on non-POSIX systems. Fixes warnings compiling against musl
libc.
Reported by ncopa.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@531 13b04d17-f746-0410-82c6-800466cd88b0
This was noticed when /channel on a very large channel segfaulted.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@528 13b04d17-f746-0410-82c6-800466cd88b0
They're pretty widely used these days, and the cost is trivial. And quite frankly,
the less #ifdefs I have to see, the better.
This covers /NICKSERV, /CHANSERV, /OPERSERV and /MEMOSERV. It also brings
in the bahamut / unreal /SILENCE server-side-ignore command, and unreal's /HELPOP.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@524 13b04d17-f746-0410-82c6-800466cd88b0
The DEFS Makefile variable has been renamed to CPPFLAGS, and is now set based on the CPPFLAGS,
INCLUDES and DEFS values provided by configure.
Reported by cpet, this allows the FreeBSD port to drop a patch.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@519 13b04d17-f746-0410-82c6-800466cd88b0
Instead of setting the mode at NAMES time (when we know that the channel is new),
remember this for later by setting the GOTNEW flag in the joinlist entry. Then
check this flag when the channel is synched.
Setting the channel mode takes us out of server "grace mode", which slows down the
processing of subsequent commands and drastically reduces the number of commands we
can have outstanding before we get kicked off for flooding. This change allows us
to stay in grace mode while we're synching every channel that we joined at connect.
In turn, this makes joining lots of channels on connect faster, and much less likely
to cause us to be booted with "Excess Flood".
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@515 13b04d17-f746-0410-82c6-800466cd88b0
prepare_command() does nothing useful here, and it sets the current server to an incorrect value
if the channel sync happens while the current window is set to a window from a different server.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@514 13b04d17-f746-0410-82c6-800466cd88b0
This fixes a bug where the cached channel log level bitmask was not correctly set unless you did a
/cset CHANNEL_LOG_LEVEL after the channel had been joined, which resulted in most things not being
logged.
It makes most sense to cache the bitmask within the cset structure, and there was even an (ununsed)
field already there for it.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@512 13b04d17-f746-0410-82c6-800466cd88b0
These were already being logged at the correct level, this just fixes the
interaction with window level and window notify_level.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@510 13b04d17-f746-0410-82c6-800466cd88b0
This affects the maximum length of the topic that can be displayed by the %-
status format. No topic can be longer than IRCD_BUFFER_SIZE, so use that.
Reported by oxy.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@508 13b04d17-f746-0410-82c6-800466cd88b0
Check that at least the first character of an incoming nickname is valid (we
actually go a bit beyond the RFC by also allowing any char with bit 8 set - at
least Russian servers use nicknames like this).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@501 13b04d17-f746-0410-82c6-800466cd88b0
The logic in the massop function to exclude already-voiced users from
massvoice was faulty - it was equivalent to just !nick_isop().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@500 13b04d17-f746-0410-82c6-800466cd88b0
Recent OpenBSD and NetBSD have changed time_t to be a 64 bit type on all
platforms. This means that on 32 bit systems, time_t is now longer than
long, and %lu can't be used to format it.
The lag check doesn't actually care what is in the first field of the PING
command, so change it to be our nick (which is arguably what it should be).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@498 13b04d17-f746-0410-82c6-800466cd88b0
This also fixes the ability to bind to key sequences ending in ^.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@476 13b04d17-f746-0410-82c6-800466cd88b0
This function never worked - function_timer() was creating a string but then
never throwing it away and returning a part of the argument instead, which
then caused a crash because it couldn't be freed later in the expression
parsing.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@472 13b04d17-f746-0410-82c6-800466cd88b0
An incorrect pointer was being passed to malloc_sprintf(), causing a
crash. Use m_sprintf() instead.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@471 13b04d17-f746-0410-82c6-800466cd88b0
The new logic is considerably shorter and simpler, and should mean that
terminfo is properly used in preference to termcap on NetBSD. This also
allows us to include term.h in term.c, where the system definition of
tparm() lives on some systems (NetBSD is one such).
The new logic also means we link against libtinfo in preference to
libncurses, which should mean a little less memory used at runtime and a
fraction faster startup time.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@434 13b04d17-f746-0410-82c6-800466cd88b0
The pointer passed to tgetstr() must not be reset each time around the loop.
Also some other minor cleanups in term_init().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@428 13b04d17-f746-0410-82c6-800466cd88b0
Replace unused .format_var member of status_expandos list with .args. For
expandos which have a subformat, this stores how many arguments are passed to
sprintf() when the subformat is expanded in the callback function. The
convert_sub_format() function then uses this to limit the number of %s
conversion specifiers it creates in the converted subformat.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@426 13b04d17-f746-0410-82c6-800466cd88b0
The old code was reusing the 'window' variable, which means that it
could pick up the STATUS_NOTIFY format from the wrong window. You
would only have noticed this if you have windows with different settings
for STATUS_NOTIFY.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@425 13b04d17-f746-0410-82c6-800466cd88b0
Status formats support a %<PAD>c syntax for specifying padding. This change
ensures that we only use padding consisting of the characters "0123456789.",
which ensures it won't confuse sprintf.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@424 13b04d17-f746-0410-82c6-800466cd88b0
that don't provide the POSIX setenv().
This fixes building plugins that link to compat.c on OS X (shared libraries on
OS X don't have direct access to environ). It also reduces the binary size on
platforms which provide setenv(), which these days is most of them.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@382 13b04d17-f746-0410-82c6-800466cd88b0
scripting function - this allows alternate hashing methods to be selected
if supported by the C library.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@361 13b04d17-f746-0410-82c6-800466cd88b0
This is a backwards-compatible change, no update to the scr-bx binary
is necessary.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@358 13b04d17-f746-0410-82c6-800466cd88b0
client purposes. The RANDOM_SOURCE setting now only affects the $rand()
scripting function.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@357 13b04d17-f746-0410-82c6-800466cd88b0
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