comparison mcabber/src/screen.c @ 1279:8bbc764139ef

Implement /buffer close|purge [jid]
author Mikael Berthe <mikael@lilotux.net>
date Sat, 25 Aug 2007 12:05:12 +0200
parents 033576acac4c
children 8b621f980321
comparison
equal deleted inserted replaced
1278:c3107650d165 1279:8bbc764139ef
2096 win_entry->bd->cleared = FALSE; 2096 win_entry->bd->cleared = FALSE;
2097 win_entry->bd->top = NULL; 2097 win_entry->bd->top = NULL;
2098 } 2098 }
2099 } 2099 }
2100 2100
2101 // scr_BufferPurge(closebuf) 2101 // scr_BufferPurge(closebuf, jid)
2102 // Purge/Drop the current buddy buffer 2102 // Purge/Drop the current buddy buffer or jid's buffer if jid != NULL.
2103 // If closebuf is 1, close the buffer. 2103 // If closebuf is 1, close the buffer.
2104 void scr_BufferPurge(int closebuf) 2104 void scr_BufferPurge(int closebuf, const char *jid)
2105 { 2105 {
2106 winbuf *win_entry; 2106 winbuf *win_entry;
2107 guint isspe; 2107 guint isspe;
2108 guint *p_closebuf; 2108 guint *p_closebuf;
2109 2109 const char *cjid;
2110 // Get win_entry 2110
2111 if (!current_buddy) return; 2111 if (jid) {
2112 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; 2112 cjid = jid;
2113 win_entry = scr_SearchWindow(CURRENT_JID, isspe); 2113 isspe = FALSE;
2114 } else {
2115 // Get win_entry
2116 if (!current_buddy) return;
2117 cjid = CURRENT_JID;
2118 isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL;
2119 }
2120 win_entry = scr_SearchWindow(cjid, isspe);
2114 if (!win_entry) return; 2121 if (!win_entry) return;
2115 2122
2116 if (!isspe) { 2123 if (!isspe) {
2117 p_closebuf = g_new(guint, 1); 2124 p_closebuf = g_new(guint, 1);
2118 *p_closebuf = closebuf; 2125 *p_closebuf = closebuf;
2119 buffer_purge((gpointer)CURRENT_JID, win_entry, p_closebuf); 2126 buffer_purge((gpointer)cjid, win_entry, p_closebuf);
2120 g_free(p_closebuf); 2127 g_free(p_closebuf);
2121 if (closebuf) { 2128 if (closebuf) {
2122 scr_set_chatmode(FALSE); 2129 scr_set_chatmode(FALSE);
2123 currentWindow = NULL; 2130 currentWindow = NULL;
2124 } 2131 }