diff options
| -rw-r--r-- | doc/user-guide/commands.xml | 15 | ||||
| -rw-r--r-- | otr.c | 25 | 
2 files changed, 39 insertions, 1 deletions
| diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index 2d6b866d..8c2a30ca 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -345,7 +345,7 @@  			<description>  				<para> -					Forgets some part of our OTR userstate. Available things: fingerprint and context. See <emphasis>help otr forget <thing></emphasis> for more information. +					Forgets some part of our OTR userstate. Available things: fingerprint, context, and key. See <emphasis>help otr forget <thing></emphasis> for more information.  				</para>  			</description> @@ -376,6 +376,19 @@  			</bitlbee-command> +			<bitlbee-command name="key"> +				<syntax>otr forget key <fingerprint></syntax> +				 +				<description> +				 +					<para> +						Forgets an OTR private key matching the specified fingerprint. It is allowed to specify only a (unique) prefix of the fingerprint. +					</para> +					 +				</description> +				 +			</bitlbee-command> +		  		</bitlbee-command>  	</bitlbee-command> @@ -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", | 
