"Systems Administrator" <[EMAIL PROTECTED]> writes:

> One of the
> things I am trying to achieve is after querying the database for a list
> of nicks which are to receive a specific message, and pushing each into
> an Array variable, I want to use that Array to send a PRIVMSG to each of
> the nicks within the array. According to the Man page this is possible
> by referencing the array which to my knowledge I am doing, however the
> message only gets sent to the first person in the array. The following
> snippet of code is an example:
[ ... ]

>   # If I try..
>   $kernel->post( 'OraBot', 'privmsg', @recpts, "Blah Blah Blah" );
>   # instead, once again, no errors, the message gets sent only to the
> first nick in the array
>   # but in this case the message gets prepended with the other nick's
> from the Array.
>   # eg. Nick1 receives a message: Nick2 Nick3 Blah Blah Blah
>
>
> Now I know I can for each loop through the array sending the messages
> individually, and I have done this, but thought this was a neater and
> possibly a more economical solution and so would like to do it this way
> if it's possible. So what am I doing wrong??

I would like to see the privmsg method but I can guess at what you are
doing wrong. Try this:

$kernel->post( 'OraBot', 'privmsg', \@recpts, "Blah Blah Blah" );

And in your privmsg method:

sub privmsg {
    my ($self, $recipients, $message) = @_[OBJECT, ARG0, ARG1];
    # loop through recipients
    if (ref $recipients eq "ARRAY") {
       foreach(@{$recipents}) {
           spam_user($message);
       }
    }
}


-- 
/Gabriel

Reply via email to