• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python settings.SIPSimpleSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sipsimple.configuration.settings.SIPSimpleSettings的典型用法代码示例。如果您正苦于以下问题:Python SIPSimpleSettings类的具体用法?Python SIPSimpleSettings怎么用?Python SIPSimpleSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SIPSimpleSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _NH_XCAPManagerDidReloadData

    def _NH_XCAPManagerDidReloadData(self, notification):
        account = notification.sender.account
        settings = SIPSimpleSettings()

        offline_status = notification.data.offline_status
        status_icon = notification.data.status_icon

        try:
            offline_note = next(note for service in offline_status.pidf.services for note in service.notes)
        except (AttributeError, StopIteration):
            offline_note = None

        settings.presence_state.offline_note = offline_note
        settings.save()

        if status_icon:
            icon_hash = hashlib.sha512(status_icon.data).hexdigest()
            user_icon = UserIcon(status_icon.url, icon_hash)
            if not settings.presence_state.icon or settings.presence_state.icon.etag != icon_hash:
                # TODO: convert icon to PNG before saving it
                self.owner.saveUserIcon(status_icon.data, icon_hash)
        else:
            user_icon = None
            if settings.presence_state.icon:
               unlink(settings.presence_state.icon.path)
            settings.presence_state.icon = None
            settings.save()

        account.xcap.icon = user_icon
        account.save()

        # Cleanup old base64 encoded icons from payload
        if account.id not in self._cleanedup_accounts:
            self._cleanup_icons(account)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:34,代码来源:PresencePublisher.py


示例2: save_certificates

 def save_certificates(self, sip_address, crt, key, ca):
     crt = crt.strip() + os.linesep
     key = key.strip() + os.linesep
     ca = ca.strip() + os.linesep
     X509Certificate(crt)
     X509PrivateKey(key)
     X509Certificate(ca)
     makedirs(ApplicationData.get('tls'))
     certificate_path = ApplicationData.get(os.path.join('tls', sip_address+'.crt'))
     file = open(certificate_path, 'w')
     os.chmod(certificate_path, 0600)
     file.write(crt+key)
     file.close()
     ca_path = ApplicationData.get(os.path.join('tls', 'ca.crt'))
     try:
         existing_cas = open(ca_path).read().strip() + os.linesep
     except:
         file = open(ca_path, 'w')
         file.write(ca)
         file.close()
     else:
         if ca not in existing_cas:
             file = open(ca_path, 'w')
             file.write(existing_cas+ca)
             file.close()
     settings = SIPSimpleSettings()
     settings.tls.ca_list = ca_path
     settings.save()
     return certificate_path
开发者ID:kogmbh,项目名称:blink-qt,代码行数:29,代码来源:__init__.py


示例3: _AH_GoogleContactsActionTriggered

 def _AH_GoogleContactsActionTriggered(self):
     settings = SIPSimpleSettings()
     if settings.google_contacts.authorization_token is not None:
         settings.google_contacts.authorization_token = None
         settings.save()
         self.google_contacts_dialog.hide()
     else:
         self.google_contacts_dialog.open()
开发者ID:pol51,项目名称:blink-qt,代码行数:8,代码来源:mainwindow.py


示例4: __init__

    def __init__(self):
        super(Blink, self).__init__(sys.argv)
        self.setAttribute(Qt.AA_DontShowIconsInMenus, False)
        self.sip_application = SIPApplication()
        self.first_run = False

        self.setOrganizationDomain("ag-projects.com")
        self.setOrganizationName("AG Projects")
        self.setApplicationName("Blink")
        self.setApplicationVersion(__version__)

        self.main_window = MainWindow()
        self.chat_window = ChatWindow()
        self.main_window.__closed__ = True
        self.chat_window.__closed__ = True
        self.main_window.installEventFilter(self)
        self.chat_window.installEventFilter(self)

        self.main_window.addAction(self.chat_window.control_button.actions.main_window)
        self.chat_window.addAction(self.main_window.quit_action)
        self.chat_window.addAction(self.main_window.help_action)
        self.chat_window.addAction(self.main_window.redial_action)
        self.chat_window.addAction(self.main_window.join_conference_action)
        self.chat_window.addAction(self.main_window.mute_action)
        self.chat_window.addAction(self.main_window.silent_action)
        self.chat_window.addAction(self.main_window.preferences_action)
        self.chat_window.addAction(self.main_window.transfers_window_action)
        self.chat_window.addAction(self.main_window.logs_window_action)
        self.chat_window.addAction(self.main_window.received_files_window_action)
        self.chat_window.addAction(self.main_window.screenshots_window_action)

        self.ip_address_monitor = IPAddressMonitor()
        self.log_manager = LogManager()
        self.presence_manager = PresenceManager()
        self.session_manager = SessionManager()
        self.update_manager = UpdateManager()

        # Prevent application from exiting after last window is closed if system tray was initialized
        if self.main_window.system_tray_icon:
            self.setQuitOnLastWindowClosed(False)

        self.main_window.check_for_updates_action.triggered.connect(self.update_manager.check_for_updates)
        self.main_window.check_for_updates_action.setVisible(self.update_manager != Null)

        if getattr(sys, "frozen", False):
            XMLDocument.schema_path = Resources.get("xml-schemas")

        Account.register_extension(AccountExtension)
        BonjourAccount.register_extension(BonjourAccountExtension)
        Contact.register_extension(ContactExtension)
        Group.register_extension(GroupExtension)
        SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)

        notification_center = NotificationCenter()
        notification_center.add_observer(self, sender=self.sip_application)

        branding.setup(self)
开发者ID:AGProjects,项目名称:blink-qt,代码行数:57,代码来源:__init__.py


示例5: _NH_CFGSettingsObjectDidChange

 def _NH_CFGSettingsObjectDidChange(self, account, data):
     if isinstance(account, Account):
         if 'message_summary.enabled' in data.modified:
             if not account.message_summary.enabled:
                 MWIData.remove(account)
     if 'audio.enable_aec' in data.modified:
         settings = SIPSimpleSettings()
         BlinkLogger().log_info(u"Acoustic Echo Canceller is %s" % ('enabled' if settings.audio.enable_aec else 'disabled'))
         settings.audio.tail_length = 15 if settings.audio.enable_aec else 0
         settings.save()
开发者ID:wilane,项目名称:blink-cocoa,代码行数:10,代码来源:SIPManager.py


示例6: runModal

 def runModal(self):
     self.window.makeKeyAndOrderFront_(None)
     rc = NSApp.runModalForWindow_(self.window)
     self.window.orderOut_(self)
     if rc == NSOKButton:
         note = unicode(self.nameText.stringValue())
         settings = SIPSimpleSettings()
         settings.presence_state.offline_note = note
         settings.save()
         return note
     return None
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:11,代码来源:OfflineNoteController.py


示例7: notificationsCheckboxClicked_

    def notificationsCheckboxClicked_(self, sender):
        settings = SIPSimpleSettings()
        settings.logs.trace_notifications_in_gui = bool(sender.state())
        settings.logs.trace_notifications = settings.logs.trace_notifications_in_gui or settings.logs.trace_notifications_to_file
        settings.save()

        notification_center = NotificationCenter()

        if settings.logs.trace_notifications_in_gui:
            notification_center.add_observer(self)
        else:
            notification_center.discard_observer(self)
开发者ID:uditha-atukorala,项目名称:blink,代码行数:12,代码来源:DebugWindow.py


示例8: msrpRadioClicked_

    def msrpRadioClicked_(self, sender):
        trace = sender.selectedCell().tag()
        settings = SIPSimpleSettings()
        settings.logs.trace_msrp_in_gui = trace
        if trace == Disabled:
            settings.logs.trace_msrp = settings.logs.trace_msrp_to_file
        elif trace == Simplified:
            settings.logs.trace_msrp = True
        elif trace == Full:
            settings.logs.trace_msrp = True

        settings.save()
开发者ID:uditha-atukorala,项目名称:blink,代码行数:12,代码来源:DebugWindow.py


示例9: _NH_SIPApplicationDidStart

    def _NH_SIPApplicationDidStart(self, notification):
        settings = SIPSimpleSettings()
        if settings.presence_state.timestamp is None:
            settings.presence_state.timestamp = ISOTimestamp.now()
            settings.save()

        self.get_location([account for account in AccountManager().iter_accounts() if account is not BonjourAccount()])
        self.publish()

        idle_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(1.0, self, "updateIdleTimer:", None, True)
        NSRunLoop.currentRunLoop().addTimer_forMode_(idle_timer, NSRunLoopCommonModes)
        NSRunLoop.currentRunLoop().addTimer_forMode_(idle_timer, NSEventTrackingRunLoopMode)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:12,代码来源:PresencePublisher.py


示例10: init

    def init(self):

        Account.register_extension(AccountExtension)
        BonjourAccount.register_extension(BonjourAccountExtension)
        Contact.register_extension(BlinkContactExtension)
        Group.register_extension(BlinkGroupExtension)
        SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)

        self._app.start(FileStorage(ApplicationData.directory))

        # start session mgr
        SessionManager()
开发者ID:uditha-atukorala,项目名称:blink,代码行数:12,代码来源:SIPManager.py


示例11: _NH_CFGSettingsObjectDidChange

    def _NH_CFGSettingsObjectDidChange(self, account, data):
        if isinstance(account, Account):
            if 'message_summary.enabled' in data.modified:
                if not account.message_summary.enabled:
                    MWIData.remove(account)

        if 'audio.echo_canceller.enabled' in data.modified:
            settings = SIPSimpleSettings()
            settings.audio.sample_rate = 32000 if settings.audio.echo_canceller.enabled and settings.audio.sample_rate not in ('16000', '32000') else 48000
            spectrum = settings.audio.sample_rate/1000/2 if settings.audio.sample_rate/1000/2 < 20 else 20
            BlinkLogger().log_info(u"Audio sample rate is set to %dkHz covering 0-%dkHz spectrum" % (settings.audio.sample_rate/1000, spectrum))
            BlinkLogger().log_info(u"Acoustic Echo Canceller is %s" % ('enabled' if settings.audio.echo_canceller.enabled else 'disabled'))
            if spectrum >=20:
                BlinkLogger().log_info(u"For studio quality disable the option 'Use ambient noise reduction' in System Preferences > Sound > Input section.")
            settings.save()
        elif 'audio.sample_rate' in data.modified:
            settings = SIPSimpleSettings()
            spectrum = settings.audio.sample_rate/1000/2 if settings.audio.sample_rate/1000/2 < 20 else 20
            if settings.audio.sample_rate == 48000:
                settings.audio.echo_canceller.enabled = False
                settings.audio.enable_aec = False
                settings.save()
            else:
                settings.audio.echo_canceller.enabled = True
                settings.audio.enable_aec = True
                settings.save()
开发者ID:uditha-atukorala,项目名称:blink,代码行数:26,代码来源:SIPManager.py


示例12: __init__

    def __init__(self):
        self.application = SIPApplication()
        self.stopping = False
        self.stop_event = Event()

        Account.register_extension(AccountExtension)
        BonjourAccount.register_extension(BonjourAccountExtension)
        SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)

        self.account_model = AccountModel()
        self.bonjour_services = BonjourServices()
        self.hal = HardwareAbstractionLayer()
        self.session_manager = SessionManager()
        self.web_handler = WebHandler()
开发者ID:eloycoto,项目名称:op2-daemon,代码行数:14,代码来源:server.py


示例13: _NH_SIPApplicationWillStart

    def _NH_SIPApplicationWillStart(self, sender, data):
        settings = SIPSimpleSettings()
        settings.user_agent = "%s %s (MacOSX)" % (NSApp.delegate().applicationName, self._version)
        BlinkLogger().log_info(u"Initializing SIP SIMPLE Client SDK %s" % sdk_version)

        build = str(NSBundle.mainBundle().infoDictionary().objectForKey_("CFBundleVersion"))
        date = str(NSBundle.mainBundle().infoDictionary().objectForKey_("BlinkVersionDate"))
        BlinkLogger().log_info(u"Build %s from %s" % (build, date))

        self.migratePasswordsToKeychain()

        # Set audio settings compatible with AEC and Noise Supressor
        settings.audio.sample_rate = 16000
        settings.audio.tail_length = 15 if settings.audio.enable_aec else 0
        settings.save()
        BlinkLogger().log_info(u"Acoustic Echo Canceller is %s" % ('enabled' if settings.audio.enable_aec else 'disabled'))

        # Although this setting is set at enrollment time, people who have downloaded previous versions will not have it
        account_manager = AccountManager()
        for account in account_manager.iter_accounts():
            must_save = False
            if account is not BonjourAccount() and account.sip.primary_proxy is None and account.sip.outbound_proxy and not account.sip.selected_proxy:
                account.sip.primary_proxy = account.sip.outbound_proxy
                must_save = True

            if account is not BonjourAccount() and settings.tls.verify_server != account.tls.verify_server:
                account.tls.verify_server = settings.tls.verify_server
                must_save = True

            if account.tls.certificate and os.path.basename(account.tls.certificate.normalized) != 'default.crt':
                account.tls.certificate = DefaultValue
                must_save = True

            if account.id.domain == "sip2sip.info":
                if account.server.settings_url is None:
                    account.server.settings_url = "https://blink.sipthor.net/settings.phtml"
                    must_save = True
                if not account.ldap.hostname:
                    account.ldap.hostname = "ldap.sipthor.net"
                    account.ldap.dn = "ou=addressbook, dc=sip2sip, dc=info"
                    account.ldap.enabled = True
                    must_save = True

            if must_save:
                account.save()

        logger = FileLogger()
        logger.start()
        self.ip_address_monitor.start()
开发者ID:wilane,项目名称:blink-cocoa,代码行数:49,代码来源:SIPManager.py


示例14: speechRecognizer_didRecognizeCommand_

 def speechRecognizer_didRecognizeCommand_(self, recognizer, command):
     if command == u'Reject':
         self.decideForAllSessionRequests(REJECT)
         self.stopSpeechRecognition()
     elif command == u'Busy':
         self.decideForAllSessionRequests(BUSY)
         self.stopSpeechRecognition()
     elif command in (u'Accept', u'Answer'):
         self.decideForAllSessionRequests(ACCEPT)
         self.stopSpeechRecognition()
     elif command in (u'Voicemail', u'Answering machine'):
         settings = SIPSimpleSettings()
         settings.answering_machine.enabled = not settings.answering_machine.enabled
         settings.save()
         if settings.answering_machine.enabled:
             self.stopSpeechRecognition()
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:16,代码来源:AlertPanel.py


示例15: sipRadioClicked_

    def sipRadioClicked_(self, sender):
        notification_center = NotificationCenter()
        trace = sender.selectedCell().tag()
        settings = SIPSimpleSettings()
        settings.logs.trace_sip_in_gui = trace
        if trace == Disabled:
            notification_center.discard_observer(self, name="DNSLookupTrace")
            settings.logs.trace_sip = settings.logs.trace_sip_to_file
        elif trace == Simplified:
            notification_center.add_observer(self, name="DNSLookupTrace")
            settings.logs.trace_sip = True
        elif trace == Full:
            notification_center.add_observer(self, name="DNSLookupTrace")
            settings.logs.trace_sip = True

        settings.save()
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:16,代码来源:DebugWindow.py


示例16: __init__

    def __init__(self):
        super(Blink, self).__init__(sys.argv)
        self.application = SIPApplication()
        self.auxiliary_thread = AuxiliaryThread()
        self.first_run = False
        self.main_window = MainWindow()

        self.update_manager = UpdateManager()
        self.main_window.check_for_updates_action.triggered.connect(self.update_manager.check_for_updates)
        self.main_window.check_for_updates_action.setVisible(self.update_manager != Null)

        Account.register_extension(AccountExtension)
        BonjourAccount.register_extension(BonjourAccountExtension)
        SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)
        session_manager = SessionManager()
        session_manager.initialize(self.main_window, self.main_window.session_model)
开发者ID:grengojbo,项目名称:blink-qt,代码行数:16,代码来源:__init__.py


示例17: init

    def init(self):
        self._version = str(NSBundle.mainBundle().infoDictionary().objectForKey_("CFBundleShortVersionString"))

        #first_start = not os.path.exists(ApplicationData.get('config'))

        Account.register_extension(AccountExtension)
        BonjourAccount.register_extension(BonjourAccountExtension)
        Contact.register_extension(BlinkContactExtension)
        ContactGroup.register_extension(BlinkContactGroupExtension)
        SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)

        self._app.start(FileStorage(ApplicationData.directory))
        self.init_configurations()

        # start session mgr
        SessionManager()
开发者ID:wilane,项目名称:blink-cocoa,代码行数:16,代码来源:SIPManager.py


示例18: handle_settings

def handle_settings():
    settings = SIPSimpleSettings()
    if request.method == 'GET':
        # Retrieve settings
        return jsonify(get_state(settings))
    else:
        # Update settings
        state = get_json(request)
        if not state:
            return error_response(400, 'error processing PUT body')
        try:
            set_state(settings, state)
        except ValueError, e:
            # TODO: some settings may have been applied, what do we do?
            return error_response(400, str(e))
        settings.save()
        return jsonify(get_state(settings))
开发者ID:echeverrifm,项目名称:op2-daemon,代码行数:17,代码来源:v1.py


示例19: _set_default_account

 def _set_default_account(self, account):
     if account is not None and not account.enabled:
         raise ValueError("account %s is not enabled" % account.id)
     notification_center = NotificationCenter()
     settings = SIPSimpleSettings()
     with self._lock:
         old_account = self.accounts.get(settings.default_account, None)
         if account is old_account:
             return
         if account is None:
             settings.default_account = None
         else:
             settings.default_account = account.id
         settings.save()
         # we need to post the notification in the file-io thread in order to have it serialized after the
         # SIPAccountManagerDidAddAccount notification that is triggered when the account is saved the first
         # time, because save is executed in the file-io thread while this runs in the current thread. -Dan
         call_in_thread('file-io', notification_center.post_notification, 'SIPAccountManagerDidChangeDefaultAccount', sender=self, data=NotificationData(old_account=old_account, account=account))
开发者ID:acatighera,项目名称:python-sipsimple,代码行数:18,代码来源:__init__.py


示例20: xcapRadioClicked_

    def xcapRadioClicked_(self, sender):
        notification_center = NotificationCenter()
        trace = sender.selectedCell().tag()
        settings = SIPSimpleSettings()
        settings.logs.trace_xcap_in_gui = trace
        if trace == Disabled:
            notification_center.discard_observer(self, name="XCAPManagerDidDiscoverServerCapabilities")
            notification_center.discard_observer(self, name="XCAPSubscriptionGotNotify")
            notification_center.discard_observer(self, name="XCAPManagerDidChangeState")
            settings.logs.trace_xcap = settings.logs.trace_xcap_to_file
        elif trace == Simplified:
            notification_center.add_observer(self, name="XCAPManagerDidDiscoverServerCapabilities")
            notification_center.add_observer(self, name="XCAPManagerDidChangeState")
            settings.logs.trace_xcap = True
        elif trace == Full:
            notification_center.add_observer(self, name="XCAPManagerDidDiscoverServerCapabilities")
            notification_center.add_observer(self, name="XCAPManagerDidChangeState")
            notification_center.add_observer(self, name="XCAPSubscriptionGotNotify")
            settings.logs.trace_xcap = True

        settings.save()
开发者ID:uditha-atukorala,项目名称:blink,代码行数:21,代码来源:DebugWindow.py



注:本文中的sipsimple.configuration.settings.SIPSimpleSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python core.SIPURI类代码示例发布时间:2022-05-27
下一篇:
Python UA.UA类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap