1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

OX bug fixing

* Don't decryption if there is no private key
 * Decryption error messages
This commit is contained in:
DebXWoody 2021-06-29 20:25:50 +02:00
parent 2a011e69ac
commit 6173e015f5
No known key found for this signature in database
GPG Key ID: CBD1B596579B7FFF
2 changed files with 12 additions and 6 deletions

View File

@ -1141,6 +1141,11 @@ _ox_key_is_usable(gpgme_key_t key, const char* const barejid, gboolean secret)
char*
p_ox_gpg_decrypt(char* base64)
{
// if there is no private key avaibale,
// we don't try do decrypt
if(!ox_is_private_key_available(connection_get_barejid())) {
return NULL;
}
setlocale(LC_ALL, "");
gpgme_check_version(NULL);
gpgme_set_locale(NULL, LC_CTYPE, setlocale(LC_CTYPE, NULL));

View File

@ -1463,28 +1463,29 @@ _handle_ox_chat(xmpp_stanza_t* const stanza, ProfMessage* message, gboolean is_m
xmpp_stanza_t *p = xmpp_stanza_get_child_by_name(x, "payload");
if ( !p ) {
log_warning("OX Stanza - no Payload");
message->plain = "OX error: No payload found";
return;
}
xmpp_stanza_t *b = xmpp_stanza_get_child_by_name(p, "body");
if ( !b ) {
log_warning("OX Stanza - no body");
message->plain = "OX error: No paylod body found";
return;
}
message->plain = xmpp_stanza_get_text(b);
message->encrypted = xmpp_stanza_get_text(ox);
if(message->plain == NULL ) {
message->plain = xmpp_stanza_get_text(stanza);
}
message->encrypted = xmpp_stanza_get_text(ox);
if (message->plain == NULL) {
message->plain = xmpp_stanza_get_text(stanza);
}
message->encrypted = xmpp_stanza_get_text(ox);
} else {
message->plain = "Unable to decrypt OX message (XEP-0373: OpenPGP for XMPP)";
log_warning("OX Stanza text to stanza failed");
}
} else {
message->plain = "Unable to decrypt OX message (XEP-0373: OpenPGP for XMPP)";
}
} else {
message->plain = "OX stanza without openpgp name";
log_warning("OX Stanza without openpgp stanza");
}
#endif // HAVE_LIBGPGME