/
iphone.rb
executable file
·38 lines (35 loc) · 1.28 KB
/
iphone.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#####
# This is the connection to the iPhone
#####
class SiriProxy::Connection::Iphone < SiriProxy::Connection
def initialize
$conf.active_connections = EM.connection_count
puts "Create server for iPhone connection"
super
self.name = "iPhone"
end
def post_init #removed code from here to allow a 4s to connect!
super
start_tls(:cert_chain_file => File.expand_path("~/.siriproxy/server.passless.crt"),
:private_key_file => File.expand_path("~/.siriproxy/server.passless.key"),
:verify_peer => false)
end
def ssl_handshake_completed
super
begin
self.host = 'guzzoni.apple.com'
self.other_connection = EventMachine.connect('guzzoni.apple.com', 443, SiriProxy::Connection::Apple)
self.plugin_manager.apple_conn = self.other_connection
other_connection.other_connection = self #hehe
other_connection.plugin_manager = plugin_manager
rescue
puts "[Warning - Siriproxy] Could not connect to Apple!!! "
puts "[Warning - Siriproxy] Closing connection!!!"
self.close_connection
end
end
def received_object(object)
return plugin_manager.process_filters(object, :from_iphone)
#plugin_manager.object_from_client(object, self)
end
end