Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sat, 20 Aug 2005 16:38:59 +0000 (16:38 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sat, 20 Aug 2005 16:38:59 +0000 (16:38 +0000)
- some more changes to get counters for newsgroups synced into buffy list (for feature request #546) (there really must be found a better way to handle all counters)

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@412 e385b8ad-14ed-0310-8656-cc95a2468c6d

browser.c
curs_main.c
nntp/newsrc.c
nntp/nntp.c
nntp/nntp.h

index 585dc1b..acb4039 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -487,6 +487,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state,
     for (tmp = news->list; tmp; tmp = tmp->next) {
       if (!(data = (NNTP_DATA *) tmp->data))
         continue;
     for (tmp = news->list; tmp; tmp = tmp->next) {
       if (!(data = (NNTP_DATA *) tmp->data))
         continue;
+      nntp_sync_sidebar (data);
       if (prefix && *prefix && strncmp (prefix, data->group,
                                         str_len (prefix)) != 0)
         continue;
       if (prefix && *prefix && strncmp (prefix, data->group,
                                         str_len (prefix)) != 0)
         continue;
@@ -494,6 +495,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state,
         continue;
       add_folder (menu, state, data->group, NULL, data, data->new);
     }
         continue;
       add_folder (menu, state, data->group, NULL, data, data->new);
     }
+    sidebar_draw (CurrentMenu);
   }
   else
 #endif /* USE_NNTP */
   }
   else
 #endif /* USE_NNTP */
@@ -576,14 +578,14 @@ static int examine_mailboxes (MUTTMENU * menu, struct browser_state *state)
     init_state (state, menu);
 
     for (tmp = news->list; tmp; tmp = tmp->next) {
     init_state (state, menu);
 
     for (tmp = news->list; tmp; tmp = tmp->next) {
-      if ((data = (NNTP_DATA *) tmp->data) != NULL && (data->new ||
-                                                       (data->subscribed
-                                                        &&
-                                                        (!option
-                                                         (OPTSHOWONLYUNREAD)
-                                                         || data->unread))))
+      if ((data = (NNTP_DATA*) tmp->data) == NULL)
+        continue;
+      nntp_sync_sidebar (data);
+      if ((data->new || (data->subscribed && 
+                         (!option (OPTSHOWONLYUNREAD)|| data->unread))))
         add_folder (menu, state, data->group, NULL, data, data->new);
     }
         add_folder (menu, state, data->group, NULL, data, data->new);
     }
+    sidebar_draw (CurrentMenu);
   }
   else
 #endif
   }
   else
 #endif
index c3b9c14..54ac430 100644 (file)
@@ -341,7 +341,6 @@ static void update_index (MUTTMENU * menu, CONTEXT * ctx, int check,
 
   if (menu->current < 0)
     menu->current = ci_first_message ();
 
   if (menu->current < 0)
     menu->current = ci_first_message ();
-
 }
 
 static void resort_index (MUTTMENU * menu)
 }
 
 static void resort_index (MUTTMENU * menu)
@@ -1194,8 +1193,8 @@ int mutt_index_menu (void)
       {
         if (Context && Context->path)
           strncpy (buf, Context->path, sizeof (buf));
       {
         if (Context && Context->path)
           strncpy (buf, Context->path, sizeof (buf));
-       if (op != OP_SIDEBAR_OPEN)
-         buffy_next (buf, sizeof (buf));
+        if (op != OP_SIDEBAR_OPEN)
+          buffy_next (buf, sizeof (buf));
       }
 
       if (op == OP_SIDEBAR_OPEN) {
       }
 
       if (op == OP_SIDEBAR_OPEN) {
index a8e1576..e58c9dc 100644 (file)
@@ -337,6 +337,8 @@ NNTP_SERVER *mutt_select_newsserver (char *server)
   NNTP_SERVER *serv;
   CONNECTION *conn;
 
   NNTP_SERVER *serv;
   CONNECTION *conn;
 
+  memset (&acct, 0, sizeof (ACCOUNT));
+
   if (!server || !*server) {
     mutt_error _("No newsserver defined!");
 
   if (!server || !*server) {
     mutt_error _("No newsserver defined!");
 
index 4875f67..7121398 100644 (file)
@@ -39,7 +39,7 @@
 
 static unsigned int _checked = 0;
 
 
 static unsigned int _checked = 0;
 
-static void update_sidebar (NNTP_DATA* data) {
+void nntp_sync_sidebar (NNTP_DATA* data) {
   int i = 0;
   BUFFY* tmp = NULL;
   char buf[STRING];
   int i = 0;
   BUFFY* tmp = NULL;
   char buf[STRING];
@@ -53,9 +53,11 @@ static void update_sidebar (NNTP_DATA* data) {
    * mailboxes command ;-((( FIXME
    */
   buf[0] = '\0';
    * mailboxes command ;-((( FIXME
    */
   buf[0] = '\0';
-  snprintf (buf, sizeof (buf), "nntp%s://%s%s/%s",
+  snprintf (buf, sizeof (buf), "nntp%s://%s%s%s%s/%s",
             (data->nserv->conn->account.flags & M_ACCT_SSL) ? "s" : "",
             NONULL (data->nserv->conn->account.user),
             (data->nserv->conn->account.flags & M_ACCT_SSL) ? "s" : "",
             NONULL (data->nserv->conn->account.user),
+            *data->nserv->conn->account.pass ? ":" : "",
+            *data->nserv->conn->account.pass ? data->nserv->conn->account.pass : "",
             data->nserv->conn->account.host,
             data->group);
   debug_print (4, ("group == '%s'\n", buf));
             data->nserv->conn->account.host,
             data->group);
   debug_print (4, ("group == '%s'\n", buf));
@@ -427,7 +429,7 @@ static void nntp_parse_xref (CONTEXT * ctx, char *group, char *xref,
     if (colon) {
       *colon = '\0';
       colon++;
     if (colon) {
       *colon = '\0';
       colon++;
-      nntp_get_status (ctx, h, p, atoi (colon));
+      nntp_get_status (ctx, h, b, atoi (colon));
       if (h && h->article_num == 0 && str_cmp (group, b) == 0)
         h->article_num = atoi (colon);
     }
       if (h && h->article_num == 0 && str_cmp (group, b) == 0)
         h->article_num = atoi (colon);
     }
@@ -832,6 +834,8 @@ int nntp_open_mailbox (CONTEXT * ctx)
   unsigned int first;
   ACCOUNT acct;
 
   unsigned int first;
   ACCOUNT acct;
 
+  memset (&acct, 0, sizeof (ACCOUNT));
+
   if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf) {
     mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path);
     mutt_sleep (2);
   if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf) {
     mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path);
     mutt_sleep (2);
@@ -1136,7 +1140,7 @@ void nntp_fastclose_mailbox (CONTEXT * ctx)
       || tmp != data)
     nntp_delete_data (data);
   else
       || tmp != data)
     nntp_delete_data (data);
   else
-    update_sidebar (data);
+    nntp_sync_sidebar (data);
 }
 
 /* commit changes and terminate connection */
 }
 
 /* commit changes and terminate connection */
@@ -1223,7 +1227,7 @@ static int _nntp_check_mailbox (CONTEXT * ctx, NNTP_DATA * nntp_data)
       nntp_data->entries[0].first = 1;
       nntp_data->entries[0].last = 0;
     }
       nntp_data->entries[0].first = 1;
       nntp_data->entries[0].last = 0;
     }
-    update_sidebar (nntp_data);
+    nntp_sync_sidebar (nntp_data);
   }
 
   time (&nntp_data->nserv->check_time);
   }
 
   time (&nntp_data->nserv->check_time);
@@ -1312,6 +1316,7 @@ int nntp_check_newgroups (NNTP_SERVER * serv, int force)
       if (l->data && ((NNTP_DATA *) l->data)->subscribed)
         _nntp_check_mailbox (NULL, (NNTP_DATA *) l->data);
     }
       if (l->data && ((NNTP_DATA *) l->data)->subscribed)
         _nntp_check_mailbox (NULL, (NNTP_DATA *) l->data);
     }
+    sidebar_draw (CurrentMenu);
   }
   else if (!force)
     return 0;
   }
   else if (!force)
     return 0;
index 0dbcc39..3ad5925 100644 (file)
@@ -117,6 +117,7 @@ void nntp_logout_all ();
 const char *nntp_format_str (char *, size_t, char, const char *, const char *,
                              const char *, const char *, unsigned long,
                              format_flag);
 const char *nntp_format_str (char *, size_t, char, const char *, const char *,
                              const char *, const char *, unsigned long,
                              format_flag);
+void nntp_sync_sidebar (NNTP_DATA*);
 
 NNTP_SERVER *CurrentNewsSrv INITVAL (NULL);
 
 
 NNTP_SERVER *CurrentNewsSrv INITVAL (NULL);