2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2003 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40 #include "procheader.h"
43 #include "statusbar.h"
46 #include "prefs_common.h"
47 #include "prefs_account.h"
48 #include "inputdialog.h"
50 #include "progressindicator.h"
57 #define NNTPS_PORT 563
60 static Folder *news_folder_new(const gchar * name, const gchar * folder);
61 static void news_folder_destroy(Folder * folder);
63 static gchar *news_fetch_msg(Folder * folder, FolderItem * item, gint num);
65 static void news_folder_init (Folder *folder,
70 static Session *news_session_new (const gchar *server,
76 static Session *news_session_new (const gchar *server,
82 static gint news_get_article_cmd (NNTPSession *session,
86 static gint news_get_article (NNTPSession *session,
90 static gint news_select_group (NNTPSession *session,
95 static MsgInfo *news_parse_xover (const gchar *xover_str);
96 static gchar *news_parse_xhdr (const gchar *xhdr_str,
98 gint news_get_num_list (Folder *folder,
101 MsgInfo *news_get_msginfo (Folder *folder,
104 GSList *news_get_msginfos (Folder *folder,
106 GSList *msgnum_list);
108 gint news_post_stream (Folder *folder,
110 static gchar *news_folder_get_path (Folder *folder);
111 gchar *news_item_get_path (Folder *folder,
114 FolderClass news_class =
120 /* Folder functions */
126 /* FolderItem functions */
139 /* Message functions */
151 FolderClass *news_get_class(void)
156 Folder *news_folder_new(const gchar *name, const gchar *path)
160 folder = (Folder *)g_new0(NewsFolder, 1);
161 folder->klass = &news_class;
162 news_folder_init(folder, name, path);
167 void news_folder_destroy(Folder *folder)
171 dir = news_folder_get_path(folder);
172 if (is_dir_exist(dir))
173 remove_dir_recursive(dir);
176 folder_remote_folder_destroy(REMOTE_FOLDER(folder));
179 static void news_folder_init(Folder *folder, const gchar *name,
182 folder_remote_folder_init(folder, name, path);
186 static Session *news_session_new(const gchar *server, gushort port,
187 const gchar *userid, const gchar *passwd,
190 static Session *news_session_new(const gchar *server, gushort port,
191 const gchar *userid, const gchar *passwd)
194 gchar buf[NNTPBUFSIZE];
197 g_return_val_if_fail(server != NULL, NULL);
199 log_message(_("creating NNTP connection to %s:%d ...\n"), server, port);
202 session = nntp_session_new(server, port, buf, userid, passwd, ssl_type);
204 session = nntp_session_new(server, port, buf, userid, passwd);
210 static Session *news_session_new_for_folder(Folder *folder)
214 const gchar *userid = NULL;
215 gchar *passwd = NULL;
217 gchar buf[NNTPBUFSIZE];
219 g_return_val_if_fail(folder != NULL, NULL);
220 g_return_val_if_fail(folder->account != NULL, NULL);
222 ac = folder->account;
223 if (ac->use_nntp_auth && ac->userid && ac->userid[0]) {
225 if (ac->passwd && ac->passwd[0])
226 passwd = g_strdup(ac->passwd);
228 passwd = input_dialog_query_password(ac->nntp_server,
233 port = ac->set_nntpport ? ac->nntpport
234 : ac->ssl_nntp ? NNTPS_PORT : NNTP_PORT;
235 session = news_session_new(ac->nntp_server, port, userid, passwd,
238 port = ac->set_nntpport ? ac->nntpport : NNTP_PORT;
239 session = news_session_new(ac->nntp_server, port, userid, passwd);
241 if ((session != NULL) && ac->use_nntp_auth && ac->use_nntp_auth_onconnect)
242 nntp_forceauth(NNTP_SESSION(session), buf, userid, passwd);
249 NNTPSession *news_session_get(Folder *folder)
251 RemoteFolder *rfolder = REMOTE_FOLDER(folder);
253 g_return_val_if_fail(folder != NULL, NULL);
254 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
255 g_return_val_if_fail(folder->account != NULL, NULL);
257 if (!rfolder->session) {
258 rfolder->session = news_session_new_for_folder(folder);
259 return NNTP_SESSION(rfolder->session);
262 if (time(NULL) - rfolder->session->last_access_time < SESSION_TIMEOUT) {
263 rfolder->session->last_access_time = time(NULL);
264 return NNTP_SESSION(rfolder->session);
267 if (nntp_mode(NNTP_SESSION(rfolder->session), FALSE)
269 log_warning("NNTP connection to %s:%d has been"
270 " disconnected. Reconnecting...\n",
271 folder->account->nntp_server,
272 folder->account->set_nntpport ?
273 folder->account->nntpport : NNTP_PORT);
274 session_destroy(rfolder->session);
275 rfolder->session = news_session_new_for_folder(folder);
278 if (rfolder->session)
279 rfolder->session->last_access_time = time(NULL);
280 return NNTP_SESSION(rfolder->session);
283 gchar *news_fetch_msg(Folder *folder, FolderItem *item, gint num)
285 gchar *path, *filename;
286 NNTPSession *session;
289 g_return_val_if_fail(folder != NULL, NULL);
290 g_return_val_if_fail(item != NULL, NULL);
292 path = folder_item_get_path(item);
293 if (!is_dir_exist(path))
295 filename = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
298 if (is_file_exist(filename)) {
299 debug_print("article %d has been already cached.\n", num);
303 session = news_session_get(folder);
309 ok = news_select_group(session, item->path, NULL, NULL, NULL);
310 if (ok != NN_SUCCESS) {
311 g_warning("can't select group %s\n", item->path);
316 debug_print("getting article %d...\n", num);
317 ok = news_get_article(NNTP_SESSION(REMOTE_FOLDER(folder)->session),
320 g_warning("can't read article %d\n", num);
321 session_destroy(SESSION(session));
322 REMOTE_FOLDER(folder)->session = NULL;
330 static NewsGroupInfo *news_group_info_new(const gchar *name,
331 gint first, gint last, gchar type)
333 NewsGroupInfo *ginfo;
335 ginfo = g_new(NewsGroupInfo, 1);
336 ginfo->name = g_strdup(name);
337 ginfo->first = first;
344 static void news_group_info_free(NewsGroupInfo *ginfo)
350 static gint news_group_info_compare(NewsGroupInfo *ginfo1,
351 NewsGroupInfo *ginfo2)
353 return g_strcasecmp(ginfo1->name, ginfo2->name);
356 GSList *news_get_group_list(Folder *folder)
358 gchar *path, *filename;
362 gchar buf[NNTPBUFSIZE];
364 g_return_val_if_fail(folder != NULL, NULL);
365 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
367 path = folder_item_get_path(FOLDER_ITEM(folder->node->data));
368 if (!is_dir_exist(path))
370 filename = g_strconcat(path, G_DIR_SEPARATOR_S, NEWSGROUP_LIST, NULL);
373 if ((fp = fopen(filename, "rb")) == NULL) {
374 NNTPSession *session;
376 session = news_session_get(folder);
382 if (nntp_list(session) != NN_SUCCESS) {
386 if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
387 log_warning("can't retrieve newsgroup list\n");
388 session_destroy(SESSION(session));
389 REMOTE_FOLDER(folder)->session = NULL;
394 if ((fp = fopen(filename, "rb")) == NULL) {
395 FILE_OP_ERROR(filename, "fopen");
401 while (fgets(buf, sizeof(buf), fp) != NULL) {
407 NewsGroupInfo *ginfo;
415 if (sscanf(p, "%d %d %c", &last_num, &first_num, &type) < 3)
418 ginfo = news_group_info_new(name, first_num, last_num, type);
421 last = list = g_slist_append(NULL, ginfo);
423 last = g_slist_append(last, ginfo);
431 list = g_slist_sort(list, (GCompareFunc)news_group_info_compare);
436 void news_group_list_free(GSList *group_list)
440 if (!group_list) return;
442 for (cur = group_list; cur != NULL; cur = cur->next)
443 news_group_info_free((NewsGroupInfo *)cur->data);
444 g_slist_free(group_list);
447 void news_remove_group_list_cache(Folder *folder)
449 gchar *path, *filename;
451 g_return_if_fail(folder != NULL);
452 g_return_if_fail(FOLDER_CLASS(folder) == &news_class);
454 path = folder_item_get_path(FOLDER_ITEM(folder->node->data));
455 filename = g_strconcat(path, G_DIR_SEPARATOR_S, NEWSGROUP_LIST, NULL);
458 if (is_file_exist(filename)) {
459 if (remove(filename) < 0)
460 FILE_OP_ERROR(filename, "remove");
465 gint news_post(Folder *folder, const gchar *file)
470 g_return_val_if_fail(folder != NULL, -1);
471 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
472 g_return_val_if_fail(file != NULL, -1);
474 if ((fp = fopen(file, "rb")) == NULL) {
475 FILE_OP_ERROR(file, "fopen");
479 ok = news_post_stream(folder, fp);
486 gint news_post_stream(Folder *folder, FILE *fp)
488 NNTPSession *session;
491 g_return_val_if_fail(folder != NULL, -1);
492 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
493 g_return_val_if_fail(fp != NULL, -1);
495 session = news_session_get(folder);
496 if (!session) return -1;
498 ok = nntp_post(session, fp);
499 if (ok != NN_SUCCESS) {
500 log_warning("can't post article.\n");
507 static gint news_get_article_cmd(NNTPSession *session, const gchar *cmd,
508 gint num, gchar *filename)
512 if (nntp_get_article(session, cmd, num, &msgid)
516 debug_print("Message-Id = %s, num = %d\n", msgid, num);
519 if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
520 log_warning("can't retrieve article %d\n", num);
527 static gint news_get_article(NNTPSession *session, gint num, gchar *filename)
529 return news_get_article_cmd(session, "ARTICLE", num, filename);
534 * @session: Active NNTP session.
535 * @group: Newsgroup name.
536 * @num: Estimated number of articles.
537 * @first: First article number.
538 * @last: Last article number.
540 * Select newsgroup @group with the GROUP command if it is not already
541 * selected in @session, or article numbers need to be returned.
543 * Return value: NNTP result code.
545 static gint news_select_group(NNTPSession *session, const gchar *group,
546 gint *num, gint *first, gint *last)
549 gint num_, first_, last_;
551 if (!num || !first || !last) {
552 if (session->group && g_strcasecmp(session->group, group) == 0)
559 g_free(session->group);
560 session->group = NULL;
562 ok = nntp_group(session, group, num, first, last);
563 if (ok == NN_SUCCESS)
564 session->group = g_strdup(group);
569 #define PARSE_ONE_PARAM(p, srcp) \
571 p = strchr(srcp, '\t'); \
572 if (!p) return NULL; \
577 static MsgInfo *news_parse_xover(const gchar *xover_str)
580 gchar buf[NNTPBUFSIZE];
581 gchar *subject, *sender, *size, *line, *date, *msgid, *ref, *tmp, *xref;
583 gint num, size_int, line_int;
586 Xstrdup_a(xover_buf, xover_str, return NULL);
588 PARSE_ONE_PARAM(subject, xover_buf);
589 PARSE_ONE_PARAM(sender, subject);
590 PARSE_ONE_PARAM(date, sender);
591 PARSE_ONE_PARAM(msgid, date);
592 PARSE_ONE_PARAM(ref, msgid);
593 PARSE_ONE_PARAM(size, ref);
594 PARSE_ONE_PARAM(line, size);
595 PARSE_ONE_PARAM(xref, line);
597 tmp = strchr(xref, '\t');
598 if (!tmp) tmp = strchr(line, '\r');
599 if (!tmp) tmp = strchr(line, '\n');
600 if (tmp) *tmp = '\0';
602 num = atoi(xover_str);
603 size_int = atoi(size);
604 line_int = atoi(line);
607 msginfo = procmsg_msginfo_new();
608 msginfo->msgnum = num;
609 msginfo->size = size_int;
611 msginfo->date = g_strdup(date);
612 msginfo->date_t = procheader_date_parse(NULL, date, 0);
614 conv_unmime_header(buf, sizeof(buf), sender, NULL);
615 msginfo->from = g_strdup(buf);
616 msginfo->fromname = procheader_get_fromname(buf);
618 conv_unmime_header(buf, sizeof(buf), subject, NULL);
619 msginfo->subject = g_strdup(buf);
621 extract_parenthesis(msgid, '<', '>');
624 msginfo->msgid = g_strdup(msgid);
626 msginfo->references = g_strdup(ref);
627 eliminate_parenthesis(ref, '(', ')');
628 if ((p = strrchr(ref, '<')) != NULL) {
629 extract_parenthesis(p, '<', '>');
632 msginfo->inreplyto = g_strdup(p);
635 msginfo->xref = g_strdup(xref);
636 p = msginfo->xref+strlen(msginfo->xref) - 1;
637 while (*p == '\r' || *p == '\n') {
645 static gchar *news_parse_xhdr(const gchar *xhdr_str, MsgInfo *msginfo)
651 p = strchr(xhdr_str, ' ');
657 num = atoi(xhdr_str);
658 if (msginfo->msgnum != num) return NULL;
660 tmp = strchr(p, '\r');
661 if (!tmp) tmp = strchr(p, '\n');
664 return g_strndup(p, tmp - p);
669 gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
675 tmp = g_strdup_printf("%s%ctmp%d", g_get_tmp_dir(),
676 G_DIR_SEPARATOR, (gint)msginfo);
680 if ((tmpfp = fopen(tmp, "wb")) == NULL) {
681 FILE_OP_ERROR(tmp, "fopen");
684 if (change_file_mode_rw(tmpfp, tmp) < 0) {
685 FILE_OP_ERROR(tmp, "chmod");
686 g_warning("can't change file mode\n");
689 fprintf(tmpfp, "From: %s\r\n", msginfo->from);
690 fprintf(tmpfp, "Newsgroups: %s\r\n", msginfo->newsgroups);
691 fprintf(tmpfp, "Subject: cmsg cancel <%s>\r\n", msginfo->msgid);
692 fprintf(tmpfp, "Control: cancel <%s>\r\n", msginfo->msgid);
693 fprintf(tmpfp, "Approved: %s\r\n", msginfo->from);
694 fprintf(tmpfp, "X-Cancelled-by: %s\r\n", msginfo->from);
695 get_rfc822_date(buf, sizeof(buf));
696 fprintf(tmpfp, "Date: %s\r\n", buf);
697 fprintf(tmpfp, "\r\n");
698 fprintf(tmpfp, "removed with sylpheed\r\n");
702 news_post(folder, tmp);
710 static gchar *news_folder_get_path(Folder *folder)
714 g_return_val_if_fail(folder->account != NULL, NULL);
716 folder_path = g_strconcat(get_news_cache_dir(),
718 folder->account->nntp_server,
723 gchar *news_item_get_path(Folder *folder, FolderItem *item)
725 gchar *folder_path, *path;
727 g_return_val_if_fail(folder != NULL, NULL);
728 g_return_val_if_fail(item != NULL, NULL);
729 folder_path = news_folder_get_path(folder);
731 g_return_val_if_fail(folder_path != NULL, NULL);
732 if (folder_path[0] == G_DIR_SEPARATOR) {
734 path = g_strconcat(folder_path, G_DIR_SEPARATOR_S,
737 path = g_strdup(folder_path);
740 path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
741 folder_path, G_DIR_SEPARATOR_S,
744 path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
752 gint news_get_num_list(Folder *folder, FolderItem *item, GSList **msgnum_list)
754 NNTPSession *session;
755 gint i, ok, num, first, last, nummsgs = 0;
758 g_return_val_if_fail(item != NULL, -1);
759 g_return_val_if_fail(item->folder != NULL, -1);
760 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
762 session = news_session_get(folder);
763 g_return_val_if_fail(session != NULL, -1);
765 ok = news_select_group(session, item->path, &num, &first, &last);
766 if (ok != NN_SUCCESS) {
767 log_warning(_("can't set group: %s\n"), item->path);
772 log_warning(_("invalid article range: %d - %d\n"),
777 for(i = first; i <= last; i++) {
778 *msgnum_list = g_slist_prepend(*msgnum_list, GINT_TO_POINTER(i));
782 dir = folder_item_get_path(item);
783 debug_print("removing old messages from %d to %d in %s\n", first, last, dir);
784 remove_numbered_files(dir, 1, first - 1);
790 #define READ_TO_LISTEND(hdr) \
791 while (!(buf[0] == '.' && buf[1] == '\r')) { \
792 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) { \
793 log_warning(_("error occurred while getting %s.\n"), hdr); \
798 MsgInfo *news_get_msginfo(Folder *folder, FolderItem *item, gint num)
800 NNTPSession *session;
801 MsgInfo *msginfo = NULL;
802 gchar buf[NNTPBUFSIZE];
804 session = news_session_get(folder);
805 g_return_val_if_fail(session != NULL, NULL);
806 g_return_val_if_fail(item != NULL, NULL);
807 g_return_val_if_fail(item->folder != NULL, NULL);
808 g_return_val_if_fail(FOLDER_CLASS(item->folder) == &news_class, NULL);
810 log_message(_("getting xover %d in %s...\n"),
812 if (nntp_xover(session, num, num) != NN_SUCCESS) {
813 log_warning(_("can't get xover\n"));
817 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
818 log_warning(_("error occurred while getting xover.\n"));
822 msginfo = news_parse_xover(buf);
824 log_warning(_("invalid xover line: %s\n"), buf);
827 READ_TO_LISTEND("xover");
832 msginfo->folder = item;
833 msginfo->flags.perm_flags = MSG_NEW|MSG_UNREAD;
834 msginfo->flags.tmp_flags = MSG_NEWS;
835 msginfo->newsgroups = g_strdup(item->path);
837 if (nntp_xhdr(session, "to", num, num) != NN_SUCCESS) {
838 log_warning(_("can't get xhdr\n"));
842 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
843 log_warning(_("error occurred while getting xhdr.\n"));
847 msginfo->to = news_parse_xhdr(buf, msginfo);
849 READ_TO_LISTEND("xhdr (to)");
851 if (nntp_xhdr(session, "cc", num, num) != NN_SUCCESS) {
852 log_warning(_("can't get xhdr\n"));
856 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
857 log_warning(_("error occurred while getting xhdr.\n"));
861 msginfo->cc = news_parse_xhdr(buf, msginfo);
863 READ_TO_LISTEND("xhdr (cc)");
868 static GSList *news_get_msginfos_for_range(NNTPSession *session, FolderItem *item, guint begin, guint end)
870 gchar buf[NNTPBUFSIZE];
871 GSList *newlist = NULL;
872 GSList *llast = NULL;
874 guint count = 0, lines = (end - begin + 2) * 3;
876 g_return_val_if_fail(session != NULL, NULL);
877 g_return_val_if_fail(item != NULL, NULL);
879 log_message(_("getting xover %d - %d in %s...\n"),
880 begin, end, item->path);
881 if (nntp_xover(session, begin, end) != NN_SUCCESS) {
882 log_warning(_("can't get xover\n"));
887 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
888 log_warning(_("error occurred while getting xover.\n"));
892 progressindicator_set_percentage
893 (PROGRESS_TYPE_NETWORK,
894 session->fetch_base_percentage +
895 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
897 if (buf[0] == '.' && buf[1] == '\r') break;
899 msginfo = news_parse_xover(buf);
901 log_warning(_("invalid xover line: %s\n"), buf);
905 msginfo->folder = item;
906 msginfo->flags.perm_flags = MSG_NEW|MSG_UNREAD;
907 msginfo->flags.tmp_flags = MSG_NEWS;
908 msginfo->newsgroups = g_strdup(item->path);
911 llast = newlist = g_slist_append(newlist, msginfo);
913 llast = g_slist_append(llast, msginfo);
918 if (nntp_xhdr(session, "to", begin, end) != NN_SUCCESS) {
919 log_warning(_("can't get xhdr\n"));
926 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
927 log_warning(_("error occurred while getting xhdr.\n"));
931 progressindicator_set_percentage
932 (PROGRESS_TYPE_NETWORK,
933 session->fetch_base_percentage +
934 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
936 if (buf[0] == '.' && buf[1] == '\r') break;
938 g_warning("llast == NULL\n");
942 msginfo = (MsgInfo *)llast->data;
943 msginfo->to = news_parse_xhdr(buf, msginfo);
948 if (nntp_xhdr(session, "cc", begin, end) != NN_SUCCESS) {
949 log_warning(_("can't get xhdr\n"));
956 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
957 log_warning(_("error occurred while getting xhdr.\n"));
961 progressindicator_set_percentage
962 (PROGRESS_TYPE_NETWORK,
963 session->fetch_base_percentage +
964 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
966 if (buf[0] == '.' && buf[1] == '\r') break;
968 g_warning("llast == NULL\n");
972 msginfo = (MsgInfo *)llast->data;
973 msginfo->cc = news_parse_xhdr(buf, msginfo);
981 GSList *news_get_msginfos(Folder *folder, FolderItem *item, GSList *msgnum_list)
983 NNTPSession *session;
984 GSList *elem, *msginfo_list = NULL, *tmp_msgnum_list, *tmp_msginfo_list;
985 guint first, last, next;
986 guint tofetch, fetched;
988 g_return_val_if_fail(folder != NULL, NULL);
989 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
990 g_return_val_if_fail(msgnum_list != NULL, NULL);
991 g_return_val_if_fail(item != NULL, NULL);
993 session = news_session_get(folder);
994 g_return_val_if_fail(session != NULL, NULL);
996 tmp_msgnum_list = g_slist_copy(msgnum_list);
997 tmp_msgnum_list = g_slist_sort(tmp_msgnum_list, g_int_compare);
999 progressindicator_start(PROGRESS_TYPE_NETWORK);
1000 tofetch = g_slist_length(tmp_msgnum_list);
1003 first = GPOINTER_TO_INT(tmp_msgnum_list->data);
1005 for(elem = g_slist_next(tmp_msgnum_list); elem != NULL; elem = g_slist_next(elem)) {
1006 next = GPOINTER_TO_INT(elem->data);
1007 if(next != (last + 1)) {
1008 session->fetch_base_percentage = ((gfloat) fetched) / ((gfloat) tofetch);
1009 session->fetch_total_percentage = ((gfloat) (last - first + 1)) / ((gfloat) tofetch);
1010 tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
1011 msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);
1012 fetched = last - first + 1;
1017 session->fetch_base_percentage = ((gfloat) fetched) / ((gfloat) tofetch);
1018 session->fetch_total_percentage = ((gfloat) (last - first + 1)) / ((gfloat) tofetch);
1019 tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
1020 msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);
1022 g_slist_free(tmp_msgnum_list);
1024 progressindicator_stop(PROGRESS_TYPE_NETWORK);
1026 return msginfo_list;