From: pdmef Date: Sat, 20 Aug 2005 16:38:59 +0000 (+0000) Subject: Rocco Rutte: X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=dba814e28104a395ffb52e16beccaecf09be8cde Rocco Rutte: - 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 --- diff --git a/browser.c b/browser.c index 585dc1b..acb4039 100644 --- 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; + nntp_sync_sidebar (data); 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); } + sidebar_draw (CurrentMenu); } 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) { - 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); } + sidebar_draw (CurrentMenu); } else #endif diff --git a/curs_main.c b/curs_main.c index c3b9c14..54ac430 100644 --- a/curs_main.c +++ b/curs_main.c @@ -341,7 +341,6 @@ static void update_index (MUTTMENU * menu, CONTEXT * ctx, int check, if (menu->current < 0) menu->current = ci_first_message (); - } 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 (op != OP_SIDEBAR_OPEN) - buffy_next (buf, sizeof (buf)); + if (op != OP_SIDEBAR_OPEN) + buffy_next (buf, sizeof (buf)); } if (op == OP_SIDEBAR_OPEN) { diff --git a/nntp/newsrc.c b/nntp/newsrc.c index a8e1576..e58c9dc 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -337,6 +337,8 @@ NNTP_SERVER *mutt_select_newsserver (char *server) NNTP_SERVER *serv; CONNECTION *conn; + memset (&acct, 0, sizeof (ACCOUNT)); + if (!server || !*server) { mutt_error _("No newsserver defined!"); diff --git a/nntp/nntp.c b/nntp/nntp.c index 4875f67..7121398 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -39,7 +39,7 @@ 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]; @@ -53,9 +53,11 @@ static void update_sidebar (NNTP_DATA* data) { * 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.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)); @@ -427,7 +429,7 @@ static void nntp_parse_xref (CONTEXT * ctx, char *group, char *xref, 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); } @@ -832,6 +834,8 @@ int nntp_open_mailbox (CONTEXT * ctx) 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); @@ -1136,7 +1140,7 @@ void nntp_fastclose_mailbox (CONTEXT * ctx) || tmp != data) nntp_delete_data (data); else - update_sidebar (data); + nntp_sync_sidebar (data); } /* 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; } - update_sidebar (nntp_data); + nntp_sync_sidebar (nntp_data); } 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); } + sidebar_draw (CurrentMenu); } else if (!force) return 0; diff --git a/nntp/nntp.h b/nntp/nntp.h index 0dbcc39..3ad5925 100644 --- a/nntp/nntp.h +++ b/nntp/nntp.h @@ -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); +void nntp_sync_sidebar (NNTP_DATA*); NNTP_SERVER *CurrentNewsSrv INITVAL (NULL);