aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2023-04-14 13:13:18 +0200
committerGitHub <noreply@github.com>2023-04-14 13:13:18 +0200
commitebec68821fa816ca181892919bd878e69d35810d (patch)
treefdcf6666c4c3aef3fe63043b6bcb52e3cd6caeb8 /src
parent766dc76e337c96e71edc698a8ee292014293c44f (diff)
parent5b8b9074a294e32cbec5f64f61d867dbf0ca1d51 (diff)
downloadprofani-tty-ebec68821fa816ca181892919bd878e69d35810d.tar.gz
Merge pull request #1826 from H3rnand3zzz/feature/roster-nickname-remove
Add nickname support for `/roster remove`
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_ac.c2
-rw-r--r--src/command/cmd_defs.c2
-rw-r--r--src/command/cmd_funcs.c13
3 files changed, 10 insertions, 7 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 3561449e..5678dbff 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -2292,7 +2292,7 @@ _roster_autocomplete(ProfWin* window, const char* const input, gboolean previous
if (result) {
return result;
}
- result = autocomplete_param_with_func(input, "/roster remove", roster_barejid_autocomplete, previous, NULL);
+ result = autocomplete_param_with_func(input, "/roster remove", roster_contact_autocomplete, previous, NULL);
if (result) {
return result;
}
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 12ebf4a1..fe993e39 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -290,7 +290,7 @@ static const struct cmd_t command_defs[] = {
"/roster size <percent>",
"/roster wrap on|off",
"/roster add <jid> [<nick>]",
- "/roster remove <jid>",
+ "/roster remove <contact>",
"/roster remove_all contacts",
"/roster nick <jid> <nick>",
"/roster clearnick <jid>",
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index f6736156..7c533a45 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -2922,14 +2922,17 @@ cmd_roster(ProfWin* window, const char* const command, gchar** args)
cons_show("You are not currently connected.");
return TRUE;
}
- char* jid = args[1];
- if (jid == NULL) {
+ char* usr = args[1];
+ if (usr == NULL) {
cons_bad_cmd_usage(command);
- } else {
- roster_send_remove(jid);
+ return TRUE;
}
+ char* barejid = roster_barejid_from_name(usr);
+ if (barejid == NULL) {
+ barejid = usr;
+ }
+ roster_send_remove(barejid);
return TRUE;
-
} else if (strcmp(args[0], "remove_all") == 0) {
if (g_strcmp0(args[1], "contacts") != 0) {
cons_bad_cmd_usage(command);