about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 57a6b151..e6588c11 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1009,8 +1009,13 @@ cmd_group(gchar **args, struct cmd_help_t help)
             return TRUE;
         }
 
-        roster_add_to_group(group, pcontact);
-        roster_send_add_to_group(group, pcontact);
+        if (p_contact_in_group(pcontact, group)) {
+            const char *display_name = p_contact_name_or_jid(pcontact);
+            ui_contact_already_in_group(display_name, group);
+            ui_current_page_off();
+        } else {
+            roster_send_add_to_group(group, pcontact);
+        }
 
         return TRUE;
     }
@@ -1036,8 +1041,13 @@ cmd_group(gchar **args, struct cmd_help_t help)
             return TRUE;
         }
 
-        roster_remove_from_group(group, pcontact);
-        roster_send_remove_from_group(group, pcontact);
+        if (!p_contact_in_group(pcontact, group)) {
+            const char *display_name = p_contact_name_or_jid(pcontact);
+            ui_contact_not_in_group(display_name, group);
+            ui_current_page_off();
+        } else {
+            roster_send_remove_from_group(group, pcontact);
+        }
 
         return TRUE;
     }