diff options
Diffstat (limited to 'src/command/commands.c')
-rw-r--r-- | src/command/commands.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index 58777a2d..a717054b 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2985,6 +2985,63 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args) } gboolean +cmd_blocked(ProfWin *window, const char *const command, gchar **args) +{ + if (jabber_get_connection_status() != JABBER_CONNECTED) { + cons_show("You are not currently connected."); + return TRUE; + } + + if (!jabber_service_supports(XMPP_FEATURE_BLOCKING)) { + cons_show("Blocking not supported by server."); + return TRUE; + } + + if (g_strcmp0(args[0], "add") == 0) { + if (args[1] == NULL) { + cons_bad_cmd_usage(command); + return TRUE; + } + + gboolean res = blocked_add(args[1]); + if (!res) { + cons_show("User %s already blocked.", args[1]); + } + + return TRUE; + } + + if (g_strcmp0(args[0], "remove") == 0) { + if (args[1] == NULL) { + cons_bad_cmd_usage(command); + return TRUE; + } + + gboolean res = blocked_remove(args[1]); + if (!res) { + cons_show("User %s is not currently blocked.", args[1]); + } + + return TRUE; + } + + GList *blocked = blocked_list(); + GList *curr = blocked; + if (curr) { + cons_show("Blocked users:"); + while (curr) { + cons_show(" %s", curr->data); + curr = g_list_next(curr); + } + } else { + cons_show("No blocked users."); + } + + return TRUE; +} + + +gboolean cmd_resource(ProfWin *window, const char *const command, gchar **args) { char *cmd = args[0]; |