# hook to show extra stuff from signature
#
# signature: the key stuff is status, summary, validity and validity_reason
#
# status - used by sup for default output
# summary - bit vector giving a summary of the signature status
# validity - 
# validity_reason - 
#
# from_key: the key used to generate the signature
#
#

#debug "sig fpr is #{signature.fingerprint}"

#from_key.subkeys.each {|sk| debug "subkey: keyid #{sk.keyid} fpr: #{sk.fpr}" }

extra_lines = []

if (signature.summary & GPGME::GPGME_SIGSUM_VALID) != 0
  case signature.validity
  when GPGME::GPGME_VALIDITY_FULL
    extra_lines << "Valid signature from a fully trusted key"
  when GPGME::GPGME_VALIDITY_MARGINAL
    extra_lines << "Valid signature from a marginally trusted key"
  end
elsif (signature.summary & GPGME::GPGME_SIGSUM_GREEN) != 0
  # signature is mostly good ...
  # could be sig expired or key expired
elsif (signature.summary & GPGME::GPGME_SIGSUM_RED) != 0
  # signature is mostly bad ...
  case signature.validity
  when GPGME::GPGME_VALIDITY_NEVER
    extra_lines << "Signature from a key that is never trusted"
  end
  # could be bad signature
else
  # unknown
  extra_lines << "GPG cannot tell whether this signature is valid"
end
