Mercurial > pidgin.yaz
comparison libpurple/blist.c @ 24387:123c78e48663
Use normalized chat names when searching for chats. This fixes an issue
where irc.undernet.org sends the chat-name in uppercase, and screws up
persistent chats. Fixes #5028.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 15 Nov 2008 03:53:25 +0000 |
parents | 8282911d5e17 |
children | 8fb78d30ea83 0331bc480515 |
comparison
equal
deleted
inserted
replaced
24386:892adcbf94c9 | 24387:123c78e48663 |
---|---|
2212 PurplePlugin *prpl; | 2212 PurplePlugin *prpl; |
2213 PurplePluginProtocolInfo *prpl_info = NULL; | 2213 PurplePluginProtocolInfo *prpl_info = NULL; |
2214 struct proto_chat_entry *pce; | 2214 struct proto_chat_entry *pce; |
2215 PurpleBlistNode *node, *group; | 2215 PurpleBlistNode *node, *group; |
2216 GList *parts; | 2216 GList *parts; |
2217 char *normname; | |
2217 | 2218 |
2218 g_return_val_if_fail(purplebuddylist != NULL, NULL); | 2219 g_return_val_if_fail(purplebuddylist != NULL, NULL); |
2219 g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); | 2220 g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); |
2220 | 2221 |
2221 if (!purple_account_is_connected(account)) | 2222 if (!purple_account_is_connected(account)) |
2225 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | 2226 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
2226 | 2227 |
2227 if (prpl_info->find_blist_chat != NULL) | 2228 if (prpl_info->find_blist_chat != NULL) |
2228 return prpl_info->find_blist_chat(account, name); | 2229 return prpl_info->find_blist_chat(account, name); |
2229 | 2230 |
2231 normname = g_strdup(purple_normalize(account, name)); | |
2230 for (group = purplebuddylist->root; group != NULL; group = group->next) { | 2232 for (group = purplebuddylist->root; group != NULL; group = group->next) { |
2231 for (node = group->child; node != NULL; node = node->next) { | 2233 for (node = group->child; node != NULL; node = node->next) { |
2232 if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | 2234 if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
2233 | 2235 |
2234 chat = (PurpleChat*)node; | 2236 chat = (PurpleChat*)node; |
2244 pce->identifier); | 2246 pce->identifier); |
2245 g_list_foreach(parts, (GFunc)g_free, NULL); | 2247 g_list_foreach(parts, (GFunc)g_free, NULL); |
2246 g_list_free(parts); | 2248 g_list_free(parts); |
2247 | 2249 |
2248 if (chat->account == account && chat_name != NULL && | 2250 if (chat->account == account && chat_name != NULL && |
2249 name != NULL && !strcmp(chat_name, name)) { | 2251 normname != NULL && !strcmp(purple_normalize(account, chat_name), normname)) { |
2250 | 2252 g_free(normname); |
2251 return chat; | 2253 return chat; |
2252 } | 2254 } |
2253 } | 2255 } |
2254 } | 2256 } |
2255 } | 2257 } |
2256 | 2258 |
2259 g_free(normname); | |
2257 return NULL; | 2260 return NULL; |
2258 } | 2261 } |
2259 | 2262 |
2260 PurpleGroup * | 2263 PurpleGroup * |
2261 purple_chat_get_group(PurpleChat *chat) | 2264 purple_chat_get_group(PurpleChat *chat) |