Commit Graph

1034 Commits (79981bda6d3f72ebdc87d40fe54dcccce88449d9)

Author SHA1 Message Date
June McEnroe 8065fcabc3 Make sure new cap is actually larger than new length 2022-02-20 12:24:54 -05:00
June McEnroe 157be8a8d7 Remove unused mbs.len field from struct Edit 2022-02-20 11:54:06 -05:00
June McEnroe 3b4ad30d97 Remove unneeded includes in ui.c 2022-02-19 23:25:36 -05:00
June McEnroe 5c4ecb5a0f Reimplement tab complete 2022-02-19 22:02:49 -05:00
June McEnroe da8deff767 Handle errors from editFn, etc. 2022-02-19 20:44:36 -05:00
June McEnroe 143fa1b509 Reimplement text macros 2022-02-19 20:38:12 -05:00
June McEnroe 073cebec7a Factor out input handling to input.c 2022-02-19 20:20:19 -05:00
June McEnroe 3359a5d69b Factor out window management to window.c 2022-02-19 18:28:45 -05:00
June McEnroe 70f627bc47 Enable -Wmissing-prototypes
In other words, warn when a function is missing static. I don't see
why this isn't in -Wextra.
2022-02-19 17:46:07 -05:00
June McEnroe a2a118c857 Fix edit.[ch] license notice additional permissions 2022-02-19 14:51:26 -05:00
June McEnroe 06d17aa8f1 Run line editing tests
I know, it feels wrong.
2022-02-19 00:01:34 -05:00
June McEnroe 1a2477ef7a Implement new line editing "library"
Losing tab complete and text macros, for now.

This new implementation works on an instance of a struct and does
not interact with the rest of catgirl, making it possible to copy
into another project. Unlike existing line editing libraries, this
one is entirely abstract and can be rendered externally.

My goal with this library is to be able to implement vi mode. Since
it operates on struct instances rather than globals, it might also
be possible to give catgirl separate line editing buffers for each
window, which would be a nice UX improvement.
2022-02-18 23:47:11 -05:00
June McEnroe 573bc855a6 Simplify cursor positioning in input
Do some extra work by adding the portion before the cursor to the
input window twice, but simplify the interaction with the split
point. This fixes the awkward behaviour when moving the cursor
across colour codes where the code would be partially interpreted
up to the cursor.
2022-02-18 23:39:46 -05:00
June McEnroe 0036e6e9f0 Fix M-f ordering 2022-02-18 22:40:16 -05:00
June McEnroe 28a27a2c0f Move sandman build to scripts/Makefile 2022-02-12 20:19:18 -05:00
June McEnroe c95c8cd1b4 Use compat_readpassphrase.c on Linux 2022-02-12 13:36:24 -05:00
June McEnroe edad0218c1 Copy RPP defines from oconfigure
We don't use any flags, so just define them in the compat source
file.
2022-02-12 13:36:24 -05:00
June McEnroe 6013ae1513 Import compat_readpassphrase.c from oconfigure
At 5d08070de6aadd979e3752263d2ec1e709bf037e.
2022-02-12 13:28:26 -05:00
June McEnroe 397b4ce6bd Prompt for empty server or SASL passwords 2022-02-12 13:26:38 -05:00
June McEnroe 9c384de6db Treat any amount of space and punctuation as word boundaries
This matches behaviour of, e.g. zsh -o emacs.
2022-02-09 17:55:33 -05:00
June McEnroe 8dec54801c Add M-s to (temporarily) reveal spoiler text 2022-02-03 22:10:54 -05:00
June McEnroe ceee69f905 Add C-z s to set spoiler text 2022-02-03 21:50:31 -05:00
June McEnroe 605f889ab5 Avoid sending null byte in SASL PLAIN
Woops! BASE64_SIZE is the size of the string buffer. Somehow ergo
is the only server software (that I know of) to reject the accidental
null byte.

Reported by smlavine.
2022-01-16 14:17:46 -05:00
June McEnroe e7cec13723 Use Cold for away notices in queries
So that they can be hidden with M-+.
2022-01-16 14:17:03 -05:00
June McEnroe adff312570 Refer to long option names, prefix commands with $ 2021-12-11 20:55:42 -05:00
Alyssa Ross 431230e0ea Support custom pkg-config executable names
When cross-compiling, it's common to have executables prefixed with
the name of the architecture you're building for,
e.g. aarch64-unknown-linux-musl-cc or x86_64-unknown-freebsd-pkg-config.
Lots of build tools support a PKG_CONFIG environment variable to
enable this use case.

With this change, I was able to successfully cross-compile and run
catgirl.
2021-11-22 12:30:31 -05:00
C. McEnroe 9c1b241c17 Cycle between adding colon suffix and not in tab complete
Allows completing a nick at the beginning of a message without a
colon by continuing to press tab, as well as after another nick
already followed by a colon without turning it into a comma-separated
list of nicks all followed by a colon. For example, tab can be used
to cycle between the following pairs:

    nick1: |
	nick1 |

	nick1, nick2: |
	nick1: nick2 |
2021-11-19 14:44:16 -05:00
C. McEnroe bd3e0ac76b Make the /ops response more flavourful
How did this normal sounding format string get in there!
2021-11-16 14:16:43 -05:00
C. McEnroe d06ac675c6 Handle RPL_WHOISSPECIAL
<https://modern.ircdocs.horse/index.html#rplwhoisspecial-320>
2021-11-10 20:31:27 -05:00
C. McEnroe 4363d4b535 Parse IRC formatting in timestamp string
Strip formatting when calculating the timestamp width to avoid
moving a bunch of code around. Use styleAdd (now with an initial
style parameter) to show timestamps.

This allows changing the style of the timestamps from the default
gray using literal IRC formatting codes in the string. Not ideal,
but no new options needed.

Suggested by Hoël Bézier and Sebastian LaVine.
2021-10-28 17:56:16 -04:00
psykose 27b5fd0251 Fix strptime decode for musl libc
POSIX does not define a %F for strptime[1], but does define %F for
strftime[2]. Afaik most libc's implement %F for both, but musl is very
standards-compliant and does not have %F on strptime, leading to
unparsed message tag times, which causes all backlog sent from bouncer
on startup to have a timestamp of the current time, instead of the
actual timestamp sent.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html
[2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
2021-10-26 12:27:54 -04:00
C. McEnroe fca48fd05d Increment replies for list modes with /mode
Otherwise only /ban can be used to list bans and /mode b or /mode
+b won't show the listing.
2021-10-17 11:55:43 -04:00
C. McEnroe b6cf41ab77 Import refactored xdg.c from pounce 2021-10-16 17:03:31 -04:00
C. McEnroe 54c632e8c3 chroot: Factor out and add OpenBSD build 2021-09-27 19:16:45 +00:00
C. McEnroe 191163cc75 Request znc.in/self-message if available
catgirl correctly handles receiving "self-messages". pounce always
sends them.

[1]: https://wiki.znc.in/Query_buffers
[2]: https://defs.ircdocs.horse/info/selfmessages.html
2021-09-20 20:25:11 -04:00
C. McEnroe 506c5ad906 Correct handling of colons in SASL PLAIN
Only the first colon should be replaced with a null byte.

Ported from pounce.
2021-09-09 12:44:01 -04:00
C. McEnroe be9bffdf49 Match id names case-insensitively
This fixes the case where an IRCd does not normalize channel names,
e.g. PRIVMSG #TEST is relayed as-is, rather than as #test or whatever
the canonical casing of the channel name is. It also fixes the case
of opening a query window with incorrect case, e.g. /query nickserv.

However, this solution is only completely correct when
CASEMAPPING=ascii.[1] I do not think the extra mappings of
CASEMAPPING=rfc1459 are relevant enough to justify adding the code
to handle it.

[1]: https://modern.ircdocs.horse/#casemapping-parameter
2021-08-26 12:59:57 -04:00
C. McEnroe 1f800bcf69 Remove trailing tab
How embarrassing.
2021-08-25 17:48:16 -04:00
C. McEnroe df1e561378 Handle tags without values
Otherwise a tag with no value would cause a segfault trying to
unescape the NULL tag pointer. This shouldn't happen for the server
tags we parse, but clients could send @+draft/reply with no value.
2021-08-15 12:24:15 -04:00
C. McEnroe 3f3585d0f3 Fix missing include for flock(2)
On OpenBSD it's in <fcntl.h>, and it gets declared anyway on FreeBSD
and macOS. Curiously, on GNU/Linux, LOCK_* are defined, but flock(2)
isn't declared.
2021-08-09 20:14:24 -04:00
C. McEnroe a585b1b073 Silence maybe uninitialized warning
Wouldn't happen anyway since configPath will always return at least
one path.
2021-08-09 20:12:44 -04:00
C. McEnroe 56139227a4 Use (bright) red for \com text macro 2021-07-26 18:25:05 -04:00
C. McEnroe 78a020df82 chroot: Avoid passing paths to -s 2021-07-20 21:27:24 -04:00
C. McEnroe d9388fa2a8 FreeBSD: Revert caph_enter(3) call to cap_enter(2)
caph_enter(3) is the same as cap_enter(2) except that it returns
success even if the kernel does not support capability mode. Since
we only enter capability mode when explicitly requested by the
restrict option, it should fail loudly if it is not supported. On
the other hand, we make calls to caph_rights_limit(3) and friends
in some places regardless of whether we actually enter capability
mode (to keep the code simple), so those should continue to succeed
even if capability mode is not supported.
2021-07-20 13:25:04 -04:00
C. McEnroe 347e2b461f Don't apply uiThreshold to Network and Debug
Messages don't really need to be hidden from <network> and I think
it could be confusing. Debug messages are all Cold so everything
would be hidden, and I want to keep them that way so that <debug>
doesn't clutter the status line needlessly.
2021-07-20 12:09:24 -04:00
Klemens Nanni f8e3414af0 Add -q/quiet option to raise default message visibility threshold
Silencing all windows with `M-+' (across multiple catgirl instances)
can be cumbersome, so provide an option to hide events, JOIN/PART noise,
etc. by default (each window's threshold will persist across load/save
cycles, i.e. when using the `-s/save' option).

Started out as `-v | visibility = threshold' to set a specific level,
the idea of a simpler toggle comes from june, who also squashed other
bugs (as usual).
2021-07-20 12:03:46 -04:00
Klemens Nanni 773d5bbdc0 chat.tmux.conf: Fix base-index setting
"base-index" expects integer values, tmux prints a warning at load-time
but otherwise ignores the configuration line.
2021-07-15 14:43:30 -04:00
Klemens Nanni e365bae8e0 Use /ns in manual example
Follow a79a3fc "Use NS and CS server aliases".
2021-07-15 14:42:33 -04:00
C. McEnroe 2f8ec18e65 Move platform-dependent sandboxing code out of main
To keep the "main" sequence of events on one screen, while emphasizing
that sandboxing happens either side of ircConnect().
2021-07-13 16:28:33 -04:00
C. McEnroe ce53e309e6 Move all UI initialization together 2021-07-13 15:39:16 -04:00