- modify nntp_buffy() to offer _next_ group with new articles instead of _first_ when attempting to change group (partially strange ordering of groups remains) (still this needs to be handled via <buffy-cycle>) (reported by Peter J. Holzer <hjp@hjp.at>)
- display some progress while fetching NNTP headers from cache
git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@402
e385b8ad-14ed-0310-8656-
cc95a2468c6d
cp = _("Open newsgroup in read-only mode");
else
cp = _("Open newsgroup");
cp = _("Open newsgroup in read-only mode");
else
cp = _("Open newsgroup");
+ nntp_buffy (buf, sizeof (buf));
}
/* this routine gives the first newsgroup with new messages */
}
/* this routine gives the first newsgroup with new messages */
-void nntp_buffy (char *s)
-{
+void nntp_buffy (char* dst, size_t dstlen) {
+ /* forward to current group */
for (list = CurrentNewsSrv->list; list; list = list->next) {
NNTP_DATA *data = (NNTP_DATA *) list->data;
for (list = CurrentNewsSrv->list; list; list = list->next) {
NNTP_DATA *data = (NNTP_DATA *) list->data;
+ if (data && data->subscribed && data->unread &&
+ Context && Context->magic == M_NNTP &&
+ str_cmp (data->group, ((NNTP_DATA *) Context->data)->group) == 0)
+ break;
+ }
+
+ *dst = '\0';
+
+ while (count < 2) {
- if (data && data->subscribed && data->unread) {
- if (Context && Context->magic == M_NNTP &&
- !str_cmp (data->group, ((NNTP_DATA *) Context->data)->group)) {
- unsigned int i, unread = 0;
+ if (!list)
+ list = CurrentNewsSrv->list;
- for (i = 0; i < Context->msgcount; i++)
- if (!Context->hdrs[i]->read && !Context->hdrs[i]->deleted)
- unread++;
- if (!unread)
- continue;
+ for (; list; list = list->next) {
+ NNTP_DATA *data = (NNTP_DATA *) list->data;
+
+ if (data && data->subscribed && data->unread) {
+ if (Context && Context->magic == M_NNTP &&
+ !str_cmp (data->group, ((NNTP_DATA *) Context->data)->group)) {
+ unsigned int i, unread = 0;
+
+ for (i = 0; i < Context->msgcount; i++)
+ if (!Context->hdrs[i]->read && !Context->hdrs[i]->deleted)
+ unread++;
+ if (!unread)
+ continue;
+ }
+ strncpy (dst, data->group, dstlen);
+ break;
- strcpy (s, data->group);
- break;
+ /* done if found */
+ if (dst && *dst)
+ return;
+ count++;
{
char buf[HUGE_STRING];
char *msg = _("Fetching message headers...");
{
char buf[HUGE_STRING];
char *msg = _("Fetching message headers...");
+ char *msg2 = _("Fetching headers from cache...");
NNTP_DATA *nntp_data = ((NNTP_DATA *) ctx->data);
int ret;
int num;
NNTP_DATA *nntp_data = ((NNTP_DATA *) ctx->data);
int ret;
int num;
num = nntp_data->lastCached - first + 1;
if (option (OPTNEWSCACHE) && nntp_data->cache && num > 0) {
nntp_cache_expand (buf, nntp_data->cache);
num = nntp_data->lastCached - first + 1;
if (option (OPTNEWSCACHE) && nntp_data->cache && num > 0) {
nntp_cache_expand (buf, nntp_data->cache);
- mutt_message _("Fetching headers from cache...");
if ((f = safe_fopen (buf, "r"))) {
if ((f = safe_fopen (buf, "r"))) {
/* counting number of lines */
while (fgets (buf, sizeof (buf), f) != NULL)
/* counting number of lines */
while (fgets (buf, sizeof (buf), f) != NULL)
fc.first = first;
fc.last = first + num - 1;
fc.msg = NULL;
fc.first = first;
fc.last = first + num - 1;
fc.msg = NULL;
- while (fgets (buf, sizeof (buf), f) != NULL)
+ while (fgets (buf, sizeof (buf), f) != NULL) {
+ if (ReadInc && ((++c) % ReadInc == 0))
+ mutt_message ("%s %d/%d", msg2, c, r);
add_xover_line (buf, &fc);
add_xover_line (buf, &fc);
fclose (f);
nntp_data->lastLoaded = fc.last;
first = fc.last + 1;
fclose (f);
nntp_data->lastLoaded = fc.last;
first = fc.last + 1;
int nntp_post (const char *);
int nntp_check_msgid (CONTEXT *, const char *);
int nntp_check_children (CONTEXT *, const char *);
int nntp_post (const char *);
int nntp_check_msgid (CONTEXT *, const char *);
int nntp_check_children (CONTEXT *, const char *);
-void nntp_buffy (char *);
+void nntp_buffy (char* dst, size_t dstlen);
void nntp_expand_path (char *, size_t, ACCOUNT *);
void nntp_logout_all ();
const char *nntp_format_str (char *, size_t, char, const char *, const char *,
void nntp_expand_path (char *, size_t, ACCOUNT *);
void nntp_logout_all ();
const char *nntp_format_str (char *, size_t, char, const char *, const char *,