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);