Permalink
Browse files

Couple changes, added logging to the console

  • Loading branch information...
1 parent 86fd55e commit eafdad50e931c08a702c9f6d6cc45dba333f815d @danopia committed Dec 18, 2009
Showing with 6 additions and 5 deletions.
  1. +5 −5 main.rb
  2. +1 −0 notify.rb
View
10 main.rb
@@ -32,20 +32,20 @@
elsif old != device
if old.connected? && !device.connected?
- Notify.send "#{device.type_name} has disconnected", "The #{device.connection_type} #{device.type_name} has disconnected from its #{device.name} link.", 'info'
+ Notify.send "#{device.type_name.capitalize} has disconnected", "The #{device.type_name} #{device.name} has disconnected from its #{device.connection_type} link.", 'info'
elsif !old.connected? && device.connected?
- Notify.send "#{device.type_name} has connected", "The #{device.connection_type} #{device.type_name} has reconnected to the network via a #{device.name} link.\nIts IP is #{device.ip}.", 'info'
+ Notify.send "#{device.type_name.capitalize} has connected", "The #{device.type_name} #{device.name} has reconnected to the network via a #{device.connection_type} link.\nIts IP is #{device.ip}.", 'info'
end
if old.ip != device.ip
- Notify.send "#{device.type_name} has a new IP", "The #{device.connection_type} #{device.type_name} has changed IPs from #{old.ip} to #{device.ip}.", 'info'
+ Notify.send "#{device.type_name.capitalize} has a new IP", "The #{device.connection_type} #{device.type_name} #{device.name} has changed IPs from #{old.ip} to #{device.ip}.", 'info'
end
if old.mac != device.mac
- Notify.send "#{device.type_name} has a new MAC!", "The #{device.connection_type} #{device.type_name} has changed MAC addresses from #{old.mac} to #{device.mac}.\nIt is possible that the device is posing as something else. This should be investigated.", 'failed'
+ Notify.send "#{device.type_name.capitalize} has a new MAC!", "The #{device.connection_type} #{device.type_name} #{device.name} has changed MAC addresses from #{old.mac} to #{device.mac}.\nIt is possible that the device is posing as something else. This should be investigated.", 'failed'
end
end
- known_devices[device.name] == device
+ known_devices[device.name] = device
end
end
View
@@ -14,5 +14,6 @@ def self.send(title, message, icon, priority=0)
end
system 'notify-send', '-i', File.expand_path(icon), '-u', pri, title, message
+ puts "[#{Time.now.to_s}] #{title}", message
end
end

0 comments on commit eafdad5

Please sign in to comment.