changeset 866:b30df2ab457f

Add "/buffer purge"
author Mikael Berthe <mikael@lilotux.net>
date Wed, 24 May 2006 22:29:05 +0200
parents cee8d6be04e1
children 7f056c566569
files mcabber/src/commands.c mcabber/src/screen.c mcabber/src/screen.h
diffstat 3 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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")) {
--- 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)
--- 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);