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().
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.
An absolute wake time is now calculated and updated by set_server_bits(),
TimerTimeout() and tclTimerTimeout(). This is then used to calculate the actual
select() timeout, instead of having those functions calculate a relative timeout
value themselves. This significantly simplifies those functions, since the
underlying values tend to be recorded as absolute times.
It also allows us to disentangle tclTimeTimeout from TimerTimeout(), and move the
responsibility for calculating the QUEUE_SENDS wake time from TimerTimeout() to
set_server_bits() where it belongs.
The QUEUE_SENDS and CONNECT_DELAY wake up times will also now be correctly
calculated, based on the last sent time and connect time respectively.
The DOUBLE_STATUS_LINES /SET has existed for a long while, but setting it has
never actually had an effect. This change causes it to affect the
/window double setting of new windows: 0 means new windows are created without
double status lines, 1 means only the first window is created with double
status lines and subsequent windows aren't (this is the default) and 2 means
that all windows are created with double status lines.
Note that setting this variable in your .ircrc can't actually affect the first
window, because that's created before the .ircrc is loaded. The compiled-in
default value (DEFAULT_DOUBLE_STATUS_LINES in config.h) is the only thing that
can affect the first window.
Reported by presi.
This is preferable to using time_diff() to compare two timevals, because
time_diff() gives its result as a 'double' which only has 53 bits of
precision.
Also switch a couple of places from using time_diff() to using
this function.
Define USE_NON_CONST so that the newer TCL headers define functions in the
same way as pre-8.4 TCL headers. It will be a good idea to change to
USE_COMPAT_CONST instead at some point.
Also use ckfree() instead of free() to free an allocation returned by TCL.
If we immediately handle timers that have already expired, there doesn't
seem to be a compelling reason to add 100ms to the expiry of unexpired timers.
This means that settings like CONNECT_DELAY and CONNECT_TIMEOUT are compared
against the current time with sub-second resolution. With the old way, the
delays could be up to a second longer than asked for, which had the effect of
almost doubling the default CONNECT_DELAY value of 1.
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.
set_server_bits() now returns -1 for "no timeout", so 0 is a legitimate
return value.
io() should only update real_timeout from server_timeout if server_timeout
is not -1 (real_timeout == -1 ends up meaning "wait indefinitely").
Note that if you set CONNECT_DELAY to zero you get a lag check ping sent off
first thing in the server connection, this should be fixed.
Replace open-coded loop with strpbrk(), make the constant lame_chars string
static const and remove the unused variable 'user'.
I think LAMEIDENT might be obsolete now anyway - I can't find a server that
allows control chars in usernames these days.
The annoy kick code looks for messages that are longer than 12 characters
and more than 75% of them are highlighted (eg. bold). The old code counted
the whoel message length, so it could be fooled by padding the message with
lots of nonprinting control characters. This change makes it count only
displaying characters.
Also fix the check for beep (it's a single character, not a highlighting
toggle, so we just check for one of them), and add a check for the blinking
highlight.
These functions are only used by parse.c:annoy_kicks(), so move them next
to that function and make them static.
This also changes their arguments from unsigned char * to char *, getting rid
of some signed/unsigned mismatch warnings.
We now send PING <server> :<server> for /spings, and
PING LAG!<cookie>.<tv_sec>.<tv_usec> :<server> for lag checks. The cookie is
set randomly at server connect time, and means that clients connected to the
same bouncer shouldn't act on each other's lag checks.
We can now remove in_sping entirely - previously it would get out of synch if
you disconnected with a sping in progress.
This changes the code to use struct timeval and get_time() on all systems,
which simplifies the code by removing most of the checks for HAVE_GETTIMEOFDAY.
The only user-visible change is that ancient systems without gettimeofday()
will see message like "Server pong from irc.choopa.net 1.0000 seconds" instead
of "Server pong from irc.choopa.net 1.x seconds". And really, I seriously
doubt that there's any systems like that left out there anyway.
Four instances where 'default:' is at the end of a block replaced with
'default: break;' (reported by mscherer).
One typo where [j] should have been [1] (array out of bounds error).
Missing <unistd.h> includes for _exit(), and <string.h> for memcpy().
There's no need for a top-level dummy Makefile - the real Makefile is generated
by configure, and the dummy file only worked on systems that had bash installed
into /usr/local/bin anwyay.
The client release version is now defined in configure.in rather than
source/irc.c. The gitversion.sh script is used to automatically add a
suffix to the version number for versions of the client built from git.
Also removed AC_REVISION() from configure.in, because $Revision$ doesn't
make sense with git.