Rocco Rutte:
[apps/madmutt.git] / curs_lib.c
index b9c4557..e73d4f5 100644 (file)
@@ -16,6 +16,7 @@
 #endif
 
 #include "mutt.h"
+#include "enter.h"
 #include "mutt_menu.h"
 #include "mutt_curses.h"
 #include "pager.h"
@@ -275,7 +276,7 @@ void mutt_query_exit (void)
   if (Timeout)
     timeout (-1);               /* restore blocking operation */
   if (mutt_yesorno (_("Exit Mutt-ng?"), M_YES) == M_YES) {
-    endwin ();
+    mutt_endwin (NULL);
     exit (1);
   }
   mutt_clear_error ();
@@ -309,6 +310,36 @@ void mutt_curses_error (const char *fmt, ...)
   set_option (OPTMSGERR);
 }
 
+#ifdef USE_SOCKET
+void mutt_progress_bar (progress_t* progress, long pos) {
+  char posstr[SHORT_STRING];
+
+  if (!pos) {
+    if (!NetInc)
+      mutt_message (progress->msg);
+    else {
+      if (progress->size)
+        mutt_pretty_size (progress->sizestr, sizeof (progress->sizestr),
+                          progress->size);
+      progress->pos = 0;
+    }
+  }
+
+  if (!NetInc)
+    return;
+
+  if (pos >= progress->pos + (NetInc << 10)) {
+    progress->pos = pos;
+    pos = pos / (NetInc << 10) * (NetInc << 10);
+    mutt_pretty_size (posstr, sizeof (posstr), pos);
+    if (progress->size)
+      mutt_message ("%s %s/%s", progress->msg, posstr, progress->sizestr);
+    else
+      mutt_message ("%s %s", progress->msg, posstr);
+  }
+}
+#endif
+
 void mutt_curses_message (const char *fmt, ...)
 {
   char TmpErrorbuf[STRING];