| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -2,15 +2,18 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# encoding: utf-8
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				from pkg_resources import parse_version
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import sys
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				if sys.version_info[0] < 3:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print('This tool works with Python3. Not Python 2')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sys.exit(1)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				try:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    import kopano
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				except ImportError:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print('python-kopano should be installed on your system')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print('python3-kopano should be installed on your system')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sys.exit(1)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				try:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    from MAPI.Util import *
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				except ImportError:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print('python-mapi should be installed on your system')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print('python3-mapi should be installed on your system')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sys.exit(1)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import json
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import base64
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -29,7 +32,6 @@ except ImportError:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    pass
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				"""
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				Read user settings
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -83,6 +85,7 @@ def opt_args(print_help=None):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    group.add_option("--htmleditor", dest="htmleditor", action="store", help="Change the HTML editor (e.g. full_tinymce)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    group.add_option("--remove-state", dest="remove_state", action="store_true", help="Remove all the state settings")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    group.add_option("--add-safesender", dest="addsender", action="store", help="Add domain to safe sender list")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    group.add_option("--polling-interval", dest="pollinginterval", action="store", help="Change the polling interval (seconds)")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    parser.add_option_group(group)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    # Advanced option group
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -578,6 +581,18 @@ def main():
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				           advanced_inject(user, setting, 'list')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				           print('{}'.format(options.addsender), 'Added to safe sender list')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        # Polling interval
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if options.pollinginterval:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            try:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                value = int(options.pollinginterval)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            except ValueError:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                print('Invalid number used. Please specify the value in seconds')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                sys.exit(1)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            settings = read_settings(user)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            setting = 'settings.zarafa.v1.main.reminder.polling_interval = {}'.format(options.pollinginterval)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            advanced_inject(user, setting)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            print('Polling interval changed to', '{}'.format(options.pollinginterval))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        # Always at last!!!
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if options.reset:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            reset_settings(user)
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				 
 |