Commit Graph

906 Commits

Author SHA1 Message Date
Kevin Easton
e3750c7c1b Remove #include <ircterm.h> from source files that don't use it
Update Makefile dependencies as a result of header file inclusion changes.
2018-12-11 20:30:27 +11:00
Kevin Easton
ac1c95c4ec Rename Window.columns to Window.saved_columns
This more accurately describes what it's for, and also avoids a conflict with the columns identifier
defined by terminfo's <term.h>.
2018-12-10 23:46:24 +11:00
Kevin Easton
9524f8996c Rename clear_screen() to input_clear_screen()
This matches input_unclear_screen(), and avoids a clash with the clear_screen identifier defined in
terminfo's <term.h>.
2018-12-10 23:29:45 +11:00
Kevin Easton
902ee7c455 Remove unused function irc_clear_screen 2018-12-10 23:25:17 +11:00
Kevin Easton
66b6fa4345 Add /EXEC -WINTARGET <target> argument
This allows you to choose a specific target window for the output of an /EXEC.
2018-11-30 13:17:27 +11:00
Kevin Easton
830572b91f Simplify and improve ov_strcpy()
The new implementation calls into strlen() and memmove(), and is safe to use even if the arguments don't
point into the same string.

The return value is now the same as the first argument (just like strcpy()), but no existing callers care
about the return value anyway.
2018-11-27 17:26:53 +11:00
Kevin Easton
e51469568e Update command-line help text to explain server descriptions
Makes it clear that a each server can also specify port/password/nick/network if desired.

Reported by Ant.
2018-11-14 13:17:48 +11:00
Kevin Easton
076850f81b Move declaration to top of block
This fixes building with gcc2.  Reported by <https://github.com/fbrosson>.
2018-11-11 01:27:09 +11:00
Kevin Easton
fe22025c01 Remove configure check for bcopy(), no longer required
This fixes building on Haiku OS (where bcopy() is a macro, not a function).
2018-11-11 01:22:31 +11:00
Kevin Easton
b5afd1d596 Replace last uses of bcopy() with memcpy()
memcpy() / memmove() are standard everywhere, this lets us remove the configure script checking around bcopy()
which helps building on Haiku OS.
2018-11-11 01:07:31 +11:00
Kevin Easton
d897a3b753 Fix /HISTORY *pattern* and /HISTORY -CLEAR
This code contained a bug where any argument to /HISTORY that _didn't_ start with "-CL" would clear history,
so no number or pattern argument could successfully be passed.

With this fix only an argument that case-insensitively matches "-clear" will clear history, so a pattern
argument will also work correctly.
2018-11-05 23:25:01 +11:00
Kevin Easton
a3e8364bc9 Straight conversion of prepare_display() from pds.pos integer to pds.dest pointer
This means that the prepare_display_state struct includes the pointer into the destination
buffer, not just the offset.
2018-07-07 12:03:22 +10:00
Kevin Easton
6d432d458f Group variables representing the current prepare_display() state into a struct
This should have no functional effect, but groups together the variables required to
'rewind' prepare_display() to a particular point in the source string all together.
2018-06-16 14:28:40 +10:00
Kevin Easton
d4c6123002 No tabs should be shown when /SET TAB is OFF
This also counts beeps, tabs and non-destructive spaces in the same way.

To maintain historical behaviour, BEEP_MAX of zero indicates no beeps allowed (the same
as /SET BEEP OFF), but TAB_MAX and ND_SPACE_MAX of zero indicates no limit.
2018-05-25 11:19:02 +10:00
Kevin Easton
255c25158c In prepare_display() set firstwb on tab as well as space 2018-05-17 23:20:15 +10:00
Kevin Easton
f859f9e2f8 Count columns used by ND_SPACE character when splitting lines
ND_SPACE take up a printable column, so they need to be counted.  Reproducer:

/eval echo $repeat(160 $chr(19))XXXXXXXXXXXXXXXXXXXXXXX
2018-05-17 16:26:17 +10:00
Kevin Easton
9bffcf91ba Use main_screen->co instead of current_term->TI_cols as fallback width for never-visible windows
Window management should be getting its idea of screen geometry from screens, rather than
directly from the terminal.
2018-05-14 15:25:21 +10:00
Kevin Easton
5cc052ee6c Use target window width rather than terminal width to wrap /list -wide output
This should make the output correct in more circumstances.  It's the same wrapping used by add_to_window, anyway.
2018-05-10 17:33:35 +10:00
Kevin Easton
14a501bd04 Add window_columns() function to determine number of columns used for splitting window output
Replaces two open-coded versions of the same pattern.
2018-05-10 17:02:16 +10:00
Kevin Easton
eb14b44413 Use current terminal size in term_reset()
Fixes a regression introduced by 70ac43ce77 where
the scroll region would be reset to the original terminal size, not current.
2018-05-07 20:13:23 +10:00
Kevin Easton
caaba512c2 Remove dead code in refresh_screen() 2018-05-07 17:14:49 +10:00
Kevin Easton
563ab3efeb Use current screen size rather than original terminal size in term_clear_screen()
Also renames the function term_clrscr() to term_clear_screen() and remove the term_clear_screen()
macro.
2018-05-05 13:34:13 +10:00
Kevin Easton
1e97709bd8 Use output_screen size instead of current_term in term_scroll
This fixes a regression in commmit 70ac43ce77,
where the original screen size would be used to scroll after the terminal had
been resized.  If the screen was shrunk, this caused display problems when
running under GNU Screen.

Using output_screen size means that it stands a better chance of working on
non-default screens, too.
2018-05-05 11:31:31 +10:00
Kevin Easton
208fddb9f5 Simplify dcc_send_socketread()
There should be no change in behaviour.  Replaces a code block of the form:

if (a || b)
{
    if (c && a)
    {
        /* one */
    }
    else if (b)
    {
        /* two */
    }
}

with the simpler equivalent:

if (c && a)
{
    /* one */
}
else if (b)
{
    /* two */
}
2018-04-12 00:20:13 +10:00
Kevin Easton
99c5ec9872 Change arcfour example module to use ARC4CHAT instead of SCHAT as the DCC type
The SCHAT type is already used by some other clients for SSL CHAT.  This example module doesn't work
yet anyway, so no-one can actually be using it.
2018-03-14 16:58:10 +11:00
Kevin Easton
9e7fc85ae1 Fix various problems with adding and removing module DCC bindings
Change remove_all_dcc_binds() so that it only removes DCC binds for the module supplied, as it's supposed to.

get_dcc_type() should ignore the first entry in dcc_types[] ("<none>") otherwise the client will try to
respond to DCC requests with that name.

Explicitly track the number of entries in the dcc_types[] array rather than using a NULL terminator.  This
allows us to change dcc_types[] to use NULL entries to mark unused slots in the array, rather than pointers
to entries with a NULL .name element.  Together, this means that the dcc_types[] array is only resized when it
actually needs to be grown and removal works correctly (without eg. prematurely marking the end of the array).

Make add_dcc_bind() fail if the requested DCC type has already been bound by a module (this still allows one
module at a time to rebind a built-in DCC type).  Previously the behaviour was ill-defined in this case.
2018-02-20 23:27:32 +11:00
Kevin Easton
5ae42802ec Fix crash when unloading the arcfour module
Remove the empty Arcfour_Cleanup() function so that the default module cleanup can happen.

Define MODULE_NAME and use that when registering the module callbacks so that the default
module cleanup will remove them correctly.
2018-02-20 23:00:00 +11:00
Kevin Easton
3687e532f0 Change declarations of several globals to 'static' in dcc.c 2018-02-12 17:16:27 +11:00
Kevin Easton
fcdfecd78c Introduce get_dcc_type(), remove open-coded variants 2018-02-09 22:09:09 +11:00
Kevin Easton
61a926a766 Introduce a struct dcc_ops to contain all functions pointers for a custom DCC type
Modules now must pass a pointer to a struct dcc_ops when calling add_dcc_bind() instead of
a list of function pointers.
2018-02-08 22:39:49 +11:00
Kevin Easton
64ec300d5d Add full prototyped declarations for DCC hook function pointers 2018-02-08 16:57:41 +11:00
Kevin Easton
d15a738ee9 Don't limit dcc_schat_input to DCC_CHAT type (which is never true) 2018-01-06 21:20:48 +11:00
Kevin Easton
5991b83e13 Fix spelling mistakes in /BHELP file
Typo in /lastlog reported by g0z.
2018-01-04 22:29:10 +11:00
Kevin Easton
c7a72b79ae Fix redirecting to DCC CHATs with /REL* commands
to + 1 is the correct destination, not to + 3.
2017-12-20 20:25:27 +11:00
Kevin Easton
2c94010d65 Update arcfour example module to use exported dcc_chat_socketread() callback
This allows it to actually connect OK, but it's still nonfunctional at the moment.
2017-12-20 18:10:02 +11:00
Kevin Easton
d7688075b6 Export dcc_chat_socketread() and dcc_send_socketread() callbacks to modules
The idea here is that if you have a module which implements a new DCC type that is essentially
a lightly-modified version of CHAT or SEND you can reuse these functions.
2017-12-20 17:36:05 +11:00
Kevin Easton
a55feeef5f Rename process_dcc_*() functions to dcc_*_socketread()
This makes it clearer what those functions really do.  It's in preparation to export them
for modules.
2017-12-20 17:11:56 +11:00
Kevin Easton
3800e4b099 Replace get_server_flag() with get_server_umode()
This function gets the status of a single umode flag identified by umode char rather than
internal server flag number.

This also lets us remove all the USER_MODE* constants because they're no longer required.

Invert the sense of the +w check in e_wall() - we only echo our OPERWALL if we're *not* +w,
because if we are +w then the server will echo it back to us anyway.
2017-12-07 00:23:43 +11:00
Kevin Easton
1769c03951 Replace set_server_flag() with update_server_umode() and remove get_possible_umodes()
The idea here is not to expose the internal server implementation for storing umodes,
but instead have callers just work in terms of umode characters.

The 'possible umodes' have always been the same for all servers anyway.  We just assume
that [a-zA-Z] is the bounding set.
2017-12-06 23:30:24 +11:00
Kevin Easton
305cfe2afb Move reinstate_user_modes() and update_user_mode() from funny.c to server.c and parse.c
Move these functions where they belong.
2017-12-06 22:13:34 +11:00
Kevin Easton
c4ba093ca5 Rework update_user_mode() 2017-12-04 17:43:47 +11:00
Kevin Easton
7642e741b9 Switch to using NULL server.ssl_fd to mark new SSL connection instead of NULL server.ctx
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.
2017-12-03 02:16:39 +11:00
Kevin Easton
7b817dd9d2 Correctly handle zero value error return from SSL_write() 2017-12-03 01:09:06 +11:00
Kevin Easton
abc9dbdf9e Use SSL_free() when closing an SSL server connection
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.
2017-12-03 01:06:53 +11:00
Kevin Easton
5d131bcf01 Add SSL version and cipher to SSL connect message
Similar to what EPIC5 does.
2017-12-03 00:13:47 +11:00
Kevin Easton
cdf53cbf86 Change switch_help from array of strings to plain string 2017-12-01 23:42:26 +11:00
Kevin Easton
035063abce Add BITCHXRC_NAME to config.h
(instead of hardcoding it in irc.c).  Simplify setting of ircrc_file and bircrc_file.

Use IRCRC_NAME and BITCHXRC_NAME in help strings.
2017-12-01 23:33:13 +11:00
Kevin Easton
973ae0e4da Correctly handle case when a nick comes between a -s flag and a server name on the command line
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.
2017-12-01 23:05:58 +11:00
Kevin Easton
a4ef0798ac Use server argument instead of from_server in rebuild_notify_ison()
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.
2017-11-30 17:27:05 +11:00
Kevin Easton
f3f2ef6796 Remove unused variable hostname in nslookup()
Squashes a warning.
2017-11-30 00:11:24 +11:00