Crossfire Server, Trunk
plugin_template.c File Reference
#include <plugin_template.h>
#include <stdarg.h>
#include <plugin_template_proto.h>
+ Include dependency graph for plugin_template.c:

Go to the source code of this file.

Functions

CF_PLUGIN int closePlugin (void)
 
CF_PLUGIN void * eventListener (int *type,...)
 
CF_PLUGIN void * getPluginProperty (int *type,...)
 
CF_PLUGIN void * globalEventListener (int *type,...)
 
void initContextStack (void)
 
CF_PLUGIN int initPlugin (const char *iversion, f_plug_api gethooksptr)
 
CFPContextpopContext (void)
 
CF_PLUGIN int postInitPlugin (void)
 
void pushContext (CFPContext *context)
 
CF_PLUGIN int runPluginCommand (object *op, char *params)
 

Variables

CFPContextcontext_stack
 
static int current_command = -999
 
CFPContextcurrent_context
 

Function Documentation

◆ closePlugin()

CF_PLUGIN int closePlugin ( void  )

Close the plugin.

Closes the sqlite database.

Returns
0.

Definition at line 295 of file plugin_template.c.

References cf_log(), llevDebug, and PLUGIN_VERSION.

+ Here is the call graph for this function:

◆ eventListener()

CF_PLUGIN void* eventListener ( int *  type,
  ... 
)

◆ getPluginProperty()

CF_PLUGIN void* getPluginProperty ( int *  type,
  ... 
)

Gets a plugin property.

Parameters
typeignored.
Returns
  • the name, if asked for 'Identification'.
  • the version, if asked for 'FullName'.
  • NULL else.

Check if plugin handles custom command

Definition at line 78 of file plugin_template.c.

References make_face_from_files::args, buf, PLUGIN_NAME, PLUGIN_VERSION, and is_valid_types_gen::type.

◆ globalEventListener()

◆ initContextStack()

void initContextStack ( void  )

Definition at line 41 of file plugin_template.c.

References context_stack, and current_context.

Referenced by postInitPlugin().

+ Here is the caller graph for this function:

◆ initPlugin()

CF_PLUGIN int initPlugin ( const char *  iversion,
f_plug_api  gethooksptr 
)

Plugin initialisation function.

Parameters
iversionserver version.
gethooksptrfunction to get the hooks.
Returns
0

Main plugin entry point.

Parameters
iversionserver version.
gethooksptrfunction to get hooks from.
Returns
always 0.

Definition at line 69 of file plugin_template.c.

References cf_init_plugin(), cf_log(), llevDebug, PLUGIN_VERSION, and nlohmann::detail::void().

+ Here is the call graph for this function:

◆ popContext()

CFPContext* popContext ( void  )

Definition at line 58 of file plugin_template.c.

References current_context, and _cfpcontext::down.

Referenced by eventListener(), and globalEventListener().

+ Here is the caller graph for this function:

◆ postInitPlugin()

CF_PLUGIN int postInitPlugin ( void  )

Plugin was initialized, now to finish.

Registers events, initializes the database.

Returns
0.

Definition at line 117 of file plugin_template.c.

References cf_log(), cf_system_register_global_event(), cfanim_globalEventListener(), EVENT_CLOCK, initContextStack(), llevDebug, PLUGIN_NAME, and PLUGIN_VERSION.

+ Here is the call graph for this function:

◆ pushContext()

void pushContext ( CFPContext context)

Definition at line 46 of file plugin_template.c.

References context_stack, current_context, and _cfpcontext::down.

Referenced by eventListener(), and globalEventListener().

+ Here is the caller graph for this function:

◆ runPluginCommand()

CF_PLUGIN int runPluginCommand ( object op,
char *  params 
)

Definition at line 113 of file plugin_template.c.

Variable Documentation

◆ context_stack

CFPContext* context_stack

Definition at line 35 of file plugin_template.c.

Referenced by initContextStack(), and pushContext().

◆ current_command

int current_command = -999
static

Definition at line 39 of file plugin_template.c.

◆ current_context

CFPContext* current_context

Definition at line 37 of file plugin_template.c.

Referenced by initContextStack(), popContext(), and pushContext().