diff options
author | James Booth <boothj5@gmail.com> | 2014-01-05 23:24:48 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-01-05 23:24:48 +0000 |
commit | 76484665fd0df4e559f7a6732819130dc98b68a7 (patch) | |
tree | c2cf9a007672d887cd4a39bca7dc53540e8827a8 | |
parent | 1d716e48adf7dc6a2639131450c1ca74d48ea105 (diff) | |
download | profani-tty-76484665fd0df4e559f7a6732819130dc98b68a7.tar.gz |
Removed prof_handle group functions
-rw-r--r-- | src/command/commands.c | 18 | ||||
-rw-r--r-- | src/profanity.c | 16 | ||||
-rw-r--r-- | src/profanity.h | 2 | ||||
-rw-r--r-- | src/roster_list.c | 30 | ||||
-rw-r--r-- | src/roster_list.h | 2 |
5 files changed, 14 insertions, 54 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; } diff --git a/src/profanity.c b/src/profanity.c index 3ee032fd..9178d056 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -118,22 +118,6 @@ prof_run(const int disable_tls, char *log_level, char *account_name) } void -prof_handle_already_in_group(const char * const contact, - const char * const group) -{ - ui_contact_already_in_group(contact, group); - ui_current_page_off(); -} - -void -prof_handle_not_in_group(const char * const contact, - const char * const group) -{ - ui_contact_not_in_group(contact, group); - ui_current_page_off(); -} - -void prof_handle_roster_add(const char * const barejid, const char * const name) { ui_roster_add(barejid, name); diff --git a/src/profanity.h b/src/profanity.h index a448c436..5e826fc4 100644 --- a/src/profanity.h +++ b/src/profanity.h @@ -31,7 +31,5 @@ void prof_run(const int disable_tls, char *log_level, char *account_name); void prof_handle_idle(void); void prof_handle_activity(void); void prof_handle_roster_add(const char * const barejid, const char * const name); -void prof_handle_already_in_group(const char * const contact, const char * const group); -void prof_handle_not_in_group(const char * const contact, const char * const group); #endif diff --git a/src/roster_list.c b/src/roster_list.c index 62d99323..7945101a 100644 --- a/src/roster_list.c +++ b/src/roster_list.c @@ -334,36 +334,6 @@ roster_get_group(const char * const group) return result; } -void -roster_add_to_group(const char * const group, PContact contact) -{ - assert(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; - } -} - -void -roster_remove_from_group(const char * const group, PContact contact) -{ - assert(contact != NULL); - - if (!p_contact_in_group(contact, group)) { - if (p_contact_name(contact) != NULL) { - prof_handle_not_in_group(p_contact_name(contact), group); - } else { - prof_handle_not_in_group(p_contact_barejid(contact), group); - } - return; - } -} - GSList * roster_get_groups(void) { diff --git a/src/roster_list.h b/src/roster_list.h index 8fe2b5bd..a7198e5c 100644 --- a/src/roster_list.h +++ b/src/roster_list.h @@ -50,8 +50,6 @@ char * roster_find_contact(char *search_str); char * roster_find_resource(char *search_str); GSList * roster_get_group(const char * const group); GSList * roster_get_groups(void); -void roster_add_to_group(const char * const group, PContact contact); -void roster_remove_from_group(const char * const group, PContact contact); char * roster_find_group(char *search_str); char * roster_find_jid(char *search_str); |