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


Golang ApplicationConfig.NotifyCommand方法代码示例

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


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

示例1: importFrom

func (x *xmppClientImporter) importFrom(f string) (*config.ApplicationConfig, bool) {
	contents, err := ioutil.ReadFile(f)
	if err != nil {
		return nil, false
	}

	c := new(xmppClientConfig)
	err = json.Unmarshal(contents, c)
	if err != nil {
		return nil, false
	}

	a := new(config.ApplicationConfig)
	ac, err := a.AddNewAccount()
	if err != nil {
		return nil, false
	}

	ac.Account = c.Account
	ac.Server = c.Server
	ac.Proxies = c.Proxies
	ac.Password = c.Password
	ac.Port = c.Port
	ac.HideStatusUpdates = c.HideStatusUpdates
	ac.OTRAutoStartSession = c.OTRAutoStartSession
	ac.OTRAutoTearDown = c.OTRAutoTearDown
	ac.OTRAutoAppendTag = c.OTRAutoAppendTag
	ac.ServerCertificateSHA256 = c.ServerCertificateSHA256
	ac.PrivateKeys = [][]byte{c.PrivateKey}
	ac.AlwaysEncryptWith = c.AlwaysEncryptWith
	ac.KnownFingerprints = make([]config.KnownFingerprint, len(c.KnownFingerprints))

	for ix, kf := range c.KnownFingerprints {
		fp, err := hex.DecodeString(kf.FingerprintHex)
		if err != nil {
			continue
		}

		ac.KnownFingerprints[ix] = config.KnownFingerprint{
			UserID:      kf.UserID,
			Fingerprint: fp,
			Untrusted:   false,
		}
	}

	ac.RequireTor = len(c.Proxies) > 0

	a.NotifyCommand = c.NotifyCommand
	a.Bell = c.Bell
	a.RawLogFile = c.RawLogFile
	a.IdleSecondsBeforeNotification = c.IdleSecondsBeforeNotification

	return a, true
}
开发者ID:0x27,项目名称:coyim,代码行数:54,代码来源:xmpp_client.go

示例2: importFrom

func (x *xmppClientImporter) importFrom(f string) (*config.ApplicationConfig, bool) {
	contents, err := ioutil.ReadFile(f)
	if err != nil {
		return nil, false
	}

	c := new(xmppClientConfig)
	err = json.Unmarshal(contents, c)
	if err != nil {
		return nil, false
	}

	a := new(config.ApplicationConfig)
	ac, err := a.AddNewAccount()
	if err != nil {
		return nil, false
	}

	ac.Account = c.Account
	ac.Server = c.Server
	ac.Proxies = c.Proxies
	ac.Password = c.Password
	ac.Port = c.Port
	ac.HideStatusUpdates = c.HideStatusUpdates
	ac.OTRAutoStartSession = c.OTRAutoStartSession
	ac.OTRAutoTearDown = c.OTRAutoTearDown
	ac.OTRAutoAppendTag = c.OTRAutoAppendTag
	ac.LegacyServerCertificateSHA256 = c.ServerCertificateSHA256
	ac.PrivateKeys = [][]byte{c.PrivateKey}
	ac.AlwaysEncryptWith = c.AlwaysEncryptWith
	ac.Peers = nil
	for _, kfpr := range c.KnownFingerprints {
		fp, _ := hex.DecodeString(kfpr.FingerprintHex)
		fpr, _ := ac.EnsurePeer(kfpr.UserID).EnsureHasFingerprint(fp)
		fpr.Trusted = true
	}
	a.NotifyCommand = c.NotifyCommand
	a.Bell = c.Bell
	a.RawLogFile = c.RawLogFile
	a.IdleSecondsBeforeNotification = c.IdleSecondsBeforeNotification

	return a, true
}
开发者ID:twstrike,项目名称:coyim,代码行数:43,代码来源:xmpp_client.go


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