-#ifdef USE_NNTP
- case OP_GET_MESSAGE:
- case OP_GET_PARENT:
- CHECK_MSGCOUNT;
- if (Context->magic == M_NNTP) {
- HEADER *h;
-
- if (op == OP_GET_MESSAGE) {
- buf[0] = 0;
- if (mutt_get_field (_("Enter Message-ID: "), buf, sizeof (buf), 0)
- != 0 || !buf[0])
- break;
- }
- else {
- string_list_t *ref = CURHDR->env->references;
-
- if (!ref) {
- mutt_error (_("Article has no parent reference!"));
-
- break;
- }
- m_strcpy(buf, sizeof(buf), ref->data);
- }
- if (!Context->id_hash)
- Context->id_hash = mutt_make_id_hash (Context);
- if ((h = hash_find (Context->id_hash, buf))) {
- if (h->virtual != -1) {
- menu->current = h->virtual;
- menu->redraw = REDRAW_MOTION_RESYNCH;
- }
- else if (h->collapsed) {
- mutt_uncollapse_thread (Context, h);
- mutt_set_virtual (Context);
- menu->current = h->virtual;
- menu->redraw = REDRAW_MOTION_RESYNCH;
- }
- else
- mutt_error (_("Message not visible in limited view."));
- }
- else {
- if (nntp_check_msgid (Context, buf) == 0) {
- h = Context->hdrs[Context->msgcount - 1];
- mutt_sort_headers (Context, 0);
- menu->current = h->virtual;
- menu->redraw = REDRAW_FULL;
- }
- else
- mutt_error (_("Article %s not found on server"), buf);
- }
- }
- break;
-
- case OP_GET_CHILDREN:
- case OP_RECONSTRUCT_THREAD:
- CHECK_MSGCOUNT;
- if (Context->magic == M_NNTP) {
- HEADER *h;
- int old = CURHDR->index;
-
- if (!CURHDR->env->message_id) {
- mutt_error (_("No Message-ID. Unable to perform operation"));
-
- break;
- }
-
- if (!Context->id_hash)
- Context->id_hash = mutt_make_id_hash (Context);
- m_strcpy(buf, sizeof(buf), CURHDR->env->message_id);
-
- if (op == OP_RECONSTRUCT_THREAD) {
- string_list_t *ref = CURHDR->env->references;
-
- while (ref) {
- nntp_check_msgid (Context, ref->data);
- /* the last msgid in References is the root message */
- if (!ref->next)
- m_strcpy(buf, sizeof(buf), ref->data);
- ref = ref->next;
- }
- }
- mutt_message (_("Check for children of message..."));
-
- if (nntp_check_children (Context, buf) == 0) {
- mutt_sort_headers (Context, (op == OP_RECONSTRUCT_THREAD));
- h = hash_find (Context->id_hash, buf);
- /* if the root message was retrieved, move to it */
- if (h)
- menu->current = h->virtual;
- else /* try to restore old position */
- for (i = 0; i < Context->msgcount; i++)
- if (Context->hdrs[i]->index == old) {
- menu->current = Context->hdrs[i]->virtual;
- /* As an added courtesy, recenter the menu
- * with the current entry at the middle of the screen */
- menu_check_recenter (menu);
- menu_current_middle (menu);
- }
- }
- menu->redraw = REDRAW_FULL;
- mutt_clear_error ();
- }
- break;
-#endif
-