changeset 1135:5d7c05932b13

Add command /buffer close
author Mikael Berthe <mikael@lilotux.net>
date Sat, 03 Feb 2007 20:05:57 +0100
parents 995dde656033
children 73820cf499a4
files mcabber/doc/help/en/hlp_buffer.txt mcabber/doc/help/fr/hlp_buffer.txt mcabber/src/commands.c mcabber/src/screen.c mcabber/src/screen.h
diffstat 5 files changed, 25 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/doc/help/en/hlp_buffer.txt	Sat Feb 03 18:31:55 2007 +0100
+++ b/mcabber/doc/help/en/hlp_buffer.txt	Sat Feb 03 20:05:57 2007 +0100
@@ -1,17 +1,20 @@
 
- /BUFFER [clear|purge|top|bottom|date|%|search_backward|search_forward]
+ /BUFFER [clear|close|purge]
+ /BUFFER [top|bottom|date|%|search_backward|search_forward]
  /BUFFER [scroll_lock|scroll_unlock|scroll_toggle]
 
 Buddy's buffer manipulation command.  Eg. you can search through buffer for "text", clear chat window etc.
 
 /buffer clear
  Clear the current buddy chat window
+/buffer close
+ Empty all contents of the buffer and close the current buddy chat window
 /buffer purge
  Clear the current buddy chat window and empty all contents of the chat buffer
+/buffer top
+ Jump to the top of the current buddy chat buffer
 /buffer bottom
  Jump to the bottom of the current buddy chat buffer
-/buffer top
- Jump to the top of the current buddy chat buffer
 /buffer up [n]
  Scroll the buffer up [n] lines (default: half a screen)
 /buffer down [n]
--- a/mcabber/doc/help/fr/hlp_buffer.txt	Sat Feb 03 18:31:55 2007 +0100
+++ b/mcabber/doc/help/fr/hlp_buffer.txt	Sat Feb 03 20:05:57 2007 +0100
@@ -1,17 +1,20 @@
 
- /BUFFER [clear|purge|top|bottom|date|%|search_backward|search_forward]
+ /BUFFER [clear|close|purge]
+ /BUFFER [top|bottom|date|%|search_backward|search_forward]
  /BUFFER [scroll_lock|scroll_unlock|scroll_toggle]
 
 Cette commande permet de gérer les tampons de discussions avec les différents contacts. Par exemple vous pouvez rechercher un texte, effacer la fenêtre de discussion, etc.
 
 /buffer clear
  Efface la fenêtre du contact sélectionné
+/buffer close
+ Ferme la fenêtre du contact sélectionné après avoir vidé le contenu du tampon associé
 /buffer purge
  Efface la fenêtre du contact sélectionné et vide le contenu du tampon associé
+/buffer top
+ Va au début du tampon
 /buffer bottom
  Va à la fin du tampon
-/buffer top
- Va au début du tampon
 /buffer up [n]
  Défile vers le haut de [n] lignes (par défaut un demi écran)
 /buffer down [n]
--- a/mcabber/src/commands.c	Sat Feb 03 18:31:55 2007 +0100
+++ b/mcabber/src/commands.c	Sat Feb 03 20:05:57 2007 +0100
@@ -174,6 +174,7 @@
   compl_add_category_word(COMPL_BUFFER, "date");
   compl_add_category_word(COMPL_BUFFER, "%");
   compl_add_category_word(COMPL_BUFFER, "purge");
+  compl_add_category_word(COMPL_BUFFER, "close");
   compl_add_category_word(COMPL_BUFFER, "scroll_lock");
   compl_add_category_word(COMPL_BUFFER, "scroll_unlock");
   compl_add_category_word(COMPL_BUFFER, "scroll_toggle");
@@ -1240,8 +1241,10 @@
     scr_BufferTopBottom(1);
   } else if (!strcasecmp(subcmd, "clear")) {
     scr_BufferClear();
+  } else if (!strcasecmp(subcmd, "close")) {
+    scr_BufferPurge(1);
   } else if (!strcasecmp(subcmd, "purge")) {
-    scr_BufferPurge();
+    scr_BufferPurge(0);
   } else if (!strcasecmp(subcmd, "scroll_lock")) {
     scr_BufferScrollLock(1);
   } else if (!strcasecmp(subcmd, "scroll_unlock")) {
--- a/mcabber/src/screen.c	Sat Feb 03 18:31:55 2007 +0100
+++ b/mcabber/src/screen.c	Sat Feb 03 20:05:57 2007 +0100
@@ -1753,9 +1753,10 @@
   update_panels();
 }
 
-//  scr_BufferPurge()
+//  scr_BufferPurge(closebuf)
 // Purge/Drop the current buddy buffer
-void scr_BufferPurge(void)
+// If closebuf is 1, close the buffer.
+void scr_BufferPurge(int closebuf)
 {
   winbuf *win_entry;
   guint isspe;
@@ -1776,6 +1777,11 @@
   win_entry->cleared = FALSE;
   win_entry->top = NULL;
 
+  if (closebuf && !isspe) {
+    scr_set_chatmode(FALSE);
+    g_hash_table_remove(winbufhash, CURRENT_JID);
+  }
+
   // Refresh the window
   scr_UpdateBuddyWindow();
 
--- a/mcabber/src/screen.h	Sat Feb 03 18:31:55 2007 +0100
+++ b/mcabber/src/screen.h	Sat Feb 03 20:05:57 2007 +0100
@@ -118,7 +118,7 @@
 void scr_BufferTopBottom(int topbottom);
 void scr_BufferClear(void);
 void scr_BufferScrollLock(int lock);
-void scr_BufferPurge(void);
+void scr_BufferPurge(int);
 void scr_BufferSearch(int direction, const char *text);
 void scr_BufferPercent(int pc);
 void scr_BufferDate(time_t t);