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

Renamed roster autocomplete functions

This commit is contained in:
James Booth 2014-11-22 21:13:33 +00:00
parent c0420e9cfb
commit e8a65e3b68
5 changed files with 38 additions and 38 deletions

View File

@ -1864,7 +1864,7 @@ _cmd_complete_parameters(char *input, int *size)
gchar *contact_choices[] = { "/msg", "/info", "/status" };
for (i = 0; i < ARRAY_SIZE(contact_choices); i++) {
result = autocomplete_param_with_func(input, size, contact_choices[i],
roster_find_contact);
roster_contact_autocomplete);
if (result != NULL) {
ui_replace_input(input, result, size);
g_free(result);
@ -1875,7 +1875,7 @@ _cmd_complete_parameters(char *input, int *size)
gchar *resource_choices[] = { "/caps", "/software", "/ping" };
for (i = 0; i < ARRAY_SIZE(resource_choices); i++) {
result = autocomplete_param_with_func(input, size, resource_choices[i],
roster_find_resource);
roster_fulljid_autocomplete);
if (result != NULL) {
ui_replace_input(input, result, size);
g_free(result);
@ -1884,7 +1884,7 @@ _cmd_complete_parameters(char *input, int *size)
}
}
result = autocomplete_param_with_func(input, size, "/invite", roster_find_contact);
result = autocomplete_param_with_func(input, size, "/invite", roster_contact_autocomplete);
if (result != NULL) {
ui_replace_input(input, result, size);
g_free(result);
@ -2013,7 +2013,7 @@ _who_autocomplete(char *input, int *size)
"/who unavailable" };
for (i = 0; i < ARRAY_SIZE(group_commands); i++) {
result = autocomplete_param_with_func(input, size, group_commands[i], roster_find_group);
result = autocomplete_param_with_func(input, size, group_commands[i], roster_group_autocomplete);
if (result != NULL) {
return result;
}
@ -2032,15 +2032,15 @@ static char *
_roster_autocomplete(char *input, int *size)
{
char *result = NULL;
result = autocomplete_param_with_func(input, size, "/roster nick", roster_find_jid);
result = autocomplete_param_with_func(input, size, "/roster nick", roster_barejid_autocomplete);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_func(input, size, "/roster clearnick", roster_find_jid);
result = autocomplete_param_with_func(input, size, "/roster clearnick", roster_barejid_autocomplete);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_func(input, size, "/roster remove", roster_find_jid);
result = autocomplete_param_with_func(input, size, "/roster remove", roster_barejid_autocomplete);
if (result != NULL) {
return result;
}
@ -2068,24 +2068,24 @@ static char *
_group_autocomplete(char *input, int *size)
{
char *result = NULL;
result = autocomplete_param_with_func(input, size, "/group show", roster_find_group);
result = autocomplete_param_with_func(input, size, "/group show", roster_group_autocomplete);
if (result != NULL) {
return result;
}
result = autocomplete_param_no_with_func(input, size, "/group add", 4, roster_find_contact);
result = autocomplete_param_no_with_func(input, size, "/group add", 4, roster_contact_autocomplete);
if (result != NULL) {
return result;
}
result = autocomplete_param_no_with_func(input, size, "/group remove", 4, roster_find_contact);
result = autocomplete_param_no_with_func(input, size, "/group remove", 4, roster_contact_autocomplete);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_func(input, size, "/group add", roster_find_group);
result = autocomplete_param_with_func(input, size, "/group add", roster_group_autocomplete);
if (result != NULL) {
return result;
}
result = autocomplete_param_with_func(input, size, "/group remove", roster_find_group);
result = autocomplete_param_with_func(input, size, "/group remove", roster_group_autocomplete);
if (result != NULL) {
return result;
}
@ -2307,7 +2307,7 @@ _otr_autocomplete(char *input, int *size)
{
char *found = NULL;
found = autocomplete_param_with_func(input, size, "/otr start", roster_find_contact);
found = autocomplete_param_with_func(input, size, "/otr start", roster_contact_autocomplete);
if (found != NULL) {
return found;
}
@ -2326,7 +2326,7 @@ _otr_autocomplete(char *input, int *size)
g_string_append(beginning, " ");
g_string_append(beginning, args[1]);
found = autocomplete_param_with_func(input, size, beginning->str, roster_find_contact);
found = autocomplete_param_with_func(input, size, beginning->str, roster_contact_autocomplete);
g_string_free(beginning, TRUE);
if (found != NULL) {
g_strfreev(args);

View File

@ -322,13 +322,13 @@ roster_has_pending_subscriptions(void)
}
char *
roster_find_contact(char *search_str)
roster_contact_autocomplete(char *search_str)
{
return autocomplete_complete(name_ac, search_str, TRUE);
}
char *
roster_find_resource(char *search_str)
roster_fulljid_autocomplete(char *search_str)
{
return autocomplete_complete(fulljid_ac, search_str, TRUE);
}
@ -384,13 +384,13 @@ roster_get_groups(void)
}
char *
roster_find_group(char *search_str)
roster_group_autocomplete(char *search_str)
{
return autocomplete_complete(groups_ac, search_str, TRUE);
}
char *
roster_find_jid(char *search_str)
roster_barejid_autocomplete(char *search_str)
{
return autocomplete_complete(barejid_ac, search_str, TRUE);
}

View File

@ -58,12 +58,12 @@ gboolean roster_add(const char * const barejid, const char * const name, GSList
char * roster_barejid_from_name(const char * const name);
GSList * roster_get_contacts(void);
gboolean roster_has_pending_subscriptions(void);
char * roster_find_contact(char *search_str);
char * roster_find_resource(char *search_str);
char * roster_contact_autocomplete(char *search_str);
char * roster_fulljid_autocomplete(char *search_str);
GSList * roster_get_group(const char * const group);
GSList * roster_get_groups(void);
char * roster_find_group(char *search_str);
char * roster_find_jid(char *search_str);
char * roster_group_autocomplete(char *search_str);
char * roster_barejid_autocomplete(char *search_str);
GSList * roster_get_contacts_by_presence(const char * const presence);
GSList * roster_get_nogroup(void);

View File

@ -264,7 +264,7 @@ _show_privacy(void)
if (current_recipient != NULL) {
char *recipient_jid = NULL;
char *found_contact = roster_find_contact(current_recipient);
char *found_contact = roster_contact_autocomplete(current_recipient);
if (found_contact != NULL) {
recipient_jid = roster_barejid_from_name(current_recipient);
free(found_contact);
@ -338,7 +338,7 @@ _show_contact_presence(void)
if (prefs_get_boolean(PREF_PRESENCE) && current_recipient) {
char *recipient_jid = NULL;
char *found_contact = roster_find_contact(current_recipient);
char *found_contact = roster_contact_autocomplete(current_recipient);
if (found_contact) {
recipient_jid = roster_barejid_from_name(current_recipient);
free(found_contact);

View File

@ -158,7 +158,7 @@ void find_first_exists(void **state)
char *search = strdup("B");
char *result = roster_find_contact(search);
char *result = roster_contact_autocomplete(search);
assert_string_equal("Bob", result);
free(result);
free(search);
@ -172,7 +172,7 @@ void find_second_exists(void **state)
roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result = roster_find_contact("Dav");
char *result = roster_contact_autocomplete("Dav");
assert_string_equal("Dave", result);
free(result);
roster_free();
@ -185,7 +185,7 @@ void find_third_exists(void **state)
roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result = roster_find_contact("Ja");
char *result = roster_contact_autocomplete("Ja");
assert_string_equal("James", result);
free(result);
roster_free();
@ -198,7 +198,7 @@ void find_returns_null(void **state)
roster_add("Dave", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result = roster_find_contact("Mike");
char *result = roster_contact_autocomplete("Mike");
assert_null(result);
roster_free();
}
@ -206,7 +206,7 @@ void find_returns_null(void **state)
void find_on_empty_returns_null(void **state)
{
roster_init();
char *result = roster_find_contact("James");
char *result = roster_contact_autocomplete("James");
assert_null(result);
roster_free();
}
@ -218,8 +218,8 @@ void find_twice_returns_second_when_two_match(void **state)
roster_add("Jamie", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result1 = roster_find_contact("Jam");
char *result2 = roster_find_contact(result1);
char *result1 = roster_contact_autocomplete("Jam");
char *result2 = roster_contact_autocomplete(result1);
assert_string_equal("Jamie", result2);
free(result1);
free(result2);
@ -240,11 +240,11 @@ void find_five_times_finds_fifth(void **state)
roster_add("Jamy", NULL, NULL, NULL, FALSE);
roster_add("Jamz", NULL, NULL, NULL, FALSE);
char *result1 = roster_find_contact("Jam");
char *result2 = roster_find_contact(result1);
char *result3 = roster_find_contact(result2);
char *result4 = roster_find_contact(result3);
char *result5 = roster_find_contact(result4);
char *result1 = roster_contact_autocomplete("Jam");
char *result2 = roster_contact_autocomplete(result1);
char *result3 = roster_contact_autocomplete(result2);
char *result4 = roster_contact_autocomplete(result3);
char *result5 = roster_contact_autocomplete(result4);
assert_string_equal("Jamo", result5);
free(result1);
free(result2);
@ -261,9 +261,9 @@ void find_twice_returns_first_when_two_match_and_reset(void **state)
roster_add("Jamie", NULL, NULL, NULL, FALSE);
roster_add("Bob", NULL, NULL, NULL, FALSE);
char *result1 = roster_find_contact("Jam");
char *result1 = roster_contact_autocomplete("Jam");
roster_reset_search_attempts();
char *result2 = roster_find_contact(result1);
char *result2 = roster_contact_autocomplete(result1);
assert_string_equal("James", result2);
free(result1);
free(result2);