aboutsummaryrefslogtreecommitdiffstats
path: root/otr.c
diff options
context:
space:
mode:
Diffstat (limited to 'otr.c')
-rw-r--r--otr.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/otr.c b/otr.c
index 4d465e71..d69dffaf 100644
--- a/otr.c
+++ b/otr.c
@@ -126,6 +126,7 @@ void myfgets(char *s, int size, FILE *stream);
void yes_keygen(gpointer w, void *data);
void yes_forget_fingerprint(gpointer w, void *data);
void yes_forget_context(gpointer w, void *data);
+void yes_forget_key(gpointer w, void *data);
/* helper to make sure accountname and protocol match the incoming "opdata" */
struct im_connection *check_imc(void *opdata, const char *accountname,
@@ -898,6 +899,13 @@ void yes_forget_context(gpointer w, void *data)
otrl_context_forget(ctx);
}
+void yes_forget_key(gpointer w, void *data)
+{
+ OtrlPrivKey *key = (OtrlPrivKey *)data;
+
+ otrl_privkey_forget(key);
+}
+
void cmd_otr_forget(irc_t *irc, char **args)
{
if(!strcmp(args[1], "fingerprint"))
@@ -974,6 +982,23 @@ void cmd_otr_forget(irc_t *irc, char **args)
g_free(s);
}
+ else if(!strcmp(args[1], "key"))
+ {
+ OtrlPrivKey *key;
+ char *s;
+
+ key = match_privkey(irc, ((const char **)args)+2);
+ if(!key) {
+ /* match_privkey does error messages */
+ return;
+ }
+
+ s = g_strdup_printf("about to forget the private key for %s/%s, are you sure?",
+ key->accountname, key->protocol);
+ query_add(irc, NULL, s, yes_forget_key, NULL, key);
+ g_free(s);
+ }
+
else
{
irc_usermsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02",