aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/nntp/camel-nntp-newsrc.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-09-01 09:58:56 +0800
committerChris Toshok <toshok@src.gnome.org>2000-09-01 09:58:56 +0800
commit71eb39b730cd190c690647d3806d567d55424026 (patch)
treee18c42836d84857e879cefae8263302e018b96a0 /camel/providers/nntp/camel-nntp-newsrc.c
parent3cf4f0d243e0c84b519fe027a3299a925e7075fb (diff)
downloadgsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar
gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.gz
gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.bz2
gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.lz
gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.xz
gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.tar.zst
gsoc2013-evolution-71eb39b730cd190c690647d3806d567d55424026.zip
use camel_remote_store_recv_line.
2000-08-31 Chris Toshok <toshok@helixcode.com> * providers/nntp/camel-nntp-utils.c (get_OVER_headers): use camel_remote_store_recv_line. * providers/nntp/camel-nntp-folder.c (nntp_folder_get_message): use camel_remote_store_recv_line to build message. also, free our buffer so we don't leak like mad. * providers/nntp/camel-nntp-store.c: (camel_nntp_store_get_additional_data) remove. (camel_nntp_store_get_extensions): use camel_remote_store_recv_line. (camel_nntp_store_get_overview_fmt): same. also, don't rely on _get_additional_data anymore since it's easier to parse without. (camel_nntp_command): use camel_remote_store_send_string and camel_remote_store_recv_line. * providers/nntp/camel-nntp-store.h: CamelRemoteStore is the parent class now. remove istream/ostream since CamelRemoteStore takes care of that for us. also remove the prototype for camel_nntp_store_get_additional_data. * providers/nntp/camel-nntp-newsrc.c (camel_nntp_newsrc_write): make sure to clear dirty bit. (camel_nntp_newsrc_read_for_server): don't worry about continually trying to open the file - if it fails we just return an unpopulated .newsrc file. svn path=/trunk/; revision=5153
Diffstat (limited to 'camel/providers/nntp/camel-nntp-newsrc.c')
-rw-r--r--camel/providers/nntp/camel-nntp-newsrc.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/camel/providers/nntp/camel-nntp-newsrc.c b/camel/providers/nntp/camel-nntp-newsrc.c
index 9510fe5bfa..af40308219 100644
--- a/camel/providers/nntp/camel-nntp-newsrc.c
+++ b/camel/providers/nntp/camel-nntp-newsrc.c
@@ -371,6 +371,8 @@ camel_nntp_newsrc_write(CamelNNTPNewsrc *newsrc)
camel_nntp_newsrc_write_to_file(newsrc, fp);
+ newsrc->dirty = FALSE;
+
fclose(fp);
}
@@ -445,30 +447,15 @@ camel_nntp_newsrc_read_for_server (const char *server)
char *filename = g_strdup_printf ("%s/.newsrc-%s", g_get_home_dir(), server);
CamelNNTPNewsrc *newsrc;
- if ((fp = fopen(filename, "r")) == NULL) {
- int fd;
-
- g_warning ("~/.newsrc-%s not present. creating empty file\n", server);
-
- if ((fd = open (filename, O_CREAT, O_TRUNC, O_WRONLY, 0777)) < 0) {
- g_warning ("unable to create ~/.newsrc-%s file\n", server);
- g_free (filename);
- return NULL;
- }
- close (fd);
-
- if ((fp = fopen(filename, "r")) == NULL) {
- g_warning ("unable to open ~/.newsrc-%s file on second try.\n", server);
- g_free (filename);
- return NULL;
- }
- }
-
newsrc = g_new0(CamelNNTPNewsrc, 1);
newsrc->filename = filename;
newsrc->groups = g_hash_table_new (g_str_hash, g_str_equal);
newsrc->subscribed_groups = g_hash_table_new (g_str_hash, g_str_equal);
+ if ((fp = fopen(filename, "r")) == NULL) {
+ g_warning ("~/.newsrc-%s not present.\n", server);
+ return newsrc;
+ }
while (fgets(buf, MAX_LINE_LENGTH, fp) != NULL) {
/* we silently ignore (and lose!) lines longer than 20 * 1500 chars.