本文整理汇总了Golang中github.com/twstrike/coyim/session/access.Session.GetConfig方法的典型用法代码示例。如果您正苦于以下问题:Golang Session.GetConfig方法的具体用法?Golang Session.GetConfig怎么用?Golang Session.GetConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/twstrike/coyim/session/access.Session
的用法示例。
在下文中一共展示了Session.GetConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: findAccountForSession
func (m *accountManager) findAccountForSession(s access.Session) *account {
acc, _ := m.getAccountByID(s.GetConfig().ID())
return acc
}
示例2: accountDialog
func (u *gtkUI) accountDialog(s access.Session, account *config.Account, saveFunction func()) {
assertInUIThread()
data := getBuilderAndAccountDialogDetails()
data.otherSettings.SetActive(u.config.AdvancedOptions)
data.acc.SetText(account.Account)
if s != nil {
data.displayName.SetProperty("placeholder-text", s.DisplayName())
nick := s.GetConfig().Nickname
if nick != "" {
data.displayName.SetText(nick)
}
}
if account.Password != "" {
data.pass.SetProperty("placeholder-text", "(saved in configuration file)")
}
data.server.SetText(account.Server)
if account.Port == 0 {
account.Port = 5222
}
data.port.SetText(strconv.Itoa(account.Port))
for _, px := range account.Proxies {
iter := data.proxies.Append()
data.proxies.SetValue(iter, 0, net.ParseProxy(px).ForPresentation())
data.proxies.SetValue(iter, 1, px)
}
for _, px := range account.Certificates {
iter := data.pins.Append()
data.pins.SetValue(iter, 0, px.Subject)
data.pins.SetValue(iter, 1, px.Issuer)
data.pins.SetValue(iter, 2, hex.EncodeToString(px.Fingerprint))
}
data.pinningPolicy.SetActive(findPinningPolicyFor(account.PinningPolicy))
if s != nil && s.PrivateKeys() != nil && len(s.PrivateKeys()) > 0 {
data.fingerprintsMessage.SetSelectable(true)
m := i18n.Local("Your fingerprints for %s:\n%s")
message := fmt.Sprintf(m, account.Account, formattedFingerprintsFor(s))
data.fingerprintsMessage.SetText(message)
}
p2, _ := data.notebook.GetNthPage(1)
p3, _ := data.notebook.GetNthPage(2)
p4, _ := data.notebook.GetNthPage(3)
failures := 0
editProxy := func(iter gtki.TreeIter, onCancel func()) {
val, _ := data.proxies.GetValue(iter, 1)
realProxyData, _ := val.GetString()
u.editProxy(realProxyData, data.dialog,
func(p net.Proxy) {
data.proxies.SetValue(iter, 0, p.ForPresentation())
data.proxies.SetValue(iter, 1, p.ForProcessing())
}, onCancel)
}
data.builder.ConnectSignals(map[string]interface{}{
"on_toggle_other_settings": func() {
otherSettings := data.otherSettings.GetActive()
u.setShowAdvancedSettings(otherSettings)
data.notebook.SetShowTabs(otherSettings)
if otherSettings {
p2.Show()
p3.Show()
p4.Show()
} else {
p2.Hide()
p3.Hide()
p4.Hide()
}
},
"on_save_signal": func() {
accTxt, _ := data.acc.GetText()
passTxt, _ := data.pass.GetText()
dispTxt, _ := data.displayName.GetText()
servTxt, _ := data.server.GetText()
portTxt, _ := data.port.GetText()
isJid, err := verifyXMPPAddress(accTxt)
if !isJid && failures > 0 {
failures++
return
}
if !isJid {
notification := buildBadUsernameNotification(err)
data.notificationArea.Add(notification)
notification.ShowAll()
failures++
log.Printf(err)
return
}
//.........这里部分代码省略.........