Example #1
0
    def __init__(self, accountId=0):
        super(RegistrationUI, self).__init__()
        WADebug.attach(self)

        YowsupDebugger.enabled = True
        self.deviceIMEI = Utilities.getImei()
        self.account = None  #waccount
        self.accountInstance = None  #real account
        self.smsHandler = None
        self.number = ""
        self.cc = ""

        self.gotAccountData.connect(self.createOrUpdateAccount)
        #AccountsManager.manager.accountCreated.connect(self.onAccountCreated)

        if accountId:
            account = AccountsManager.getAccountById(accountId)
            if account:
                self.account = account
                self.cc = account.cc
                self.number = account.phoneNumber
                self.accountInstance = account.accountInstance
                self.setupEditMode()
            else:
                raise Exception("Got account Id but couldn't find account")
        else:

            #this is a new account request
            #check existence of an old one
            account = AccountsManager.findAccount()
            if account:
                self.account = account
                self.cc = account.cc
                self.number = account.phoneNumber
                self.accountInstance = account.accountInstance
                self.setupEditMode()
            else:
                self.setupNewMode()

        src = QUrl('/opt/waxmppplugin/bin/wazapp/UI/Registration/regmain.qml')
        self.setSource(src)

        self.registrationFailed.connect(self.rootObject().onRegistrationFailed)
        self.registrationSuccess.connect(
            self.rootObject().onRegistrationSuccess)
        self.voiceCodeRequested.connect(self.rootObject().onVoiceCodeRequested)
        self.statusUpdated.connect(self.rootObject().onStatusUpdated)
        self.verificationSuccess.connect(self.rootObject().onVerifySuccess)
        self.verificationFailed.connect(self.rootObject().onVerifyFailed)

        self.rootObject().savePushName.connect(self.savePushname)
        self.rootObject().abraKadabra.connect(self.abraKadabra)
        self.rootObject().codeRequest.connect(self.codeRequest)
        #self.rootObject().stopCodeRequest.connect(self.stopCodeRequest)
        self.rootObject().registerRequest.connect(self.registerRequest)
        self.rootObject().deleteAccount.connect(self.deleteAccount)
        self.rootObject().verifyAccount.connect(self.existsRequest)
Example #2
0
    def __init__(self, accountId = 0):
        super(RegistrationUI, self).__init__()
        WADebug.attach(self)
        
        YowsupDebugger.enabled = True
        self.deviceIMEI = Utilities.getImei()
        self.account = None #waccount
        self.accountInstance = None #real account
        self.smsHandler = None
        self.number = ""
        self.cc = ""
        
        self.gotAccountData.connect(self.createOrUpdateAccount)
        #AccountsManager.manager.accountCreated.connect(self.onAccountCreated)
        
        if accountId:
            account = AccountsManager.getAccountById(accountId)
            if account:
                self.account = account
                self.cc = account.cc
                self.number = account.phoneNumber
                self.accountInstance = account.accountInstance
                self.setupEditMode()
            else:
                raise Exception("Got account Id but couldn't find account")
        else:
            
            #this is a new account request
            #check existence of an old one 
            account = AccountsManager.findAccount()
            if account:
                self.account = account
                self.cc = account.cc
                self.number = account.phoneNumber
                self.accountInstance = account.accountInstance
                self.setupEditMode()
            else:
                self.setupNewMode()

        src = QUrl('/opt/waxmppplugin/bin/wazapp/UI/Registration/regmain.qml')
        self.setSource(src)

        self.registrationFailed.connect(self.rootObject().onRegistrationFailed)
        self.registrationSuccess.connect(self.rootObject().onRegistrationSuccess)
        self.voiceCodeRequested.connect(self.rootObject().onVoiceCodeRequested)
        self.statusUpdated.connect(self.rootObject().onStatusUpdated)
        self.verificationSuccess.connect(self.rootObject().onVerifySuccess)
        self.verificationFailed.connect(self.rootObject().onVerifyFailed)

        self.rootObject().savePushName.connect(self.savePushname)
        self.rootObject().abraKadabra.connect(self.abraKadabra)
        self.rootObject().codeRequest.connect(self.codeRequest)
        #self.rootObject().stopCodeRequest.connect(self.stopCodeRequest)
        self.rootObject().registerRequest.connect(self.registerRequest)
        self.rootObject().deleteAccount.connect(self.deleteAccount)
        self.rootObject().verifyAccount.connect(self.existsRequest)
Example #3
0
    def proceed(self):
        account = AccountsManager.getCurrentAccount()
        self._d(account)

        if (account is None):
            #self.d("Forced reg");
            return self.regFallback()
            #gui.forceRegistration();
            #self.app.exit();

        imsi = Utilities.getImsi()
        store = DataStore(imsi)

        if store.status == False:
            #or exit
            store.reset()

        store.prepareGroupConversations()
        store.prepareMedia()
        store.updateDatabase()
        store.initModels()

        gui = WAUI(account.jid)
        gui.setAccountPushName(account.pushName)
        #url = QUrl('/opt/waxmppplugin/bin/wazapp/UI/main.qml')
        #gui.setSource(url)
        gui.initConnections(store)

        self.app.focusChanged.connect(gui.focusChanged)
        gui.quit.connect(self.quit)

        #gui.populatePhoneContacts();

        print "SHOW FULL SCREEN"
        gui.showFullScreen()

        gui.onProcessEventsRequested()

        self.createDirs()

        self.processVersionTriggers()

        gui.populateContacts("ALL")

        gui.populateConversations()

        gui.populatePhoneContacts()

        gui.initializationDone = True
        gui.initialized.emit()

        print "INIT CONNECTION"
        gui.initConnection()
        #splash.finish(gui);
        gui.setMyAccount(account.jid)

        self.gui = gui

        self.gui.whatsapp.eventHandler.setMyAccount(account.jid)
Example #4
0
    def createOrUpdateAccount(self, data):

        if self.accountInstance is None:
            self.accountInstance = AccountsManager.manager.createAccount(
                "waxmpp")
            self.accountInstance.sync()
            self.setAccountData(self.accountInstance.id(), data, True)
        else:
            self.setAccountData(self.accountInstance.id(), data, False)

        if not self.account:
            self.account = AccountsManager.getCurrentAccount()
Example #5
0
	def proceed(self):
		account = AccountsManager.getCurrentAccount();
		self._d(account)
	
	
		if(account is None):
			self.d("Forced reg");
			return self.regFallback()
			#gui.forceRegistration();
			#self.app.exit();
			
		imsi = Utilities.getImsi();
		store = DataStore(imsi);
		
		if store.status == False:
			#or exit
			store.reset();
			
		
		store.prepareGroupConversations();
		store.prepareMedia()
		store.updateDatabase()
		store.initModels()
		
		gui = WAUI();
		#url = QUrl('/opt/waxmppplugin/bin/wazapp/UI/main.qml')
		#gui.setSource(url)
		gui.initConnections(store);
	
		self.app.focusChanged.connect(gui.focusChanged)
		gui.quit.connect(self.quit);

		gui.populateContacts();
		
		gui.populateConversations();
		
		gui.showFullScreen();
		
		
		
		
		

		gui.initConnection();
		#splash.finish(gui);
		
		self.gui = gui;
		
		self.gui.whatsapp.eventHandler.initialConnCheck()
Example #6
0
    def proceed(self):

        #url = QUrl('/opt/waxmppplugin/bin/wazapp/UI/WASplash.qml')
        #gui.setSource(url)

        #check db_state

        #gui.initConnection();
        #pixmap = QPixmap("/opt/waxmppplugin/bin/wazapp/UI/pics/wasplash.png");
        #splash = QSplashScreen(pixmap);
        #splash.show();

        account = AccountsManager.getCurrentAccount()

        print account

        if (account is None):
            Utilities.debug("Forced reg")
            return self.regFallback()
            #gui.forceRegistration();
            #self.app.exit();

        imsi = Utilities.getImsi()
        store = DataStore(imsi)

        if store.status == False:
            #or exit
            store.reset()

        gui = WAUI()
        #url = QUrl('/opt/waxmppplugin/bin/wazapp/UI/main.qml')
        #gui.setSource(url)
        gui.initConnections(store)

        self.app.focusChanged.connect(gui.focusChanged)
        gui.quit.connect(self.quit)

        gui.populateContacts()

        gui.showFullScreen()

        gui.initConnection()
        #splash.finish(gui);

        self.gui = gui

        self.gui.whatsapp.eventHandler.initialConnCheck()
Example #7
0
    def proceed(self):

        # url = QUrl('/opt/waxmppplugin/bin/wazapp/UI/WASplash.qml')
        # gui.setSource(url)

        # check db_state

        # gui.initConnection();
        # pixmap = QPixmap("/opt/waxmppplugin/bin/wazapp/UI/pics/wasplash.png");
        # splash = QSplashScreen(pixmap);
        # splash.show();

        account = AccountsManager.getCurrentAccount()

        print account

        if account is None:
            Utilities.debug("Forced reg")
            return self.regFallback()
            # gui.forceRegistration();
            # self.app.exit();

        imsi = Utilities.getImsi()
        store = DataStore(imsi)

        if store.status == False:
            # or exit
            store.reset()

        gui = WAUI()
        # url = QUrl('/opt/waxmppplugin/bin/wazapp/UI/main.qml')
        # gui.setSource(url)
        gui.initConnections(store)

        self.app.focusChanged.connect(gui.focusChanged)
        gui.quit.connect(self.quit)

        gui.populateContacts()

        gui.showFullScreen()

        gui.initConnection()
        # splash.finish(gui);

        self.gui = gui

        self.gui.whatsapp.eventHandler.initialConnCheck()
Example #8
0
	def __init__(self,store, contactsManager, mode,userid = None):
		WADebug.attach(self);
		self.store = store;
		self.mode = mode
		self.uid = userid;
		
		super(ContactsSyncer,self).__init__();
		
		acc = AccountsManager.getCurrentAccount();
		
		if not acc:
			self.contactsRefreshFail.emit()
			
		
		username = str(acc.username)
		password = acc.password
		
		self.contactsManager = contactsManager
			
		self.syncer = WAContactsSyncRequest(username, password, [])	
Example #9
0
 def setMyPushName(self, pushname):
     AccountsManager.setPushName(pushname)
     self.rootContext().setContextProperty("myPushName", pushname)
     self.whatsapp.eventHandler.setMyPushName.emit(pushname)
Example #10
0
	def proceed(self):
		account = AccountsManager.getCurrentAccount();
		self._d(account)
	
	
		if(account is None):
			#self.d("Forced reg");
			return self.regFallback()
			#gui.forceRegistration();
			#self.app.exit();
			
		imsi = Utilities.getImsi();
		store = DataStore(imsi);
		
		if store.status == False:
			#or exit
			store.reset();
			
		
		store.prepareGroupConversations();
		store.prepareMedia()
		store.updateDatabase()
		store.initModels()
		
		gui = WAUI(account.jid);
		gui.setAccountPushName(account.pushName)
		#url = QUrl('/opt/waxmppplugin/bin/wazapp/UI/main.qml')
		#gui.setSource(url)
		gui.initConnections(store);
	
		self.app.focusChanged.connect(gui.focusChanged)
		gui.quit.connect(self.quit);

		#gui.populatePhoneContacts();
		
		
		print "SHOW FULL SCREEN"
		gui.showFullScreen();
		
		gui.onProcessEventsRequested()
		
				
		self.createDirs()
		
		
		self.processVersionTriggers()

		gui.populateContacts("ALL");
		
		gui.populateConversations();
		
		gui.populatePhoneContacts()
		
		gui.initializationDone = True
		gui.initialized.emit()
		
		
		print "INIT CONNECTION"
		gui.initConnection();
		#splash.finish(gui);
		gui.setMyAccount(account.jid);

		self.gui = gui;
		
		self.gui.whatsapp.eventHandler.setMyAccount(account.jid)
Example #11
0
	def setMyPushName(self, pushname):
		AccountsManager.setPushName(pushname);
		self.rootContext().setContextProperty("myPushName", pushname);
		self.whatsapp.eventHandler.setMyPushName.emit(pushname)
Example #12
0
 def __init__(self, current_id):
     self.user_id = current_id
     self.account = AccountsManager.getCurrentAccount()
Example #13
0
	def __init__(self,current_id):
		self.user_id = current_id;
		self.account = AccountsManager.getCurrentAccount();