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 */
152 FolderClass *news_get_class(void)
157 Folder *news_folder_new(const gchar *name, const gchar *path)
161 folder = (Folder *)g_new0(NewsFolder, 1);
162 folder->klass = &news_class;
163 news_folder_init(folder, name, path);
168 void news_folder_destroy(Folder *folder)
172 dir = news_folder_get_path(folder);
173 if (is_dir_exist(dir))
174 remove_dir_recursive(dir);
177 folder_remote_folder_destroy(REMOTE_FOLDER(folder));
180 static void news_folder_init(Folder *folder, const gchar *name,
183 folder_remote_folder_init(folder, name, path);
187 static Session *news_session_new(const gchar *server, gushort port,
188 const gchar *userid, const gchar *passwd,
191 static Session *news_session_new(const gchar *server, gushort port,
192 const gchar *userid, const gchar *passwd)
195 gchar buf[NNTPBUFSIZE];
198 g_return_val_if_fail(server != NULL, NULL);
200 log_message(_("creating NNTP connection to %s:%d ...\n"), server, port);
203 session = nntp_session_new(server, port, buf, userid, passwd, ssl_type);
205 session = nntp_session_new(server, port, buf, userid, passwd);
211 static Session *news_session_new_for_folder(Folder *folder)
215 const gchar *userid = NULL;
216 gchar *passwd = NULL;
218 gchar buf[NNTPBUFSIZE];
220 g_return_val_if_fail(folder != NULL, NULL);
221 g_return_val_if_fail(folder->account != NULL, NULL);
223 ac = folder->account;
224 if (ac->use_nntp_auth && ac->userid && ac->userid[0]) {
226 if (ac->passwd && ac->passwd[0])
227 passwd = g_strdup(ac->passwd);
229 passwd = input_dialog_query_password(ac->nntp_server,
234 port = ac->set_nntpport ? ac->nntpport
235 : ac->ssl_nntp ? NNTPS_PORT : NNTP_PORT;
236 session = news_session_new(ac->nntp_server, port, userid, passwd,
239 port = ac->set_nntpport ? ac->nntpport : NNTP_PORT;
240 session = news_session_new(ac->nntp_server, port, userid, passwd);
242 if ((session != NULL) && ac->use_nntp_auth && ac->use_nntp_auth_onconnect)
243 nntp_forceauth(NNTP_SESSION(session), buf, userid, passwd);
250 NNTPSession *news_session_get(Folder *folder)
252 RemoteFolder *rfolder = REMOTE_FOLDER(folder);
254 g_return_val_if_fail(folder != NULL, NULL);
255 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
256 g_return_val_if_fail(folder->account != NULL, NULL);
258 if (!rfolder->session) {
259 rfolder->session = news_session_new_for_folder(folder);
260 return NNTP_SESSION(rfolder->session);
263 if (time(NULL) - rfolder->session->last_access_time < SESSION_TIMEOUT) {
264 rfolder->session->last_access_time = time(NULL);
265 return NNTP_SESSION(rfolder->session);
268 if (nntp_mode(NNTP_SESSION(rfolder->session), FALSE)
270 log_warning("NNTP connection to %s:%d has been"
271 " disconnected. Reconnecting...\n",
272 folder->account->nntp_server,
273 folder->account->set_nntpport ?
274 folder->account->nntpport : NNTP_PORT);
275 session_destroy(rfolder->session);
276 rfolder->session = news_session_new_for_folder(folder);
279 if (rfolder->session)
280 rfolder->session->last_access_time = time(NULL);
281 return NNTP_SESSION(rfolder->session);
284 gchar *news_fetch_msg(Folder *folder, FolderItem *item, gint num)
286 gchar *path, *filename;
287 NNTPSession *session;
290 g_return_val_if_fail(folder != NULL, NULL);
291 g_return_val_if_fail(item != NULL, NULL);
293 path = folder_item_get_path(item);
294 if (!is_dir_exist(path))
296 filename = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
299 if (is_file_exist(filename)) {
300 debug_print("article %d has been already cached.\n", num);
304 session = news_session_get(folder);
310 ok = news_select_group(session, item->path, NULL, NULL, NULL);
311 if (ok != NN_SUCCESS) {
312 g_warning("can't select group %s\n", item->path);
317 debug_print("getting article %d...\n", num);
318 ok = news_get_article(NNTP_SESSION(REMOTE_FOLDER(folder)->session),
321 g_warning("can't read article %d\n", num);
322 session_destroy(SESSION(session));
323 REMOTE_FOLDER(folder)->session = NULL;
331 static NewsGroupInfo *news_group_info_new(const gchar *name,
332 gint first, gint last, gchar type)
334 NewsGroupInfo *ginfo;
336 ginfo = g_new(NewsGroupInfo, 1);
337 ginfo->name = g_strdup(name);
338 ginfo->first = first;
345 static void news_group_info_free(NewsGroupInfo *ginfo)
351 static gint news_group_info_compare(NewsGroupInfo *ginfo1,
352 NewsGroupInfo *ginfo2)
354 return g_strcasecmp(ginfo1->name, ginfo2->name);
357 GSList *news_get_group_list(Folder *folder)
359 gchar *path, *filename;
363 gchar buf[NNTPBUFSIZE];
365 g_return_val_if_fail(folder != NULL, NULL);
366 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
368 path = folder_item_get_path(FOLDER_ITEM(folder->node->data));
369 if (!is_dir_exist(path))
371 filename = g_strconcat(path, G_DIR_SEPARATOR_S, NEWSGROUP_LIST, NULL);
374 if ((fp = fopen(filename, "rb")) == NULL) {
375 NNTPSession *session;
377 session = news_session_get(folder);
383 if (nntp_list(session) != NN_SUCCESS) {
387 if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
388 log_warning("can't retrieve newsgroup list\n");
389 session_destroy(SESSION(session));
390 REMOTE_FOLDER(folder)->session = NULL;
395 if ((fp = fopen(filename, "rb")) == NULL) {
396 FILE_OP_ERROR(filename, "fopen");
402 while (fgets(buf, sizeof(buf), fp) != NULL) {
408 NewsGroupInfo *ginfo;
416 if (sscanf(p, "%d %d %c", &last_num, &first_num, &type) < 3)
419 ginfo = news_group_info_new(name, first_num, last_num, type);
422 last = list = g_slist_append(NULL, ginfo);
424 last = g_slist_append(last, ginfo);
432 list = g_slist_sort(list, (GCompareFunc)news_group_info_compare);
437 void news_group_list_free(GSList *group_list)
441 if (!group_list) return;
443 for (cur = group_list; cur != NULL; cur = cur->next)
444 news_group_info_free((NewsGroupInfo *)cur->data);
445 g_slist_free(group_list);
448 void news_remove_group_list_cache(Folder *folder)
450 gchar *path, *filename;
452 g_return_if_fail(folder != NULL);
453 g_return_if_fail(FOLDER_CLASS(folder) == &news_class);
455 path = folder_item_get_path(FOLDER_ITEM(folder->node->data));
456 filename = g_strconcat(path, G_DIR_SEPARATOR_S, NEWSGROUP_LIST, NULL);
459 if (is_file_exist(filename)) {
460 if (remove(filename) < 0)
461 FILE_OP_ERROR(filename, "remove");
466 gint news_post(Folder *folder, const gchar *file)
471 g_return_val_if_fail(folder != NULL, -1);
472 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
473 g_return_val_if_fail(file != NULL, -1);
475 if ((fp = fopen(file, "rb")) == NULL) {
476 FILE_OP_ERROR(file, "fopen");
480 ok = news_post_stream(folder, fp);
487 gint news_post_stream(Folder *folder, FILE *fp)
489 NNTPSession *session;
492 g_return_val_if_fail(folder != NULL, -1);
493 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
494 g_return_val_if_fail(fp != NULL, -1);
496 session = news_session_get(folder);
497 if (!session) return -1;
499 ok = nntp_post(session, fp);
500 if (ok != NN_SUCCESS) {
501 log_warning("can't post article.\n");
508 static gint news_get_article_cmd(NNTPSession *session, const gchar *cmd,
509 gint num, gchar *filename)
513 if (nntp_get_article(session, cmd, num, &msgid)
517 debug_print("Message-Id = %s, num = %d\n", msgid, num);
520 if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
521 log_warning("can't retrieve article %d\n", num);
528 static gint news_get_article(NNTPSession *session, gint num, gchar *filename)
530 return news_get_article_cmd(session, "ARTICLE", num, filename);
535 * @session: Active NNTP session.
536 * @group: Newsgroup name.
537 * @num: Estimated number of articles.
538 * @first: First article number.
539 * @last: Last article number.
541 * Select newsgroup @group with the GROUP command if it is not already
542 * selected in @session, or article numbers need to be returned.
544 * Return value: NNTP result code.
546 static gint news_select_group(NNTPSession *session, const gchar *group,
547 gint *num, gint *first, gint *last)
550 gint num_, first_, last_;
552 if (!num || !first || !last) {
553 if (session->group && g_strcasecmp(session->group, group) == 0)
560 g_free(session->group);
561 session->group = NULL;
563 ok = nntp_group(session, group, num, first, last);
564 if (ok == NN_SUCCESS)
565 session->group = g_strdup(group);
570 #define PARSE_ONE_PARAM(p, srcp) \
572 p = strchr(srcp, '\t'); \
573 if (!p) return NULL; \
578 static MsgInfo *news_parse_xover(const gchar *xover_str)
581 gchar buf[NNTPBUFSIZE];
582 gchar *subject, *sender, *size, *line, *date, *msgid, *ref, *tmp, *xref;
584 gint num, size_int, line_int;
587 Xstrdup_a(xover_buf, xover_str, return NULL);
589 PARSE_ONE_PARAM(subject, xover_buf);
590 PARSE_ONE_PARAM(sender, subject);
591 PARSE_ONE_PARAM(date, sender);
592 PARSE_ONE_PARAM(msgid, date);
593 PARSE_ONE_PARAM(ref, msgid);
594 PARSE_ONE_PARAM(size, ref);
595 PARSE_ONE_PARAM(line, size);
596 PARSE_ONE_PARAM(xref, line);
598 tmp = strchr(xref, '\t');
599 if (!tmp) tmp = strchr(line, '\r');
600 if (!tmp) tmp = strchr(line, '\n');
601 if (tmp) *tmp = '\0';
603 num = atoi(xover_str);
604 size_int = atoi(size);
605 line_int = atoi(line);
608 msginfo = procmsg_msginfo_new();
609 msginfo->msgnum = num;
610 msginfo->size = size_int;
612 msginfo->date = g_strdup(date);
613 msginfo->date_t = procheader_date_parse(NULL, date, 0);
615 conv_unmime_header(buf, sizeof(buf), sender, NULL);
616 msginfo->from = g_strdup(buf);
617 msginfo->fromname = procheader_get_fromname(buf);
619 conv_unmime_header(buf, sizeof(buf), subject, NULL);
620 msginfo->subject = g_strdup(buf);
622 extract_parenthesis(msgid, '<', '>');
625 msginfo->msgid = g_strdup(msgid);
627 msginfo->references = g_strdup(ref);
628 eliminate_parenthesis(ref, '(', ')');
629 if ((p = strrchr(ref, '<')) != NULL) {
630 extract_parenthesis(p, '<', '>');
633 msginfo->inreplyto = g_strdup(p);
636 msginfo->xref = g_strdup(xref);
637 p = msginfo->xref+strlen(msginfo->xref) - 1;
638 while (*p == '\r' || *p == '\n') {
646 static gchar *news_parse_xhdr(const gchar *xhdr_str, MsgInfo *msginfo)
652 p = strchr(xhdr_str, ' ');
658 num = atoi(xhdr_str);
659 if (msginfo->msgnum != num) return NULL;
661 tmp = strchr(p, '\r');
662 if (!tmp) tmp = strchr(p, '\n');
665 return g_strndup(p, tmp - p);
670 gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
676 tmp = g_strdup_printf("%s%ctmp%d", g_get_tmp_dir(),
677 G_DIR_SEPARATOR, (gint)msginfo);
681 if ((tmpfp = fopen(tmp, "wb")) == NULL) {
682 FILE_OP_ERROR(tmp, "fopen");
685 if (change_file_mode_rw(tmpfp, tmp) < 0) {
686 FILE_OP_ERROR(tmp, "chmod");
687 g_warning("can't change file mode\n");
690 fprintf(tmpfp, "From: %s\r\n", msginfo->from);
691 fprintf(tmpfp, "Newsgroups: %s\r\n", msginfo->newsgroups);
692 fprintf(tmpfp, "Subject: cmsg cancel <%s>\r\n", msginfo->msgid);
693 fprintf(tmpfp, "Control: cancel <%s>\r\n", msginfo->msgid);
694 fprintf(tmpfp, "Approved: %s\r\n", msginfo->from);
695 fprintf(tmpfp, "X-Cancelled-by: %s\r\n", msginfo->from);
696 get_rfc822_date(buf, sizeof(buf));
697 fprintf(tmpfp, "Date: %s\r\n", buf);
698 fprintf(tmpfp, "\r\n");
699 fprintf(tmpfp, "removed with sylpheed\r\n");
703 news_post(folder, tmp);
711 static gchar *news_folder_get_path(Folder *folder)
715 g_return_val_if_fail(folder->account != NULL, NULL);
717 folder_path = g_strconcat(get_news_cache_dir(),
719 folder->account->nntp_server,
724 gchar *news_item_get_path(Folder *folder, FolderItem *item)
726 gchar *folder_path, *path;
728 g_return_val_if_fail(folder != NULL, NULL);
729 g_return_val_if_fail(item != NULL, NULL);
730 folder_path = news_folder_get_path(folder);
732 g_return_val_if_fail(folder_path != NULL, NULL);
733 if (folder_path[0] == G_DIR_SEPARATOR) {
735 path = g_strconcat(folder_path, G_DIR_SEPARATOR_S,
738 path = g_strdup(folder_path);
741 path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
742 folder_path, G_DIR_SEPARATOR_S,
745 path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
753 gint news_get_num_list(Folder *folder, FolderItem *item, GSList **msgnum_list)
755 NNTPSession *session;
756 gint i, ok, num, first, last, nummsgs = 0;
759 g_return_val_if_fail(item != NULL, -1);
760 g_return_val_if_fail(item->folder != NULL, -1);
761 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, -1);
763 session = news_session_get(folder);
764 g_return_val_if_fail(session != NULL, -1);
766 ok = news_select_group(session, item->path, &num, &first, &last);
767 if (ok != NN_SUCCESS) {
768 log_warning(_("can't set group: %s\n"), item->path);
773 log_warning(_("invalid article range: %d - %d\n"),
778 for(i = first; i <= last; i++) {
779 *msgnum_list = g_slist_prepend(*msgnum_list, GINT_TO_POINTER(i));
783 dir = folder_item_get_path(item);
784 debug_print("removing old messages from %d to %d in %s\n", first, last, dir);
785 remove_numbered_files(dir, 1, first - 1);
791 #define READ_TO_LISTEND(hdr) \
792 while (!(buf[0] == '.' && buf[1] == '\r')) { \
793 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) { \
794 log_warning(_("error occurred while getting %s.\n"), hdr); \
799 MsgInfo *news_get_msginfo(Folder *folder, FolderItem *item, gint num)
801 NNTPSession *session;
802 MsgInfo *msginfo = NULL;
803 gchar buf[NNTPBUFSIZE];
805 session = news_session_get(folder);
806 g_return_val_if_fail(session != NULL, NULL);
807 g_return_val_if_fail(item != NULL, NULL);
808 g_return_val_if_fail(item->folder != NULL, NULL);
809 g_return_val_if_fail(FOLDER_CLASS(item->folder) == &news_class, NULL);
811 log_message(_("getting xover %d in %s...\n"),
813 if (nntp_xover(session, num, num) != NN_SUCCESS) {
814 log_warning(_("can't get xover\n"));
818 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
819 log_warning(_("error occurred while getting xover.\n"));
823 msginfo = news_parse_xover(buf);
825 log_warning(_("invalid xover line: %s\n"), buf);
828 READ_TO_LISTEND("xover");
833 msginfo->folder = item;
834 msginfo->flags.perm_flags = MSG_NEW|MSG_UNREAD;
835 msginfo->flags.tmp_flags = MSG_NEWS;
836 msginfo->newsgroups = g_strdup(item->path);
838 if (nntp_xhdr(session, "to", num, num) != NN_SUCCESS) {
839 log_warning(_("can't get xhdr\n"));
843 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
844 log_warning(_("error occurred while getting xhdr.\n"));
848 msginfo->to = news_parse_xhdr(buf, msginfo);
850 READ_TO_LISTEND("xhdr (to)");
852 if (nntp_xhdr(session, "cc", num, num) != NN_SUCCESS) {
853 log_warning(_("can't get xhdr\n"));
857 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
858 log_warning(_("error occurred while getting xhdr.\n"));
862 msginfo->cc = news_parse_xhdr(buf, msginfo);
864 READ_TO_LISTEND("xhdr (cc)");
869 static GSList *news_get_msginfos_for_range(NNTPSession *session, FolderItem *item, guint begin, guint end)
871 gchar buf[NNTPBUFSIZE];
872 GSList *newlist = NULL;
873 GSList *llast = NULL;
875 guint count = 0, lines = (end - begin + 2) * 3;
877 g_return_val_if_fail(session != NULL, NULL);
878 g_return_val_if_fail(item != NULL, NULL);
880 log_message(_("getting xover %d - %d in %s...\n"),
881 begin, end, item->path);
882 if (nntp_xover(session, begin, end) != NN_SUCCESS) {
883 log_warning(_("can't get xover\n"));
888 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
889 log_warning(_("error occurred while getting xover.\n"));
893 progressindicator_set_percentage
894 (PROGRESS_TYPE_NETWORK,
895 session->fetch_base_percentage +
896 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
898 if (buf[0] == '.' && buf[1] == '\r') break;
900 msginfo = news_parse_xover(buf);
902 log_warning(_("invalid xover line: %s\n"), buf);
906 msginfo->folder = item;
907 msginfo->flags.perm_flags = MSG_NEW|MSG_UNREAD;
908 msginfo->flags.tmp_flags = MSG_NEWS;
909 msginfo->newsgroups = g_strdup(item->path);
912 llast = newlist = g_slist_append(newlist, msginfo);
914 llast = g_slist_append(llast, msginfo);
919 if (nntp_xhdr(session, "to", begin, end) != NN_SUCCESS) {
920 log_warning(_("can't get xhdr\n"));
927 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
928 log_warning(_("error occurred while getting xhdr.\n"));
932 progressindicator_set_percentage
933 (PROGRESS_TYPE_NETWORK,
934 session->fetch_base_percentage +
935 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
937 if (buf[0] == '.' && buf[1] == '\r') break;
939 g_warning("llast == NULL\n");
943 msginfo = (MsgInfo *)llast->data;
944 msginfo->to = news_parse_xhdr(buf, msginfo);
949 if (nntp_xhdr(session, "cc", begin, end) != NN_SUCCESS) {
950 log_warning(_("can't get xhdr\n"));
957 if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) {
958 log_warning(_("error occurred while getting xhdr.\n"));
962 progressindicator_set_percentage
963 (PROGRESS_TYPE_NETWORK,
964 session->fetch_base_percentage +
965 (((gfloat) count) / ((gfloat) lines)) * session->fetch_total_percentage);
967 if (buf[0] == '.' && buf[1] == '\r') break;
969 g_warning("llast == NULL\n");
973 msginfo = (MsgInfo *)llast->data;
974 msginfo->cc = news_parse_xhdr(buf, msginfo);
982 GSList *news_get_msginfos(Folder *folder, FolderItem *item, GSList *msgnum_list)
984 NNTPSession *session;
985 GSList *elem, *msginfo_list = NULL, *tmp_msgnum_list, *tmp_msginfo_list;
986 guint first, last, next;
987 guint tofetch, fetched;
989 g_return_val_if_fail(folder != NULL, NULL);
990 g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
991 g_return_val_if_fail(msgnum_list != NULL, NULL);
992 g_return_val_if_fail(item != NULL, NULL);
994 session = news_session_get(folder);
995 g_return_val_if_fail(session != NULL, NULL);
997 tmp_msgnum_list = g_slist_copy(msgnum_list);
998 tmp_msgnum_list = g_slist_sort(tmp_msgnum_list, g_int_compare);
1000 progressindicator_start(PROGRESS_TYPE_NETWORK);
1001 tofetch = g_slist_length(tmp_msgnum_list);
1004 first = GPOINTER_TO_INT(tmp_msgnum_list->data);
1006 for(elem = g_slist_next(tmp_msgnum_list); elem != NULL; elem = g_slist_next(elem)) {
1007 next = GPOINTER_TO_INT(elem->data);
1008 if(next != (last + 1)) {
1009 session->fetch_base_percentage = ((gfloat) fetched) / ((gfloat) tofetch);
1010 session->fetch_total_percentage = ((gfloat) (last - first + 1)) / ((gfloat) tofetch);
1011 tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
1012 msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);
1013 fetched = last - first + 1;
1018 session->fetch_base_percentage = ((gfloat) fetched) / ((gfloat) tofetch);
1019 session->fetch_total_percentage = ((gfloat) (last - first + 1)) / ((gfloat) tofetch);
1020 tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
1021 msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);
1023 g_slist_free(tmp_msgnum_list);
1025 progressindicator_stop(PROGRESS_TYPE_NETWORK);
1027 return msginfo_list;