EventsActionRegister

From TrillWiki

Jump to: navigation, search

The eventsActionRegister function allows a plugin to register for a program action that may be triggered by an event. Within the events area of Trillian, an event can trigger many different program actions. If you wish to be within this list, register for it with this function.

Compatibility: 2.0 and higher

Contents

Syntax

plugin_send(MYGUID, "eventsActionRegister", struct event_action_register_t *);

Note that all Trillian functions and notifications begin with a lower-case letter, despite the Wiki requirement that all pages start with a capital letter.

Parameters

EventsActionRegister utilitizes the event_action_register_t structure.

struct event_action_register_t {  
 	unsigned int			struct_size; 
 
 	char				*event; 
 	char				*description; 
 	 
 	int				custom_settings; 
 	int				event_id; 
 
 	ttkCallback			callback; 
 	void				*data; 
 };



event
The name of the event. This value may not change with a language change and must stay consistent from load to load.
description
The description of the event. This is a most likely the same as the event string in the main language and can change with a language change.
custom_settings
If this event needs more settings, it may be included in its own action setting. Set this to 1 if you have a dialog to go along with it within the advanced preferences screen.
callback
The callback to receive both the custom notifications and the event. The event will be sent as the 'event' variable of the callback. The user data will be an event_variable_t struct.
data
The data to send with the above callback.


Return Value

Negative value on error, event id on success.

Remarks

Be sure to unregister for this action when the plugin stops.