 net = require("net")
 
 module.exports = class BabyFtpd
+  authUser = {}
   constructor: (option = {})->
-    @piServer  = undefined
+    @piServer = undefined
+  
+  addUser: (userName, userPass)->
+    authUser[userName] = userPass
   
   listen: (port = 21, host = "0.0.0.0")->
     @piServer = net.createServer()


unless module.parent
  ftpd = new BabyFtpd
  ftpd.listen 8021, "localhost"

      @reply 202
    
    # 仮実装しているもの
    #"RETR": ()->
    #"PWD": ()->
    #"NLST": ()->
    
    # 各コマンドの処理
    "USER": (username)->
      @userName = username
      @reply 331
    
    "PASS": (password)->
      userPass = authUser[@userName]
      if userPass? and userPass is password
        @reply 230
      else
        @reply 530
    
    "PWD": ()->
      @reply 257, '"/"'
