# parse it yourself, or you can bind to 'MSG', 'PUBLIC',
# etc and get it all nicely split up for you.
- data[:target] = @server.user_or_channel(argv[0])
+ begin
+ data[:target] = @server.user_or_channel(argv[0])
+ rescue
+ # The previous may fail e.g. when the target is a server or something
+ # like that (e.g. $<mask>). In any of these cases, we just use the
+ # String as a target
+ # FIXME we probably want to explicitly check for the #<mask> $<mask>
+ data[:target] = argv[0]
+ end
data[:message] = argv[1]
handle(:privmsg, data)
handle(:msg, data)
end
when 'NOTICE'
- data[:target] = @server.user_or_channel(argv[0])
+ begin
+ data[:target] = @server.user_or_channel(argv[0])
+ rescue
+ # The previous may fail e.g. when the target is a server or something
+ # like that (e.g. $<mask>). In any of these cases, we just use the
+ # String as a target
+ # FIXME we probably want to explicitly check for the #<mask> $<mask>
+ data[:target] = argv[0]
+ end
data[:message] = argv[1]
case data[:source]
when User
data[:message] = argv[0]
data[:was_on] = @server.channels.inject(ChannelList.new) { |list, ch|
list << ch if ch.users.include?(data[:source])
+ list
}
@server.delete_user(data[:source])
handle(:join, data)
when 'TOPIC'
data[:channel] = @server.channel(argv[0])
- data[:topic] = ChannelTopic.new(argv[1], data[:source], Time.new)
+ data[:topic] = Channel::Topic.new(argv[1], data[:source], Time.new)
data[:channel].topic.replace(data[:topic])
handle(:changetopic, data)