mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Removed unused arg from roster_get_ functions
This commit is contained in:
parent
369aa5e8a8
commit
e816b124ee
@ -887,7 +887,7 @@ cmd_export(ProfWin *window, const char *const command, gchar **args)
|
|||||||
|
|
||||||
if (-1 == write(fd, "jid,name\n", strlen("jid,name\n"))) goto write_error;
|
if (-1 == write(fd, "jid,name\n", strlen("jid,name\n"))) goto write_error;
|
||||||
|
|
||||||
list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
if (list) {
|
if (list) {
|
||||||
GSList *curr = list;
|
GSList *curr = list;
|
||||||
while (curr){
|
while (curr){
|
||||||
@ -1623,13 +1623,13 @@ _who_roster(ProfWin *window, const char *const command, gchar **args)
|
|||||||
cons_show("");
|
cons_show("");
|
||||||
GSList *list = NULL;
|
GSList *list = NULL;
|
||||||
if (group) {
|
if (group) {
|
||||||
list = roster_get_group(group, ROSTER_ORD_NAME, TRUE);
|
list = roster_get_group(group, ROSTER_ORD_NAME);
|
||||||
if (list == NULL) {
|
if (list == NULL) {
|
||||||
cons_show("No such group: %s.", group);
|
cons_show("No such group: %s.", group);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
if (list == NULL) {
|
if (list == NULL) {
|
||||||
cons_show("No contacts in roster.");
|
cons_show("No contacts in roster.");
|
||||||
return;
|
return;
|
||||||
@ -1931,7 +1931,7 @@ cmd_group(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList *list = roster_get_group(group, ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_group(group, ROSTER_ORD_NAME);
|
||||||
cons_show_roster_group(group, list);
|
cons_show_roster_group(group, list);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2014,7 +2014,7 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
cons_show_roster(list);
|
cons_show_roster(list);
|
||||||
g_slist_free(list);
|
g_slist_free(list);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2591,7 +2591,7 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList *all = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *all = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
GSList *curr = all;
|
GSList *curr = all;
|
||||||
while (curr) {
|
while (curr) {
|
||||||
PContact contact = curr->data;
|
PContact contact = curr->data;
|
||||||
|
@ -406,7 +406,7 @@ roster_get_contacts_by_presence(const char *const presence)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GSList*
|
GSList*
|
||||||
roster_get_contacts(roster_ord_t order, gboolean include_offline)
|
roster_get_contacts(roster_ord_t order)
|
||||||
{
|
{
|
||||||
assert(roster != NULL);
|
assert(roster != NULL);
|
||||||
|
|
||||||
@ -424,12 +424,6 @@ roster_get_contacts(roster_ord_t order, gboolean include_offline)
|
|||||||
|
|
||||||
g_hash_table_iter_init(&iter, roster->contacts);
|
g_hash_table_iter_init(&iter, roster->contacts);
|
||||||
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
||||||
PContact contact = value;
|
|
||||||
const char *presence = p_contact_presence(contact);
|
|
||||||
if (!include_offline && (g_strcmp0(presence, "offline") == 0)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = g_slist_insert_sorted(result, value, cmp_func);
|
result = g_slist_insert_sorted(result, value, cmp_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +488,7 @@ roster_fulljid_autocomplete(const char *const search_str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GSList*
|
GSList*
|
||||||
roster_get_group(const char *const group, roster_ord_t order, gboolean include_offline)
|
roster_get_group(const char *const group, roster_ord_t order)
|
||||||
{
|
{
|
||||||
assert(roster != NULL);
|
assert(roster != NULL);
|
||||||
|
|
||||||
@ -512,12 +506,6 @@ roster_get_group(const char *const group, roster_ord_t order, gboolean include_o
|
|||||||
|
|
||||||
g_hash_table_iter_init(&iter, roster->contacts);
|
g_hash_table_iter_init(&iter, roster->contacts);
|
||||||
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
||||||
PContact contact = value;
|
|
||||||
const char *presence = p_contact_presence(contact);
|
|
||||||
if (!include_offline && (g_strcmp0(presence, "offline") == 0)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
GSList *groups = p_contact_groups(value);
|
GSList *groups = p_contact_groups(value);
|
||||||
if (group == NULL) {
|
if (group == NULL) {
|
||||||
if (groups == NULL) {
|
if (groups == NULL) {
|
||||||
|
@ -59,12 +59,12 @@ void roster_update(const char *const barejid, const char *const name, GSList *gr
|
|||||||
gboolean roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription,
|
gboolean roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription,
|
||||||
gboolean pending_out);
|
gboolean pending_out);
|
||||||
char* roster_barejid_from_name(const char *const name);
|
char* roster_barejid_from_name(const char *const name);
|
||||||
GSList* roster_get_contacts(roster_ord_t order, gboolean include_offline);
|
GSList* roster_get_contacts(roster_ord_t order);
|
||||||
GSList* roster_get_contacts_online(void);
|
GSList* roster_get_contacts_online(void);
|
||||||
gboolean roster_has_pending_subscriptions(void);
|
gboolean roster_has_pending_subscriptions(void);
|
||||||
char* roster_contact_autocomplete(const char *const search_str);
|
char* roster_contact_autocomplete(const char *const search_str);
|
||||||
char* roster_fulljid_autocomplete(const char *const search_str);
|
char* roster_fulljid_autocomplete(const char *const search_str);
|
||||||
GSList* roster_get_group(const char *const group, roster_ord_t order, gboolean include_offline);
|
GSList* roster_get_group(const char *const group, roster_ord_t order);
|
||||||
GSList* roster_get_groups(void);
|
GSList* roster_get_groups(void);
|
||||||
char* roster_group_autocomplete(const char *const search_str);
|
char* roster_group_autocomplete(const char *const search_str);
|
||||||
char* roster_barejid_autocomplete(const char *const search_str);
|
char* roster_barejid_autocomplete(const char *const search_str);
|
||||||
|
@ -621,7 +621,7 @@ void
|
|||||||
cons_show_sent_subs(void)
|
cons_show_sent_subs(void)
|
||||||
{
|
{
|
||||||
if (roster_has_pending_subscriptions()) {
|
if (roster_has_pending_subscriptions()) {
|
||||||
GSList *contacts = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *contacts = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
PContact contact = NULL;
|
PContact contact = NULL;
|
||||||
cons_show("Awaiting subscription responses from:");
|
cons_show("Awaiting subscription responses from:");
|
||||||
GSList *curr = contacts;
|
GSList *curr = contacts;
|
||||||
|
@ -137,9 +137,9 @@ _rosterwin_contacts_all(ProfLayoutSplit *layout, gboolean newline)
|
|||||||
|
|
||||||
char *order = prefs_get_string(PREF_ROSTER_ORDER);
|
char *order = prefs_get_string(PREF_ROSTER_ORDER);
|
||||||
if (g_strcmp0(order, "presence") == 0) {
|
if (g_strcmp0(order, "presence") == 0) {
|
||||||
contacts = roster_get_contacts(ROSTER_ORD_PRESENCE, TRUE);
|
contacts = roster_get_contacts(ROSTER_ORD_PRESENCE);
|
||||||
} else {
|
} else {
|
||||||
contacts = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
contacts = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
}
|
}
|
||||||
prefs_free_string(order);
|
prefs_free_string(order);
|
||||||
|
|
||||||
@ -189,9 +189,9 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group, gboolean newl
|
|||||||
|
|
||||||
char *order = prefs_get_string(PREF_ROSTER_ORDER);
|
char *order = prefs_get_string(PREF_ROSTER_ORDER);
|
||||||
if (g_strcmp0(order, "presence") == 0) {
|
if (g_strcmp0(order, "presence") == 0) {
|
||||||
contacts = roster_get_group(group, ROSTER_ORD_PRESENCE, TRUE);
|
contacts = roster_get_group(group, ROSTER_ORD_PRESENCE);
|
||||||
} else {
|
} else {
|
||||||
contacts = roster_get_group(group, ROSTER_ORD_NAME, TRUE);
|
contacts = roster_get_group(group, ROSTER_ORD_NAME);
|
||||||
}
|
}
|
||||||
prefs_free_string(order);
|
prefs_free_string(order);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ void cmd_roster_shows_roster_when_no_args(void **state)
|
|||||||
|
|
||||||
roster_create();
|
roster_create();
|
||||||
roster_add("bob@server.org", "bob", NULL, "both", FALSE);
|
roster_add("bob@server.org", "bob", NULL, "both", FALSE);
|
||||||
GSList *roster = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *roster = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
|
|
||||||
expect_memory(cons_show_roster, list, roster, sizeof(roster));
|
expect_memory(cons_show_roster, list, roster, sizeof(roster));
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
void empty_list_when_none_added(void **state)
|
void empty_list_when_none_added(void **state)
|
||||||
{
|
{
|
||||||
roster_create();
|
roster_create();
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
assert_null(list);
|
assert_null(list);
|
||||||
roster_destroy();
|
roster_destroy();
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ void contains_one_element(void **state)
|
|||||||
{
|
{
|
||||||
roster_create();
|
roster_create();
|
||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
assert_int_equal(1, g_slist_length(list));
|
assert_int_equal(1, g_slist_length(list));
|
||||||
roster_destroy();
|
roster_destroy();
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ void first_element_correct(void **state)
|
|||||||
{
|
{
|
||||||
roster_create();
|
roster_create();
|
||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
PContact james = list->data;
|
PContact james = list->data;
|
||||||
|
|
||||||
assert_string_equal("James", p_contact_barejid(james));
|
assert_string_equal("James", p_contact_barejid(james));
|
||||||
@ -42,7 +42,7 @@ void contains_two_elements(void **state)
|
|||||||
roster_create();
|
roster_create();
|
||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
|
|
||||||
assert_int_equal(2, g_slist_length(list));
|
assert_int_equal(2, g_slist_length(list));
|
||||||
roster_destroy();
|
roster_destroy();
|
||||||
@ -53,7 +53,7 @@ void first_and_second_elements_correct(void **state)
|
|||||||
roster_create();
|
roster_create();
|
||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
|
|
||||||
PContact first = list->data;
|
PContact first = list->data;
|
||||||
PContact second = (g_slist_next(list))->data;
|
PContact second = (g_slist_next(list))->data;
|
||||||
@ -69,7 +69,7 @@ void contains_three_elements(void **state)
|
|||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
|
|
||||||
assert_int_equal(3, g_slist_length(list));
|
assert_int_equal(3, g_slist_length(list));
|
||||||
roster_destroy();
|
roster_destroy();
|
||||||
@ -81,7 +81,7 @@ void first_three_elements_correct(void **state)
|
|||||||
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
PContact bob = list->data;
|
PContact bob = list->data;
|
||||||
PContact dave = (g_slist_next(list))->data;
|
PContact dave = (g_slist_next(list))->data;
|
||||||
PContact james = (g_slist_next(g_slist_next(list)))->data;
|
PContact james = (g_slist_next(g_slist_next(list)))->data;
|
||||||
@ -99,7 +99,7 @@ void add_twice_at_beginning_adds_once(void **state)
|
|||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
PContact first = list->data;
|
PContact first = list->data;
|
||||||
PContact second = (g_slist_next(list))->data;
|
PContact second = (g_slist_next(list))->data;
|
||||||
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
||||||
@ -118,7 +118,7 @@ void add_twice_in_middle_adds_once(void **state)
|
|||||||
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
PContact first = list->data;
|
PContact first = list->data;
|
||||||
PContact second = (g_slist_next(list))->data;
|
PContact second = (g_slist_next(list))->data;
|
||||||
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
||||||
@ -137,7 +137,7 @@ void add_twice_at_end_adds_once(void **state)
|
|||||||
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
roster_add("Dave", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
roster_add("Bob", NULL, NULL, NULL, FALSE);
|
||||||
roster_add("James", NULL, NULL, NULL, FALSE);
|
roster_add("James", NULL, NULL, NULL, FALSE);
|
||||||
GSList *list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
GSList *list = roster_get_contacts(ROSTER_ORD_NAME);
|
||||||
PContact first = list->data;
|
PContact first = list->data;
|
||||||
PContact second = (g_slist_next(list))->data;
|
PContact second = (g_slist_next(list))->data;
|
||||||
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
||||||
|
Loading…
Reference in New Issue
Block a user