Crossfire Server, Trunk  R20739
cfnewspaper.c File Reference
#include <cfnewspaper.h>
#include <stdarg.h>
#include <cfnewspaper_proto.h>
#include <sqlite3.h>
#include <stdlib.h>
#include <string.h>
#include <svnversion.h>
+ Include dependency graph for cfnewspaper.c:

Go to the source code of this file.

Data Structures

struct  kill_format
 
struct  paper_properties
 

Typedefs

typedef struct kill_format kill_format
 
typedef struct paper_properties paper_properties
 

Functions

CF_PLUGIN int cfnewspaper_globalEventListener (int *type,...)
 
CF_PLUGIN int cfnewspaper_runPluginCommand (object *op, char *params)
 
CF_PLUGIN int closePlugin (void)
 
static void do_kills (char *buffer, int size, time_t start, time_t end, const char *reg, kill_format *format)
 
static void do_region (region *reg, char *buffer, int size, time_t start, time_t end)
 
static void do_region_kills (region *reg, char *buffer, int size, time_t start, time_t end)
 
static void do_sql (const char *sql, sqlite3 *base)
 
static void do_world (char *buffer, int size, time_t start, time_t end)
 
static void do_world_kills (char *buffer, int size, time_t start, time_t end)
 
CF_PLUGIN int eventListener (int *type,...)
 
static void format_time (timeofday_t *tod, char *buffer, int size)
 
static paper_propertiesget_newspaper (const char *name)
 
static void get_newspaper_content (object *paper, paper_properties *properties, region *reg)
 
static int get_region_id (region *reg)
 
CF_PLUGIN void * getPluginProperty (int *type,...)
 
CF_PLUGIN int initPlugin (const char *iversion, f_plug_api gethooksptr)
 
static void news_cat (char *buffer, int size, const char *format,...)
 
CF_PLUGIN int postInitPlugin (void)
 
static void read_parameters (void)
 

Variables

static paper_properties default_properties
 
f_plug_api gethook
 
static sqlite3 * logger_database
 
static sqlite3 * newspaper_database
 
f_plug_api reCmp
 
f_plug_api registerGlobalEvent
 
CF_PLUGIN char SvnRevPlugin [] = SVN_REV
 
f_plug_api unregisterGlobalEvent
 

Typedef Documentation

◆ kill_format

typedef struct kill_format kill_format

◆ paper_properties

Function Documentation

◆ cfnewspaper_globalEventListener()

CF_PLUGIN int cfnewspaper_globalEventListener ( int *  type,
  ... 
)

Definition at line 137 of file cfnewspaper.c.

◆ cfnewspaper_runPluginCommand()

CF_PLUGIN int cfnewspaper_runPluginCommand ( object op,
char *  params 
)

Definition at line 133 of file cfnewspaper.c.

◆ do_kills()

static void do_kills ( char *  buffer,
int  size,
time_t  start,
time_t  end,
const char *  reg,
kill_format format 
)
static

◆ do_region()

static void do_region ( region reg,
char *  buffer,
int  size,
time_t  start,
time_t  end 
)
static

Definition at line 286 of file cfnewspaper.c.

References do_region_kills(), regiondef::name, and news_cat().

Referenced by get_newspaper_content().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_region_kills()

static void do_region_kills ( region reg,
char *  buffer,
int  size,
time_t  start,
time_t  end 
)
static

Definition at line 268 of file cfnewspaper.c.

References do_kills(), get_region_id(), kill_format::many_monster_death, kill_format::many_player_death, kill_format::no_monster_death, kill_format::no_player_death, kill_format::one_monster_death, kill_format::one_player_death, and snprintf.

Referenced by do_region().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_sql()

static void do_sql ( const char *  sql,
sqlite3 *  base 
)
static

Definition at line 53 of file cfnewspaper.c.

References cf_log(), llevError, and PLUGIN_NAME.

Referenced by get_region_id().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_world()

static void do_world ( char *  buffer,
int  size,
time_t  start,
time_t  end 
)
static

Definition at line 304 of file cfnewspaper.c.

References do_world_kills(), and news_cat().

Referenced by get_newspaper_content().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_world_kills()

static void do_world_kills ( char *  buffer,
int  size,
time_t  start,
time_t  end 
)
static

Definition at line 292 of file cfnewspaper.c.

References do_kills(), kill_format::many_monster_death, kill_format::many_player_death, kill_format::no_monster_death, kill_format::no_player_death, kill_format::one_monster_death, and kill_format::one_player_death.

Referenced by do_world().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_time()

static void format_time ( timeofday_t tod,
char *  buffer,
int  size 
)
static

Definition at line 91 of file cfnewspaper.c.

References _timeofday::day, _timeofday::hour, _timeofday::minute, _timeofday::month, snprintf, and _timeofday::year.

Referenced by get_newspaper_content().

+ Here is the caller graph for this function:

◆ get_newspaper()

static paper_properties* get_newspaper ( const char *  name)
static

Definition at line 204 of file cfnewspaper.c.

References default_properties.

Referenced by eventListener().

+ Here is the caller graph for this function:

◆ get_newspaper_content()

static void get_newspaper_content ( object paper,
paper_properties properties,
region reg 
)
static

Definition at line 310 of file cfnewspaper.c.

References cf_get_time(), cf_log(), cf_object_set_string_property(), CFAPI_OBJECT_PROP_MESSAGE, do_region(), do_world(), format_time(), paper_properties::info_region, paper_properties::info_world, llevError, logger_database, and PLUGIN_NAME.

Referenced by eventListener().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_region_id()

static int get_region_id ( region reg)
static

Definition at line 67 of file cfnewspaper.c.

References do_sql(), logger_database, and regiondef::name.

Referenced by do_region_kills().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ news_cat()

static void news_cat ( char *  buffer,
int  size,
const char *  format,
  ... 
)
static

Definition at line 208 of file cfnewspaper.c.

Referenced by do_kills(), do_region(), and do_world().

+ Here is the caller graph for this function:

◆ read_parameters()

static void read_parameters ( void  )
static

Definition at line 95 of file cfnewspaper.c.

Referenced by postInitPlugin().

+ Here is the caller graph for this function:

Variable Documentation

◆ default_properties

paper_properties default_properties
static
Initial value:
= {
"world newspaper",
0,
1
}

Definition at line 189 of file cfnewspaper.c.

Referenced by get_newspaper().

◆ gethook

f_plug_api gethook

Definition at line 41 of file cfnewspaper.c.

◆ logger_database

sqlite3* logger_database
static

◆ newspaper_database

sqlite3* newspaper_database
static

Definition at line 51 of file cfnewspaper.c.

Referenced by closePlugin(), and postInitPlugin().

◆ reCmp

f_plug_api reCmp

Definition at line 47 of file cfnewspaper.c.

◆ registerGlobalEvent

f_plug_api registerGlobalEvent

Definition at line 43 of file cfnewspaper.c.

◆ SvnRevPlugin

CF_PLUGIN char SvnRevPlugin[] = SVN_REV

Definition at line 39 of file cfnewspaper.c.

◆ unregisterGlobalEvent

f_plug_api unregisterGlobalEvent

Definition at line 45 of file cfnewspaper.c.