mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Free resources on OTR shutdown
This commit is contained in:
parent
8cf7122e7a
commit
c98ce4299d
@ -2766,6 +2766,7 @@ cmd_otr(gchar **args, struct cmd_help_t help)
|
||||
if (strcmp(args[0], "gen") == 0) {
|
||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
||||
otr_keygen(account);
|
||||
account_free(account);
|
||||
return TRUE;
|
||||
|
||||
} else if (strcmp(args[0], "myfp") == 0) {
|
||||
|
@ -163,6 +163,14 @@ _otr_init(void)
|
||||
data_loaded = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_otr_shutdown(void)
|
||||
{
|
||||
if (jid != NULL) {
|
||||
free(jid);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_otr_poll(void)
|
||||
{
|
||||
@ -172,6 +180,9 @@ _otr_poll(void)
|
||||
static void
|
||||
_otr_on_connect(ProfAccount *account)
|
||||
{
|
||||
if (jid != NULL) {
|
||||
free(jid);
|
||||
}
|
||||
jid = strdup(account->jid);
|
||||
log_info("Loading OTR key for %s", jid);
|
||||
|
||||
@ -253,11 +264,12 @@ _otr_keygen(ProfAccount *account)
|
||||
return;
|
||||
}
|
||||
|
||||
if (jid != NULL) {
|
||||
free(jid);
|
||||
}
|
||||
jid = strdup(account->jid);
|
||||
log_info("Generating OTR key for %s", jid);
|
||||
|
||||
jid = strdup(account->jid);
|
||||
|
||||
gchar *data_home = xdg_get_data_home();
|
||||
GString *basedir = g_string_new(data_home);
|
||||
free(data_home);
|
||||
@ -634,6 +646,7 @@ void
|
||||
otr_init_module(void)
|
||||
{
|
||||
otr_init = _otr_init;
|
||||
otr_shutdown = _otr_shutdown;
|
||||
otr_libotr_version = _otr_libotr_version;
|
||||
otr_start_query = _otr_start_query;
|
||||
otr_poll = _otr_poll;
|
||||
|
@ -41,6 +41,7 @@ OtrlMessageAppOps* otr_messageops(void);
|
||||
GHashTable* otr_smpinitators(void);
|
||||
|
||||
void (*otr_init)(void);
|
||||
void (*otr_shutdown)(void);
|
||||
char* (*otr_libotr_version)(void);
|
||||
char* (*otr_start_query)(void);
|
||||
void (*otr_poll)(void);
|
||||
|
@ -305,6 +305,9 @@ _shutdown(void)
|
||||
muc_close();
|
||||
caps_close();
|
||||
ui_close();
|
||||
#ifdef HAVE_LIBOTR
|
||||
otr_shutdown();
|
||||
#endif
|
||||
chat_log_close();
|
||||
prefs_close();
|
||||
theme_close();
|
||||
|
Loading…
Reference in New Issue
Block a user