Mikkel Kroman wrote:
> IRC::Connect hostname: 'irc.phora.net' do
>   def on_message(nick, channel, message, *args)
>     # This is what I want it to be like:
>     # nick.say("Hello there, #{nick}!")
>     # or atleast something like that.
>     # but for now, I'm stuck with this:
>     privmsg(nick, "Hello there, #{nick}!")
>     # is it maybe possible to make some
>     # kind of 'alias'?
>   end
> end

If you just want to send a message to user with nickname "foo", then
  privmsg("foo", "Hello")
looks to be the right way to go about it.

If you want to abstract away the concept of an "IRC user" then create an 
object for it. One of the great things about Ruby is that it's only a 
few lines.

> How would I be able to create User instances which also should have 
> access to the IRC::Client's socket? Currently I'm using User.new("nick", 
> @socket) which is, well.. yeah.

That seems like exactly the way to go about it, if you know at user 
creation time that user "nick" is always reachable through @socket. (But 
really @socket should be the IRC client connection object, rather than 
the raw socket)
-- 
Posted via http://www.ruby-forum.com/.