Commit Graph

912 Commits

Author SHA1 Message Date
Kevin Easton
0703126773 Factor out common dll variable list lookup into lookup_dllvar() 2017-11-03 16:22:57 +11:00
Kevin Easton
3b2793877d Change set_var_value() argument from int to enum VAR_TYPES 2017-11-03 14:48:26 +11:00
Kevin Easton
59d237d819 Remove unused code branch in setcmd()
If cnt == 0, that implies that dll == NULL (if the list search returned an entry, it at least must match
the prefix we're looking for).
2017-11-03 01:18:04 +11:00
Kevin Easton
574053da52 Split out set_var_value_dll() from set_var_value()
Also remove external declaration of set_var_value() from vars.h, since it is only used in
vars.c.
2017-11-03 01:14:30 +11:00
Kevin Easton
1797858d0b Extract common core from set_var_value() into helper function 2017-11-02 23:57:15 +11:00
Kevin Easton
1cb3775ced Fix typo testing VIF_CHANGED
This error seemed to be benign, because I don't think there was a way to get here with
int_flags non-zero without VIF_CHANGED already set.

Remove unnecessary tests for 'value' and '!value', because value is always non-NULL in that
code path.
2017-11-02 16:16:37 +11:00
Kevin Easton
a220b8aa7f Rename VIF_BITCHX to VF_BITCHX
This flag is part of ->flags, not ->int_flags, so name it appropriately.
2017-10-26 17:41:05 +11:00
Kevin Easton
571aafcb45 Add helper function save_vars_by_flags() for saving variables
The majority of save_variables() and savebitchx_variables() were common code, so pull it
out into a helper function.
2017-10-26 17:36:28 +11:00
Kevin Easton
dc30b852e1 Add VF_NO_SAVE flag to mark variables that shouldn't be saved
This replaces an explicit test for the variable names "DISPLAY" and "CLIENT_INFORMATION".
2017-10-26 16:15:59 +11:00
Kevin Easton
796eef3f99 Removed unused VF_NODAEMON flag
No code ever tests for this flag, so just remove it.
2017-10-26 15:56:31 +11:00
Kevin Easton
46047b058c Remove unused function clear_sets() 2017-10-25 17:00:48 +11:00
Kevin Easton
481970b30d Use correct type for ircii_rem_str() 2017-10-25 16:59:18 +11:00
Kevin Easton
ff048fbee9 Shitlist level 3/4 should kick regardless of /CSET KICK_IF_BANNED
As reported by Ancient, this is how it is documented to work.  It's also how shitlist level 2 works, so
it's consistent this way.

Some other cleanups in check_auto() while we're here.
2017-10-23 00:32:05 +11:00
Kevin Easton
60b40cf332 Simplify conditionals in check_prot() 2017-10-20 16:12:14 +11:00
gdinit
bac141898b Correct spelling of some client messages, comments and function names 2017-10-20 14:57:17 +11:00
Kevin Easton
b102b9d5c9 Remove pointless NULL test in translat.c
'args' is always non-NULL when this function is called (and has already been dereferenced before the point
where it was tested, anyway).
2017-10-14 23:18:26 +11:00
Kevin Easton
5839f2b393 Support fractional-second intervals on recurring timers
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.
2017-10-11 23:21:14 +11:00
Kevin Easton
bbd18ba47e Introduce time_offset() helper and replace open-coded versions in timer.c
This function takes a struct timeval and offsets it by a (potentially fractional)
number of seconds, given as a 'double'.
2017-09-20 23:07:52 +10:00
Kevin Easton
604fcf794b Remove unused kill_timer() and get_delete_timer() functions
These functions are completely unused.  Also remove the TimerList.delete member that is only used
by these functions.
2017-09-20 15:31:41 +10:00
Kevin Easton
5bd8a40cf8 Change $geom() to return current screen's geometry, not the original terminal's
This only affects additional screens created with /window create, which is an unusual
configuration.
2017-09-15 17:39:52 +10:00
Kevin Easton
70ac43ce77 Remove globals 'li' and 'co' in term.c
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).
2017-09-15 17:15:24 +10:00
Kevin Easton
c9b0e654b5 Remove unused variables BC, UP and my_PC
These appear to be a hangover from old termcap-using code, but there's nothing in BX that uses them anymore.
2017-09-02 07:03:10 +10:00
Kevin Easton
9080475ff7 Remove unnecessary typecasts in initialisation of tcaps[] 2017-09-02 04:55:19 +10:00
Kevin Easton
4a3cff53f4 Simplify and improve justification step of status formatting, and use the same code for $statsparse()
Separate out the justification step of make_status() into a new function, so it can be wired in to
stat_convert_format() as well.  This makes $statsparse() work correctly with right-justified status
formats.

Minimise the amount of copying around that is done during the justification - instead, we can just
remember pointers into the buffer returned by strip_ansi() for the left-hand-side, right-hand-side and
padding character.

Don't keep concatenating onto the same buffer with strlcat() when generating the padding - that gives
n^2 behaviour.  Instead keep a pointer to the current end and concatenate there.

Ensure buffer is null-terminated before calling strlcat() on it, in stat_convert_format().
2017-08-23 02:21:42 +10:00
Kevin Easton
f7de661f2f Use L suffixed constant to match type of server.flags / server.flags2 field in (get|set)_server_flag()
Also squash return value of get_server_flag() to 1 / 0.
2017-08-22 23:16:43 +10:00
Kevin Easton
05633c9bc3 Consistently use SIGNAL_HANDLER() macro to define signal handler functions
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).
2017-08-22 22:48:06 +10:00
Kevin Easton
742eeb33f7 Restore terminal settings after flushing output, not before 2017-08-22 22:26:50 +10:00
Kevin Easton
73148fa4a4 Remove unused server flags CLOSE_PENDING and CLOSING_SERVER, rename LOGGED_IN to SF_LOGGED_IN
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.
2017-07-19 07:57:52 +10:00
Kevin Easton
0fea2b97a4 Remove exported function create_server_list()
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).
2017-07-17 12:59:49 +10:00
Kevin Easton
d2e576a774 Fix $myservers(1) to only return registered server refnums
When $myservers() is called with an argument of 1 it is supposed to only return the refnums of servers
that are registered (ie. those which it is legal to send a command to).  This is the way EPIC works, and
it was always intended to work this way in BX too.

Also fix the warning about a NULL itsname - we use our name for the server if it isn't registered yet.

Remove the slightly bogus use of strncat() while we're here, by removing the temporary stack buffer and
just directly creating the result string with m_s3cat().
2017-07-17 12:48:28 +10:00
Kevin Easton
cd9c358eed Fix CHANGE_NICK_ON_KILL feature
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.
2017-07-15 23:29:14 +10:00
Kevin Easton
b481ed1e6e Remove pointless NULL check in repaint_window()
The function has already dereferenced the pointer and passing NULL to this function is just a bug.
2017-07-15 22:24:09 +10:00
Kevin Easton
ce780c5b63 Use character constants instead of bare integers for escape character in strip_ansi()
Also use '\t' instead of '\011' in prepare_display().

Should be no functional changes, just looks nicer.
2017-07-15 22:22:58 +10:00
Kevin Easton
df12f6860a Remove unused 'in_help' flag from log_put_it()
The flag was set, but never tested.
2017-07-15 00:33:24 +10:00
Kevin Easton
d68d06480c Remove unused argument from log_put_it(), move declaration to output.h 2017-07-15 00:16:18 +10:00
Kevin Easton
9c46ddddb6 Check for unset MSGLOG_FILE or CTOOLZ_DIR, or failed stat(), in readlog()
Unset MSGLOG_FILE or CTOOLZ_DIR could cause a null pointer dereference.

If stat() failed it dereferenced the bogus 'struct stat', and in the directory case
just silently failed.  Now it falls through to the "error opening" path.
2017-07-15 00:07:25 +10:00
Kevin Easton
a6a5a19e28 Fix memory leak in /QUEUE -FLUSH
The queue->name must be freed.
2017-07-11 19:01:09 +10:00
Kevin Easton
dbd37bc35d Messages sent by /SV and /PASTE should be logged in the send log
This looks like an oversight.
2017-07-09 00:14:15 +10:00
Kevin Easton
bb616e0626 Change send_text() to combine command, hook and log arguments into one set of flags
This function is exported to modules, so it requires updating a few modules and rolling the module table version.
2017-07-09 00:08:04 +10:00
Kevin Easton
496bbc8b74 Add send_text() flag STXT_LOG
Eventually to replace the 'log' parameter to send_text().
2017-07-08 21:49:59 +10:00
Kevin Easton
1bceb5ed86 Pass STXT_NOTICE flag instead of command string to functions downstream of send_text()
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").
2017-07-08 21:37:08 +10:00
Kevin Easton
f8c76a4351 Include ircaux.h in qbx.c
This is required for SERVICE_CLIENT and PROTOCOL_UDP.
2017-07-08 21:34:28 +10:00
Kevin Easton
a8e33b5efd Include irc.h in struct.h for required macros and typedefs
This fixes building the acro plugin.
2017-07-08 21:32:42 +10:00
Kevin Easton
2d0b3e728f Replace 'hook' and 'noisy' flags in functions downstream of send_text() with !(stxt_flags & STXT_QUIET)
This is in preparation for consolidating the various send_text() options into one set of consistent flags.
2017-07-07 15:19:39 +10:00
Kevin Easton
2c8671f3dd Simplify send_text() by separating out special targets into another function
Also rename the double-negative flag 'not_done' to the more description 'done_forward'.
2017-07-05 17:36:52 +10:00
Kevin Easton
ac84793dd6 Switch from direct tcl_interp->result access to Tcl_GetStringResult() and Tcl_AppendResult()
This allows building against recent libtcl versions.

A fallback definition of Tcl_GetStringResult() is included so that building against libtcl 7 still works.
2017-07-01 00:47:20 +10:00
Kevin Easton
356eb699d0 Remove unnecessary repeated lines in parse_command()
There was no need for the same lines both in the WANT_TCL and !WANT_TCL branches.
2017-06-30 23:05:05 +10:00
Kevin Easton
19639ed608 Minor cleanups in send_text()
This removes some unused variables and some unnecessary copies of the text to be sent.
2017-06-29 16:51:26 +10:00
Kevin Easton
57827008a1 Change sed_encrypt_msg() so it doesn't modify the passed message in-place
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.
2017-06-29 00:10:24 +10:00
Kevin Easton
3c2028e167 Rename crypt_msg() / decrypt_msg() to sed_encrypt_msg() / sed_decrypt_msg() and move to ctcp.c
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.
2017-06-28 22:26:08 +10:00