#
# $Id: messagehandler.icn,v 1.1 2004-02-12 17:07:56 rparlett Exp $
#

package mail

class MessageHandler : TypeHandler()
   method can_handle(ct)
      return (::map(ct.get_type()) == "message") & (::map(ct.get_subtype()) == "rfc822")
   end

   method convert_to_object(m,  data)
      local res
      res := Message()
      res.parse(data) | return error(res)
      return res
   end

   method convert_from_object(m, obj)
      return obj.to_rfc822()
   end
end
