aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Matrix.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 38ab6d0..2452548 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -80,6 +80,7 @@ namespace QuickMedia {
enum class GpgLineType {
UID,
FPR,
+ SUB,
UNKNOWN
};
@@ -120,6 +121,7 @@ namespace QuickMedia {
}
std::string_view fpr;
+ std::string_view name_and_email;
string_split(output, '\n', [&](const char *str, size_t size) {
GpgLineType line_type = GpgLineType::UNKNOWN;
int column = 0;
@@ -132,20 +134,24 @@ namespace QuickMedia {
line_type = GpgLineType::UID;
else if(section == "fpr")
line_type = GpgLineType::FPR;
+ else if(section == "sub")
+ line_type = GpgLineType::SUB;
} else if(column == 1) {
- if(line_type == GpgLineType::UID)
- invalid_signature = (section == "e" || section == "r"); // Expired or revoked
- } else if(column == 9) {
- if(line_type == GpgLineType::UID && !invalid_signature) {
- // Assumes that each uid is preceeded with fpr
- const std::string user_email = std::string(gpg_display_name_extract_email(section));
+ if(line_type == GpgLineType::UID || line_type == GpgLineType::SUB)
+ invalid_signature |= (section == "e" || section == "r"); // Expired or revoked
+
+ if(line_type == GpgLineType::SUB && !invalid_signature) {
+ const std::string user_email = std::string(gpg_display_name_extract_email(name_and_email));
if(!user_email.empty() && users_by_email.find(user_email) != users_by_email.end()) {
fprintf(stderr, "found public key %.*s for user %s\n", (int)fpr.size(), fpr.data(), user_email.c_str());
callback(fpr);
}
- } else if(line_type == GpgLineType::FPR) {
- fpr = section;
}
+ } else if(column == 9) {
+ if(line_type == GpgLineType::UID)
+ name_and_email = section;
+ else if(line_type == GpgLineType::FPR)
+ fpr = section;
}
++column;