diff options
Diffstat (limited to '')
-rw-r--r-- | src/gpg/result_analyse/SignResultAnalyse.cpp | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/src/gpg/result_analyse/SignResultAnalyse.cpp b/src/gpg/result_analyse/SignResultAnalyse.cpp index eda95ff1..15d6ddf5 100644 --- a/src/gpg/result_analyse/SignResultAnalyse.cpp +++ b/src/gpg/result_analyse/SignResultAnalyse.cpp @@ -26,53 +26,56 @@ SignResultAnalyse::SignResultAnalyse(gpgme_error_t error, gpgme_sign_result_t result) { - if(result == nullptr) { - return; - } - stream << "# Sign Report: " << endl << "-----" << endl; stream << "Status: " << gpgme_strerror(error) << endl << endl; - auto new_sign = result->signatures; + if(gpg_err_code(error) != GPG_ERR_NO_ERROR) { + setStatus(-1); + } - while(new_sign != nullptr) { - stream << "> A New Signature: " << endl; + if(result != nullptr) { - stream << "Sign mode: "; - if(new_sign->type == GPGME_SIG_MODE_NORMAL) - stream << "Normal"; - else if(new_sign->type == GPGME_SIG_MODE_CLEAR) - stream << "Clear"; - else if(new_sign->type == GPGME_SIG_MODE_DETACH) - stream << "Detach"; + auto new_sign = result->signatures; - stream << endl; + while (new_sign != nullptr) { + stream << "> A New Signature: " << endl; - stream << "Public key algo: " << gpgme_pubkey_algo_name(new_sign->pubkey_algo) << endl; - stream << "Hash algo: " << gpgme_hash_algo_name(new_sign->hash_algo) << endl; - stream << "Date of signature: " << QDateTime::fromTime_t(new_sign->timestamp).toString() << endl; + stream << "Sign mode: "; + if (new_sign->type == GPGME_SIG_MODE_NORMAL) + stream << "Normal"; + else if (new_sign->type == GPGME_SIG_MODE_CLEAR) + stream << "Clear"; + else if (new_sign->type == GPGME_SIG_MODE_DETACH) + stream << "Detach"; - stream << endl; + stream << endl; - new_sign = new_sign->next; - } + stream << "Public key algo: " << gpgme_pubkey_algo_name(new_sign->pubkey_algo) << endl; + stream << "Hash algo: " << gpgme_hash_algo_name(new_sign->hash_algo) << endl; + stream << "Date of signature: " << QDateTime::fromTime_t(new_sign->timestamp).toString() << endl; + + stream << endl; + + new_sign = new_sign->next; + } + + auto invalid_signer = result->invalid_signers; - auto invalid_signer = result->invalid_signers; + if (invalid_signer != nullptr) + stream << "Invalid Signers: " << endl; - if(invalid_signer!= nullptr) - stream << "Invalid Signers: " << endl; + while (invalid_signer != nullptr) { + setStatus(0); + stream << "Fingerprint: " << invalid_signer->fpr << endl; + stream << "Reason: " << gpgme_strerror(invalid_signer->reason) << endl; + stream << endl; - while(invalid_signer != nullptr) { - setStatus(0); - stream << "Fingerprint: " << invalid_signer->fpr << endl; - stream << "Reason: " << gpgme_strerror(invalid_signer->reason) << endl; - stream << endl; + invalid_signer = invalid_signer->next; + } - invalid_signer = invalid_signer->next; } - stream << "-----" << endl; - stream << endl; + stream << "-----" << endl << endl; } |