diff options
author | James Booth <boothj5@gmail.com> | 2013-09-21 22:33:43 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-11-08 00:17:27 +0000 |
commit | d9395daa2fdb312ae454d4a10f4e6f31ab71917c (patch) | |
tree | 5a87fb175447a9dddb0555ba5a4a925f63936002 /src | |
parent | 599bee2ce8ddc7974dc4e0592e0c84f9b243a007 (diff) | |
download | profani-tty-d9395daa2fdb312ae454d4a10f4e6f31ab71917c.tar.gz |
Added /otr command
Diffstat (limited to 'src')
-rw-r--r-- | src/command/command.c | 32 | ||||
-rw-r--r-- | src/profanity.c | 3 |
2 files changed, 32 insertions, 3 deletions
diff --git a/src/command/command.c b/src/command/command.c index 7a74f394..3828ddcf 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -129,6 +129,7 @@ static gboolean _cmd_nick(gchar **args, struct cmd_help_t help); static gboolean _cmd_notify(gchar **args, struct cmd_help_t help); static gboolean _cmd_online(gchar **args, struct cmd_help_t help); static gboolean _cmd_outtype(gchar **args, struct cmd_help_t help); +static gboolean _cmd_otr(gchar **args, struct cmd_help_t help); static gboolean _cmd_prefs(gchar **args, struct cmd_help_t help); static gboolean _cmd_priority(gchar **args, struct cmd_help_t help); static gboolean _cmd_quit(gchar **args, struct cmd_help_t help); @@ -651,6 +652,14 @@ static struct cmd_t command_defs[] = "Such as whether you have become inactive, or have closed the chat window.", NULL } } }, + { "/otr", + _cmd_otr, parse_args, 1, 2, NULL, + { "/otr gen|start|end|trust|untrust [contact]", "Off The Record encryption commands.", + { "/otr gen|start|end|trust|untrust [contact]", + "-----------------------------------------", + "gen - Load or create private key and fingerprints.", + NULL } } }, + { "/outtype", _cmd_outtype, parse_args, 1, 1, cons_outtype_setting, { "/outtype on|off", "Send typing notification to recipient.", @@ -3207,6 +3216,29 @@ _cmd_outtype(gchar **args, struct cmd_help_t help) } static gboolean +_cmd_otr(gchar **args, struct cmd_help_t help) +{ +#ifdef HAVE_LIBOTR + if (strcmp(args[0], "gen") == 0) { + if (jabber_get_connection_status() != JABBER_CONNECTED) { + cons_show("You must be connected with an account to load OTR information."); + return TRUE; + } else { + ProfAccount *account = accounts_get_account(jabber_get_account_name()); + otr_account_load(account); + return TRUE; + } + } else { + cons_show("Usage: %s", help.usage); + return TRUE; + } +#else + cons_show("This version of Profanity has not been build with OTR support enabled"); + return TRUE; +#endif +} + +static gboolean _cmd_gone(gchar **args, struct cmd_help_t help) { char *value = args[0]; diff --git a/src/profanity.c b/src/profanity.c index 09bd77d8..913f3350 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -261,9 +261,6 @@ void prof_handle_login_account_success(char *account_name) { ProfAccount *account = accounts_get_account(account_name); -#ifdef HAVE_LIBOTR - otr_account_load(account); -#endif resource_presence_t resource_presence = accounts_get_login_presence(account->name); contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence); cons_show_login_success(account); |