import enum from nntp.tiny.db import Database from nntp.tiny.newsgroup import Newsgroup class ServerCapability(enum.Flag): NONE = 0 AUTH = enum.auto() POST = enum.auto() class Server(): def __init_(self, db: Database): self.db = db self.capabilities = ServerCapability.NONE self.newsgroups = dict() self._init_groups() def _init_newsgroups(self): for newsgroup in self.db.query(Newsgroup).each(): self.newsgroups[newsgroup.name.casefold()] = newsgroup