X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=nntp%2Fnntp.c;h=64a64340c0d40bf8fa6526362a77dfab9b09dba6;hb=c228dbc78fa40b09da8bcf5c1650d6006c389ce4;hp=4875f67b34107a2999654a777a2af13a91986a52;hpb=c97c29afb910fc6b5fadbe15452dad185570be9b;p=apps%2Fmadmutt.git diff --git a/nntp/nntp.c b/nntp/nntp.c index 4875f67..64a6434 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); } @@ -568,23 +570,19 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) break; case 1: hdr->env->subject = str_dup (b); - /* Now we need to do the things which would normally be done in - * mutt_read_rfc822_header() */ - if (hdr->env->subject) { - regmatch_t pmatch[1]; - - rfc2047_decode (&hdr->env->subject); - - if (regexec (ReplyRegexp.rx, hdr->env->subject, 1, pmatch, 0) == 0) - hdr->env->real_subj = hdr->env->subject + pmatch[0].rm_eo; - else - hdr->env->real_subj = hdr->env->subject; - } break; case 2: rfc822_free_address (&hdr->env->from); hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b); - rfc2047_decode_adrlist (hdr->env->from); + /* same as for mutt_parse_rfc822_line(): + * don't leave from info NULL if there's an invalid address (or + * whatever) in From: field; mutt would just display it as empty + * and mark mail/(esp.) news article as your own. aaargh! this + * bothered me for _years_ */ + if (!hdr->env->from) { + hdr->env->from = rfc822_new_address (); + hdr->env->from->personal = str_dup (b); + } break; case 3: hdr->date_sent = mutt_parse_date (b, hdr); @@ -611,6 +609,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) hdr->env->xref = str_dup (b); nntp_parse_xref (ctx, nntp_data->group, b, hdr); } + rfc2047_decode_envelope (hdr->env); if (!*p) return -1; b = p; @@ -832,6 +831,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 +1137,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 +1224,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 +1313,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;