Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Net::OSCAR - a bot that will send and receive?

by marcussen (Pilgrim)
on Dec 08, 2008 at 00:35 UTC ( #728825=note: print w/replies, xml ) Need Help??

in reply to Net::OSCAR - a bot that will send and receive?

Did you check the documentation? Granted it's not brimming with code examples, but there is quite a bit of text in Net::OSCAR. From a quick browse it appears that you need to declare a callback for:

im_in (OSCAR, FROM, MESSAGE[, AWAY]) Called when someone sends you an instant message. If the AWAY para +meter is non-zero, the message was generated as an automatic reply, p +erhaps because you sent that person a message and they had an away me +ssage set.

Confucius says kill mosquito unless cannon

Replies are listed 'Best First'.
Re^2: Net::OSCAR - a bot that will send and receive?
by Anonymous Monk on Dec 08, 2008 at 01:36 UTC
    I understand, and have this:
    sub im_in { my($oscar, $sender, $message, $is_away) = @_; print "$sender: $message\n"; }
    this handles messages received, and of course we use this:
    but the problem is, it doesnt do anything if I go inside a loop of sending messages every X amount of seconds like the example above, it never goes into the callback function, because its stuck inside the loop.. thats the problem im having.

      I do not see the callback set in the code snippet you've posted. I'm fairly certain you need to call $oscar->set_callback_im_in(\&im_in) before you can expect that to be mapped. If it is called before your loop, then you should post the complete code where it is called (perhaps \&signon_done?). The do_one_loop method should call your im_in method if there's a message on the server (assuming your sleep(5) isn't causing connection problems).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://728825]
[corenth]: I'm a pragmatic free-software advocate. I'll play in a walled sandbox when I need to.
[erix]: hm, there's a FANN perl module - looks a bit old
[Cosmic37]: I'm afraid I don't know the answer to your map question...... what were the references too?
[corenth]: each reference was to a fairly small scaler.
[corenth]: I mean, array of scalers. usually triples.
[Cosmic37]: there is a FANN discussion group but seems to have gone quiet... http://leenissen. dk/fann/forum/ viewforum.php?f=18 &sid=1afc1fb3fa1a3 7f52b03e40d05cdaaa 3

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-02-20 18:29 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (274 votes). Check out past polls.