aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--otr.c14
-rw-r--r--root_commands.c4
2 files changed, 13 insertions, 5 deletions
diff --git a/otr.c b/otr.c
index 0f441e3d..66cdb645 100644
--- a/otr.c
+++ b/otr.c
@@ -124,6 +124,9 @@ void show_otr_context_info(irc_t *irc, ConnContext *ctx);
/* show the list of fingerprints associated with a given context */
void show_fingerprints(irc_t *irc, ConnContext *ctx);
+/* to log out accounts during keygen */
+extern void cmd_account(irc_t *irc, char **cmd);
+
/*** routines declared in otr.h: ***/
@@ -1121,14 +1124,12 @@ void show_otr_context_info(irc_t *irc, ConnContext *ctx)
void otr_keygen(irc_t *irc, const char *handle, const char *protocol)
{
+ char *account_off[] = {"account", "off", NULL};
GError *err;
GThread *thr;
struct kgdata *kg;
gint ev;
- irc_usermsg(irc, "generating new otr privkey for %s/%s...",
- handle, protocol);
-
kg = g_new0(struct kgdata, 1);
if(!kg) {
irc_usermsg(irc, "otr keygen failed: out of memory");
@@ -1166,6 +1167,13 @@ void otr_keygen(irc_t *irc, const char *handle, const char *protocol)
return;
}
+ /* tell the user what's happening, go comatose, and start the keygen */
+ irc_usermsg(irc, "going comatose for otr key generation, this will take a moment");
+ irc_usermsg(irc, "all accounts logging out, user commands disabled");
+ cmd_account(irc, account_off);
+ irc_usermsg(irc, "generating new otr privkey for %s/%s...",
+ handle, protocol);
+
thr = g_thread_create(&otr_keygen_thread_func, kg, FALSE, &err);
if(!thr) {
irc_usermsg(irc, "otr keygen failed: %s", err->message);
diff --git a/root_commands.c b/root_commands.c
index 61bb5da9..7352b638 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -135,7 +135,7 @@ static void cmd_help( irc_t *irc, char **cmd )
}
}
-static void cmd_account( irc_t *irc, char **cmd );
+void cmd_account( irc_t *irc, char **cmd );
static void cmd_identify( irc_t *irc, char **cmd )
{
@@ -212,7 +212,7 @@ static void cmd_drop( irc_t *irc, char **cmd )
}
}
-static void cmd_account( irc_t *irc, char **cmd )
+void cmd_account( irc_t *irc, char **cmd )
{
account_t *a;