diff options
author | Chris Toshok <toshok@helixcode.com> | 2000-10-11 12:37:33 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2000-10-11 12:37:33 +0800 |
commit | 4f8ffe430fdfe646741aaaf569929b286fc1be2f (patch) | |
tree | 65e8406cd00ce8eaaa08aa207e33a35a68aa4a89 /camel/providers/nntp/camel-nntp-newsrc.c | |
parent | 139f2405f0a36396f7e3e171ad03a18e8d78ea69 (diff) | |
download | gsoc2013-evolution-4f8ffe430fdfe646741aaaf569929b286fc1be2f.tar gsoc2013-evolution-4f8ffe430fdfe646741aaaf569929b286fc1be2f.tar.gz gsoc2013-evolution-4f8ffe430fdfe646741aaaf569929b286fc1be2f.tar.bz2 gsoc2013-evolution-4f8ffe430fdfe646741aaaf569929b286fc1be2f.tar.lz gsoc2013-evolution-4f8ffe430fdfe646741aaaf569929b286fc1be2f.tar.xz gsoc2013-evolution-4f8ffe430fdfe646741aaaf569929b286fc1be2f.tar.zst gsoc2013-evolution-4f8ffe430fdfe646741aaaf569929b286fc1be2f.zip |
fill in message_count and unread_message_count properly.
2000-10-10 Chris Toshok <toshok@helixcode.com>
* providers/nntp/camel-nntp-store.c
(build_folder_info_from_grouplist): fill in message_count and
unread_message_count properly.
* providers/nntp/camel-nntp-newsrc.h: reformat.
* providers/nntp/camel-nntp-grouplist.c
(camel_nntp_get_grouplist_from_file): remove spew.
* providers/nntp/camel-nntp-newsrc.c
(camel_nntp_newsrc_group_get_num_articles_read): new function.
(camel_nntp_newsrc_group_get_highest_article_read): robustification.
svn path=/trunk/; revision=5832
Diffstat (limited to 'camel/providers/nntp/camel-nntp-newsrc.c')
-rw-r--r-- | camel/providers/nntp/camel-nntp-newsrc.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/camel/providers/nntp/camel-nntp-newsrc.c b/camel/providers/nntp/camel-nntp-newsrc.c index 9fa05fbe49..b474dd3a40 100644 --- a/camel/providers/nntp/camel-nntp-newsrc.c +++ b/camel/providers/nntp/camel-nntp-newsrc.c @@ -65,15 +65,32 @@ camel_nntp_newsrc_group_add (CamelNNTPNewsrc *newsrc, const char *group_name, gb return new_group; } -static long +static int camel_nntp_newsrc_group_get_highest_article_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group) { - if (group->ranges->len == 0) + if (!group || group->ranges->len == 0) return 0; return g_array_index(group->ranges, ArticleRange, group->ranges->len - 1).high; } +static int +camel_nntp_newsrc_group_get_num_articles_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group) +{ + int i; + int count = 0; + + if (group == NULL) + return 0; + + for (i = 0; i < group->ranges->len; i ++) + count += (g_array_index(group->ranges, ArticleRange, i).high - + g_array_index(group->ranges, ArticleRange, i).low) + 1; + + return count; +} + + static void camel_nntp_newsrc_group_mark_range_read(CamelNNTPNewsrc *newsrc, NewsrcGroup *group, long low, long high) { @@ -169,6 +186,16 @@ camel_nntp_newsrc_get_highest_article_read (CamelNNTPNewsrc *newsrc, const char return camel_nntp_newsrc_group_get_highest_article_read (newsrc, group); } +int +camel_nntp_newsrc_get_num_articles_read (CamelNNTPNewsrc *newsrc, const char *group_name) +{ + NewsrcGroup *group; + + group = g_hash_table_lookup (newsrc->groups, group_name); + + return camel_nntp_newsrc_group_get_num_articles_read (newsrc, group); +} + void camel_nntp_newsrc_mark_article_read (CamelNNTPNewsrc *newsrc, const char *group_name, int num) { |