1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Removed roster_list dependency on xmpp module

This commit is contained in:
James Booth 2014-01-05 23:08:11 +00:00
parent 06ce95f68a
commit 1d716e48ad
3 changed files with 22 additions and 30 deletions

View File

@ -1009,7 +1009,8 @@ cmd_group(gchar **args, struct cmd_help_t help)
return TRUE; return TRUE;
} }
roster_add_to_group(group, barejid); roster_add_to_group(group, pcontact);
roster_send_add_to_group(group, pcontact);
return TRUE; return TRUE;
} }
@ -1035,7 +1036,8 @@ cmd_group(gchar **args, struct cmd_help_t help)
return TRUE; return TRUE;
} }
roster_remove_from_group(group, barejid); roster_remove_from_group(group, pcontact);
roster_send_remove_from_group(group, pcontact);
return TRUE; return TRUE;
} }

View File

@ -31,7 +31,6 @@
#include "jid.h" #include "jid.h"
#include "tools/autocomplete.h" #include "tools/autocomplete.h"
#include "profanity.h" #include "profanity.h"
#include "xmpp/xmpp.h"
// nicknames // nicknames
static Autocomplete name_ac; static Autocomplete name_ac;
@ -336,41 +335,32 @@ roster_get_group(const char * const group)
} }
void void
roster_add_to_group(const char * const group, const char * const barejid) roster_add_to_group(const char * const group, PContact contact)
{ {
PContact contact = g_hash_table_lookup(contacts, barejid); assert(contact != NULL);
if (contact != NULL) { if (p_contact_in_group(contact, group)) {
if (p_contact_in_group(contact, group)) { if (p_contact_name(contact) != NULL) {
if (p_contact_name(contact) != NULL) { prof_handle_already_in_group(p_contact_name(contact), group);
prof_handle_already_in_group(p_contact_name(contact), group); } else {
} else { prof_handle_already_in_group(p_contact_barejid(contact), group);
prof_handle_already_in_group(p_contact_barejid(contact), group);
}
return;
} }
return;
roster_send_add_to_group(group, contact);
} }
} }
void void
roster_remove_from_group(const char * const group, const char * const barejid) roster_remove_from_group(const char * const group, PContact contact)
{ {
PContact contact = g_hash_table_lookup(contacts, barejid); assert(contact != NULL);
if (contact != NULL) { if (!p_contact_in_group(contact, group)) {
if (!p_contact_in_group(contact, group)) { if (p_contact_name(contact) != NULL) {
if (p_contact_name(contact) != NULL) { prof_handle_not_in_group(p_contact_name(contact), group);
prof_handle_not_in_group(p_contact_name(contact), group); } else {
} else { prof_handle_not_in_group(p_contact_barejid(contact), group);
prof_handle_not_in_group(p_contact_barejid(contact), group);
}
return;
} }
return;
roster_send_remove_from_group(group, contact);
} }
} }

View File

@ -50,8 +50,8 @@ char * roster_find_contact(char *search_str);
char * roster_find_resource(char *search_str); char * roster_find_resource(char *search_str);
GSList * roster_get_group(const char * const group); GSList * roster_get_group(const char * const group);
GSList * roster_get_groups(void); GSList * roster_get_groups(void);
void roster_add_to_group(const char * const group, const char * const barejid); void roster_add_to_group(const char * const group, PContact contact);
void roster_remove_from_group(const char * const group, const char * const barejid); void roster_remove_from_group(const char * const group, PContact contact);
char * roster_find_group(char *search_str); char * roster_find_group(char *search_str);
char * roster_find_jid(char *search_str); char * roster_find_jid(char *search_str);