Adding an event handler for when a user adds a friend

Trying to add some functionality to my Elgg site when a user adds a friend. As I understand it, an event handler would be the way to do this. 


function my_function( $event, $object_type, $object ){

//do something


register_elgg_event_handler('friend', 'user', 'my_function');  


Is that the correct code? Any help is much appreciated!