From abdb91e58ef32a627ad20463c8e40a7e4df0179b Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sat, 12 Mar 2011 01:47:08 +0100 Subject: [PATCH] Added the UPNP protocol command for non-persistent updates. --- lib/ildus/server/handler.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/ildus/server/handler.rb b/lib/ildus/server/handler.rb index efa0251..c363e70 100644 --- a/lib/ildus/server/handler.rb +++ b/lib/ildus/server/handler.rb @@ -194,6 +194,23 @@ module Ildus prot_msg 240, host, addr end + def upnp_cmd(host, interval, addr=nil) + raise NotAuthError unless @account.authenticated? + # FIXME: actually do something with the interval! + if addr.nil? + addr = Socket.getnameinfo(@io.getpeername).first + addr = IPAddr.new(addr) + else + addr = IPAddr.new(addr) + end + @commit ||= @domain.update_host(host, addr) + rescue HostNotFoundError + prot_msg 425, host + rescue RecordNotFoundError + prot_msg 426, type, host + else + prot_msg 240, host, addr + end def adda_cmd(host, new_alias) raise NotImplementedError end