Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/screen.c @ 2012:2039ea6bd7a5
Fix bug in /buffer close_all command
author | Hermitifier |
---|---|
date | Thu, 01 Mar 2012 14:46:49 +0100 |
parents | a859ed648638 |
children | 8dc418af3e72 |
comparison
equal
deleted
inserted
replaced
2011:c3214f645131 | 2012:2039ea6bd7a5 |
---|---|
2691 // buffer_purge() | 2691 // buffer_purge() |
2692 // key: winId/jid | 2692 // key: winId/jid |
2693 // value: winbuf structure | 2693 // value: winbuf structure |
2694 // data: int, set to 1 if the buffer should be closed. | 2694 // data: int, set to 1 if the buffer should be closed. |
2695 // NOTE: does not work for special buffers. | 2695 // NOTE: does not work for special buffers. |
2696 static void buffer_purge(gpointer key, gpointer value, gpointer data) | 2696 static gboolean buffer_purge(gpointer key, gpointer value, gpointer data) |
2697 { | 2697 { |
2698 int *p_closebuf = data; | 2698 int *p_closebuf = data; |
2699 winbuf *win_entry = value; | 2699 winbuf *win_entry = value; |
2700 gboolean retval = FALSE; | |
2700 | 2701 |
2701 // Delete the current hbuf | 2702 // Delete the current hbuf |
2702 hbuf_free(&win_entry->bd->hbuf); | 2703 hbuf_free(&win_entry->bd->hbuf); |
2703 | 2704 |
2704 if (*p_closebuf) { | 2705 if (*p_closebuf) { |
2705 g_hash_table_remove(winbufhash, key); | 2706 retval = TRUE; |
2706 } else { | 2707 } else { |
2707 win_entry->bd->cleared = FALSE; | 2708 win_entry->bd->cleared = FALSE; |
2708 win_entry->bd->top = NULL; | 2709 win_entry->bd->top = NULL; |
2709 } | 2710 } |
2711 return retval; | |
2710 } | 2712 } |
2711 | 2713 |
2712 // scr_buffer_purge(closebuf, jid) | 2714 // scr_buffer_purge(closebuf, jid) |
2713 // Purge/Drop the current buddy buffer or jid's buffer if jid != NULL. | 2715 // Purge/Drop the current buddy buffer or jid's buffer if jid != NULL. |
2714 // If closebuf is 1, close the buffer. | 2716 // If closebuf is 1, close the buffer. |
2740 if (!win_entry) return; | 2742 if (!win_entry) return; |
2741 | 2743 |
2742 if (!isspe) { | 2744 if (!isspe) { |
2743 p_closebuf = g_new(guint, 1); | 2745 p_closebuf = g_new(guint, 1); |
2744 *p_closebuf = closebuf; | 2746 *p_closebuf = closebuf; |
2745 buffer_purge((gpointer)cjid, win_entry, p_closebuf); | 2747 if(buffer_purge((gpointer)cjid, win_entry, p_closebuf)) |
2748 g_hash_table_remove(winbufhash, cjid); | |
2746 roster_msg_setflag(cjid, FALSE, FALSE); | 2749 roster_msg_setflag(cjid, FALSE, FALSE); |
2747 g_free(p_closebuf); | 2750 g_free(p_closebuf); |
2748 if (closebuf && !hold_chatmode) { | 2751 if (closebuf && !hold_chatmode) { |
2752 //buddy_setactiveresource(bud, resource); | |
2749 scr_set_chatmode(FALSE); | 2753 scr_set_chatmode(FALSE); |
2750 currentWindow = NULL; | 2754 currentWindow = NULL; |
2751 } | 2755 } |
2752 } else { | 2756 } else { |
2753 // (Special buffer) | 2757 // (Special buffer) |
2777 { | 2781 { |
2778 guint *p_closebuf; | 2782 guint *p_closebuf; |
2779 p_closebuf = g_new(guint, 1); | 2783 p_closebuf = g_new(guint, 1); |
2780 | 2784 |
2781 *p_closebuf = closebuf; | 2785 *p_closebuf = closebuf; |
2782 g_hash_table_foreach(winbufhash, buffer_purge, p_closebuf); | 2786 g_hash_table_foreach_remove(winbufhash, buffer_purge, p_closebuf); |
2783 g_free(p_closebuf); | 2787 g_free(p_closebuf); |
2784 | 2788 |
2785 if (closebuf) { | 2789 if (closebuf) { |
2786 scr_set_chatmode(FALSE); | 2790 scr_set_chatmode(FALSE); |
2787 currentWindow = NULL; | 2791 currentWindow = NULL; |