seen (SeenPlugin)

    # File rbot/plugins/seen.rb, line 54
      def seen(saw)
        ret = "#{saw.nick} was last seen "
        ago = Time.new - saw.time

        if (ago.to_i == 0)
          ret += "just now, "
        else
          days = (ago / (60*60*24)).to_i
          ago = ago % (60*60*24)
          hours = (ago / (60*60)).to_i
          ago = ago % (60*60)
          minutes = (ago / 60).to_i
          ago = ago % 60
          seconds = ago.to_i

          ret += "#{days} days " if days > 1
          ret += "#{days} day " if days == 1
          ret += "#{hours} hours " if hours > 1
          ret += "#{hours} hour " if hours == 1
          ret += "#{minutes} minutes " if minutes > 1
          ret += "#{minutes} minute " if minutes == 1
          ret += "#{seconds} seconds " if seconds > 1
          ret += "#{seconds} second " if seconds == 1

          ret += "ago, "
        end

        case saw.type
        when "PUBLIC"
          ret += "saying #{saw.message}"
        when "ACTION"
          ret += "doing #{saw.nick} #{saw.message}"
        when "NICK"
          ret += "changing nick from #{saw.nick} to #{saw.message}"
        when "PART"
          ret += "leaving #{saw.where}"
        when "JOIN"
          ret += "joining #{saw.where}"
        when "QUIT"
          ret += "quiting IRC (#{saw.message})"
        when "TOPIC"
          ret += "changing the topic of #{saw.where} to #{saw.message}"
        end
      end