Пример #1
0
    def sipc_auth_t_finished(self):
        kill_qthread(self.sipc_auth_t_killer)

        res_obj = self.sipc_auth_t.get_return()
        code = res_obj.code

        if code == SIPResponse.OK:
            self._retry_times = 0
            i_update_user_after_sipc_auth_success(self.user, res_obj)
            self.show_contact_list_win()
            return

        elif code == SIPResponse.EXTENSION_REQUIRED: # login location changed
            self.verification = i_generate_verification_pic(self.user, res_obj)
            body = "%s<br />%s" % (self.verification.text, self.verification.tips)
            (btn_val, chars) = GetVerificationDialog.get_input(body = body,
                        path = self.verification.picture_path)
            
            if btn_val:
                logger.info("(SIPC auth) Input recognise chars: %s" % chars)
                self.verification.chars = chars
                self.sipc_auth_t_run()
            else:
                self.verification = None
                self.user = None
                self.show_or_hide_login_widgets(show = True)

            return

        self.show_or_hide_login_widgets(show = True)
        popup_error(self, "SIPC authentication response code: %d" % code)
Пример #2
0
    def sipc_auth_t_finished(self):
        kill_qthread(self.sipc_auth_t_killer)

        res_obj = self.sipc_auth_t.get_return()
        code = res_obj.code

        if code == SIPResponse.OK:
            self._retry_times = 0
            i_update_user_after_sipc_auth_success(self.user, res_obj)
            self.show_contact_list_win()
            return

        elif code == SIPResponse.EXTENSION_REQUIRED:  # login location changed
            self.verification = i_generate_verification_pic(self.user, res_obj)
            body = "%s<br />%s" % (self.verification.text,
                                   self.verification.tips)
            (btn_val, chars) = GetVerificationDialog.get_input(
                body=body, path=self.verification.picture_path)

            if btn_val:
                logger.info("(SIPC auth) Input recognise chars: %s" % chars)
                self.verification.chars = chars
                self.sipc_auth_t_run()
            else:
                self.verification = None
                self.user = None
                self.show_or_hide_login_widgets(show=True)

            return

        self.show_or_hide_login_widgets(show=True)
        popup_error(self, "SIPC authentication response code: %d" % code)
Пример #3
0
    def sipc_auth_t_run(self):
        kill_qthread(self.sipc_auth_t)
        kill_qthread(self.sipc_auth_t_killer)

        self.sipc_auth_t = IThread(i_sipc_auth, user = self.user, verification = self.verification, debug = True)
        self.sipc_auth_t_killer = IThreadKiller(self.sipc_auth_t, timeout = 10)

        self.connect(self.sipc_auth_t, QtCore.SIGNAL("thread_finished()"), self.sipc_auth_t_finished)
        self.connect(self.sipc_auth_t_killer, QtCore.SIGNAL('kill_qthread()'), self.kill_sipc_auth_t)

        self.sipc_auth_t.start()
        self.sipc_auth_t_killer.start()
Пример #4
0
    def kill_sipc_auth_t(self):
        kill_qthread(self.sipc_auth_t)

        if self._retry_times < MAX_RETRY_TIMES:
            self._retry_times += 1
            logger.error("SIPC authentication failed, auto re-try ...")
            self.sipc_auth_t_run()
            return

        self.verification = None
        self.user = None
        self.show_or_hide_login_widgets(show = True)
        
        popup_error(self, u"连接超时(SIPC),请稍候再尝试")
Пример #5
0
    def download_sys_config_t_run(self):
        kill_qthread(self.download_sys_config_t)
        kill_qthread(self.download_sys_config_t_killer)

        self.download_sys_config_t = IThread(i_download_sys_config, user = self.user, debug = True)
        self.download_sys_config_t_killer = IThreadKiller(self.download_sys_config_t, timeout = 20)

        self.connect(self.download_sys_config_t, QtCore.SIGNAL("thread_finished()"),
                     self.download_sys_config_t_finished)
        self.connect(self.download_sys_config_t_killer, QtCore.SIGNAL("kill_qthread()"),
                     self.kill_download_sys_config_t)

        self.download_sys_config_t.start()
        self.download_sys_config_t_killer.start()
Пример #6
0
    def kill_download_sys_config_t(self):
        kill_qthread(self.download_sys_config_t)

        if self._retry_times < MAX_RETRY_TIMES:
            self._retry_times += 1
            logger.error("Download configuration failed, auto re-try ...")
            self.download_sys_config_t_run()
            return

        self.verification = None
        self.user = None
        self.show_or_hide_login_widgets(show = True)

        popup_error(self, "Download configuration failed, try again later")
Пример #7
0
    def kill_sipc_auth_t(self):
        kill_qthread(self.sipc_auth_t)

        if self._retry_times < MAX_RETRY_TIMES:
            self._retry_times += 1
            logger.error("SIPC authentication failed, auto re-try ...")
            self.sipc_auth_t_run()
            return

        self.verification = None
        self.user = None
        self.show_or_hide_login_widgets(show=True)

        popup_error(self, u"连接超时(SIPC),请稍候再尝试")
Пример #8
0
    def kill_download_sys_config_t(self):
        kill_qthread(self.download_sys_config_t)

        if self._retry_times < MAX_RETRY_TIMES:
            self._retry_times += 1
            logger.error("Download configuration failed, auto re-try ...")
            self.download_sys_config_t_run()
            return

        self.verification = None
        self.user = None
        self.show_or_hide_login_widgets(show=True)

        popup_error(self, "Download configuration failed, try again later")
Пример #9
0
    def sipc_auth_t_run(self):
        kill_qthread(self.sipc_auth_t)
        kill_qthread(self.sipc_auth_t_killer)

        self.sipc_auth_t = IThread(i_sipc_auth,
                                   user=self.user,
                                   verification=self.verification,
                                   debug=True)
        self.sipc_auth_t_killer = IThreadKiller(self.sipc_auth_t, timeout=10)

        self.connect(self.sipc_auth_t, QtCore.SIGNAL("thread_finished()"),
                     self.sipc_auth_t_finished)
        self.connect(self.sipc_auth_t_killer, QtCore.SIGNAL('kill_qthread()'),
                     self.kill_sipc_auth_t)

        self.sipc_auth_t.start()
        self.sipc_auth_t_killer.start()
Пример #10
0
    def download_sys_config_t_finished(self):
        kill_qthread(self.download_sys_config_t_killer)

        res_obj = self.download_sys_config_t.get_return()
        code = res_obj.code

        if code == httplib.OK:
            self.download_sys_config_t = None
            self.download_sys_config_t_killer = None
            self._retry_times = 0
            i_update_user_after_get_sys_config_success(self.user, res_obj.body)
            self.sipc_auth_t_run()
            return

        self.download_sys_config_t = None
        self.download_sys_config_t_killer = None
        self.show_or_hide_login_widgets(show = True)
        popup_error(self, "Download configuration response code: %d" % code)
Пример #11
0
    def download_sys_config_t_finished(self):
        kill_qthread(self.download_sys_config_t_killer)

        res_obj = self.download_sys_config_t.get_return()
        code = res_obj.code

        if code == httplib.OK:
            self.download_sys_config_t = None
            self.download_sys_config_t_killer = None
            self._retry_times = 0
            i_update_user_after_get_sys_config_success(self.user, res_obj.body)
            self.sipc_auth_t_run()
            return

        self.download_sys_config_t = None
        self.download_sys_config_t_killer = None
        self.show_or_hide_login_widgets(show=True)
        popup_error(self, "Download configuration response code: %d" % code)
Пример #12
0
    def download_sys_config_t_run(self):
        kill_qthread(self.download_sys_config_t)
        kill_qthread(self.download_sys_config_t_killer)

        self.download_sys_config_t = IThread(i_download_sys_config,
                                             user=self.user,
                                             debug=True)
        self.download_sys_config_t_killer = IThreadKiller(
            self.download_sys_config_t, timeout=20)

        self.connect(self.download_sys_config_t,
                     QtCore.SIGNAL("thread_finished()"),
                     self.download_sys_config_t_finished)
        self.connect(self.download_sys_config_t_killer,
                     QtCore.SIGNAL("kill_qthread()"),
                     self.kill_download_sys_config_t)

        self.download_sys_config_t.start()
        self.download_sys_config_t_killer.start()
Пример #13
0
    def ssi_auth_t_finished(self):
        # why not necessary to call disconnect(SIGNAL) here
        # http://doc.qt.nokia.com/4.7/qobject.html#disconnect-3
        kill_qthread(self.ssi_auth_t_killer)

        res_obj = self.ssi_auth_t.get_return()
        code = res_obj.code

        if code == httplib.OK:
            i_update_user_after_ssi_auth_success(self.user, res_obj,
                                                 self.get_if_remember_passwd())

            self._retry_times = 0

            self.download_sys_config_t_run()

        elif code == HTTPResponse.PASSWD_ERROR:
            self.user = None
            self.show_or_hide_login_widgets(show=True)
            popup_error(self, u"密码错误")

        elif code in (HTTPResponse.CCPS_CHECK_ERROR, HTTPResponse.NEED_VERIFY):
            self.verification = i_generate_verification_pic(self.user, res_obj)
            body = "%s<br />%s" % (self.verification.text,
                                   self.verification.tips)
            (btn_val, chars) = GetVerificationDialog.get_input(
                body=body, path=self.verification.picture_path)

            if btn_val:
                logger.info("(SSI auth)Input recognise chars: %s" % chars)
                self.verification.chars = chars
                self.ssi_auth_t_run()
            else:
                self.verification = None
                self.user = None
                self.show_or_hide_login_widgets(show=True)
        else:
            raise Exception("SSI authentication response code: %d" % code)
Пример #14
0
    def ssi_auth_t_finished(self):
        # why not necessary to call disconnect(SIGNAL) here
        # http://doc.qt.nokia.com/4.7/qobject.html#disconnect-3
        kill_qthread(self.ssi_auth_t_killer)

        res_obj = self.ssi_auth_t.get_return()
        code = res_obj.code

        if code == httplib.OK:
            i_update_user_after_ssi_auth_success(self.user, res_obj, self.get_if_remember_passwd())

            self._retry_times = 0
            
            self.download_sys_config_t_run()

        elif code == HTTPResponse.PASSWD_ERROR:
            self.user = None
            self.show_or_hide_login_widgets(show = True)
            popup_error(self, u"密码错误")
            
        elif code in (HTTPResponse.CCPS_CHECK_ERROR, HTTPResponse.NEED_VERIFY):
            self.verification = i_generate_verification_pic(self.user, res_obj)
            body = "%s<br />%s" % (self.verification.text, self.verification.tips)
            (btn_val, chars) = GetVerificationDialog.get_input(body = body,
                        path = self.verification.picture_path)

            if btn_val:
                logger.info("(SSI auth)Input recognise chars: %s" % chars)
                self.verification.chars = chars
                self.ssi_auth_t_run()
            else:
                self.verification = None
                self.user = None
                self.show_or_hide_login_widgets(show = True)
        else:
            raise Exception("SSI authentication response code: %d" % code)