# HG changeset patch # User Mikael Berthe # Date 1148502545 -7200 # Node ID b30df2ab457fa196063b80b8707ad030fdf37ca9 # Parent cee8d6be04e188681a08683153ab8fa9cd1125c3 Add "/buffer purge" diff -r cee8d6be04e1 -r b30df2ab457f mcabber/src/commands.c --- a/mcabber/src/commands.c Wed May 24 21:52:46 2006 +0200 +++ b/mcabber/src/commands.c Wed May 24 22:29:05 2006 +0200 @@ -155,6 +155,7 @@ compl_add_category_word(COMPL_BUFFER, "search_forward"); compl_add_category_word(COMPL_BUFFER, "date"); compl_add_category_word(COMPL_BUFFER, "%"); + compl_add_category_word(COMPL_BUFFER, "purge"); // Group category compl_add_category_word(COMPL_GROUP, "fold"); @@ -1012,6 +1013,8 @@ scr_BufferTopBottom(1); } else if (!strcasecmp(subcmd, "clear")) { scr_BufferClear(); + } else if (!strcasecmp(subcmd, "purge")) { + scr_BufferPurge(); } else if (!strcasecmp(subcmd, "up")) { buffer_updown(-1, arg); } else if (!strcasecmp(subcmd, "down")) { diff -r cee8d6be04e1 -r b30df2ab457f mcabber/src/screen.c --- a/mcabber/src/screen.c Wed May 24 21:52:46 2006 +0200 +++ b/mcabber/src/screen.c Wed May 24 22:29:05 2006 +0200 @@ -1523,6 +1523,37 @@ doupdate(); } +// scr_BufferPurge() +// Purge/Drop the current buddy buffer +void scr_BufferPurge(void) +{ + winbuf *win_entry; + guint isspe; + + // Get win_entry + if (!current_buddy) return; + isspe = buddy_gettype(BUDDATA(current_buddy)) & ROSTER_TYPE_SPECIAL; + win_entry = scr_SearchWindow(CURRENT_JID, isspe); + if (!win_entry) return; + + // Delete the current hbuf + hbuf_free(&win_entry->hbuf); + if (isspe) { + // Currently it can only be the status buffer + statushbuf = NULL; + } + + win_entry->cleared = FALSE; + win_entry->top = NULL; + + // Refresh the window + scr_UpdateBuddyWindow(); + + // Finished :) + update_panels(); + doupdate(); +} + // scr_BufferTopBottom() // Jump to the head/tail of the current buddy window // (top if topbottom == -1, bottom topbottom == 1) diff -r cee8d6be04e1 -r b30df2ab457f mcabber/src/screen.h --- a/mcabber/src/screen.h Wed May 24 21:52:46 2006 +0200 +++ b/mcabber/src/screen.h Wed May 24 22:29:05 2006 +0200 @@ -89,6 +89,7 @@ void scr_RosterJumpJid(char *); void scr_BufferTopBottom(int topbottom); void scr_BufferClear(void); +void scr_BufferPurge(void); void scr_BufferSearch(int direction, const char *text); void scr_BufferPercent(int pc); void scr_BufferDate(time_t t);