Change raw_input() to input() and unicode to str. This is *not* compatible with Python 2. Update the hashbangs to run with Python 3.
		
			
				
	
	
		
			44 lines
		
	
	
		
			965 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			965 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/python3
 | 
						|
 | 
						|
import sys
 | 
						|
import dbus
 | 
						|
 | 
						|
bus = dbus.SystemBus()
 | 
						|
 | 
						|
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
 | 
						|
						'org.ofono.Manager')
 | 
						|
 | 
						|
modems = manager.GetModems()
 | 
						|
 | 
						|
for path, properties in modems:
 | 
						|
	if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
 | 
						|
		continue
 | 
						|
 | 
						|
	connman = dbus.Interface(bus.get_object('org.ofono', path),
 | 
						|
					'org.ofono.ConnectionManager')
 | 
						|
 | 
						|
	contexts = connman.GetContexts()
 | 
						|
	path = "";
 | 
						|
 | 
						|
	for i, properties in contexts:
 | 
						|
		if properties["Type"] == "mms":
 | 
						|
			path = i
 | 
						|
			break
 | 
						|
 | 
						|
	if path == "":
 | 
						|
		print("No MMS context")
 | 
						|
		exit(1)
 | 
						|
 | 
						|
	context = dbus.Interface(bus.get_object('org.ofono', path),
 | 
						|
					'org.ofono.ConnectionContext')
 | 
						|
 | 
						|
	if len(sys.argv) < 3:
 | 
						|
		print("Usage: %s <proxy> <center>" % (sys.argv[0]))
 | 
						|
		exit(1)
 | 
						|
 | 
						|
	context.SetProperty("MessageProxy", sys.argv[1])
 | 
						|
	print("Setting MMS Proxy to %s" % (sys.argv[1]))
 | 
						|
 | 
						|
	context.SetProperty("MessageCenter", sys.argv[2])
 | 
						|
	print("Setting MMSC to %s" % (sys.argv[2]))
 |