Commit Graph

595 Commits

Author SHA1 Message Date
Kevin Easton
6dbc712046 Rework and improve the scheduling of the server lag check
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.
2015-06-12 15:54:43 +10:00
Kevin Easton
7eae2aba86 Change arguments of my_strnstr() from const unsigned char * to const char *
This kills warnings in both ircaux.c and input.c.
2015-06-07 00:30:05 +10:00
Kevin Easton
c0c7cdbdcc Rework the calculation of the select timeout in io() to be based on absolute wake time
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.
2015-06-07 00:03:09 +10:00
Kevin Easton
6f0f9dd8a8 Add missing Changelog entry for commit [8cdc62a] 2015-06-03 23:34:18 +10:00
Kevin Easton
8cdc62ae0d Wire up /SET DOUBLE_STATUS_LINES so it actually does something
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.
2015-06-03 23:16:57 +10:00
Kevin Easton
ec842a808f Update COMPILE-PROBLEMS
Remove reference to crashes with clang under FreeBSD, advised by cpet.

Add name of libncurses-devel package for Cygwin.
2015-06-03 22:43:00 +10:00
Kevin Easton
454deb943a Bring the BitchX(1) man page a little more up-to-date
Some changes from cpet to replace references to bitchx.com with bitchx.org.

Also a few minor formatting fixes and changes to the contributors.
2015-06-03 22:38:02 +10:00
Kevin Easton
5d46e9a768 Add OpenBSD to list of known-working OSes
Patch from cpet, who confirmed a BitchX port has existed in OpenBSD since 1999.
2015-06-03 22:15:56 +10:00
Kevin Easton
b14d0ddcb9 Add timer_cmp() utility function to compare two timevals.
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.
2015-05-21 01:21:02 +10:00
Kevin Easton
b944573a5e Minor fixes to enable compiling against TCL8.5
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.
2015-05-16 22:20:25 +10:00
Kevin Easton
e33393ab86 Remove 100ms fudge factor on timer expiry.
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.
2015-05-16 14:13:11 +10:00
Kevin Easton
af017816e2 Use time_since() and time_until() instead of open-coded variants
Use these helpers in the places where we're calling get_time() and
comparing it against a single struct timeval.
2015-05-14 00:02:51 +10:00
Kevin Easton
f1c27a4f64 Switch server->connect_time from time_t to struct timeval
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.
2015-05-13 23:17:18 +10:00
Kevin Easton
4ee6c6295b Add time_until() and time_since() utility functions
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.
2015-05-13 21:50:30 +10:00
Kevin Easton
0f8280ed51 Prevent indefinite wait if CONNECT_DELAY is set to zero
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.
2015-05-12 22:39:30 +10:00
Kevin Easton
72f5536121 Fix bug that prevents ignoring of NICK messages.
check_ignore() returns IGNORED for that case, not zero.
2015-05-10 14:22:12 +10:00
Kevin Easton
dea26d0c1c Remove unused variables in check_bitch_mode() and parse_server() 2015-05-09 00:01:07 +10:00
Kevin Easton
32659b9998 Simplify LAMEIDENT code and remove unused variable.
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.
2015-05-08 23:25:41 +10:00
Kevin Easton
a497d3ab09 Remove unused variables in whoreply() and add_user_who()
The result of add_to_channel() isn't used in these functions, so we don't
need to store it.
2015-05-08 22:24:36 +10:00
Kevin Easton
941a3c6c63 Removed unused variables in p_privmsg()
com_do_log and com_lines are static variables that are set, but never
checked by any code.
2015-05-08 21:50:14 +10:00
Kevin Easton
5e9263f325 Simplify and improve ANNOY_KICK checks.
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.
2015-05-07 22:30:59 +10:00
Kevin Easton
e646ab42d2 Move char_fucknut() and caps_fucknut() from misc.c to parse.c.
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.
2015-05-05 20:30:07 +10:00
Kevin Easton
9f7cf6b6c2 Alter the way PINGs for /sping and lag check are used.
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.
2015-05-04 00:13:08 +10:00
Kevin Easton
443b87a8aa Remove alternate /sping implementation for systems without gettimeofday()
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.
2015-03-29 20:35:57 +11:00
Kevin Easton
1c6ff3088a Fix compilation problems in 'amp' plugin.
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().
2015-03-17 00:06:34 +11:00
Kevin Easton
6898260809 Add configure.lineno to files removed by distclean target. 2015-03-16 23:45:49 +11:00
Kevin Easton
5b89193679 Remove doc/Makefile (template for dummy toplevel Makefile). 2015-03-16 23:23:14 +11:00
Kevin Easton
ca093feaf9 Remove top-level dummy Makefile.
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.
2015-03-16 23:18:00 +11:00
Kevin Easton
3b80790a31 Define VERSION in configure, and add git describe output if available.
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.
2015-03-16 23:04:43 +11:00
Kevin Easton
aab85f807a Update version number to 1.2.1 in preparation for release.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@537 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-14 10:42:09 +00:00
Kevin Easton
a06fe2a883 Revert back to using floating point for stats calculations, but correctly rounded.
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
2014-11-14 10:34:50 +00:00
Kevin Easton
62b483f811 Rename README-1.2 to README.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@535 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-13 12:25:24 +00:00
Kevin Easton
77d5c9e0aa Remove old 1.1-final README, to be replaced with 1.2 README.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@534 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-13 12:24:57 +00:00
Kevin Easton
42c366ab20 Add an introduction to the release notes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@533 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-13 12:22:35 +00:00
Kevin Easton
85ec7d8859 Reword warning about FreeBSD / clang compile issue.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@532 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-13 10:12:24 +00:00
Kevin Easton
137fbd9b85 Prefer <fcntl.h> over <sys/fcntl.h>.
<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
2014-11-06 10:44:07 +00:00
Kevin Easton
bb5e9920d2 Squash a warning when compiling with a some curses library configurations.
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
2014-11-06 10:25:37 +00:00
Kevin Easton
835453ae40 Bump up defaults for FLOOD_AFTER, SCROLLBACK_LINES and LASTLOG.
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
2014-11-05 11:01:40 +00:00
Kevin Easton
93d06b03c9 Fix overflow in say() when handling a client message over the maximum.
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
2014-11-05 09:32:46 +00:00
Kevin Easton
ca55063443 Apply patch from cpet mentioning problems with FreeBSD/clang.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@527 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-04 12:59:35 +00:00
Kevin Easton
07c2291966 Add SERVERREQ flag to all send_2comm commands.
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
2014-11-04 10:54:23 +00:00
Kevin Easton
867f7f8327 Add SERVERREQ flag to all send_comm commands which were missing it.
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
2014-11-04 10:36:54 +00:00
Kevin Easton
0b6725dbe2 Remove WANT_CHAN_NICK_SERV define and include services commands by default.
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
2014-11-04 10:27:19 +00:00
Kevin Easton
78aeaeb1cb Cleanups around WANT_CHAN_NICK.
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
2014-11-04 10:05:58 +00:00
Kevin Easton
eb5f767d53 Update default /FSET LINKS so it shows more than the first word of the server description.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@522 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-03 10:32:21 +00:00
Kevin Easton
f6d42f35d4 Fix spelling mistake in client message.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@521 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-03 10:26:13 +00:00
Kevin Easton
685fc8b25a bxconf has its own set of required libraries, different to the client itself.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@520 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-01 14:52:43 +00:00
Kevin Easton
a05b1160c3 Change build to pass through CPPFLAGS if provided, and to use the DEFS value set by configure.
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
2014-11-01 14:37:41 +00:00
Kevin Easton
4ce8dc88de Update default server list.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@518 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-01 11:13:47 +00:00
Kevin Easton
4f181b5977 Cleanup and update some ancilliary infomation files.
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
2014-11-01 03:40:30 +00:00