Anope IRC Services  Version 1.8
Data Structures | Macros | Functions | Variables
news.c File Reference
#include "services.h"
#include "pseudo.h"
Include dependency graph for news.c:

Go to the source code of this file.

Data Structures

struct  newsmsgs
 

Macros

#define MSG_SYNTAX   0
 
#define MSG_LIST_HEADER   1
 
#define MSG_LIST_ENTRY   2
 
#define MSG_LIST_NONE   3
 
#define MSG_ADD_SYNTAX   4
 
#define MSG_ADD_FULL   5
 
#define MSG_ADDED   6
 
#define MSG_DEL_SYNTAX   7
 
#define MSG_DEL_NOT_FOUND   8
 
#define MSG_DELETED   9
 
#define MSG_DEL_NONE   10
 
#define MSG_DELETED_ALL   11
 
#define MSG_MAX   11
 
#define SAFE(x)
 
#define SAFE(x)
 

Functions

static int * findmsgs (int16 type, char **typename)
 
static void do_news (User *u, int16 type)
 
static void do_news_list (User *u, int16 type, int *msgs)
 
static void do_news_add (User *u, int16 type, int *msgs, const char *typename)
 
static int add_newsitem (User *u, const char *text, int16 type)
 
static void do_news_del (User *u, int16 type, int *msgs, const char *typename)
 
static int del_newsitem (int num, int16 type)
 
void get_news_stats (long *nrec, long *memuse)
 
void load_news ()
 
void save_news ()
 
void save_rdb_news ()
 
void display_news (User *u, int16 type)
 
int do_logonnews (User *u)
 
int do_opernews (User *u)
 
int do_randomnews (User *u)
 
void do_news (User *u, short type)
 
static int add_newsitem (User *u, const char *text, short type)
 
static int del_newsitem (int num, short type)
 

Variables

int32 nnews = 0
 
int32 news_size = 0
 
NewsItemnews = NULL
 
struct newsmsgs msgarray []
 

Macro Definition Documentation

#define MSG_ADD_FULL   5

Definition at line 33 of file news.c.

Referenced by do_news_add().

#define MSG_ADD_SYNTAX   4

Definition at line 32 of file news.c.

Referenced by do_news_add().

#define MSG_ADDED   6

Definition at line 34 of file news.c.

Referenced by do_news_add().

#define MSG_DEL_NONE   10

Definition at line 38 of file news.c.

Referenced by do_news_del().

#define MSG_DEL_NOT_FOUND   8

Definition at line 36 of file news.c.

Referenced by do_news_del().

#define MSG_DEL_SYNTAX   7

Definition at line 35 of file news.c.

Referenced by do_news_del().

#define MSG_DELETED   9

Definition at line 37 of file news.c.

Referenced by do_news_del().

#define MSG_DELETED_ALL   11

Definition at line 39 of file news.c.

Referenced by do_news_del().

#define MSG_LIST_ENTRY   2

Definition at line 30 of file news.c.

Referenced by do_news_list().

#define MSG_LIST_HEADER   1

Definition at line 29 of file news.c.

Referenced by do_news_list().

#define MSG_LIST_NONE   3

Definition at line 31 of file news.c.

Referenced by do_news_list().

#define MSG_MAX   11

Definition at line 40 of file news.c.

#define MSG_SYNTAX   0

Definition at line 28 of file news.c.

Referenced by do_news().

#define SAFE (   x)
Value:
do { \
if ((x) < 0) { \
if (!forceload) \
fatal("Read error on %s", NewsDBName); \
nnews = i; \
break; \
} \
} while (0)
int32 nnews
Definition: news.c:20
E char * NewsDBName
Definition: extern.h:338
E void E void E void fatal(const char *fmt,...) FORMAT(printf
E int forceload
Definition: extern.h:780

Definition at line 200 of file news.c.

Referenced by load_news(), and save_news().

#define SAFE (   x)
Value:
do { \
if ((x) < 0) { \
log_perror("Write error on %s", NewsDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
anope_cmd_global(NULL, "Write error on %s: %s", NewsDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
return; \
} \
} while (0)
E int WarningTimeout
Definition: extern.h:347
E char * NewsDBName
Definition: extern.h:338
E void restore_db(dbFILE *f)
Definition: datafiles.c:318
E char * strerror(int errnum)
Definition: compat.c:123
static time_t lastwarn
Definition: datafiles.c:19
E void E void log_perror(const char *fmt,...) FORMAT(printf
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506

Definition at line 200 of file news.c.

Function Documentation

static int add_newsitem ( User u,
const char *  text,
int16  type 
)
static

Referenced by do_news_add().

static int add_newsitem ( User u,
const char *  text,
short  type 
)
static
static int del_newsitem ( int  num,
int16  type 
)
static

Referenced by do_news_del().

static int del_newsitem ( int  num,
short  type 
)
static

Definition at line 534 of file news.c.

References nnews.

void display_news ( User u,
int16  type 
)
int do_logonnews ( User u)

Definition at line 336 of file news.c.

References do_news(), MOD_CONT, and NEWS_LOGON.

Referenced by AnopeInit().

static void do_news ( User u,
int16  type 
)
static
void do_news ( User u,
short  type 
)
static void do_news_add ( User u,
int16  type,
int *  msgs,
const char *  typename 
)
static
static void do_news_del ( User u,
int16  type,
int *  msgs,
const char *  typename 
)
static
static void do_news_list ( User u,
int16  type,
int *  msgs 
)
static

Definition at line 401 of file news.c.

References MSG_LIST_ENTRY, MSG_LIST_HEADER, MSG_LIST_NONE, nnews, notice_lang(), s_OperServ, and strftime_lang().

Referenced by do_news().

int do_opernews ( User u)

Definition at line 344 of file news.c.

References do_news(), MOD_CONT, and NEWS_OPER.

Referenced by AnopeInit().

int do_randomnews ( User u)

Definition at line 351 of file news.c.

References do_news(), MOD_CONT, and NEWS_RANDOM.

Referenced by AnopeInit().

static int* findmsgs ( int16  type,
char **  typename 
)
static

Definition at line 93 of file news.c.

References lenof, newsmsgs::msgs, and newsmsgs::name.

Referenced by do_news().

void get_news_stats ( long *  nrec,
long *  memuse 
)

Definition at line 128 of file news.c.

References news_size, and nnews.

Referenced by get_operserv_stats().

void load_news ( void  )
void save_news ( void  )
void save_rdb_news ( void  )

Variable Documentation

struct newsmsgs msgarray[]

Definition at line 48 of file news.c.

NewsItem* news = NULL

Definition at line 22 of file news.c.

int32 news_size = 0

Definition at line 21 of file news.c.

Referenced by add_newsitem(), get_news_stats(), and load_news().

int32 nnews = 0