lib/rype/api.rb in rype-0.0.3 vs lib/rype/api.rb in rype-0.0.4

- old
+ new

@@ -1,17 +1,9 @@ require 'dbus' require 'forwardable' module Rype - class Notify < DBus::Object - dbus_interface "com.Skype.API.Client" do - dbus_method :Notify, "in data:s" do |message| - Api.notify(message) - end - end - end - class Api class << self extend Forwardable def_delegators :instance, :attach, :invoke, :on_notification, :notify, :thread @@ -102,11 +94,12 @@ Api.notify(message) end end end - receiving_service = bus.request_service("com.nikofelger.rype.#{@application_name}.#{Process.pid}") - receiving_service.export(Notify.new("/com/Skype/Client")) + receiving_service_name = "com.nikofelger.rype-#{@application_name.gsub(/[^A-Za-z0-9-]/, '-')}-#{Process.pid}" + receiving_service = bus.request_service(receiving_service_name) + receiving_service.export(callback_interface.new("/com/Skype/Client")) dbus_event_loop = DBus::Main.new dbus_event_loop << bus dbus_event_loop.run end end