view plugins/SIGNALS @ 116:8c982b7f18d4

[gaim-migrate @ 126] Hmm committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Fri, 14 Apr 2000 08:36:36 +0000
parents c5a1a1b05c26
children 395a8593918f
line wrap: on
line source

enum gaim_event {
	event_signon = 0,
	event_signoff,
	event_im_recv,
	event_im_send,
	event_buddy_signon,
	event_buddy_signoff,
	event_blist_update
};

To add a signal handler, call the fuction gaim_signal_connect with the
following arguments:

void *, enum gaim_event, void *, void *

The first arg is the handle that was passed to gaim_signal_init. You did
	save it, right?
The second arg is hopefully obvious.
The third arg is a pointer to a function that takes various args
	depending on which event you're dealing with.
The fourth arg is any data you want to send to your function, as a final
	argument.

To remove a signal handler, call the function gaim_signal_disconnect with the
following arguments:

void *, enum gaim_event, void *

The first arg is the handle that was passed to gaim_signal_init.
The second arg is hopefully obvious.
The third arg is a pointer to the function you attached.

Note that it deletes *all* functions matching the function you pass, not just
one. Sorry, that's just the way it works.

So here are the args that get passed to your functions in various events:

event_signon:
	(none)

	Note that you can get the username (which would probably be the only
	useful information here) from other places. (Read gaim.h for details).

event_signoff:
	(none)

event_im_recv:
	char **who, char **text

	'who' is the username of the person who sent the message.
	'text' is the actual strict text (with HTML tags and all) of the
		message they sent.
	
	Note that you can modify these values. (You are encouraged to do so!)
	Note that *other* plugins can also modify these values, so you should
	check that they are not NULL, and try not to leave them as NULL.

event_im_send:
	char *who, char **text

	'who' is the username of the person you're sending the message to.
	'text' is the actual strict text (with HTML tags and all) of the
		message you're sending.

	Note that you can modify outgoing text. (You are _not_ encouraged to
		do so ;-) .)

event_buddy_signon:
	char *who
	
	'who' is who signed on.

event_buddy_signoff:
	char *who

	'who' is who signed off.

event_blist_update:
	(none)
	
	This event is called when the buddylist is updated (automatically every 20 seconds)