Four-level refactor of the chat-window scrolling state:
L1. Extract win_page_space() and unify the two-branch clamp at the end of
win_page_down into a single last_page_start formula. Removes the
duplicated `getmaxy(stdscr) - 4` magic across page_up / page_down /
sub_page_up / sub_page_down and the off-by-one between the two clamp
branches.
L2. Remove ProfLayout::paged sticky flag. Replace with win_is_paged(),
derived from y_pos and the current pad height. Eliminates the entire
bug class of "stuck paged=1" — there is no flag to drift, no manual
reset to forget. The earlier non-CHAT bottom-reach reset, the
WIN_SCROLL_REACHED_BOTTOM reset, the win_clear paged=1 line, and the
cl_ev_send_ai_msg paged=0 workaround all collapse into "y_pos governs
everything." cl_ev_send_ai_msg now calls win_move_to_end so the user's
own message is visible after scroll-up.
L3. _win_printf no longer drops messages when paged. The line is appended
to the buffer and to the curses pad unconditionally; it lands below
the visible viewport so the user's reading position is unchanged. The
unread badge still increments. Suppressed messages are no longer lost
forever — page-down naturally reveals them.
L4. Replace the win_scroll_state_t enum (INNER / REACHED_TOP /
REACHED_BOTTOM, conflating layout edge with DB exhaustion) with a
ScrollEdges struct of two independent booleans:
db_exhausted_above — a previous page-up DB fetch returned empty
db_exhausted_below — same for page-down
The flags are flipped to TRUE on DB_RESPONSE_EMPTY and cleared by a
scroll in the opposite direction (so MAM late-delivery and /history
switch can re-trigger fetches). Buffer-edge state is no longer
encoded here — y_pos handles that.
Tests: stub_ui gets a no-op win_move_to_end. 545/545 unit tests pass.
As 9f2abc75 accidentally got the ordering of some of the includes wrong,
I decided to propose my initial solution again.
Additional to that, I've opened a MR against CMocka to solve this on
their side, since I believe that the current way this is done is not
sustainable [0].
[0] https://gitlab.com/cmocka/cmocka/-/merge_requests/91
Fixes: 9f2abc75 ("Fix tests with gcc15 (uintptr_t)")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
CProof note: our new tests need to also be updated.
Implement /force-encryption command to configure forced encryption
settings with on|off and policy resend-to-confirm|block options.
The changes enhance user experience by clarifying encryption requirements
and providing actionable commands. Users can now press Enter again to
confirm unencrypted messages in resend-to-confirm mode.
- Update formatting for stub files
- Update docs
While original project, Profanity, provides valuable basis for this
fork, we are not affiliated with the upstream. This commit
is updating documentation to reflect accurate information.
The docs are going to be updated further once the website is created.
Reviewed-on: devs/profanity#5
Co-authored-by: Jabber Developer <jabber.developer@jabber.space>
Co-committed-by: Jabber Developer <jabber.developer@jabber.space>
Instead of adding stuff to `_shutdown()`, we can now register a shutdown
routine from the respective `init()` function of our modules.
This also has the advantage, that we're sure they're called in reverse
order from how the initialization happened.
I didn't simply use `atexit()` because POSIX says that the number of
possible callbacks is limited (min 32) and I was not sure whether
we will maybe extend this number at one point.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Sometimes after a reconnect the current window would get cleared. This
was a deliberate change to fix the profanity window looking all garbled
up after providing the passphrase for a gpg key using pinentry-curses.
Fixes https://github.com/profanity-im/profanity/issues/1556
Fixes https://github.com/profanity-im/profanity/issues/1794
Explanation
The problem is the download's identifier. Downloads are given an ID so they can be referenced later when their progress changes. Currently, the download's ID is the download's URL. When you download the same file twice, you have two downloads with the same ID. Download progress updates are shown on the first of both downloads with the same ID.
Solution
Change the download's ID from its URL to a random number. A random ID is generated when get_random_string() is called from cmd_funcs.c. Several other functions are updated to cope with the new ID format.
Only nicknames, photos, birthdays, addresses, telephone numbers, emails,
JIDs, titles, roles, notes, and URLs are supported
Due to the synopsis array not having enough space, `/vcard photo
open-self` and `/vcard photo save-self` are not documented properly in
the synopsis section of the `/vcard` command, but they are documented in
the arguments section
Fixed memory leak in vcard autocomplete (thanks to debXwoody)
Probably missing copy of body to plain in carbon and privmessage.
Only covers the incoming message path because goal is OMEMO decryption
of untrusted message.
Cover some of the log functions but not all.
Unit tests on 32-bit architectures were failing due to
"cast to pointer from integer of different size" warnings.
mock_ptr_type silences those by first casting to uintptr_t.