All checks were successful
CI Code / Check spelling (pull_request) Successful in 17s
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Code Coverage (pull_request) Successful in 3m41s
CI Code / Linux (debian) (pull_request) Successful in 5m15s
CI Code / Linux (ubuntu) (pull_request) Successful in 5m21s
CI Code / Linux (arch) (pull_request) Successful in 13m55s
CI Code / Check spelling (push) Successful in 1m24s
CI Code / Check coding style (push) Successful in 1m38s
CI Code / Linux (arch) (push) Successful in 7m14s
CI Code / Linux (debian) (push) Successful in 8m27s
CI Code / Linux (ubuntu) (push) Successful in 8m29s
CI Code / Code Coverage (push) Successful in 7m50s
Block all three code paths in message_send_chat_pgp that previously fell back to sending unencrypted messages: encryption failure, missing PGP key, and missing LibGPGME. Each path now shows a specific error in the chat window and returns NULL so the caller skips logging and display. Also replace the generic cons_show for OX signcrypt failure with a win_println on the current window, ensuring the user sees the error even when the chat window is not focused. Improve p_gpg_encrypt error reporting by adding a gchar** err out-parameter. Each failure path now sets a descriptive message (e.g. missing recipient key, missing sender key, GPGME context failure, encryption failure) so the caller can display the exact reason to the user. Fix a memory leak: gpgme_key_unref(receiver_key) was missing from the sender_key failure path.
59 lines
1.7 KiB
C
59 lines
1.7 KiB
C
/*
|
|
* gpg.h
|
|
* vim: expandtab:ts=4:sts=4:sw=4
|
|
*
|
|
* Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later WITH OpenSSL-exception
|
|
*/
|
|
|
|
#ifndef PGP_GPG_H
|
|
#define PGP_GPG_H
|
|
|
|
#include "glib.h"
|
|
|
|
typedef struct pgp_key_t
|
|
{
|
|
gchar* id;
|
|
gchar* name;
|
|
gchar* fp;
|
|
gboolean encrypt;
|
|
gboolean sign;
|
|
gboolean certify;
|
|
gboolean authenticate;
|
|
gboolean secret;
|
|
} ProfPGPKey;
|
|
|
|
typedef struct pgp_pubkeyid_t
|
|
{
|
|
gchar* id;
|
|
gboolean received;
|
|
} ProfPGPPubKeyId;
|
|
|
|
void p_gpg_init(void);
|
|
void p_gpg_on_connect(const gchar* const barejid);
|
|
void p_gpg_on_disconnect(void);
|
|
GHashTable* p_gpg_list_keys(void);
|
|
void p_gpg_free_keys(GHashTable* keys);
|
|
gboolean p_gpg_addkey(const gchar* const jid, const gchar* const keyid);
|
|
GHashTable* p_gpg_pubkeys(void);
|
|
gboolean p_gpg_valid_key(const gchar* const keyid, gchar** err_str);
|
|
gboolean p_gpg_available(const gchar* const barejid);
|
|
const gchar* p_gpg_libver(void);
|
|
gchar* p_gpg_sign(const gchar* const str, const gchar* const fp);
|
|
void p_gpg_verify(const gchar* const barejid, const gchar* const sign);
|
|
gchar* p_gpg_encrypt(const gchar* const barejid, const gchar* const message, const gchar* const fp, gchar** err);
|
|
gchar* p_gpg_decrypt(const gchar* const cipher);
|
|
void p_gpg_free_decrypted(gchar* decrypted);
|
|
gchar* p_gpg_autocomplete_key(const gchar* const search_str, gboolean previous, void* context);
|
|
void p_gpg_autocomplete_key_reset(void);
|
|
gchar* p_gpg_format_fp_str(gchar* fp);
|
|
gchar* p_gpg_get_pubkey(const gchar* const keyid);
|
|
gboolean p_gpg_is_public_key_format(const gchar* buffer);
|
|
ProfPGPKey* p_gpg_import_pubkey(const gchar* buffer);
|
|
|
|
ProfPGPKey* p_gpg_key_new(void);
|
|
void p_gpg_free_key(ProfPGPKey* key);
|
|
|
|
#endif
|