PGP: Show key IDs for assigned public keys

This commit is contained in:
James Booth
2015-08-25 22:45:51 +01:00
parent 592a3695a5
commit fc1ee79190
5 changed files with 73 additions and 73 deletions

View File

@@ -1146,7 +1146,7 @@ static struct cmd_t command_defs[] =
CMD_SYN(
"/pgp libver",
"/pgp keys",
"/pgp fps",
"/pgp contacts",
"/pgp setkey <contact> <keyid>",
"/pgp start [<contact>]",
"/pgp end",
@@ -1156,8 +1156,8 @@ static struct cmd_t command_defs[] =
"See the /account command to set your own PGP key.")
CMD_ARGS(
{ "libver", "Show which version of the libgpgme library is being used." },
{ "keys", "List all keys." },
{ "fps", "Show known fingerprints." },
{ "keys", "List all keys known to the system." },
{ "contacts", "Show contacts with assigned public keys." },
{ "setkey <contact> <keyid>", "Manually associate a key ID with a JID." },
{ "start [<contact>]", "Start PGP encrypted chat, current contact will be used if not specified." },
{ "end", "End PGP encrypted chat with the current recipient." },
@@ -2053,7 +2053,7 @@ cmd_init(void)
pgp_ac = autocomplete_new();
autocomplete_add(pgp_ac, "keys");
autocomplete_add(pgp_ac, "fps");
autocomplete_add(pgp_ac, "contacts");
autocomplete_add(pgp_ac, "setkey");
autocomplete_add(pgp_ac, "libver");
autocomplete_add(pgp_ac, "start");

View File

@@ -4270,25 +4270,25 @@ cmd_pgp(ProfWin *window, const char * const command, gchar **args)
return TRUE;
}
if (g_strcmp0(args[0], "fps") == 0) {
if (g_strcmp0(args[0], "contacts") == 0) {
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
GHashTable *fingerprints = p_gpg_fingerprints();
GList *jids = g_hash_table_get_keys(fingerprints);
GHashTable *pubkeys = p_gpg_pubkeys();
GList *jids = g_hash_table_get_keys(pubkeys);
if (!jids) {
cons_show("No PGP fingerprints available.");
cons_show("No contacts found with PGP public keys assigned.");
return TRUE;
}
cons_show("Known PGP fingerprints:");
cons_show("Assigned PGP public keys:");
GList *curr = jids;
while (curr) {
char *jid = curr->data;
char *fingerprint = g_hash_table_lookup(fingerprints, jid);
cons_show(" %s: %s", jid, fingerprint);
char *pubkey = g_hash_table_lookup(pubkeys, jid);
cons_show(" %s: %s", jid, pubkey);
curr = g_list_next(curr);
}
g_list_free(jids);