/* grouplist.* - nntp newsgroups list cache code Copyright (C) 2002 Matthew Mueller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GROUPSLIST_H_ #define _GROUPSLIST_H_ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "rcount.h" #include #include #include #include "stlhelp.h" #include "etree.h" #define GLCACHE_VERSION "NGETGL1" class c_grouplist_getinfo : public c_refcounted{ public: nntp_grouplist_pred *pred; int flags; c_grouplist_getinfo(nntp_grouplist_pred *pre,int flag):pred(pre), flags(flag) { } ~c_grouplist_getinfo() { delete pred; } }; typedef list t_grouplist_getinfo_list; class c_nntp_grouplist_server_info : public c_refcounted { public: ulong serverid; string date; c_nntp_grouplist_server_info(ulong sid):serverid(sid) {} c_nntp_grouplist_server_info(ulong sid,string dat):serverid(sid),date(dat) {} }; typedef map t_nntp_grouplist_server_info_map; class c_server_group_description : public c_refcounted { public: string description; set serverids; c_server_group_description(const string &desc):description(desc){} }; typedef map t_server_group_description_map; class c_group_availability : public c_refcounted{ public: string groupname; set serverids; t_server_group_description_map servergroups; bool addserverdescription(ulong serverid, const string &desc); c_group_availability(const string &name):groupname(name){} }; typedef map t_group_availability_map; class c_nntp_grouplist : public c_refcounted{ protected: string filename; bool saveit; t_nntp_grouplist_server_info_map server_info; t_group_availability_map groups; public: c_nntp_grouplist_server_info::ptr getserverinfo(ulong serverid); void addgroup(ulong serverid, string name); void addgroupdesc(ulong serverid, string name, string desc); void printinfos(const t_grouplist_getinfo_list &getinfos) const; void flushserver(ulong serverid); c_nntp_grouplist(void); c_nntp_grouplist(string path); void save(void); ~c_nntp_grouplist(); }; void nntp_grouplist_printinfos(const t_grouplist_getinfo_list &getinfos); #endif