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.
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.
This helper function is for modules to save the contents of their module variables to a file
as SET commands.
It will remove the need to export the raw dll_variable list to modules.
A fractional-second timeout was already supported for the initial timeout of a /TIMER, but
if the timer was recurring then the interval was rounded to a whole number of seconds for
the subsequent timeouts.
Change the type of interval from long to double to fix this.
These globals were used to store the original terminal dimesions from the terminal database (or
in the case of reattaching, supplied by scr-bx) to be applied if the current terminal dimensions
could not be determined.
Instead, we leave the original terminal dimensions in current_term->TI_lines and current_term->TI_cols,
and create current_term->li and current_term->co to store the current terminal dimensions (as eg.
supplied by scr-bx).
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).
CLOSING_SERVER was never referenced outside of server.h where it's defined, and CLOSE_PENDING was cleared
but never set by any code.
Rename LOGGED_IN to namespace it (in anticipation of other flag variables in the server struct being
consolidated into a set of server flags).
Also put correct parantheses around the definition of SF_LOGGED_IN.
The guts of this function doesn't need to be in server.c - it only uses extern server functions so it
makes sense just to move it into the body of function_servers(), the only caller.
That means it's no longer accessible for loadable modules, but it isn't much use for them anyway. They
can always directly access the server list if they need that info.
(Requires rolling the module table version).
Remove the 'resend_only' flag option to fudge_nickname(). The only caller passing it was the CHANGE_NICK_ON_KILL
feature, and in that case it was the wrong thing too (and stopped that function from working at all).
Some other minor cleanups in fudge_nickname() while we're there.
This uses another bit in the existing flags argument in place of the command argument, and avoids
having to re-compare against fixed strings ("PRIVMSG", "NOTICE").
This allows building against recent libtcl versions.
A fallback definition of Tcl_GetStringResult() is included so that building against libtcl 7 still works.
This means the calling code in commands.c no longer needs to take a copy before calling the function.
Also remove code testing result of of ctcp_quote_it() and ctcp_unquote_it() - these functions never fail.
These functions are really specific to parsing and creating CTCP SED messages, which means they belong
in ctcp.c with the other CTCP code.
Also remove unnecessary inclusions of encrypt.h and ctcp.h.
Use size_t for passing buffer lengths, and const char * for encryption keys and other non-modified buffer
arguments.
Remove pointless helper function do_crypt().
Remove the inclusion of color.h from config.h, which is included by every file via irc.h, and instead
include it only in debug.c, fset.c and vars.c which are the only files that use it.
This minimises the number of files that need to be rebuilt when changing default format strings.
Encrypted messages to a channel need to use their own format. This also fixes the use of ENCRYPTED_PRIVMSG
and ENCRYPTED_NOTICE - they were being called with too many arguments so the destination nick was being prepended
to the message text.
Actual encryped messages and notices are now printed directly from do_sed() / do_reply_sed().
Inline CTCP replacement is only done if the message cannot be decrypted (for the [ENCRYPTED MESSAGE]
placeholder).
This removes the need for the global flag 'sed' to alter the NOTICE and PRIVMSG handling.
A side-effect of this is that SED PRIVMSGs now do not go through the usual PRIVMSG ignore
and flood handling. This is acceptable because messages can only go through this path if
the sender has actually been added as a SED peer with /ENCRYPT, and it still goes through
the CTCP ignore and flood handling.
This flag is for tracking if we've sent a KICK for a nick. It means we can avoid
sending duplicate KICKs (eg for floods, channel protection etc).
MODULE_VERSION is bumped because NickList is a struct exported to modules.
This test is done quite a bit across the tree, and the open-coded variants make it easy to have an
accidental mismatch between the length of the prefix being tested and the length actually passed to
strncmp().
This fixes an issue of that type comparing the server version against the prefix "u2.10", where the old
code used an incorrect length of 4.
Tokens that begin with two underscores __* or an underscore and an uppercase letter _X* are reserved,
so we should avoid those for our own include guards. The standard I'm settling on for foo.h is FOO_H_.
Also define STERM_C and include modval.h in scr-bx.c.
This allows us to remove the slightly bogus dummy definition of enum VAR_TYPES from modval.h, and use a simple
macro to redirect the declaration and use of get_int_var() to BX_get_int_var().
irc_std.h is where these belong - it's where the normal declarations (via the system headers) come from on
systems which don't need the compat functions.
This change means that struct.h no longer needs to include alist.h, so it will be indirectly included in a lot
fewer other files.
As a consequence, server.h needs to include notify.h to get the definitions of those data types.