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 */
140 /* Message functions */
154 FolderClass *news_get_class(void)
159 Folder *news_folder_new(const gchar *name, const gchar *path)
163 folder = (Folder *)g_new0(NewsFolder, 1);
164 folder->klass = &news_class;
165 news_folder_init(folder, name, path);
170 void news_folder_destroy(Folder *folder)
174 dir = news_folder_get_path(folder);
175 if (is_dir_exist(dir))
176 remove_dir_recursive(dir);
179 folder_remote_folder_destroy(REMOTE_FOLDER(folder));
182 static void news_folder_init(Folder *folder, const gchar *name,
185 folder_remote_folder_init(folder, name, path);
189 static Session *news_session_new(const gchar *server, gushort port,
190 const gchar *userid, const gchar *passwd,
193 static Session *news_session_new(const gchar *server, gushort port,
194 const gchar *userid, const gchar *passwd)
197 gchar buf[NNTPBUFSIZE];
200 g_return_val_if_fail(server != NULL, NULL);
202 log_message(_("creating NNTP connection to %s:%d ...\n"), server, port);
205 session = nntp_session_new(server, port, buf, userid, passwd, ssl_type);
207 session = nntp_session_new(server, port, buf, userid, passwd);
213 static Session *news_session_new_for_folder(Folder *folder)
217 const gchar *userid = NULL;
218 gchar *passwd = NULL;
220 gchar buf[NNTPBUFSIZE];
222 g_return_val_if_fail(folder != NULL, NULL);
223 g_return_val_if_fail(folder->account != NULL, NULL);
225 ac = folder->account;
226 if (ac->use_nntp_auth && ac->userid && ac->userid[0]) {
228 if (ac->passwd && ac->passwd[0])
229 passwd = g_strdup(ac->passwd);
231 passwd = input_dialog_query_password(ac->nntp_server,
236 port = ac->set_nntpport ? ac->nntpport
237 : ac->ssl_nntp ? NNTPS_PORT : NNTP_PORT;
238 session = news_session_new(ac->nntp_server, port, userid, passwd,
241 port = ac->set_nntpport ? ac->nntpport : NNTP_PORT;
242 session = news_session_new(ac->nntp_server, port, userid, passwd);
244 if ((session != NULL) && ac->use_nntp_auth && ac->use_nntp_auth_onconnect)
245 nntp_forceauth(NNTP_SESSION(session), buf, userid, passwd);
252 NNTPSession *news_session_get(Folder *folder)
254 RemoteFolder *rfolder = REMOTE_FOLDER(folder);
256 g_return_val_if_fail(folder != NULL, NULL);
257 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
258 g_return_val_if_fail(folder->account != NULL, NULL);
260 if (!rfolder->session) {
261 rfolder->session = news_session_new_for_folder(folder);
262 return NNTP_SESSION(rfolder->session);
265 if (time(NULL) - rfolder->session->last_access_time < SESSION_TIMEOUT) {
266 rfolder->session->last_access_time = time(NULL);
267 return NNTP_SESSION(rfolder->session);
270 if (nntp_mode(NNTP_SESSION(rfolder->session), FALSE)
272 log_warning("NNTP connection to %s:%d has been"
273 " disconnected. Reconnecting...\n",
274 folder->account->nntp_server,
275 folder->account->set_nntpport ?
276 folder->account->nntpport : NNTP_PORT);
277 session_destroy(rfolder->session);
278 rfolder->session = news_session_new_for_folder(folder);
281 if (rfolder->session)
282 rfolder->session->last_access_time = time(NULL);
283 return NNTP_SESSION(rfolder->session);
286 gchar *news_fetch_msg(Folder *folder, FolderItem *item, gint num)
288 gchar *path, *filename;
289 NNTPSession *session;
292 g_return_val_if_fail(folder != NULL, NULL);
293 g_return_val_if_fail(item != NULL, NULL);
295 path = folder_item_get_path(item);
296 if (!is_dir_exist(path))
298 filename = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
301 if (is_file_exist(filename)) {
302 debug_print("article %d has been already cached.\n", num);
306 session = news_session_get(folder);
312 ok = news_select_group(session, item->path, NULL, NULL, NULL);
313 if (ok != NN_SUCCESS) {
314 g_warning("can't select group %s\n", item->path);
319 debug_print("getting article %d...\n", num);
320 ok = news_get_article(NNTP_SESSION(REMOTE_FOLDER(folder)->session),
323 g_warning("can't read article %d\n", num);
324 session_destroy(SESSION(session));
325 REMOTE_FOLDER(folder)->session = NULL;
333 static NewsGroupInfo *news_group_info_new(const gchar *name,
334 gint first, gint last, gchar type)
336 NewsGroupInfo *ginfo;
338 ginfo = g_new(NewsGroupInfo, 1);
339 ginfo->name = g_strdup(name);
340 ginfo->first = first;
347 static void news_group_info_free(NewsGroupInfo *ginfo)
353 static gint news_group_info_compare(NewsGroupInfo *ginfo1,
354 NewsGroupInfo *ginfo2)
356 return g_strcasecmp(ginfo1->name, ginfo2->name);
359 GSList *news_get_group_list(Folder *folder)
361 gchar *path, *filename;
365 gchar buf[NNTPBUFSIZE];
367 g_return_val_if_fail(folder != NULL, NULL);
368 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
370 path = folder_item_get_path(FOLDER_ITEM(folder->node->data));
371 if (!is_dir_exist(path))
373 filename = g_strconcat(path, G_DIR_SEPARATOR_S, NEWSGROUP_LIST, NULL);
376 if ((fp = fopen(filename, "rb")) == NULL) {
377 NNTPSession *session;
379 session = news_session_get(folder);
385 if (nntp_list(session) != NN_SUCCESS) {
389 if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
390 log_warning("can't retrieve newsgroup list\n");
391 session_destroy(SESSION(session));
392 REMOTE_FOLDER(folder)->session = NULL;
397 if ((fp = fopen(filename, "rb")) == NULL) {
398 FILE_OP_ERROR(filename, "fopen");
404 while (fgets(buf, sizeof(buf), fp) != NULL) {
410 NewsGroupInfo *ginfo;
418 if (sscanf(p, "%d %d %c", &last_num, &first_num, &type) < 3)
421 ginfo = news_group_info_new(name, first_num, last_num, type);
424 last = list = g_slist_append(NULL, ginfo);
426 last = g_slist_append(last, ginfo);
434 list = g_slist_sort(list, (GCompareFunc)news_group_info_compare);
439 void news_group_list_free(GSList *group_list)
443 if (!group_list) return;
445 for (cur = group_list; cur != NULL; cur = cur->next)
446 news_group_info_free((NewsGroupInfo *)cur->data);
447 g_slist_free(group_list);
450 void news_remove_group_list_cache(Folder *folder)
452 gchar *path, *filename;
454 g_return_if_fail(folder != NULL);
455 g_return_if_fail(FOLDER_CLASS(folder) == &news_class);
457 path = folder_item_get_path(FOLDER_ITEM(folder->node->data));
458 filename = g_strconcat(path, G_DIR_SEPARATOR_S, NEWSGROUP_LIST, NULL);
461 if (is_file_exist(filename)) {
462 if (remove(filename) < 0)
463 FILE_OP_ERROR(filename, "remove");
468 gint news_post(Folder *folder, const gchar *file)
473 g_return_val_if_fail(folder != NULL, -1);
474 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
475 g_return_val_if_fail(file != NULL, -1);
477 if ((fp = fopen(file, "rb")) == NULL) {
478 FILE_OP_ERROR(file, "fopen");
482 ok = news_post_stream(folder, fp);
489 gint news_post_stream(Folder *folder, FILE *fp)
491 NNTPSession *session;
494 g_return_val_if_fail(folder != NULL, -1);
495 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
496 g_return_val_if_fail(fp != NULL, -1);
498 session = news_session_get(folder);
499 if (!session) return -1;
501 ok = nntp_post(session, fp);
502 if (ok != NN_SUCCESS) {
503 log_warning("can't post article.\n");
510 static gint news_get_article_cmd(NNTPSession *session, const gchar *cmd,
511 gint num, gchar *filename)
515 if (nntp_get_article(session, cmd, num, &msgid)
519 debug_print("Message-Id = %s, num = %d\n", msgid, num);
522 if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
523 log_warning("can't retrieve article %d\n", num);
530 static gint news_get_article(NNTPSession *session, gint num, gchar *filename)
532 return news_get_article_cmd(session, "ARTICLE", num, filename);
537 * @session: Active NNTP session.
538 * @group: Newsgroup name.
539 * @num: Estimated number of articles.
540 * @first: First article number.
541 * @last: Last article number.
543 * Select newsgroup @group with the GROUP command if it is not already
544 * selected in @session, or article numbers need to be returned.
546 * Return value: NNTP result code.
548 static gint news_select_group(NNTPSession *session, const gchar *group,
549 gint *num, gint *first, gint *last)
552 gint num_, first_, last_;
554 if (!num || !first || !last) {
555 if (session->group && g_strcasecmp(session->group, group) == 0)
562 g_free(session->group);
563 session->group = NULL;
565 ok = nntp_group(session, group, num, first, last);
566 if (ok == NN_SUCCESS)
567 session->group = g_strdup(group);
572 #define PARSE_ONE_PARAM(p, srcp) \
574 p = strchr(srcp, '\t'); \
575 if (!p) return NULL; \
580 static MsgInfo *news_parse_xover(const gchar *xover_str)
583 gchar buf[NNTPBUFSIZE];
584 gchar *subject, *sender, *size, *line, *date, *msgid, *ref, *tmp, *xref;
586 gint num, size_int, line_int;
589 Xstrdup_a(xover_buf, xover_str, return NULL);
591 PARSE_ONE_PARAM(subject, xover_buf);
592 PARSE_ONE_PARAM(sender, subject);
593 PARSE_ONE_PARAM(date, sender);
594 PARSE_ONE_PARAM(msgid, date);
595 PARSE_ONE_PARAM(ref, msgid);
596 PARSE_ONE_PARAM(size, ref);
597 PARSE_ONE_PARAM(line, size);
598 PARSE_ONE_PARAM(xref, line);
600 tmp = strchr(xref, '\t');
601 if (!tmp) tmp = strchr(line, '\r');
602 if (!tmp) tmp = strchr(line, '\n');
603 if (tmp) *tmp = '\0';
605 num = atoi(xover_str);
606 size_int = atoi(size);
607 line_int = atoi(line);
610 msginfo = procmsg_msginfo_new();
611 msginfo->msgnum = num;
612 msginfo->size = size_int;
614 msginfo->date = g_strdup(date);
615 msginfo->date_t = procheader_date_parse(NULL, date, 0);
617 conv_unmime_header(buf, sizeof(buf), sender, NULL);
618 msginfo->from = g_strdup(buf);
619 msginfo->fromname = procheader_get_fromname(buf);
621 conv_unmime_header(buf, sizeof(buf), subject, NULL);
622 msginfo->subject = g_strdup(buf);
624 extract_parenthesis(msgid, '<', '>');
627 msginfo->msgid = g_strdup(msgid);
629 msginfo->references = g_strdup(ref);
630 eliminate_parenthesis(ref, '(', ')');
631 if ((p = strrchr(ref, '<')) != NULL) {
632 extract_parenthesis(p, '<', '>');
635 msginfo->inreplyto = g_strdup(p);
638 msginfo->xref = g_strdup(xref);
639 p = msginfo->xref+strlen(msginfo->xref) - 1;
640 while (*p == '\r' || *p == '\n') {
648 static gchar *news_parse_xhdr(const gchar *xhdr_str, MsgInfo *msginfo)
654 p = strchr(xhdr_str, ' ');
660 num = atoi(xhdr_str);
661 if (msginfo->msgnum != num) return NULL;
663 tmp = strchr(p, '\r');
664 if (!tmp) tmp = strchr(p, '\n');
667 return g_strndup(p, tmp - p);
672 gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
678 tmp = g_strdup_printf("%s%ctmp%d", g_get_tmp_dir(),
679 G_DIR_SEPARATOR, (gint)msginfo);
683 if ((tmpfp = fopen(tmp, "wb")) == NULL) {
684 FILE_OP_ERROR(tmp, "fopen");
687 if (change_file_mode_rw(tmpfp, tmp) < 0) {
688 FILE_OP_ERROR(tmp, "chmod");
689 g_warning("can't change file mode\n");
692 fprintf(tmpfp, "From: %s\r\n", msginfo->from);
693 fprintf(tmpfp, "Newsgroups: %s\r\n", msginfo->newsgroups);
694 fprintf(tmpfp, "Subject: cmsg cancel <%s>\r\n", msginfo->msgid);
695 fprintf(tmpfp, "Control: cancel <%s>\r\n", msginfo->msgid);
696 fprintf(tmpfp, "Approved: %s\r\n", msginfo->from);
697 fprintf(tmpfp, "X-Cancelled-by: %s\r\n", msginfo->from);
698 get_rfc822_date(buf, sizeof(buf));
699 fprintf(tmpfp, "Date: %s\r\n", buf);
700 fprintf(tmpfp, "\r\n");
701 fprintf(tmpfp, "removed with sylpheed\r\n");
705 news_post(folder, tmp);
713 static gchar *news_folder_get_path(Folder *folder)
717 g_return_val_if_fail(folder->account != NULL, NULL);
719 folder_path = g_strconcat(get_news_cache_dir(),
721 folder->account->nntp_server,
726 gchar *news_item_get_path(Folder *folder, FolderItem *item)
728 gchar *folder_path, *path;
730 g_return_val_if_fail(folder != NULL, NULL);
731 g_return_val_if_fail(item != NULL, NULL);
732 folder_path = news_folder_get_path(folder);
734 g_return_val_if_fail(folder_path != NULL, NULL);
735 if (folder_path[0] == G_DIR_SEPARATOR) {
737 path = g_strconcat(folder_path, G_DIR_SEPARATOR_S,
740 path = g_strdup(folder_path);
743 path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
744 folder_path, G_DIR_SEPARATOR_S,
747 path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
755 gint news_get_num_list(Folder *folder, FolderItem *item, GSList **msgnum_list)
757 NNTPSession *session;
758 gint i, ok, num, first, last, nummsgs = 0;
761 g_return_val_if_fail(item != NULL, -1);
762 g_return_val_if_fail(item->folder != NULL, -1);
763 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
765 session = news_session_get(folder);
766 g_return_val_if_fail(session != NULL, -1);
768 ok = news_select_group(session, item->path, &num, &first, &last);
769 if (ok != NN_SUCCESS) {
770 log_warning(_("can't set group: %s\n"), item->path);
775 log_warning(_("invalid article range: %d - %d\n"),
780 for(i = first; i <= last; i++) {
781 *msgnum_list = g_slist_prepend(*msgnum_list, GINT_TO_POINTER(i));
785 dir = folder_item_get_path(item);
786 debug_print("removing old messages from %d to %d in %s\n", first, last, dir);
787 remove_numbered_files(dir, 1, first - 1);
793 #define READ_TO_LISTEND(hdr) \
794 while (!(buf[0] == '.' && buf[1] == '\r')) { \
795 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) { \
796 log_warning(_("error occurred while getting %s.\n"), hdr); \
801 MsgInfo *news_get_msginfo(Folder *folder, FolderItem *item, gint num)
803 NNTPSession *session;
804 MsgInfo *msginfo = NULL;
805 gchar buf[NNTPBUFSIZE];
807 session = news_session_get(folder);
808 g_return_val_if_fail(session != NULL, NULL);
809 g_return_val_if_fail(item != NULL, NULL);
810 g_return_val_if_fail(item->folder != NULL, NULL);
811 g_return_val_if_fail(FOLDER_CLASS(item->folder) == &news_class, NULL);
813 log_message(_("getting xover %d in %s...\n"),
815 if (nntp_xover(session, num, num) != NN_SUCCESS) {
816 log_warning(_("can't get xover\n"));
820 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
821 log_warning(_("error occurred while getting xover.\n"));
825 msginfo = news_parse_xover(buf);
827 log_warning(_("invalid xover line: %s\n"), buf);
830 READ_TO_LISTEND("xover");
835 msginfo->folder = item;
836 msginfo->flags.perm_flags = MSG_NEW|MSG_UNREAD;
837 msginfo->flags.tmp_flags = MSG_NEWS;
838 msginfo->newsgroups = g_strdup(item->path);
840 if (nntp_xhdr(session, "to", num, num) != NN_SUCCESS) {
841 log_warning(_("can't get xhdr\n"));
845 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
846 log_warning(_("error occurred while getting xhdr.\n"));
850 msginfo->to = news_parse_xhdr(buf, msginfo);
852 READ_TO_LISTEND("xhdr (to)");
854 if (nntp_xhdr(session, "cc", num, num) != NN_SUCCESS) {
855 log_warning(_("can't get xhdr\n"));
859 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
860 log_warning(_("error occurred while getting xhdr.\n"));
864 msginfo->cc = news_parse_xhdr(buf, msginfo);
866 READ_TO_LISTEND("xhdr (cc)");
871 static GSList *news_get_msginfos_for_range(NNTPSession *session, FolderItem *item, guint begin, guint end)
873 gchar buf[NNTPBUFSIZE];
874 GSList *newlist = NULL;
875 GSList *llast = NULL;
877 guint count = 0, lines = (end - begin + 2) * 3;
879 g_return_val_if_fail(session != NULL, NULL);
880 g_return_val_if_fail(item != NULL, NULL);
882 log_message(_("getting xover %d - %d in %s...\n"),
883 begin, end, item->path);
884 if (nntp_xover(session, begin, end) != NN_SUCCESS) {
885 log_warning(_("can't get xover\n"));
890 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
891 log_warning(_("error occurred while getting xover.\n"));
895 progressindicator_set_percentage
896 (PROGRESS_TYPE_NETWORK,
897 session->fetch_base_percentage +
898 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
900 if (buf[0] == '.' && buf[1] == '\r') break;
902 msginfo = news_parse_xover(buf);
904 log_warning(_("invalid xover line: %s\n"), buf);
908 msginfo->folder = item;
909 msginfo->flags.perm_flags = MSG_NEW|MSG_UNREAD;
910 msginfo->flags.tmp_flags = MSG_NEWS;
911 msginfo->newsgroups = g_strdup(item->path);
914 llast = newlist = g_slist_append(newlist, msginfo);
916 llast = g_slist_append(llast, msginfo);
921 if (nntp_xhdr(session, "to", begin, end) != NN_SUCCESS) {
922 log_warning(_("can't get xhdr\n"));
929 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
930 log_warning(_("error occurred while getting xhdr.\n"));
934 progressindicator_set_percentage
935 (PROGRESS_TYPE_NETWORK,
936 session->fetch_base_percentage +
937 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
939 if (buf[0] == '.' && buf[1] == '\r') break;
941 g_warning("llast == NULL\n");
945 msginfo = (MsgInfo *)llast->data;
946 msginfo->to = news_parse_xhdr(buf, msginfo);
951 if (nntp_xhdr(session, "cc", begin, end) != NN_SUCCESS) {
952 log_warning(_("can't get xhdr\n"));
959 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
960 log_warning(_("error occurred while getting xhdr.\n"));
964 progressindicator_set_percentage
965 (PROGRESS_TYPE_NETWORK,
966 session->fetch_base_percentage +
967 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
969 if (buf[0] == '.' && buf[1] == '\r') break;
971 g_warning("llast == NULL\n");
975 msginfo = (MsgInfo *)llast->data;
976 msginfo->cc = news_parse_xhdr(buf, msginfo);
984 GSList *news_get_msginfos(Folder *folder, FolderItem *item, GSList *msgnum_list)
986 NNTPSession *session;
987 GSList *elem, *msginfo_list = NULL, *tmp_msgnum_list, *tmp_msginfo_list;
988 guint first, last, next;
989 guint tofetch, fetched;
991 g_return_val_if_fail(folder != NULL, NULL);
992 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
993 g_return_val_if_fail(msgnum_list != NULL, NULL);
994 g_return_val_if_fail(item != NULL, NULL);
996 session = news_session_get(folder);
997 g_return_val_if_fail(session != NULL, NULL);
999 tmp_msgnum_list = g_slist_copy(msgnum_list);
1000 tmp_msgnum_list = g_slist_sort(tmp_msgnum_list, g_int_compare);
1002 progressindicator_start(PROGRESS_TYPE_NETWORK);
1003 tofetch = g_slist_length(tmp_msgnum_list);
1006 first = GPOINTER_TO_INT(tmp_msgnum_list->data);
1008 for(elem = g_slist_next(tmp_msgnum_list); elem != NULL; elem = g_slist_next(elem)) {
1009 next = GPOINTER_TO_INT(elem->data);
1010 if(next != (last + 1)) {
1011 session->fetch_base_percentage = ((gfloat) fetched) / ((gfloat) tofetch);
1012 session->fetch_total_percentage = ((gfloat) (last - first + 1)) / ((gfloat) tofetch);
1013 tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
1014 msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);
1015 fetched = last - first + 1;
1020 session->fetch_base_percentage = ((gfloat) fetched) / ((gfloat) tofetch);
1021 session->fetch_total_percentage = ((gfloat) (last - first + 1)) / ((gfloat) tofetch);
1022 tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
1023 msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);
1025 g_slist_free(tmp_msgnum_list);
1027 progressindicator_stop(PROGRESS_TYPE_NETWORK);
1029 return msginfo_list;