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.
Integer division has potential edge-case overflow problems that are best avoided.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@536 13b04d17-f746-0410-82c6-800466cd88b0
<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
ncurses can optionally declare tigetstr(), tigetnum() and tigetflags() with a
const char * argument, indicated by the NCURSES_CONST macro. So we use this
macro, if available, to optionally declare cap2str.iname as const char *.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@530 13b04d17-f746-0410-82c6-800466cd88b0
Bandwidth and memory have both increased a lot since these values were last looked at.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@529 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
send_2comm() always sends the command on to the server, so it always requires a server connection.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@526 13b04d17-f746-0410-82c6-800466cd88b0
send_comm() just passes the command directly to the connected server, so it obviously
requires a server connection.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@525 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
Remove unused function declaration, add SERVERREQ flag to CHANSERV command and remove IRCIIHELP
command that no server has provided in a long time, as far as I can tell.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@523 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
Bump copyright date, add TCL information to README-1.2, replace old COMPILE-PROBLEMS with more relevant
information and remove old 'bugs' file.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@517 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
Old behaviour was that /if (0) { echo y } would execute an empty command for the missing else
case, which winds up doing send_text("").
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@513 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
IRCNet uses message sources like *.se (ie masked server names) after a
netsplit.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@509 13b04d17-f746-0410-82c6-800466cd88b0