Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 29749:8c87d8558fb5
propagate from branch 'im.pidgin.pidgin' (head 226a30da7a9fe3b828a1fe564797b3388e6159bc)
to branch 'im.pidgin.pidgin.next.minor' (head 1e6b3ddac07dbc4d92425cb8f7fd28e21c7b6138)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 08 Feb 2010 17:07:30 +0000 |
parents | 56ea87a90cba 88c462455bc8 |
children | 2b9db39bd7ed |
comparison
equal
deleted
inserted
replaced
29748:56ea87a90cba | 29749:8c87d8558fb5 |
---|---|
4047 if (is_me && color) | 4047 if (is_me && color) |
4048 gdk_color_free(color); | 4048 gdk_color_free(color); |
4049 g_free(alias_key); | 4049 g_free(alias_key); |
4050 } | 4050 } |
4051 | 4051 |
4052 static void | 4052 /** |
4053 tab_complete_process_item(int *most_matched, char *entered, gsize entered_bytes, char **partial, char *nick_partial, | 4053 * @param most_matched Used internally by this function. |
4054 GList **matches, gboolean command, char *name) | 4054 * @param entered The partial string that the user types before hitting the |
4055 * tab key. | |
4056 * @param entered_bytes The length of entered. | |
4057 * @param partial This is a return variable. This will be set to a string | |
4058 * containing the largest common string between all matches. This will | |
4059 * be inserted into the input box at the start of the word that the | |
4060 * user is tab completing. For example, if a chat room contains | |
4061 * "AlfFan" and "AlfHater" and the user types "a<TAB>" then this will | |
4062 * contain "Alf" | |
4063 * @param nick_partial Used internally by this function. Shoudl be a | |
4064 * temporary buffer that is entered_bytes+1 bytes long. | |
4065 * @param matches This is a return variable. If the given name is a potential | |
4066 * match for the entered string, then add a copy of the name to this | |
4067 * list. The caller is responsible for g_free'ing the data in this | |
4068 * list. | |
4069 * @param name The buddy name or alias or slash command name that we're | |
4070 * checking for a match. | |
4071 */ | |
4072 static void | |
4073 tab_complete_process_item(int *most_matched, const char *entered, gsize entered_bytes, char **partial, char *nick_partial, | |
4074 GList **matches, char *name) | |
4055 { | 4075 { |
4056 memcpy(nick_partial, name, entered_bytes); | 4076 memcpy(nick_partial, name, entered_bytes); |
4057 if (purple_utf8_strcasecmp(nick_partial, entered)) | 4077 if (purple_utf8_strcasecmp(nick_partial, entered)) |
4058 return; | 4078 return; |
4059 | 4079 |
4158 GList *l; | 4178 GList *l; |
4159 | 4179 |
4160 /* Commands */ | 4180 /* Commands */ |
4161 for (l = list; l != NULL; l = l->next) { | 4181 for (l = list; l != NULL; l = l->next) { |
4162 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, | 4182 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, |
4163 &matches, TRUE, l->data); | 4183 &matches, l->data); |
4164 } | 4184 } |
4165 g_list_free(list); | 4185 g_list_free(list); |
4166 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { | 4186 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
4167 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); | 4187 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); |
4168 GList *l = purple_conv_chat_get_users(chat); | 4188 GList *l = purple_conv_chat_get_users(chat); |
4171 int f; | 4191 int f; |
4172 | 4192 |
4173 /* Users */ | 4193 /* Users */ |
4174 for (; l != NULL; l = l->next) { | 4194 for (; l != NULL; l = l->next) { |
4175 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, | 4195 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, |
4176 &matches, FALSE, ((PurpleConvChatBuddy *)l->data)->name); | 4196 &matches, ((PurpleConvChatBuddy *)l->data)->name); |
4177 } | 4197 } |
4178 | 4198 |
4179 | 4199 |
4180 /* Aliases */ | 4200 /* Aliases */ |
4181 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | 4201 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
4189 CHAT_USERS_ALIAS_COLUMN, &alias, | 4209 CHAT_USERS_ALIAS_COLUMN, &alias, |
4190 -1); | 4210 -1); |
4191 | 4211 |
4192 if (name && alias && strcmp(name, alias)) | 4212 if (name && alias && strcmp(name, alias)) |
4193 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, | 4213 tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial, |
4194 &matches, FALSE, alias); | 4214 &matches, alias); |
4195 g_free(name); | 4215 g_free(name); |
4196 g_free(alias); | 4216 g_free(alias); |
4197 | 4217 |
4198 f = gtk_tree_model_iter_next(model, &iter); | 4218 f = gtk_tree_model_iter_next(model, &iter); |
4199 } while (f != 0); | 4219 } while (f != 0); |