- fc.ctx = ctx;
- fc.base = first;
- fc.last = last;
- fc.messages = safe_calloc (last - first + 1, sizeof (unsigned short));
- if (nntp_data->nserv->hasLISTGROUP) {
- snprintf (buf, sizeof (buf), "LISTGROUP %s\r\n", nntp_data->group);
- if (mutt_nntp_fetch (nntp_data, buf, NULL, nntp_fetch_numbers, &fc, 0) !=
- 0) {
- mutt_error (_("LISTGROUP command failed: %s"), buf);
- sleep (2);
-#ifdef DEBUG
- nntp_error ("nntp_fetch_headers()", buf);
-#endif
- FREE (&fc.messages);
- return -1;
- }
- }
- else {
- /* mutt_nntp_query() issues a 'GROUP nntp_data->group'
- * command on its own if !*buf */
- buf[0] = '\0';
- mutt_nntp_query (nntp_data, buf, sizeof (buf));
- if (sscanf (buf + 4, "%d %u %u %s", &num, &fc.first, &fc.last, buf) != 4) {
- mutt_error (_("GROUP command failed: %s"), buf);
- FREE (&fc.messages);
- return (-1);
- }
- else {
- for (num = fc.first; num < fc.last; num++)
- _nntp_fetch_numbers (num, &fc);
- }
- }