The -s flag resets after the next server on the command line, but it was also incorrectly resetting
if a nickname was seen as well. This meant that a command line like this failed to use SSL:
BitchX -s -p 9999 gauze irc.choopa.net
Also update the help text to correctly reflect the operation of the -s flag.
Reported by gauze.
With this change, the signal handler signature is defined in only one place.
Also make most signal handler functions static (those that are only referred to in irc.c).
init_socketpath() was building a sprintf() format string intended to be used by /DETACH to create the socket
file name. This included the actual socket path, plus a %d for the port, plus the sanitised tty name and
hostname.
Only one caller needed all this though - the /DETACH command - and the other callers (in scr-bx.c) just
wanted to truncate it to the actual socket path. The format string also wasn't safe - if the home directory
path, hostname or ttyname contained % characters these werent being escaped.
It simplifies things to have init_socketpath() just return the actual socket path, after creating the 'screens'
directory if necessary. This lets the code in scr-bx.c use it as-is, and removes the need for the global
socket_path variable. The code to include the sanitised tty name and hostname in the socket file name can
be moved to the create_ipc_socket() function.
There's no need to check access() for the socket path before trying to create it - just call mkdir() regardless,
since it will fail if the path already exists, which is fine.
This commit also adds error handling to the create_ipc_socket() function for the case where creation of the
socket file fails, and switches the chmod() and chown() for the opened file to the more appropriate fchmod()
and fchown().
pid_t is defined by POSIX to be a signed integer type, so the %u format is wrong.
Cast to long and print with %ld - it is unlikely that any real-world system has pid_t bigger than long.
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.
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.
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.
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.
of an array was tested (always not-NULL) and one unused variable (first_time
in io()).
The user-visible change here is that the emergency exit QUIT messages
(eg "User abort with 5 Ctrl-C's") will be correctly relayed to the local
terminal now.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@321 13b04d17-f746-0410-82c6-800466cd88b0