aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-06-13 01:19:56 +0100
committerJames Booth <boothj5@gmail.com>2015-06-13 01:19:56 +0100
commit698288ab5cc7ae5c81770b76d3dcb15ae45f7739 (patch)
treea70f9e63c516f37791be800d72ac4e6456bdaf90 /src
parenta408ca7326ee4e0b4e0539ce8cf37dfa02a7a6b3 (diff)
downloadprofani-tty-698288ab5cc7ae5c81770b76d3dcb15ae45f7739.tar.gz
Show message when offline for /pgp fps
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 7e2294a0..5f24d33e 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -4100,21 +4100,26 @@ cmd_pgp(gchar **args, struct cmd_help_t help)
}
g_slist_free_full(keys, (GDestroyNotify)p_gpg_free_key);
} else if (g_strcmp0(args[0], "fps") == 0) {
- GHashTable *fingerprints = p_gpg_fingerprints();
- GList *jids = g_hash_table_get_keys(fingerprints);
- if (jids) {
- cons_show("Received PGP fingerprints:");
- GList *curr = jids;
- while (curr) {
- char *jid = curr->data;
- char *fingerprint = g_hash_table_lookup(fingerprints, jid);
- cons_show(" %s: %s", jid, fingerprint);
- curr = g_list_next(curr);
- }
+ jabber_conn_status_t conn_status = jabber_get_connection_status();
+ if (conn_status != JABBER_CONNECTED) {
+ cons_show("You are not currently connected.");
} else {
- cons_show("No PGP fingerprints received.");
+ GHashTable *fingerprints = p_gpg_fingerprints();
+ GList *jids = g_hash_table_get_keys(fingerprints);
+ if (jids) {
+ cons_show("Received PGP fingerprints:");
+ GList *curr = jids;
+ while (curr) {
+ char *jid = curr->data;
+ char *fingerprint = g_hash_table_lookup(fingerprints, jid);
+ cons_show(" %s: %s", jid, fingerprint);
+ curr = g_list_next(curr);
+ }
+ } else {
+ cons_show("No PGP fingerprints received.");
+ }
+ g_list_free(jids);
}
- g_list_free(jids);
} else if (g_strcmp0(args[0], "libver") == 0) {
const char *libver = p_gpg_libver();
if (libver) {