summary refs log tree commit diff
path: root/chat.h
AgeCommit message (Collapse)Author
2021-06-25Keep log directory open, use mkdirat(2) and openat(2)C. McEnroe
2021-06-20OpenBSD: Only unveil used directoriesKlemens Nanni
dataMkdir() already picked the appropiate directory so make it return that such that unveilData() can go as only that one directory needs unveiling.
2021-06-18Add -m mode option to set user modesC. McEnroe
2021-06-17Match windows by substring in /windowC. McEnroe
This could just iterate over idNames instead, but using complete means more recently used windows will match first.
2021-06-11Open save file once in uiLoad() and keep it open until uiSave()Klemens Nanni
Opening the same file *path* twice is a TOCTOU, although not a critical one: worst case we load from one file and save to another - the impact depends on how and when catgirl is started the next anyway. More importantly, keeping the file handle open at runtime allows us to drop all filesystem related promises for `-s/save' on OpenBSD. uiLoad() now opens "r+", meaning "Open for reading and writing." up front so uiSave() can write to it. In the case of a nonexistent save file, it now opens with "w" meaning "Open for writing. The file is created if it does not exist.", i.e. the same write/create semantics as "w" except uiLoad() no longer truncates. existing files. uiSave() now truncates the save file to avoid appending in general.
2021-06-09Avoid creating out-of-bounds pointer when checking for seprintf truncationMichael Forney
It is technically undefined behavior (see C11 6.5.6p8) to construct a pointer more than one past the end of an array. To prevent this, compare n with the remaining space in the array before adding to ptr.
2021-06-09Remove catfC. McEnroe
2021-06-09Replace catf with seprintfC. McEnroe
2021-06-09Add seprintfC. McEnroe
Based on seprint(2) from Plan 9. I'm not sure if my return value exactly matches Plan 9's in the case of truncation. seprint(2) is described only as returning a pointer to the terminating '\0', but if it does so even in the case of truncation, it is awkward for the caller to detect. This implementation returns end in the truncation case, so that (ptr == end) indicates truncation.
2021-05-28List windows with /window 1.8C. McEnroe
Reuse the /window command to preserve /wi abbreviation.
2021-05-27Hash the username in kiosk modeC. McEnroe
So that the first part of $SSH_CLIENT can be passed as username.
2021-05-04Ignore messages in reply to previously ignored messagesC. McEnroe
Using the +draft/reply client tag, which is supported by BitBot. This hides the bot's replies to ignored users or ignored bot command messages. This commit is dedicated to the land of Estonia.
2021-04-02Skip STATUSMSG prefixesC. McEnroe
This feature is rarely used, so just skip STATUSMSG prefixes in the target so messages get routed correctly.
2021-03-17Show where too-long-messages will be automatically splitC. McEnroe
2021-03-08Disable nick and channel colors with hash bound 0C. McEnroe
2021-02-21Use separate reply counts for automatic join topics/namesC. McEnroe
This restores showing the topic and names for automatic joined channels, while still avoiding touching the windows, by using Cold heat.
2021-01-27Measure timestamp width using ncursesC. McEnroe
This allows for non-ASCII characters in timestamps, and simplifies things by including the trailing space in the width.
2021-01-27Add toggleable display of timestampsC. McEnroe
2021-01-26Add numbers to buffer linesC. McEnroe
This directly correlates hard-wrapped lines with the soft lines they were wrapped from. Choosing uint here because it doesn't change the size of struct Line. It doesn't at all matter since buffers only hold 1024 lines at a time anyway.
2021-01-23Separate kiosk mode from restrict modeC. McEnroe
Restrict mode will focus on sandboxing, while kiosk will continue to restrict IRC access through a public kiosk. Kiosk mode without restrict mode allows execution of man 1 catgirl with /help, assuming external sandboxing. The /list and /part commands are also added to the list of disabled commands in kiosk mode, since they are pointless without access to /join.
2021-01-16Rename ignore code to filterC. McEnroe
2021-01-16Generalize ignore toggling to visibility thresholdC. McEnroe
2021-01-11Save and load the URL ring in the save file 1.4C. McEnroe
2021-01-10Print chain to stdout with -oC. McEnroe
2021-01-09Add -o and -t options to trust self-signed certificatesC. McEnroe
2021-01-09Allow configuring the upper bound of the hash functionC. McEnroe
This allows limiting the nick colors used to the 16-color terminal set without modifying the TERM environment variable. Produces different results from just using the default configuration in a 16-color terminal, but what can you do?
2021-01-01Split ignore fields to avoid over-eager * matchingC. McEnroe
Split ignore fields and match each separately to avoid an early * eagerly matching across several fields. For example, "* JOIN * *" should not match messages which happen to contain the word "JOIN" followed by two other words. Ignore capacity is reduced to 64 to keep the size of the array the same. I don't think it's an issue.
2020-12-30Factor out reply count checking and decrementingC. McEnroe
2020-12-30Add /whowasC. McEnroe
2020-12-30Show setnames like nick changesC. McEnroe
2020-12-29Add /setname commandC. McEnroe
I'm not sure about that replies check in handleStandardReply. If more of those are added the reply counter system will definitely need refactoring.
2020-10-12Avoid eating C-c while connectingC. McEnroe
Split UI initialization into two steps either side of the call to connect, so that C-c works as interrupt while it's blocked.
2020-10-09Factor out styleStripC. McEnroe
2020-10-02Double up /help for server helpC. McEnroe
While the automatic search via LESS is neat, I don't think it's very useful. Just always open the manual to the COMMANDS section, and fix it to append to LESS rather than replace it.
2020-09-30Use WHO for /opsC. McEnroe
Accumulate names in a buffer and show away status.
2020-09-30Add /ops commandC. McEnroe
It's pretty awkward with large channels since NAMES isn't sorted by prefixes or anything... But having it accumulate names across many replies would require more reworking.
2020-09-02Recalculate unreadHard on reflowC. McEnroe
2020-09-02Hide ignored messages at the soft -> hard buffer layerC. McEnroe
This restores normal scrolling behaviour.
2020-09-02Actually insert blank lines in the soft bufferC. McEnroe
So they can be preserved forever!
2020-09-02Render one main window from buffersC. McEnroe
Still missing: split scrolling and preserving a blank on reflow either from resize or ignore toggling. Anecdata: on one of my instances of catgirl, RAM usage of the previous release was ~30M, RAM usage of this commit was ~12M.
2020-09-01Implement buffer line wrappingC. McEnroe
Not yet rendered in the UI! Just done in parallel.
2020-09-01Factor buffer out of uiC. McEnroe
In preparation for doing line wrapping outside of ncurses.
2020-09-01Move styleParse out of uiC. McEnroe
2020-08-21Use a static buffer for base directory pathsC. McEnroe
2020-08-20Use configPath to load TLS cert/privC. McEnroe
2020-08-20Refactor base dir functions to iterate over pathsC. McEnroe
2020-08-04Say "OpenSSL" in additional permission noticesC. McEnroe
LibreSSL is "a modified version of that library".
2020-07-30Replace catf with something that tracks lenC. McEnroe
Also the old catf would be broken with -DNDEBUG oops!
2020-07-30Define explicit_bzero using memset_s on macOSC. McEnroe
2020-07-30Remove use of strlcatC. McEnroe
catf is not better though and should really be replaced.