Commit Graph

920 Commits

Author SHA1 Message Date
Kevin Easton
f27d4d6599 Move find_old_server() nearby to only caller and make static 2019-02-03 00:59:18 +11:00
Kevin Easton
488c5bd9ba Remove obsolete check_host() function
This does nothing except fail when particular usernames are in use.
2019-01-31 22:24:11 +11:00
Kevin Easton
ec8dee84b1 Remove my_from_server argument to finalize_server_connect()
This argument is always equal to the refnum argument at all three call sites.
2019-01-24 17:32:47 +11:00
Kevin Easton
062a5b781f Simplification of logic in server_lost()
Should have no change to behaviour.
2019-01-24 17:27:57 +11:00
Kevin Easton
18227203d9 Display "Servers exhausted. Restarting." message at the right time
The intention is to display this message when the client has failed to
connect to enough servers that it has to start back at the initially
requested server again.

The old code instead had some quite odd conditions.
2019-01-22 16:20:54 +11:00
Kevin Easton
32e5a0f281 Retry the initial server connection the correct number of times
The previous code relied on server[i].retries being equal to one less than the
number of connection attempts that had been made on entry to advance_server(), but
this was false for the initial connection attempt.

Change the code instead so that on entry to advance_server(), server[i].retries is
always the number of previous connection attempts that have been made.  This does the
right thing for initial connection attempts since .retries starts at zero.
2019-01-21 17:01:20 +11:00
Kevin Easton
080d26e4e1 Simplify next_server()
Replace the overly complex recursive implementation with a simple iterative one
that should behave exactly the same.
2019-01-19 00:52:20 +11:00
Kevin Easton
8072aea782 Improve error messages for SSL connection failures
This now shows the underlying failure reason, and includes the server name.
2019-01-16 23:54:59 +11:00
Kevin Easton
6cf30d8ce1 Make finalize_server_connect() static
It is only called within server.c.
2019-01-16 23:26:39 +11:00
Kevin Easton
95b57cc3cc Correctly handle reconnection after finalize_server_connect() fails
finalize_server_connect() can fail for SSL connections, because SSL_connect() can fail.  Without this change, the client won't
try to reconnect after an initial SSL connection failure - it'll just wait forever.

Reported by g0z, thanks!
2019-01-16 17:13:29 +11:00
Kevin Easton
ad93fed710 Rename 'lines' identifiers that clash with <term.h>
Also pull out common part of scrollback_fowards() and scrollback_backwards() into a
helper function.
2018-12-14 17:55:52 +11:00
Kevin Easton
f8ed18becb Rename 'pad_char' argument to padc
This avoids a clash with pad_char defined in <term.h>.
2018-12-12 00:22:59 +11:00
Kevin Easton
6a6f235db3 Rename 'lines' variables
This avoids a clash with the 'lines' macro declared in <term.h>.
2018-12-12 00:16:56 +11:00
Kevin Easton
76fc3b1b04 Rename 'lines' variable to 'line_range'
This avoids a conflict with the macro defined in <term.h>.
2018-12-11 22:29:20 +11:00
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