1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Initialise and free capabilities

This commit is contained in:
James Booth 2013-01-20 00:35:40 +00:00
parent 7920a9b2f1
commit 22589e8798
3 changed files with 22 additions and 0 deletions

View File

@ -23,9 +23,20 @@
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "common.h"
#include "capabilities.h"
GHashTable *capabilities;
void
caps_init(void)
{
capabilities = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
(GDestroyNotify)caps_destroy);
}
Capabilities *
caps_create(const char * const client, const char * const version)
{
@ -55,3 +66,9 @@ caps_destroy(Capabilities *caps)
FREE_SET_NULL(caps);
}
}
void
caps_close(void)
{
g_hash_table_destroy(capabilities);
}

View File

@ -28,7 +28,9 @@ typedef struct capabilities_t {
char *version;
} Capabilities;
void caps_init(void);
Capabilities* caps_create(const char * const client, const char * const version);
void caps_destroy(Capabilities *caps);
void caps_close(void);
#endif

View File

@ -30,6 +30,7 @@
#include <glib.h>
#include "accounts.h"
#include "capabilities.h"
#include "chat_log.h"
#include "chat_session.h"
#include "command.h"
@ -541,6 +542,7 @@ _init(const int disable_tls, char *log_level)
theme_init(theme);
g_free(theme);
ui_init();
caps_init();
jabber_init(disable_tls);
cmd_init();
log_info("Initialising contact list");
@ -553,6 +555,7 @@ _shutdown(void)
{
jabber_disconnect();
contact_list_free();
caps_close();
ui_close();
chat_log_close();
prefs_close();