diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-05-22 14:18:20 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-05-22 14:18:20 +0200 |
commit | 88c36745fe3f568f09fcd4078fc760a52e826eb7 (patch) | |
tree | 3689d6661dae93788c394e93acc64cbf4f385052 /src/command/cmd_funcs.c | |
parent | fad296b79e42a0df6c0f118e1c011f480462551f (diff) | |
download | profani-tty-88c36745fe3f568f09fcd4078fc760a52e826eb7.tar.gz |
Add option to add bookmark name
`/bookmark add|update` got `name` field. By default localpart of JID is used (like before) but now we can set the name ourselves. Regards https://github.com/profanity-im/profanity/issues/697
Diffstat (limited to 'src/command/cmd_funcs.c')
-rw-r--r-- | src/command/cmd_funcs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 758d356f..8e02a822 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -4625,7 +4625,7 @@ cmd_bookmark(ProfWin *window, const char *const command, gchar **args) assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); char *nick = muc_nick(mucwin->roomjid); char *password = muc_password(mucwin->roomjid); - gboolean added = bookmark_add(mucwin->roomjid, nick, password, "on"); + gboolean added = bookmark_add(mucwin->roomjid, nick, password, "on", NULL); if (added) { win_println(window, THEME_DEFAULT, "!", "Bookmark added for %s.", mucwin->roomjid); } else { @@ -4710,7 +4710,7 @@ cmd_bookmark(ProfWin *window, const char *const command, gchar **args) return TRUE; } - gchar *opt_keys[] = { "autojoin", "nick", "password", NULL }; + gchar *opt_keys[] = { "autojoin", "nick", "password", "name", NULL }; gboolean parsed; GHashTable *options = parse_options(&args[2], opt_keys, &parsed); @@ -4733,9 +4733,10 @@ cmd_bookmark(ProfWin *window, const char *const command, gchar **args) char *nick = g_hash_table_lookup(options, "nick"); char *password = g_hash_table_lookup(options, "password"); + char *name = g_hash_table_lookup(options, "name"); if (strcmp(cmd, "add") == 0) { - gboolean added = bookmark_add(jid, nick, password, autojoin); + gboolean added = bookmark_add(jid, nick, password, autojoin, name); if (added) { cons_show("Bookmark added for %s.", jid); } else { @@ -4747,7 +4748,7 @@ cmd_bookmark(ProfWin *window, const char *const command, gchar **args) } if (strcmp(cmd, "update") == 0) { - gboolean updated = bookmark_update(jid, nick, password, autojoin); + gboolean updated = bookmark_update(jid, nick, password, autojoin, name); if (updated) { cons_show("Bookmark updated."); } else { |