Mercurial > ~mikael > mcabber > hg
diff 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 |
line wrap: on
line diff
--- a/mcabber/src/screen.c Sat Aug 25 11:06:28 2007 +0200 +++ b/mcabber/src/screen.c Sat Aug 25 12:05:12 2007 +0200 @@ -2098,25 +2098,32 @@ } } -// scr_BufferPurge(closebuf) -// Purge/Drop the current buddy buffer +// scr_BufferPurge(closebuf, jid) +// Purge/Drop the current buddy buffer or jid's buffer if jid != NULL. // If closebuf is 1, close the buffer. -void scr_BufferPurge(int closebuf) +void scr_BufferPurge(int closebuf, const char *jid) { winbuf *win_entry; guint isspe; guint *p_closebuf; - - // Get win_entry - if (!current_buddy) return; - isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; - win_entry = scr_SearchWindow(CURRENT_JID, isspe); + const char *cjid; + + if (jid) { + cjid = jid; + isspe = FALSE; + } else { + // Get win_entry + if (!current_buddy) return; + cjid = CURRENT_JID; + isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; + } + win_entry = scr_SearchWindow(cjid, isspe); if (!win_entry) return; if (!isspe) { p_closebuf = g_new(guint, 1); *p_closebuf = closebuf; - buffer_purge((gpointer)CURRENT_JID, win_entry, p_closebuf); + buffer_purge((gpointer)cjid, win_entry, p_closebuf); g_free(p_closebuf); if (closebuf) { scr_set_chatmode(FALSE);