From bc85c337a6e4680cedb1217b6cf25cf4d8f69b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Fri, 19 Sep 2014 18:10:45 +0200 Subject: [PATCH] Implemented tox_weechat_identity_delete. --- src/tox-weechat-identities.c | 13 +++++++++++++ src/tox-weechat-identities.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/tox-weechat-identities.c b/src/tox-weechat-identities.c index 6d47e9f..99706b5 100644 --- a/src/tox-weechat-identities.c +++ b/src/tox-weechat-identities.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -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) { diff --git a/src/tox-weechat-identities.h b/src/tox-weechat-identities.h index c46eee8..33a7a1a 100644 --- a/src/tox-weechat-identities.h +++ b/src/tox-weechat-identities.h @@ -21,6 +21,7 @@ #define TOX_WEECHAT_IDENTITIES_H #include +#include 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);