--20cf30051046d69b7b04a8727ab0
Content-Type: text/plain; charset=ISO-8859-1

So I ran your code.  I notice that client.connect returns a separate thread,
so creating your own event/thread with EM shouldn't be needed.


take a look at the documentation:
http://net-toc.rubyforge.org/doc/classes/Net/TOC/Client.html#M000012

 wait(limitl)
<http://net-toc.rubyforge.org/doc/classes/Net/TOC/Client.src/M000012.html>

Waits for the event-handling thread for limit seconds, or indefinitely if no
argument is given. Use this to prevent your program from exiting
prematurely...


I haven't been able to get a ruby script to connect, and doing it in IRB
works for me, too.  I think using client.wait (instead of sleep) is going in
the right direction.  I did a "puts client.buddy_list" in the client, which
reported back my buddy list.  However, doing this in the script printed out
an empty line, so it looks like the connection isn't completing.  You may
want to try playing with this some more--hope this helps

On Tue, Jul 19, 2011 at 1:34 PM, Opviel Krevt <ovashena / gmail.com> wrote:

> No errors. The rb file completes-- but the account never signs on and no
> message is sent. RUBY_VERSION yields 1.8.7 for both the rb file and irb.
>
> Using eventmachine, would it look something like this?
>
> EventMachine::run do
>
> #Define TOC Connection
> client  et::TOC.new(username, password)
>
> #Connect
> client.connect
>
> #Grab object associated with buddy's screenname
> friend  lient.buddy_list.buddy_named(screenname)
>
> #Sends the IM
> friend.send_im(message)
>
> end
>
> --
> Posted via http://www.ruby-forum.com/.
>
>

--20cf30051046d69b7b04a8727ab0--