about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-06-23 16:29:42 +0100
committerJames Booth <boothj5@gmail.com>2013-06-23 16:29:42 +0100
commit265fff8f40ad521d09bf56e8f2e8fad89ef63865 (patch)
tree4fb0fb65885e7d5bf262d0b17c85b42138054172 /src
parentf9b8da1afee6267cc1b09f036cd58e1d9326509c (diff)
downloadprofani-tty-265fff8f40ad521d09bf56e8f2e8fad89ef63865.tar.gz
Show message when contact already in group
Diffstat (limited to 'src')
-rw-r--r--src/profanity.c8
-rw-r--r--src/profanity.h1
-rw-r--r--src/ui/core.c6
-rw-r--r--src/ui/ui.h1
-rw-r--r--src/xmpp/roster.c5
5 files changed, 21 insertions, 0 deletions
diff --git a/src/profanity.c b/src/profanity.c
index 732cbf5c..7042b7b5 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -149,6 +149,14 @@ prof_handle_duck_result(const char * const result)
 }
 
 void
+prof_handle_already_in_group(const char * const barejid,
+    const char * const group)
+{
+    ui_contact_already_in_group(barejid, group);
+    ui_current_page_off();
+}
+
+void
 prof_handle_error_message(const char *from, const char *err_msg)
 {
     win_type_t win_type = ui_current_win_type();
diff --git a/src/profanity.h b/src/profanity.h
index ebf7d044..7254c2de 100644
--- a/src/profanity.h
+++ b/src/profanity.h
@@ -82,5 +82,6 @@ void prof_handle_duck_help(const char * const result);
 void prof_handle_duck_result(const char * const result);
 void prof_handle_roster_add(const char * const barejid, const char * const name);
 void prof_handle_roster_remove(const char * const barejid);
+void prof_handle_already_in_group(const char * const barejid, const char * const group);
 
 #endif
diff --git a/src/ui/core.c b/src/ui/core.c
index 3b08e593..86518bf7 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -456,6 +456,12 @@ ui_roster_remove(const char * const barejid)
 }
 
 void
+ui_contact_already_in_group(const char * const barejid, const char * const group)
+{
+    cons_show("%s already in group %s", barejid, group);
+}
+
+void
 ui_contact_online(const char * const barejid, const char * const resource,
     const char * const show, const char * const status, GDateTime *last_activity)
 {
diff --git a/src/ui/ui.h b/src/ui/ui.h
index a41a8cff..f8a6ff2d 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -114,6 +114,7 @@ void ui_room_member_presence(const char * const room,
     const char * const nick, const char * const show, const char * const status);
 void ui_roster_add(const char * const barejid, const char * const name);
 void ui_roster_remove(const char * const barejid);
+void ui_contact_already_in_group(const char * const barejid, const char * const group);
 
 // contact status functions
 void ui_status_room(const char * const contact);
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 8e8dc328..f29ac09b 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -293,6 +293,11 @@ roster_add_to_group(const char * const group, const char * const barejid)
 
     if (contact != NULL) {
         if (p_contact_in_group(contact, group)) {
+            if (p_contact_name(contact) != NULL) {
+                prof_handle_already_in_group(p_contact_name(contact), group);
+            } else {
+                prof_handle_already_in_group(p_contact_barejid(contact), group);
+            }
             return;
         }