summaryrefslogtreecommitdiff
path: root/include/modules/os_news.h
blob: 2c488babfa419c946567cad6d9df152aadf015b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 *
 * (C) 2011-2025 Anope Team
 * Contact us at team@anope.org
 *
 * Please read COPYING and README for further details.
 */

#ifndef OS_NEWS
#define OS_NEWS

enum NewsType
{
	NEWS_LOGON,
	NEWS_RANDOM,
	NEWS_OPER
};

struct NewsMessages
{
	NewsType type;
	Anope::string name;
	const char *msgs[10];
};

struct NewsItem : Serializable
{
	NewsType type;
	Anope::string text;
	Anope::string who;
	time_t time;

	NewsItem() : Serializable("NewsItem") { }
};

class NewsService : public Service
{
 public:
	NewsService(Module *m) : Service(m, "NewsService", "news") { }

	virtual NewsItem *CreateNewsItem() = 0;

	virtual void AddNewsItem(NewsItem *n) = 0;

	virtual void DelNewsItem(NewsItem *n) = 0;

	virtual std::vector<NewsItem *> &GetNewsList(NewsType t) = 0;
};

static ServiceReference<NewsService> news_service("NewsService", "news");

#endif // OS_NEWS