Show message on /bookmark remove when bookmark does not exist

This commit is contained in:
James Booth
2014-02-02 00:59:32 +00:00
parent 92b85bb7f1
commit 9d957e5f93
10 changed files with 47 additions and 15 deletions

View File

@@ -1781,11 +1781,15 @@ cmd_bookmark(gchar **args, struct cmd_help_t help)
cons_show("Bookmark updated for %s.", jid);
}
} else if (strcmp(cmd, "remove") == 0) {
bookmark_remove(jid, autojoin);
if (autojoin) {
cons_show("Autojoin disabled for %s.", jid);
gboolean removed = bookmark_remove(jid, autojoin);
if (removed) {
if (autojoin) {
cons_show("Autojoin disabled for %s.", jid);
} else {
cons_show("Bookmark removed for %s.", jid);
}
} else {
cons_show("Bookmark removed for %s.", jid);
cons_show("No bookmark exists for %s.", jid);
}
} else {
cons_show("Usage: %s", help.usage);

View File

@@ -71,7 +71,7 @@ _bookmark_add(const char *jid, const char *nick, gboolean autojoin)
return FALSE;
}
static void
static gboolean
_bookmark_remove(const char *jid, gboolean autojoin)
{
/* TODO: manage bookmark_list */
@@ -81,6 +81,8 @@ _bookmark_remove(const char *jid, gboolean autojoin)
/* TODO: send request */
autocomplete_remove(bookmark_ac, jid);
}
return FALSE;
}
static const GList *

View File

@@ -133,7 +133,7 @@ Capabilities* (*caps_get)(const char * const caps_str);
void (*caps_close)(void);
gboolean (*bookmark_add)(const char *jid, const char *nick, gboolean autojoin);
void (*bookmark_remove)(const char *jid, gboolean autojoin);
gboolean (*bookmark_remove)(const char *jid, gboolean autojoin);
const GList * (*bookmark_get_list)(void);
char * (*bookmark_find)(char *search_str);
void (*bookmark_autocomplete_reset)(void);