From 3a39f4fa0afcadbcee291cffb47b8278ff7462c8 Mon Sep 17 00:00:00 2001 From: cn Date: Sat, 27 Apr 2013 14:30:15 +0200 Subject: [PATCH] Supply IP to responder --- lib/dyndnsd.rb | 4 ++-- lib/dyndnsd/responder/rest_style.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dyndnsd.rb b/lib/dyndnsd.rb index 9ab4021..5a0b918 100644 --- a/lib/dyndnsd.rb +++ b/lib/dyndnsd.rb @@ -81,10 +81,10 @@ module Dyndnsd @db['serial'] += 1 @db.save update - return @responder.response_for(:good) + return @responder.response_for(:good, myip) end - @responder.response_for(:nochg) + @responder.response_for(:nochg, myip) end def self.run! diff --git a/lib/dyndnsd/responder/rest_style.rb b/lib/dyndnsd/responder/rest_style.rb index 04b4928..6fd0f32 100644 --- a/lib/dyndnsd/responder/rest_style.rb +++ b/lib/dyndnsd/responder/rest_style.rb @@ -2,7 +2,7 @@ module Dyndnsd module Responder class RestStyle - def response_for(state) + def response_for(state, ip = nil) # general http errors return [405, {"Content-Type" => "text/plain"}, ["Method Not Allowed"]] if state == :method_forbidden return [404, {"Content-Type" => "text/plain"}, ["Not Found"]] if state == :not_found @@ -11,8 +11,8 @@ module Dyndnsd return [403, {"Content-Type" => "text/plain"}, ["Forbidden"]] if state == :host_forbidden return [422, {"Content-Type" => "text/plain"}, ["Hostname malformed"]] if state == :hostname_malformed # OKs - return [200, {"Content-Type" => "text/plain"}, ["Good"]] if state == :good - return [200, {"Content-Type" => "text/plain"}, ["No change"]] if state == :nochg + return [200, {"Content-Type" => "text/plain"}, ["Changed to #{ip}"]] if state == :good + return [200, {"Content-Type" => "text/plain"}, ["No change needed for #{ip}"]] if state == :nochg end end end