summaryrefslogtreecommitdiff
path: root/include/modules/operserv/news.h
blob: 815c71db6ce9267b07c60e5da358767c833c8306 (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
/*
 *
 * (C) 2011-2025 Anope Team
 * Contact us at team@anope.org
 *
 * Please read COPYING and README for further details.
 */

#pragma once

enum NewsType
{
	NEWS_LOGON,
	NEWS_RANDOM,
	NEWS_OPER
};

struct NewsMessages final
{
	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");