Class: Skype::OS::MacNative

Inherits:
Abstruct
  • Object
show all
Defined in:
lib/mac-skype/Ruby4Skype.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_application_name = nil) ⇒ MacNative

Returns a new instance of MacNative.



14
15
16
17
18
# File 'lib/mac-skype/Ruby4Skype.rb', line 14

def initialize client_application_name = nil
  @attached = false
  @debug = false
  @agent = Mac::Skype::Agent.instance
end

Instance Attribute Details

#attachedObject

Returns the value of attribute attached.



20
21
22
# File 'lib/mac-skype/Ruby4Skype.rb', line 20

def attached
  @attached
end

#debugObject (readonly)

Returns the value of attribute debug.



20
21
22
# File 'lib/mac-skype/Ruby4Skype.rb', line 20

def debug
  @debug
end

#nameObject (readonly)

Returns the value of attribute name.



20
21
22
# File 'lib/mac-skype/Ruby4Skype.rb', line 20

def name
  @name
end

#responseObject (readonly)

Returns the value of attribute response.



20
21
22
# File 'lib/mac-skype/Ruby4Skype.rb', line 20

def response
  @response
end

Instance Method Details

#attachObject



31
32
33
34
35
# File 'lib/mac-skype/Ruby4Skype.rb', line 31

def attach
  unless attached?
    @agent.connect
  end
end

#attach_waitObject



37
38
39
40
41
# File 'lib/mac-skype/Ruby4Skype.rb', line 37

def attach_wait
  attach
  sleep 0.1 until attached?
  @agent.send_command('PROTOCOL 9999')
end

#attached?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/mac-skype/Ruby4Skype.rb', line 43

def attached?
  @agent.connected?
end

#closeObject



71
72
73
# File 'lib/mac-skype/Ruby4Skype.rb', line 71

def close
  dettach if attached?
end

#dettachObject



47
48
49
50
# File 'lib/mac-skype/Ruby4Skype.rb', line 47

def dettach
  self.attached = false
  @agent.disconnect
end

#invoke_block(cmd) ⇒ Object



61
62
63
64
65
# File 'lib/mac-skype/Ruby4Skype.rb', line 61

def invoke_block cmd
  p ">#{cmd}" if @debug

  @agent.send_command(cmd)
end

#invoke_callback(cmd, cb = Proc.new) ⇒ Object



56
57
58
59
# File 'lib/mac-skype/Ruby4Skype.rb', line 56

def invoke_callback cmd, cb = Proc.new
  res = invoke_block cmd
  cb.call res
end

#messageloopObject



27
28
29
# File 'lib/mac-skype/Ruby4Skype.rb', line 27

def messageloop
  @agent.run_forever
end

#set_notify_selector(block = Proc.new) ⇒ Object



67
68
69
# File 'lib/mac-skype/Ruby4Skype.rb', line 67

def set_notify_selector(block = Proc.new)
  @agent.on_message(&block)
end

#skype_running?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/mac-skype/Ruby4Skype.rb', line 52

def skype_running?
  @agent.running?
end

#start_messageloopObject



23
24
25
# File 'lib/mac-skype/Ruby4Skype.rb', line 23

def start_messageloop
  raise 'not impremented yet. use messageloop().'
end