Gossamer Forum
Quote Reply
PM Hook
I'm playing with a plugin to block pm's from specific users but the hook I'm using seems to be useless. I'm trying to use do_message_send PRE/LAST but I don't get any arguments other than the do= parameter - how do I get the pm details like sender, body etc?

Last edited by:

Paul: Aug 17, 2002, 12:11 AM
Quote Reply
Re: [Paul] PM Hook In reply to
I think you don't get the message details as arguments to the sub, rather you have to extract them from $IN. Looking at GForum::Message::send, it says:
Code:
my ($do, $func) = @_;
my $page = $func->{page};
my $user_id = $IN->param('user');
my $user_username = $IN->param('user_username') if not $user_id;
my $temp_id = $IN->param('temp_id');
That gives you the userid or the username of the recipient, and this in turn will allow you to check if the sender is blocked.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] PM Hook In reply to
Hmm it would have seemed sensible for this to be passed as an argument :(

Thanks though.
Quote Reply
Re: [Paul] PM Hook In reply to
I think it just a matter of when $IN parameters are actually read and put into an argument for a sub. As far as I can see, all the do_xxxx kind of actions just get the page parameter passed (from the definition of the action), and they have to read all other parameters by themselves. Jason probably has his reasons for doing it like this...

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] PM Hook In reply to
Most of my plugins have been for Links SQL which seems to pass arguements to most hooks so maybe thats whats confusing me. As you say I'm sure there's a reason....I suppose if everything is accessible from $IN then you don't need to pass the extra arguments....I guess you only get arguments when something other than input is generated.