static int nntp_prefetch(mailmessage * msg_info)
{
  char * msg_content;
  size_t msg_length;
  struct generic_message_t * msg;
  int r;
  struct nntp_cached_session_state_data * cached_data;
  struct nntp_session_state_data * ancestor_data;
  char filename[PATH_MAX];

  /* we try the cached message */

  cached_data = get_cached_session_data(msg_info);

  ancestor_data = get_ancestor_session_data(msg_info);

  snprintf(filename, PATH_MAX, "%s/%s/%i", cached_data->nntp_cache_directory,
      ancestor_data->nntp_group_name, msg_info->msg_index);
  
  r = generic_cache_read(filename, &msg_content, &msg_length);
  if (r == MAIL_NO_ERROR) {
    msg = msg_info->msg_data;

    msg->msg_message = msg_content;
    msg->msg_length = msg_length;

    return MAIL_NO_ERROR;
  }

  /* we get the message through the network */

  r = nntpdriver_article(get_ancestor_session(msg_info),
      msg_info->msg_index, &msg_content,
      &msg_length);

  if (r != MAIL_NO_ERROR)
    return r;

  /* we write the message cache */

  generic_cache_store(filename, msg_content, msg_length);

  msg = msg_info->msg_data;

  msg->msg_message = msg_content;
  msg->msg_length = msg_length;

  return MAIL_NO_ERROR;
}
static int nntp_prefetch(mailmessage * msg_info)
{
    char * msg_content;
    size_t msg_length;
    struct generic_message_t * msg;
    int r;

    r = nntpdriver_article(msg_info->msg_session, msg_info->msg_index,
                           &msg_content, &msg_length);
    if (r != MAIL_NO_ERROR)
        return r;

    msg = msg_info->msg_data;

    msg->msg_message = msg_content;
    msg->msg_length = msg_length;

    return MAIL_NO_ERROR;
}