revert: restore pre-upstream-merge baseline (tree of 3b673150b)
All checks were successful
CI Code / Check spelling (pull_request) Successful in 18s
CI Code / Check coding style (pull_request) Successful in 30s
CI Code / Linux (ubuntu) (pull_request) Successful in 4m51s
CI Code / Linux (debian) (pull_request) Successful in 6m59s
CI Code / Linux (arch) (pull_request) Successful in 10m12s
CI Code / Code Coverage (pull_request) Successful in 6m44s

Roll the tree back to the pre-merge tip 3b673150b, undoing the upstream sync merge 72f4f186d (303 files) and the 13 post-merge commits layered on top of it.

Purpose: restore the last pre-sync baseline so the reported OMEMO/OTR encryption regressions can be reproduced against a known-good state and the upstream sync ruled in or out as the cause. Nothing is dropped from history; the merge and every post-merge commit remain reachable and can be cherry-picked back selectively.

Baseline:     3b673150b chore(chatlog): disable background message file logging (stage 1)

Undoes merge: 72f4f186d merge: sync upstream profanity-im/profanity
This commit is contained in:
2026-06-29 12:17:01 +03:00
parent ca92d29179
commit f9e184eda7
311 changed files with 9908 additions and 11285 deletions

View File

@@ -3,9 +3,35 @@
* vim: expandtab:ts=4:sts=4:sw=4
*
* Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com>
* Copyright (C) 2019 - 2026 Michael Vetter <jubalh@iodoru.org>
* Copyright (C) 2019 - 2025 Michael Vetter <jubalh@iodoru.org>
*
* This file is part of Profanity.
*
* Profanity is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Profanity is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Profanity. If not, see <https://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give permission to
* link the code of portions of this program with the OpenSSL library under
* certain conditions as described in each individual source file, and
* distribute linked combinations including the two.
*
* You must obey the GNU General Public License in all respects for all of the
* code used other than OpenSSL. If you modify file(s) with this exception, you
* may extend this exception to your version of the file(s), but you are not
* obligated to do so. If you do not wish to do so, delete this exception
* statement from your version. If you delete this exception statement from all
* source files in the program, then also delete it here.
*
* SPDX-License-Identifier: GPL-3.0-or-later WITH OpenSSL-exception
*/
#include "config.h"
@@ -48,27 +74,25 @@ typedef struct _status_bar_t
char* prompt;
char* fulljid;
GHashTable* tabs;
guint current_tab;
int current_tab;
} StatusBar;
static GTimeZone* tz;
static StatusBar* statusbar;
static WINDOW* statusbar_win;
#define CONSOLE_TAB_ID 10 // Console tab ID in status bar hash table
void _get_range_bounds(guint* start, guint* end, gboolean is_static);
static guint _status_bar_draw_time(guint pos);
static guint _status_bar_draw_maintext(guint pos);
static guint _status_bar_draw_dbbackend(guint pos);
static guint _status_bar_draw_bracket(gboolean current, guint pos, const char* ch);
static guint _status_bar_draw_extended_tabs(guint pos, gboolean prefix, guint start, guint end, gboolean is_static);
static guint _status_bar_draw_tab(StatusBarTab* tab, guint pos, guint num, gboolean include_brackets);
static guint _status_bar_draw_tabs(guint pos);
void _get_range_bounds(int* start, int* end, gboolean is_static);
static int _status_bar_draw_time(int pos);
static int _status_bar_draw_maintext(int pos);
static int _status_bar_draw_dbbackend(int pos);
static int _status_bar_draw_bracket(gboolean current, int pos, const char* ch);
static int _status_bar_draw_extended_tabs(int pos, gboolean prefix, int start, int end, gboolean is_static);
static int _status_bar_draw_tab(StatusBarTab* tab, int pos, int num, gboolean include_brackets);
static int _status_bar_draw_tabs(int pos);
static void _destroy_tab(StatusBarTab* tab);
static guint _tabs_width(guint start, guint end);
static guint _count_digits(guint number);
static guint _count_digits_in_range(guint start, guint end);
static int _tabs_width(int start, int end);
static unsigned int _count_digits(int number);
static unsigned int _count_digits_in_range(int start, int end);
static char* _display_name(StatusBarTab* tab);
static gboolean _tabmode_is_actlist(void);
@@ -77,12 +101,12 @@ status_bar_init(void)
{
tz = g_time_zone_new_local();
statusbar = g_new0(StatusBar, 1);
statusbar = malloc(sizeof(StatusBar));
statusbar->time = NULL;
statusbar->prompt = NULL;
statusbar->fulljid = NULL;
statusbar->tabs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)_destroy_tab);
StatusBarTab* console = g_new0(StatusBarTab, 1);
StatusBarTab* console = calloc(1, sizeof(StatusBarTab));
console->window_type = WIN_CONSOLE;
console->identifier = strdup("console");
console->display_name = NULL;
@@ -156,10 +180,10 @@ status_bar_set_all_inactive(void)
}
void
status_bar_current(guint i)
status_bar_current(int i)
{
if (i == 0) {
statusbar->current_tab = CONSOLE_TAB_ID;
statusbar->current_tab = 10;
} else {
statusbar->current_tab = i;
}
@@ -170,7 +194,12 @@ status_bar_current(guint i)
void
status_bar_inactive(const int win)
{
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER((win == 0) ? CONSOLE_TAB_ID : win));
int true_win = win;
if (true_win == 0) {
true_win = 10;
}
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER(true_win));
status_bar_draw();
}
@@ -178,7 +207,9 @@ status_bar_inactive(const int win)
void
_create_tab(const int win, win_type_t wintype, char* identifier, gboolean highlight)
{
StatusBarTab* tab = g_new0(StatusBarTab, 1);
int true_win = win == 0 ? 10 : win;
StatusBarTab* tab = malloc(sizeof(StatusBarTab));
tab->identifier = strdup(identifier);
tab->highlight = highlight;
tab->window_type = wintype;
@@ -207,7 +238,7 @@ _create_tab(const int win, win_type_t wintype, char* identifier, gboolean highli
}
}
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER((win == 0) ? CONSOLE_TAB_ID : win), tab);
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
status_bar_draw();
}
@@ -279,8 +310,8 @@ status_bar_draw(void)
werase(statusbar_win);
wbkgd(statusbar_win, theme_attrs(THEME_STATUS_TEXT));
guint max_tabs = prefs_get_statusbartabs();
guint pos = 1;
gint max_tabs = prefs_get_statusbartabs();
int pos = 1;
pos = _status_bar_draw_time(pos);
pos = _status_bar_draw_maintext(pos);
@@ -292,27 +323,24 @@ status_bar_draw(void)
inp_put_back();
}
static guint
_status_bar_draw_tabs(guint pos)
static int
_status_bar_draw_tabs(int pos)
{
auto_gchar gchar* tabmode = prefs_get_string(PREF_STATUSBAR_TABMODE);
if (g_strcmp0(tabmode, "actlist") != 0) {
guint start, end;
int start, end;
gboolean is_static = g_strcmp0(tabmode, "dynamic") != 0;
_get_range_bounds(&start, &end, is_static);
guint tabs_w = _tabs_width(start, end);
int max_x = getmaxx(stdscr);
if (max_x > 0 && (guint)max_x > tabs_w) {
pos = (guint)max_x - tabs_w;
} else {
pos = getmaxx(stdscr) - _tabs_width(start, end);
if (pos < 0) {
pos = 0;
}
pos = _status_bar_draw_extended_tabs(pos, TRUE, start, end, is_static);
for (guint i = start; i <= end; i++) {
for (int i = start; i <= end; i++) {
StatusBarTab* tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
if (tab) {
pos = _status_bar_draw_tab(tab, pos, i, TRUE);
@@ -360,9 +388,9 @@ _status_bar_draw_tabs(guint pos)
static gboolean
_has_new_msgs_beyond_range_on_side(gboolean left_side, int display_tabs_start, int display_tabs_end)
{
guint max_tabs = prefs_get_statusbartabs();
gint max_tabs = prefs_get_statusbartabs();
int tabs_count = g_hash_table_size(statusbar->tabs);
if ((guint)tabs_count <= max_tabs) {
if (tabs_count <= max_tabs) {
return FALSE;
}
@@ -379,10 +407,10 @@ _has_new_msgs_beyond_range_on_side(gboolean left_side, int display_tabs_start, i
return FALSE;
}
static guint
_status_bar_draw_extended_tabs(guint pos, gboolean prefix, guint start, guint end, gboolean is_static)
static int
_status_bar_draw_extended_tabs(int pos, gboolean prefix, int start, int end, gboolean is_static)
{
guint max_tabs = prefs_get_statusbartabs();
gint max_tabs = prefs_get_statusbartabs();
if (max_tabs == 0) {
return pos;
}
@@ -395,9 +423,7 @@ _status_bar_draw_extended_tabs(guint pos, gboolean prefix, guint start, guint en
if (prefix && start < 2) {
return pos;
}
// Guard against underflow when opened_tabs == 0 (reachable if the
// earlier `opened_tabs <= max_tabs` early-return no longer holds).
if (!prefix && end >= opened_tabs) {
if (!prefix && end > opened_tabs - 1) {
return pos;
}
gboolean is_current = is_static && statusbar->current_tab > max_tabs;
@@ -423,8 +449,8 @@ _status_bar_draw_extended_tabs(guint pos, gboolean prefix, guint start, guint en
return pos;
}
static guint
_status_bar_draw_tab(StatusBarTab* tab, guint pos, guint num, gboolean include_brackets)
static int
_status_bar_draw_tab(StatusBarTab* tab, int pos, int num, gboolean include_brackets)
{
gboolean is_current = num == statusbar->current_tab;
@@ -472,8 +498,8 @@ _status_bar_draw_tab(StatusBarTab* tab, guint pos, guint num, gboolean include_b
return pos;
}
static guint
_status_bar_draw_bracket(gboolean current, guint pos, const char* ch)
static int
_status_bar_draw_bracket(gboolean current, int pos, const char* ch)
{
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
wattron(statusbar_win, bracket_attrs);
@@ -488,8 +514,8 @@ _status_bar_draw_bracket(gboolean current, guint pos, const char* ch)
return pos;
}
static guint
_status_bar_draw_time(guint pos)
static int
_status_bar_draw_time(int pos)
{
auto_gchar gchar* time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
if (g_strcmp0(time_pref, "off") == 0) {
@@ -509,7 +535,7 @@ _status_bar_draw_time(guint pos)
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
int time_attrs = theme_attrs(THEME_STATUS_TIME);
guint len = (guint)strlen(statusbar->time);
size_t len = strlen(statusbar->time);
wattron(statusbar_win, bracket_attrs);
mvwaddch(statusbar_win, 0, pos, '[');
pos++;
@@ -533,8 +559,8 @@ _tabmode_is_actlist(void)
return g_strcmp0(tabmode, "actlist") == 0;
}
static guint
_status_bar_draw_maintext(guint pos)
static int
_status_bar_draw_maintext(int pos)
{
const char* maintext = NULL;
auto_jid Jid* jidp = NULL;
@@ -580,8 +606,8 @@ _status_bar_draw_maintext(guint pos)
return pos;
}
static guint
_status_bar_draw_dbbackend(guint pos)
static int
_status_bar_draw_dbbackend(int pos)
{
if (!prefs_get_boolean(PREF_STATUSBAR_SHOW_DBBACKEND))
return pos;
@@ -607,20 +633,20 @@ _destroy_tab(StatusBarTab* tab)
}
}
static guint
_tabs_width(guint start, guint end)
static int
_tabs_width(int start, int end)
{
gboolean show_number = prefs_get_boolean(PREF_STATUSBAR_SHOW_NUMBER);
gboolean show_name = prefs_get_boolean(PREF_STATUSBAR_SHOW_NAME);
gboolean show_read = prefs_get_boolean(PREF_STATUSBAR_SHOW_READ);
guint max_tabs = prefs_get_statusbartabs();
gint max_tabs = prefs_get_statusbartabs();
guint opened_tabs = g_hash_table_size(statusbar->tabs);
int width = start < 2 ? 1 : 4;
width += (end < opened_tabs) ? 3 : 0;
width += end > opened_tabs - 1 ? 0 : 3;
if (show_name && show_number) {
for (guint i = start; i <= end; i++) {
for (int i = start; i <= end; i++) {
StatusBarTab* tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
if (tab) {
gboolean is_current = i == statusbar->current_tab;
@@ -637,7 +663,7 @@ _tabs_width(guint start, guint end)
}
if (show_name && !show_number) {
for (guint i = start; i <= end; i++) {
for (int i = start; i <= end; i++) {
StatusBarTab* tab = g_hash_table_lookup(statusbar->tabs, GINT_TO_POINTER(i));
if (tab) {
gboolean is_current = i == statusbar->current_tab;
@@ -713,7 +739,7 @@ _display_name(StatusBarTab* tab)
}
void
_get_range_bounds(guint* start, guint* end, gboolean is_static)
_get_range_bounds(int* start, int* end, gboolean is_static)
{
int current_tab = statusbar->current_tab;
gint display_range = prefs_get_statusbartabs();
@@ -736,10 +762,12 @@ _get_range_bounds(guint* start, guint* end, gboolean is_static)
}
// Counts amount of digits in a number
static guint
_count_digits(guint number)
static unsigned int
_count_digits(int number)
{
guint digits_count = 0;
unsigned int digits_count = 0;
if (number < 0)
number = -number;
do {
number /= 10;
@@ -751,11 +779,12 @@ _count_digits(guint number)
// Counts the total number of digits in a range of numbers, inclusive.
// Example: _count_digits_in_range(2, 3) returns 2, _count_digits_in_range(2, 922) returns 2657
static guint
_count_digits_in_range(guint start, guint end)
static unsigned int
_count_digits_in_range(int start, int end)
{
guint total_digits = 0;
for (guint i = start; i <= end; i++) {
int total_digits = 0;
for (int i = start; i <= end; i++) {
total_digits += _count_digits(i);
}