Merge upstream/master into merge/upstream-full
All checks were successful
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Check spelling (pull_request) Successful in 15s
CI Code / Linux (debian) (pull_request) Successful in 6m43s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m49s
CI Code / Linux (arch) (pull_request) Successful in 8m52s
CI Code / Code Coverage (pull_request) Successful in 7m19s
All checks were successful
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Check spelling (pull_request) Successful in 15s
CI Code / Linux (debian) (pull_request) Successful in 6m43s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m49s
CI Code / Linux (arch) (pull_request) Successful in 8m52s
CI Code / Code Coverage (pull_request) Successful in 7m19s
Merge profanity-im/profanity master (373 commits) into cproof fork.
Source changes (manual merge):
- src/command/: cmd_defs, cmd_funcs, cmd_ac — upstream g_new0, auto_gchar,
launch_editor callback; keep our XEP-0308 LMC, force-encryption, CWE-134
- src/config/: preferences, tlscerts, account — upstream UNIQUE dedup,
dynamic pad capacity; keep our db_history_result_t, scroll logic
- src/database.*: upstream g_new0 memory mgmt; keep our return types,
add null-check fix for msg->timestamp
- src/omemo/, src/pgp/: upstream _gpgme_key_get_email, g_new0;
keep our replace_id in omemo_on_message_send
- src/tools/: editor, http_upload, bookmark_ignore — upstream launch_editor
callback API
- src/ui/: console, window, chatwin, mucwin, inputwin, buffer —
upstream win_warn_needed/sent dedup, PAD_MIN_HEIGHT dynamic pads;
keep our y_start_pos scroll, _truncate_datetime_suffix
- src/xmpp/: message, stanza, presence, roster_list, iq, session —
upstream connection_get_available_resources; keep our LMC stanza logic
- src/common.c: fix format-security (cons_show)
Build system:
- Makefile.am: updated test paths to subdirectory structure, added
test_cmd_ac, test_forced_encryption
- Restored autotools files deleted by upstream meson migration:
bootstrap.sh, autogen.sh, m4/ax_valgrind_check.m4, configure-debug
Tests:
- Unit tests: upstream unittests.c base + our forced_encryption tests
(482 passed, 0 failed across all 4 configurations)
- Functional tests: kept our version (93 passed, 0 failed)
upstream version requires stbbr_for_xmlns not yet in our stabber fork
- Updated test stubs: stub_xmpp.c, stub_omemo.c from upstream
Compile fixes:
- src/common.c: cons_show(errmsg) -> cons_show("%s", errmsg)
- src/database.c: null-check before msg->timestamp access
- src/ui/console.c: size_t -> (int) cast for format width
- src/config/tlscerts.c: %d -> %zu for size_t
This commit is contained in:
@@ -3,35 +3,9 @@
|
||||
* vim: expandtab:ts=4:sts=4:sw=4
|
||||
*
|
||||
* Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com>
|
||||
* 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.
|
||||
* Copyright (C) 2019 - 2026 Michael Vetter <jubalh@iodoru.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later WITH OpenSSL-exception
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -102,7 +76,7 @@ gchar*
|
||||
get_display_name(const ProfMessage* const message, int* flags)
|
||||
{
|
||||
if (equals_our_barejid(message->from_jid->barejid)) {
|
||||
return g_strdup("me");
|
||||
return prefs_get_string(PREF_OUTGOING_STAMP);
|
||||
} else {
|
||||
if (flags)
|
||||
*flags = NO_ME;
|
||||
@@ -353,9 +327,10 @@ message_handlers_init(void)
|
||||
ProfMessage*
|
||||
message_init(void)
|
||||
{
|
||||
ProfMessage* message = calloc(1, sizeof(ProfMessage));
|
||||
ProfMessage* message = g_new0(ProfMessage, 1);
|
||||
|
||||
message->enc = PROF_MSG_ENC_NONE;
|
||||
message->omemo_err = OMEMO_ERR_NONE;
|
||||
message->trusted = true;
|
||||
message->type = PROF_MSG_TYPE_UNINITIALIZED;
|
||||
|
||||
@@ -420,7 +395,7 @@ message_handlers_clear(void)
|
||||
void
|
||||
message_pubsub_event_handler_add(const char* const node, ProfMessageCallback func, ProfMessageFreeCallback free_func, void* userdata)
|
||||
{
|
||||
ProfMessageHandler* handler = malloc(sizeof(ProfMessageHandler));
|
||||
ProfMessageHandler* handler = g_new(ProfMessageHandler, 1);
|
||||
handler->func = func;
|
||||
handler->free_func = free_func;
|
||||
handler->userdata = userdata;
|
||||
@@ -476,7 +451,7 @@ message_send_chat_pgp(const char* const barejid, const char* const msg, gboolean
|
||||
ProfAccount* account = accounts_get_account(session_get_account_name());
|
||||
if (account->pgp_keyid) {
|
||||
auto_jid Jid* jidp = jid_create(jid);
|
||||
auto_char char* encrypted = p_gpg_encrypt(jidp->barejid, msg, account->pgp_keyid);
|
||||
auto_gchar gchar* encrypted = p_gpg_encrypt(jidp->barejid, msg, account->pgp_keyid);
|
||||
if (encrypted) {
|
||||
message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id);
|
||||
xmpp_message_set_body(message, "This message is encrypted (XEP-0027).");
|
||||
@@ -1092,9 +1067,12 @@ _handle_groupchat(xmpp_stanza_t* const stanza)
|
||||
char* stanzaid = NULL;
|
||||
xmpp_stanza_t* stanzaidst = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_STANZA_ID, STANZA_NS_STABLE_ID);
|
||||
if (stanzaidst) {
|
||||
stanzaid = (char*)xmpp_stanza_get_attribute(stanzaidst, STANZA_ATTR_ID);
|
||||
if (stanzaid) {
|
||||
message->stanzaid = strdup(stanzaid);
|
||||
const char* by = xmpp_stanza_get_attribute(stanzaidst, "by");
|
||||
if (by && (g_strcmp0(by, from_jid->barejid) == 0)) {
|
||||
stanzaid = (char*)xmpp_stanza_get_attribute(stanzaidst, STANZA_ATTR_ID);
|
||||
if (stanzaid) {
|
||||
message->stanzaid = strdup(stanzaid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,8 +1088,13 @@ _handle_groupchat(xmpp_stanza_t* const stanza)
|
||||
|
||||
// check omemo encryption
|
||||
#ifdef HAVE_OMEMO
|
||||
message->plain = omemo_receive_message(stanza, &message->trusted);
|
||||
if (message->plain != NULL) {
|
||||
message->plain = omemo_receive_message(stanza, &message->trusted, &message->omemo_err);
|
||||
if (message->omemo_err != OMEMO_ERR_NONE) {
|
||||
message->enc = PROF_MSG_ENC_OMEMO;
|
||||
if (message->plain == NULL) {
|
||||
message->plain = omemo_error_to_string(message->omemo_err);
|
||||
}
|
||||
} else if (message->plain != NULL) {
|
||||
message->enc = PROF_MSG_ENC_OMEMO;
|
||||
}
|
||||
#endif
|
||||
@@ -1270,8 +1253,13 @@ _handle_muc_private_message(xmpp_stanza_t* const stanza)
|
||||
|
||||
// check omemo encryption
|
||||
#ifdef HAVE_OMEMO
|
||||
message->plain = omemo_receive_message(stanza, &message->trusted);
|
||||
if (message->plain != NULL) {
|
||||
message->plain = omemo_receive_message(stanza, &message->trusted, &message->omemo_err);
|
||||
if (message->omemo_err != OMEMO_ERR_NONE) {
|
||||
message->enc = PROF_MSG_ENC_OMEMO;
|
||||
if (message->plain == NULL) {
|
||||
message->plain = omemo_error_to_string(message->omemo_err);
|
||||
}
|
||||
} else if (message->plain != NULL) {
|
||||
message->enc = PROF_MSG_ENC_OMEMO;
|
||||
}
|
||||
#endif
|
||||
@@ -1404,9 +1392,12 @@ _handle_chat(xmpp_stanza_t* const stanza, gboolean is_mam, gboolean is_carbon, c
|
||||
char* stanzaid = NULL;
|
||||
xmpp_stanza_t* stanzaidst = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_STANZA_ID, STANZA_NS_STABLE_ID);
|
||||
if (stanzaidst) {
|
||||
stanzaid = (char*)xmpp_stanza_get_attribute(stanzaidst, STANZA_ATTR_ID);
|
||||
if (stanzaid) {
|
||||
message->stanzaid = strdup(stanzaid);
|
||||
const char* by = xmpp_stanza_get_attribute(stanzaidst, "by");
|
||||
if (by && equals_our_barejid(by)) {
|
||||
stanzaid = (char*)xmpp_stanza_get_attribute(stanzaidst, STANZA_ATTR_ID);
|
||||
if (stanzaid) {
|
||||
message->stanzaid = strdup(stanzaid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1437,8 +1428,13 @@ _handle_chat(xmpp_stanza_t* const stanza, gboolean is_mam, gboolean is_carbon, c
|
||||
|
||||
#ifdef HAVE_OMEMO
|
||||
// check omemo encryption
|
||||
message->plain = omemo_receive_message(stanza, &message->trusted);
|
||||
if (message->plain != NULL) {
|
||||
message->plain = omemo_receive_message(stanza, &message->trusted, &message->omemo_err);
|
||||
if (message->omemo_err != OMEMO_ERR_NONE) {
|
||||
message->enc = PROF_MSG_ENC_OMEMO;
|
||||
if (message->plain == NULL) {
|
||||
message->plain = omemo_error_to_string(message->omemo_err);
|
||||
}
|
||||
} else if (message->plain != NULL) {
|
||||
message->enc = PROF_MSG_ENC_OMEMO;
|
||||
}
|
||||
#endif
|
||||
@@ -1534,6 +1530,20 @@ _handle_mam(xmpp_stanza_t* const stanza)
|
||||
|
||||
// <result xmlns='urn:xmpp:mam:2' queryid='f27' id='5d398-28273-f7382'>
|
||||
// same as <stanza-id> from XEP-0359 for live messages
|
||||
const char* by = xmpp_stanza_get_attribute(result, "by");
|
||||
const char* from = xmpp_stanza_get_from(stanza);
|
||||
if (by) {
|
||||
if (g_strcmp0(by, from) != 0) {
|
||||
log_warning("MAM result 'by' attribute (%s) does not match 'from' (%s)", by, from);
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
if (from && !equals_our_barejid(from)) {
|
||||
log_warning("MAM result from %s with no 'by' attribute (expected our own JID)", from);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
const char* result_id = xmpp_stanza_get_id(result);
|
||||
|
||||
GDateTime* timestamp = stanza_get_delay_from(forwarded, NULL);
|
||||
|
||||
Reference in New Issue
Block a user