comparison src/conversation.c @ 6456:ccfdf9f2cdd1

[gaim-migrate @ 6965] Conversation placement by group now applies to chats in the buddy list as well. Also added functions for finding a chat by name, and getting its parent group. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 13 Aug 2003 21:08:29 +0000
parents 9c65a439d327
children 338147ea6896
comparison
equal deleted inserted replaced
6455:cd0b5eaf9460 6456:ccfdf9f2cdd1
2218 GaimWindow *win; 2218 GaimWindow *win;
2219 GaimConversationType type; 2219 GaimConversationType type;
2220 2220
2221 type = gaim_conversation_get_type(conv); 2221 type = gaim_conversation_get_type(conv);
2222 2222
2223 if (type != GAIM_CONV_IM) { 2223 if (type == GAIM_CONV_IM) {
2224 win = gaim_get_last_window_with_type(type);
2225
2226 if (win == NULL)
2227 conv_placement_new_window(conv);
2228 else
2229 gaim_window_add_conversation(win, conv);
2230 }
2231 else {
2232 struct buddy *b; 2224 struct buddy *b;
2233 struct group *grp = NULL; 2225 struct group *grp = NULL;
2234 GList *wins, *convs; 2226 GList *wins, *convs;
2235 2227
2236 b = gaim_find_buddy(gaim_conversation_get_account(conv), 2228 b = gaim_find_buddy(gaim_conversation_get_account(conv),
2268 } 2260 }
2269 } 2261 }
2270 2262
2271 /* Make a new window. */ 2263 /* Make a new window. */
2272 conv_placement_new_window(conv); 2264 conv_placement_new_window(conv);
2265 }
2266 else if (type == GAIM_CONV_CHAT) {
2267 struct chat *chat;
2268 struct group *group = NULL;
2269 GList *wins, *convs;
2270
2271 chat = gaim_blist_find_chat(gaim_conversation_get_account(conv),
2272 gaim_conversation_get_name(conv));
2273
2274 if (chat != NULL)
2275 group = gaim_blist_chat_get_group(chat);
2276
2277 /* Go through the list of chats and find one with this group. */
2278 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
2279 GaimWindow *win2;
2280 GaimConversation *conv2;
2281 struct chat *chat2;
2282 struct group *group2 = NULL;
2283
2284 win2 = (GaimWindow *)wins->data;
2285
2286 for (convs = gaim_window_get_conversations(win2);
2287 convs != NULL;
2288 convs = convs->next) {
2289
2290 conv2 = (GaimConversation *)convs->data;
2291
2292 chat2 = gaim_blist_find_chat(
2293 gaim_conversation_get_account(conv2),
2294 gaim_conversation_get_name(conv2));
2295
2296 if (chat2 != NULL)
2297 group2 = gaim_blist_chat_get_group(chat2);
2298
2299 if (group == group2) {
2300 gaim_window_add_conversation(win2, conv);
2301
2302 return;
2303 }
2304 }
2305 }
2306
2307 /* Make a new window. */
2308 conv_placement_new_window(conv);
2309 }
2310 else {
2311 win = gaim_get_last_window_with_type(type);
2312
2313 if (win == NULL)
2314 conv_placement_new_window(conv);
2315 else
2316 gaim_window_add_conversation(win, conv);
2273 } 2317 }
2274 } 2318 }
2275 2319
2276 /* This groups things by account. Otherwise, the same semantics as above */ 2320 /* This groups things by account. Otherwise, the same semantics as above */
2277 static void 2321 static void