# HG changeset patch # User Mark Doliner # Date 1265564610 0 # Node ID 584ef95f0e777e23cceffd94209f99a32fd4c7e1 # Parent b62d06a0e8efdc933cb075c103e2f9bb27d94831# Parent 88c462455bc84efc5a1af654bfb6cd4a1aa023b9 merge of '033dd646e39f8913f23a1536f8ff18c0489a8432' and '8a8eea49a73487bb8550ba0ec70e444aaa6e2204' diff -r b62d06a0e8ef -r 584ef95f0e77 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sun Feb 07 17:34:48 2010 +0000 +++ b/pidgin/gtkconv.c Sun Feb 07 17:43:30 2010 +0000 @@ -4150,9 +4150,29 @@ g_free(alias_key); } -static void -tab_complete_process_item(int *most_matched, char *entered, gsize entered_bytes, char **partial, char *nick_partial, - GList **matches, gboolean command, char *name) +/** + * @param most_matched Used internally by this function. + * @param entered The partial string that the user types before hitting the + * tab key. + * @param entered_bytes The length of entered. + * @param partial This is a return variable. This will be set to a string + * containing the largest common string between all matches. This will + * be inserted into the input box at the start of the word that the + * user is tab completing. For example, if a chat room contains + * "AlfFan" and "AlfHater" and the user types "a" then this will + * contain "Alf" + * @param nick_partial Used internally by this function. Shoudl be a + * temporary buffer that is entered_bytes+1 bytes long. + * @param matches This is a return variable. If the given name is a potential + * match for the entered string, then add a copy of the name to this + * list. The caller is responsible for g_free'ing the data in this + * list. + * @param name The buddy name or alias or slash command name that we're + * checking for a match. + */ +static void +tab_complete_process_item(int *most_matched, const char *entered, gsize entered_bytes, char **partial, char *nick_partial, + GList **matches, char *name) { memcpy(nick_partial, name, entered_bytes); if (purple_utf8_strcasecmp(nick_partial, entered)) @@ -4261,7 +4281,7 @@ /* Commands */ for (l = list; l != NULL; l = l->next) { tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, - &matches, TRUE, l->data); + &matches, l->data); } g_list_free(list); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { @@ -4274,7 +4294,7 @@ /* Users */ for (; l != NULL; l = l->next) { tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, - &matches, FALSE, ((PurpleConvChatBuddy *)l->data)->name); + &matches, ((PurpleConvChatBuddy *)l->data)->name); } @@ -4292,7 +4312,7 @@ if (name && alias && strcmp(name, alias)) tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, - &matches, FALSE, alias); + &matches, alias); g_free(name); g_free(alias);