view plugins/SIGNALS @ 250:c5aa7bf99059

[gaim-migrate @ 260] Mostly just touch-ups to the README.gaim file, and a couple FIXME's thrown about in oscar.c committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 22 May 2000 15:43:11 +0000
parents 4e91b92f91a7
children be408b41c172
line wrap: on
line source

enum gaim_event {
	event_signon = 0,
	event_signoff,
	event_away,
	event_back,
	event_im_recv,
	event_im_send,
	event_buddy_signon,
	event_buddy_signoff,
	event_buddy_away,
	event_buddy_back,
	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_away:
	(none)

	Note that the away message that's being used can be retrieved from a
	global variable. (Read gaim.h for details.)

event_back:
	(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_buddy_away:
	char *who

	'who' is who went away.

event_buddy_back:
	char *who

	'who' is who is no longer away.

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