Add "mutt_" prefix to global sidebar functions.

Also, remove unused sb_init declaration.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
# HG changeset patch
# User Kevin McCarthy <[email protected]>
# Date 1464744521 25200
#      Tue May 31 18:28:41 2016 -0700
# Node ID 511014517c8567de59ceebcb08c0494566e464b3
# Parent  bc43f166e8cda5638ad594aa941b6ce0543634c3
Add "mutt_" prefix to global sidebar functions.

Also, remove unused sb_init declaration.

diff --git a/buffy.c b/buffy.c
--- a/buffy.c
+++ b/buffy.c
@@ -239,17 +239,17 @@
     strfcpy (buf, path->data, sizeof (buf));
 
     if(data == MUTT_UNMAILBOXES && mutt_strcmp(buf,"*") == 0)
     {
       for (tmp = &Incoming; *tmp;)
       {
         tmp1=(*tmp)->next;
 #ifdef USE_SIDEBAR
-       sb_notify_mailbox (*tmp, 0);
+       mutt_sb_notify_mailbox (*tmp, 0);
 #endif
         buffy_free (tmp);
         *tmp=tmp1;
       }
       return 0;
     }
 
     mutt_expand_path (buf, sizeof (buf));
@@ -275,28 +275,28 @@
     }
 
     if(data == MUTT_UNMAILBOXES)
     {
       if(*tmp)
       {
         tmp1=(*tmp)->next;
 #ifdef USE_SIDEBAR
-       sb_notify_mailbox (*tmp, 0);
+       mutt_sb_notify_mailbox (*tmp, 0);
 #endif
         buffy_free (tmp);
         *tmp=tmp1;
       }
       continue;
     }
 
     if (!*tmp) {
       *tmp = buffy_new (buf);
 #ifdef USE_SIDEBAR
-      sb_notify_mailbox (*tmp, 1);
+      mutt_sb_notify_mailbox (*tmp, 1);
 #endif
     }
 
     (*tmp)->new = 0;
     (*tmp)->notified = 1;
     (*tmp)->newly_created = 0;
 
     /* for check_mbox_size, it is important that if the folder is new (tested 
by
@@ -577,17 +577,17 @@
   if (!Context || Context->magic == MUTT_IMAP || Context->magic == MUTT_POP
       || stat (Context->path, &contex_sb) != 0)
   {
     contex_sb.st_dev=0;
     contex_sb.st_ino=0;
   }
   
 #ifdef USE_SIDEBAR
-  int should_refresh = sb_should_refresh();
+  int should_refresh = mutt_sb_should_refresh();
 #endif
   for (tmp = Incoming; tmp; tmp = tmp->next)
   {
     if (tmp->magic != MUTT_IMAP)
     {
       tmp->new = 0;
 #ifdef USE_POP
       if (mx_is_pop (tmp->path))
@@ -652,17 +652,17 @@
       tmp->notified = 0;
     else if (!tmp->notified)
       BuffyNotify++;
   }
 #ifdef USE_SIDEBAR
   if (should_refresh)
   {
     SidebarNeedsRedraw = 1;
-    sb_set_update_time();
+    mutt_sb_set_update_time();
   }
 #endif
 
   BuffyDoneTime = BuffyTime;
   return (BuffyCount);
 }
 
 int mutt_buffy_list (void)
diff --git a/curs_main.c b/curs_main.c
--- a/curs_main.c
+++ b/curs_main.c
@@ -618,17 +618,17 @@
       mutt_show_error ();
     }
 
     if (menu->menu == MENU_MAIN)
     {
 #ifdef USE_SIDEBAR
       if (menu->redraw & REDRAW_SIDEBAR || SidebarNeedsRedraw)
       {
-        sb_set_buffystats (Context);
+        mutt_sb_set_buffystats (Context);
         menu_redraw_sidebar (menu);
       }
 #endif
       if (Context && Context->hdrs && !(menu->current >= Context->vcount))
       {
        menu_check_recenter (menu);
 
        if (menu->redraw & REDRAW_INDEX)
@@ -1196,17 +1196,17 @@
          {
            mutt_error _("No mailboxes have new mail");
            break;
          }
        }
 #ifdef USE_SIDEBAR
         else if (op == OP_SIDEBAR_OPEN)
         {
-          const char *path = sb_get_highlight();
+          const char *path = mutt_sb_get_highlight();
           if (!path || !*path)
             break;
           strncpy (buf, path, sizeof (buf));
         }
 #endif
        else
        {
          mutt_buffy (buf, sizeof (buf));
@@ -1225,17 +1225,17 @@
          {
             mutt_window_clearline (MuttMessageWindow, 0);
            break;
          }
        }
 
        mutt_expand_path (buf, sizeof (buf));
 #ifdef USE_SIDEBAR
-       sb_set_open_buffy (buf);
+       mutt_sb_set_open_buffy (buf);
 #endif
        if (mx_get_magic (buf) <= 0)
        {
          mutt_error (_("%s is not a mailbox."), buf);
          break;
        }
        mutt_str_replace (&CurrentFolder, buf);
 
@@ -2345,17 +2345,17 @@
 
 #ifdef USE_SIDEBAR
       case OP_SIDEBAR_NEXT:
       case OP_SIDEBAR_NEXT_NEW:
       case OP_SIDEBAR_PAGE_DOWN:
       case OP_SIDEBAR_PAGE_UP:
       case OP_SIDEBAR_PREV:
       case OP_SIDEBAR_PREV_NEW:
-        sb_change_mailbox (op);
+        mutt_sb_change_mailbox (op);
         break;
 
       case OP_SIDEBAR_TOGGLE_VISIBLE:
        toggle_option (OPTSIDEBAR);
         mutt_reflow_windows();
        menu->redraw = REDRAW_FULL;
        break;
 #endif
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
@@ -1229,17 +1229,17 @@
     }
 
     mutt_folder_hook (folder);
 
     if((Context = mx_open_mailbox (folder, ((flags & MUTT_RO) || option 
(OPTREADONLY)) ? MUTT_READONLY : 0, NULL))
        || !explicit_folder)
     {
 #ifdef USE_SIDEBAR
-      sb_set_open_buffy (folder);
+      mutt_sb_set_open_buffy (folder);
 #endif
       mutt_index_menu ();
       if (Context)
        FREE (&Context);
     }
 #ifdef USE_IMAP
     imap_logout_all ();
 #endif
diff --git a/menu.c b/menu.c
--- a/menu.c
+++ b/menu.c
@@ -233,17 +233,17 @@
   NORMAL_COLOR;
   menu->redraw &= ~REDRAW_STATUS;
 }
 
 #ifdef USE_SIDEBAR
 void menu_redraw_sidebar (MUTTMENU *menu)
 {
   SidebarNeedsRedraw = 0;
-  sb_draw ();
+  mutt_sb_draw ();
 }
 #endif
 
 void menu_redraw_index (MUTTMENU *menu)
 {
   char buf[LONG_STRING];
   int i;
   int do_color;
diff --git a/mx.c b/mx.c
--- a/mx.c
+++ b/mx.c
@@ -740,17 +740,17 @@
     hash_destroy (&ctx->subj_hash, NULL);
   if (ctx->id_hash)
     hash_destroy (&ctx->id_hash, NULL);
   mutt_clear_threads (ctx);
   for (i = 0; i < ctx->msgcount; i++)
     mutt_free_header (&ctx->hdrs[i]);
 #ifdef USE_SIDEBAR
   ctx->msgcount -= ctx->deleted;
-  sb_set_buffystats (ctx);
+  mutt_sb_set_buffystats (ctx);
 #endif
   FREE (&ctx->hdrs);
   FREE (&ctx->v2r);
   FREE (&ctx->path);
   FREE (&ctx->pattern);
   if (ctx->limit_pattern) 
     mutt_pattern_free (&ctx->limit_pattern);
   safe_fclose (&ctx->fp);
diff --git a/pager.c b/pager.c
--- a/pager.c
+++ b/pager.c
@@ -1784,17 +1784,17 @@
            break;
        }
     }
 
 #ifdef USE_SIDEBAR
     if ((redraw & REDRAW_SIDEBAR) || SidebarNeedsRedraw)
     {
       SidebarNeedsRedraw = 0;
-      sb_draw ();
+      mutt_sb_draw ();
     }
 #endif
 
     if ((redraw & REDRAW_BODY) || topline != oldtopline)
     {
       do {
         mutt_window_move (pager_window, 0, 0);
        curline = oldtopline = topline;
@@ -2832,17 +2832,17 @@
 
 #ifdef USE_SIDEBAR
       case OP_SIDEBAR_NEXT:
       case OP_SIDEBAR_NEXT_NEW:
       case OP_SIDEBAR_PAGE_DOWN:
       case OP_SIDEBAR_PAGE_UP:
       case OP_SIDEBAR_PREV:
       case OP_SIDEBAR_PREV_NEW:
-       sb_change_mailbox (ch);
+       mutt_sb_change_mailbox (ch);
        break;
 
       case OP_SIDEBAR_TOGGLE_VISIBLE:
        toggle_option (OPTSIDEBAR);
         mutt_reflow_windows();
        redraw = REDRAW_FULL;
        break;
 #endif
diff --git a/sidebar.c b/sidebar.c
--- a/sidebar.c
+++ b/sidebar.c
@@ -718,22 +718,22 @@
     row++;
   }
 
   fill_empty_space (row, num_rows - row, w);
 }
 
 
 /**
- * sb_draw - Completely redraw the sidebar
+ * mutt_sb_draw - Completely redraw the sidebar
  *
  * Completely refresh the sidebar region.  First draw the divider; then, for
  * each BUFFY, call make_sidebar_entry; finally blank out any remaining space.
  */
-void sb_draw (void)
+void mutt_sb_draw (void)
 {
   if (!option (OPTSIDEBAR))
     return;
 
   int num_rows  = MuttSidebarWindow->rows;
   int num_cols  = MuttSidebarWindow->cols;
 
   int div_width = draw_divider (num_rows, num_cols);
@@ -748,54 +748,54 @@
 
   if (!prepare_sidebar (num_rows))
     return;
 
   draw_sidebar (num_rows, num_cols, div_width);
 }
 
 /**
- * sb_should_refresh - Check if the sidebar is due to be refreshed
+ * mutt_sb_should_refresh - Check if the sidebar is due to be refreshed
  *
  * The "sidebar_refresh_time" config option allows the user to limit the 
frequency
  * with which the sidebar is refreshed.
  *
  * Returns:
  *     1  Yes, refresh is due
  *     0  No,  refresh happened recently
  */
-int sb_should_refresh (void)
+int mutt_sb_should_refresh (void)
 {
   if (!option (OPTSIDEBAR))
     return 0;
 
   if (SidebarRefreshTime == 0)
     return 0;
 
   time_t diff = (time (NULL) - LastRefresh);
 
   return (diff >= SidebarRefreshTime);
 }
 
 /**
- * sb_change_mailbox - Change the selected mailbox
+ * mutt_sb_change_mailbox - Change the selected mailbox
  * @op: Operation code
  *
  * Change the selected mailbox, e.g. "Next mailbox", "Previous Mailbox
  * with new mail". The operations are listed OPS.SIDEBAR which is built
  * into an enum in keymap_defs.h.
  *
  * If the operation is successful, HilBuffy will be set to the new mailbox.
  * This function only *selects* the mailbox, doesn't *open* it.
  *
  * Allowed values are: OP_SIDEBAR_NEXT, OP_SIDEBAR_NEXT_NEW,
  * OP_SIDEBAR_PAGE_DOWN, OP_SIDEBAR_PAGE_UP, OP_SIDEBAR_PREV,
  * OP_SIDEBAR_PREV_NEW.
  */
-void sb_change_mailbox (int op)
+void mutt_sb_change_mailbox (int op)
 {
   if (!option (OPTSIDEBAR))
     return;
 
   BUFFY *b;
   if (!HilBuffy)       /* It'll get reset on the next draw */
     return;
 
@@ -841,23 +841,23 @@
       break;
     default:
       return;
   }
   SidebarNeedsRedraw = 1;
 }
 
 /**
- * sb_set_buffystats - Update the BUFFY's message counts from the CONTEXT
+ * mutt_sb_set_buffystats - Update the BUFFY's message counts from the CONTEXT
  * @ctx:  A mailbox CONTEXT
  *
  * Given a mailbox CONTEXT, find a matching mailbox BUFFY and copy the message
  * counts into it.
  */
-void sb_set_buffystats (const CONTEXT *ctx)
+void mutt_sb_set_buffystats (const CONTEXT *ctx)
 {
   /* Even if the sidebar's hidden,
    * we should take note of the new data. */
   BUFFY *b = Incoming;
   if (!ctx || !b)
     return;
 
   for (; b; b = b->next)
@@ -869,42 +869,42 @@
       b->msg_count   = ctx->msgcount;
       b->msg_flagged = ctx->flagged;
       break;
     }
   }
 }
 
 /**
- * sb_get_highlight - Get the BUFFY that's highlighted in the sidebar
+ * mutt_sb_get_highlight - Get the BUFFY that's highlighted in the sidebar
  *
  * Get the path of the mailbox that's highlighted in the sidebar.
  *
  * Returns:
  *     Mailbox path
  */
-const char *sb_get_highlight (void)
+const char *mutt_sb_get_highlight (void)
 {
   if (!option (OPTSIDEBAR))
     return NULL;
 
   if (!HilBuffy)
     return NULL;
 
   return HilBuffy->path;
 }
 
 /**
- * sb_set_open_buffy - Set the OpnBuffy based on a mailbox path
+ * mutt_sb_set_open_buffy - Set the OpnBuffy based on a mailbox path
  * @path: Mailbox path
  *
  * Search through the list of mailboxes.  If a BUFFY has a matching path, set
  * OpnBuffy to it.
  */
-BUFFY *sb_set_open_buffy (const char *path)
+BUFFY *mutt_sb_set_open_buffy (const char *path)
 {
   /* Even if the sidebar is hidden */
 
   BUFFY *b = Incoming;
 
   if (!path || !b)
     return NULL;
 
@@ -920,38 +920,38 @@
       break;
     }
   }
 
   return OpnBuffy;
 }
 
 /**
- * sb_set_update_time - Note the time that the sidebar was updated
+ * mutt_sb_set_update_time - Note the time that the sidebar was updated
  *
  * Update the timestamp representing the last sidebar update.  If the user
  * configures "sidebar_refresh_time", this will help to reduce traffic.
  */
-void sb_set_update_time (void)
+void mutt_sb_set_update_time (void)
 {
   /* XXX - should this be public? */
 
   LastRefresh = time (NULL);
 }
 
 /**
- * sb_notify_mailbox - The state of a BUFFY is about to change
+ * mutt_sb_notify_mailbox - The state of a BUFFY is about to change
  *
  * We receive a notification:
  *     After a new BUFFY has been created
  *     Before a BUFFY is deleted
  *
  * Before a deletion, check that our pointers won't be invalidated.
  */
-void sb_notify_mailbox (BUFFY *b, int created)
+void mutt_sb_notify_mailbox (BUFFY *b, int created)
 {
   if (!b)
     return;
 
   /* Any new/deleted mailboxes will cause a refresh.  As long as
    * they're valid, our pointers will be updated in prepare_sidebar() */
 
   if (created)
diff --git a/sidebar.h b/sidebar.h
--- a/sidebar.h
+++ b/sidebar.h
@@ -18,19 +18,18 @@
  */
 
 #ifndef SIDEBAR_H
 #define SIDEBAR_H
 
 #include "mutt.h"
 #include "buffy.h"
 
-void         sb_change_mailbox (int op);
-void         sb_draw (void);
-const char * sb_get_highlight (void);
-void         sb_init (void);
-void         sb_notify_mailbox (BUFFY *b, int created);
-void         sb_set_buffystats (const CONTEXT *ctx);
-BUFFY *      sb_set_open_buffy (const char *path);
-void         sb_set_update_time (void);
-int          sb_should_refresh (void);
+void         mutt_sb_change_mailbox (int op);
+void         mutt_sb_draw (void);
+const char * mutt_sb_get_highlight (void);
+void         mutt_sb_notify_mailbox (BUFFY *b, int created);
+void         mutt_sb_set_buffystats (const CONTEXT *ctx);
+BUFFY *      mutt_sb_set_open_buffy (const char *path);
+void         mutt_sb_set_update_time (void);
+int          mutt_sb_should_refresh (void);
 
 #endif /* SIDEBAR_H */

Attachment: signature.asc
Description: PGP signature

Reply via email to