-#endif
-#ifdef USE_NNTP
- case OP_SUBSCRIBE_PATTERN:
- case OP_UNSUBSCRIBE_PATTERN:
- if (option (OPTNEWS)) {
- regex_t *rx = p_new(regex_t, 1);
- char *s = buf;
- int j = menu->current;
- NNTP_DATA *nd;
- NNTP_SERVER *news = CurrentNewsSrv;
-
- if (i == OP_SUBSCRIBE_PATTERN || i == OP_UNSUBSCRIBE_PATTERN) {
- char tmp[STRING];
- int err;
-
- buf[0] = 0;
- if (i == OP_SUBSCRIBE_PATTERN)
- snprintf (tmp, sizeof (tmp), _("Subscribe pattern: "));
- else
- snprintf (tmp, sizeof (tmp), _("Unsubscribe pattern: "));
- if (mutt_get_field (tmp, buf, sizeof (buf), 0) != 0 || !buf[0]) {
- p_delete(&rx);
- break;
- }
-
- if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0) {
- regerror (err, rx, buf, sizeof (buf));
- regfree (rx);
- p_delete(&rx);
- mutt_error ("%s", buf);
- break;
- }
- menu->redraw = REDRAW_FULL;
- j = 0;
- }
- else if (!state.entrylen) {
- mutt_error _("No newsgroups match the mask");
-
- break;
- }
-
- for (; j < state.entrylen; j++) {
- struct folder_file *f = &state.entry[j];
-
- if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE ||
- regexec (rx, f->name, 0, NULL, 0) == 0) {
- if (i == OP_BROWSER_SUBSCRIBE || i == OP_SUBSCRIBE_PATTERN)
- nd = mutt_newsgroup_subscribe (news, f->name);
- else
- nd = mutt_newsgroup_unsubscribe (news, f->name);
-/* if (nd)
- {
- FOLDER folder;
- char buffer[_POSIX_PATH_MAX + SHORT_STRING];
-
- folder.name = f->name;
- folder.f = NULL;
- folder.new = nd->new;
- folder.nd = nd;
- p_delete(&f->desc);
- mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat),
- newsgroup_format_str, (unsigned long) &folder,
- M_FORMAT_ARROWCURSOR);
- f->desc = m_strdup(buffer);
- } */
- }
- if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE) {
- if (menu->current + 1 < menu->max)
- menu->current++;
- menu->redraw = REDRAW_MOTION_RESYNCH;
- break;
- }
- }
- if (i == OP_SUBSCRIBE_PATTERN) {
- LIST *grouplist = NULL;
-
- if (news)
- grouplist = news->list;
- for (; grouplist; grouplist = grouplist->next) {
- nd = (NNTP_DATA *) grouplist->data;
- if (nd && nd->group && !nd->subscribed) {
- if (regexec (rx, nd->group, 0, NULL, 0) == 0) {
- mutt_newsgroup_subscribe (news, nd->group);
- add_folder (menu, &state, nd->group, NULL, nd, nd->new);
- }
- }
- }
- init_menu (&state, menu, title, sizeof (title), buffy);
- }
- mutt_newsrc_update (news);
- nntp_clear_cacheindex (news);
- if (i != OP_BROWSER_SUBSCRIBE && i != OP_BROWSER_UNSUBSCRIBE)
- regfree (rx);
- p_delete(&rx);
- }
-#ifdef USE_IMAP