Implemented tox_weechat_identity_delete.

This commit is contained in:
Håvard Pettersson 2014-09-19 18:10:45 +02:00
parent 10c704da6f
commit bc85c337a6
2 changed files with 18 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include <string.h>
#include <pwd.h>
#include <unistd.h>
#include <stdbool.h>
#include <weechat/weechat-plugin.h>
#include <tox/tox.h>
@ -349,6 +350,18 @@ tox_weechat_identity_for_buffer(struct t_gui_buffer *buffer)
return NULL;
}
void
tox_weechat_identity_delete(struct t_tox_weechat_identity *identity,
bool keep_data)
{
char *data_path = tox_weechat_identity_data_file_path(identity);
tox_weechat_identity_free(identity);
if (!keep_data)
unlink(data_path);
}
void
tox_weechat_identity_free(struct t_tox_weechat_identity *identity)
{

View File

@ -21,6 +21,7 @@
#define TOX_WEECHAT_IDENTITIES_H
#include <stdint.h>
#include <stdbool.h>
enum t_tox_weechat_identity_option
{
@ -75,6 +76,10 @@ tox_weechat_identity_name_search(const char *name);
struct t_tox_weechat_identity *
tox_weechat_identity_for_buffer(struct t_gui_buffer *buffer);
void
tox_weechat_identity_delete(struct t_tox_weechat_identity *identity,
bool keep_data);
void
tox_weechat_identity_free(struct t_tox_weechat_identity *identity);