当前位置: 首页>>代码示例>>Python>>正文


Python SIPSimpleSettings.save方法代码示例

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


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

示例1: _NH_XCAPManagerDidReloadData

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
    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,代码行数:36,代码来源:PresencePublisher.py

示例2: save_certificates

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
 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,代码行数:31,代码来源:__init__.py

示例3: _AH_GoogleContactsActionTriggered

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
 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,代码行数:10,代码来源:mainwindow.py

示例4: _NH_CFGSettingsObjectDidChange

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
 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,代码行数:12,代码来源:SIPManager.py

示例5: runModal

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
 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,代码行数:13,代码来源:OfflineNoteController.py

示例6: notificationsCheckboxClicked_

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
    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,代码行数:14,代码来源:DebugWindow.py

示例7: msrpRadioClicked_

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
    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,代码行数:14,代码来源:DebugWindow.py

示例8: _NH_SIPApplicationDidStart

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
    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,代码行数:14,代码来源:PresencePublisher.py

示例9: _NH_SIPApplicationWillStart

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
    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,代码行数:51,代码来源:SIPManager.py

示例10: sipRadioClicked_

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
    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,代码行数:18,代码来源:DebugWindow.py

示例11: speechRecognizer_didRecognizeCommand_

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
 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,代码行数:18,代码来源:AlertPanel.py

示例12: handle_settings

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
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,代码行数:19,代码来源:v1.py

示例13: _set_default_account

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
 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,代码行数:20,代码来源:__init__.py

示例14: xcapRadioClicked_

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
    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,代码行数:23,代码来源:DebugWindow.py

示例15: _NH_AudioDevicesDidChange

# 需要导入模块: from sipsimple.configuration.settings import SIPSimpleSettings [as 别名]
# 或者: from sipsimple.configuration.settings.SIPSimpleSettings import save [as 别名]
 def _NH_AudioDevicesDidChange(self, notification):
     for action in self.output_device_menu.actions():
         self.output_devices_group.removeAction(action)
         self.output_device_menu.removeAction(action)
     for action in self.input_device_menu.actions():
         self.input_devices_group.removeAction(action)
         self.input_device_menu.removeAction(action)
     for action in self.alert_device_menu.actions():
         self.alert_devices_group.removeAction(action)
         self.alert_device_menu.removeAction(action)
     if self.session_model.active_sessions:
         old_devices = set(notification.data.old_devices)
         new_devices = set(notification.data.new_devices)
         added_devices = new_devices - old_devices
         if added_devices:
             new_device = added_devices.pop()
             settings = SIPSimpleSettings()
             settings.audio.input_device = new_device
             settings.audio.output_device = new_device
             settings.save()
     self.load_audio_devices()
开发者ID:pol51,项目名称:blink-qt,代码行数:23,代码来源:mainwindow.py


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