comparison mcabber/src/screen.c @ 1345:8e4e741787be

Small change to buffer close Don't leave chat mode if the buffer to close isn't the current one.
author Mikael Berthe <mikael@lilotux.net>
date Fri, 09 Nov 2007 19:32:45 +0100
parents e30a9d907105
children 9716cf8a0726
comparison
equal deleted inserted replaced
1344:44ff580ee388 1345:8e4e741787be
2395 { 2395 {
2396 winbuf *win_entry; 2396 winbuf *win_entry;
2397 guint isspe; 2397 guint isspe;
2398 guint *p_closebuf; 2398 guint *p_closebuf;
2399 const char *cjid; 2399 const char *cjid;
2400 guint hold_chatmode = FALSE;
2400 2401
2401 if (jid) { 2402 if (jid) {
2402 cjid = jid; 2403 cjid = jid;
2403 isspe = FALSE; 2404 isspe = FALSE;
2405 // If closebuf is TRUE, it's probably better not to leave chat mode
2406 // if the change isn't related to the current buffer.
2407 if (closebuf && current_buddy) {
2408 if (buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL ||
2409 strcasecmp(jid, CURRENT_JID))
2410 hold_chatmode = TRUE;
2411 }
2404 } else { 2412 } else {
2405 // Get win_entry 2413 // Get win_entry
2406 if (!current_buddy) return; 2414 if (!current_buddy) return;
2407 cjid = CURRENT_JID; 2415 cjid = CURRENT_JID;
2408 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; 2416 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
2413 if (!isspe) { 2421 if (!isspe) {
2414 p_closebuf = g_new(guint, 1); 2422 p_closebuf = g_new(guint, 1);
2415 *p_closebuf = closebuf; 2423 *p_closebuf = closebuf;
2416 buffer_purge((gpointer)cjid, win_entry, p_closebuf); 2424 buffer_purge((gpointer)cjid, win_entry, p_closebuf);
2417 g_free(p_closebuf); 2425 g_free(p_closebuf);
2418 if (closebuf) { 2426 if (closebuf && !hold_chatmode) {
2419 scr_set_chatmode(FALSE); 2427 scr_set_chatmode(FALSE);
2420 currentWindow = NULL; 2428 currentWindow = NULL;
2421 } 2429 }
2422 } else { 2430 } else {
2423 // (Special buffer) 2431 // (Special buffer)