server.ctx is now allocated once for each server on first connection, then reused for subsequent connections.
server.ctx wasn't being cleared when the server was closed (as server.ssl_fd is), so this was causing
reconnection to fail until try_connect() got called.
This also removes the last uses of the CHK_* macros in ssl.h, so remove them.
This avoids leaking memory.
Also change to always call SSL_shutdown() regardless of whether a QUIT message was sent. No
need to call SSL_shutdown() from write_to_server(), close_server() will do it for us.
Remove "Closing SSL connection" message.
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.
It is only called in one place, where from_server is already set to the same as the argument.
Rename rebuild_all_ison() to rebuild_notify_ison_all().
Make rebuild_notify_ison() and rebuild_notify_ison_all() static, they are only called from
this file.
There's no need for the conditional compilation - tcl_bx.h itself has the WANT_TCL guards
necessary.
This makes generating the Makefile target dependencies easier.
The only external change here is that it now always sets *cnt to 0 when it returns NULL
Previously, it could set it to -1 in some cases, in particular when dll_commands is NULL.
This led to a bug where /HELP would show the wrong number of matching commands, because it
added the return value of find_dll_command() to the number of matching internal commands.
Also fixes a set-but-unused-variable warning.
There's no need to dynamically allocate encode_string, so just make it static.
It does need to be unsigned char though, for the loop that intialises it. So cast it
when calling my_encrypt() / my_decrypt().
This fixes 'const char **' vs 'char **' compiler warnings.
Additionally, tcl_bx.h always defines STDVAR and can be included without checking for WANT_TCL.
Rename global variable 's' to a longer name. Rename function 'ignore' to a name that reflects what
it actually does.
Make sigint_handler() and my_exit() static, because they're only used in this file.
Remove the 'how' parameter to rsindex(), making it reverse-search for only the first matching character,
as sindex() already does. There are only two callers, and one already passed a hardcoded value of 1.
Also change rsindex() so that it starts searching at the character BEFORE the passed in position. This
makes it easier to repeatedly call rsindex() in a loop to search for the Nth matching character, and
also fixes a technical instance of undefined behaviour where a pointer is decremented to point before
the start of the string.
Remove the 'mark' parameter to strsearch(). Instead, always forward-search from the beginning of the
string and reverse-search from the end of the string, as this is what the two callers want anyway.
Bump the module ABI version because these functions are exported to modules.
inv_strpbrk() is the inverse of the standard function strpbrk().
Calls to sindex() where both strings are not NULL and the second string begins with ^ are equivalent
to calls to inv_strpbrk() (but without the ^). Convert those calls.
sindex(), where neither argument is NULL and the accept string does not start with ^, is exactly equivalent
to the standard function strpbrk().
Further, strpbrk() where the accept string is only one character long, is exactly equivalent to strchr().
The old code could move the variable 'pointer' backwards one character before the start
of the string (then incremented it again before returning). Formally this is undefined
behaviour, so fix it.
The removed variables are:
dll_functions
dll_numeric
dll_commands
dll_variable
dll_ctcp
dll_window
These are not actually directly used by any modules, and hiding them allows us to more easily
change their implementation later.