Class: Skype::Events
- Inherits:
-
Object
- Object
- Skype::Events
- Defined in:
- lib/skype/events.rb
Class Method Summary collapse
Class Method Details
.initialize_listeners ⇒ Object
21 22 23 24 25 26 |
# File 'lib/skype/events.rb', line 21 def initialize_listeners mutex = Mutex.new Skype::Events.on(:chats_received) do |chats| mutex.synchronize { Skype::Chat.chats = chats } end end |
.on(event) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/skype/events.rb', line 6 def on(event) case event when :chatmessage_received Skype::Api.instance.on_notification("CHATMESSAGE (.*) STATUS RECEIVED") do || yield Chatmessage.new() end when :chats_received Skype::Api.instance.on_notification("CHATS (.*)") do |chatlist| yield chatlist.split(', ').map { |chatname| Chat.new(chatname) } end end end |