package xmpp import ( "fmt" "strings" "gosrc.io/xmpp" ) type Config struct { Account string `yaml:"account"` Password string `yaml:"password"` } func (c *Config) xmppConfig() (*xmpp.Config, error) { parts := strings.SplitN(c.Account, "@", 2) if len(parts) != 2 { return nil, fmt.Errorf("xmpp: invalid account '%s'", c.Account) } server := parts[1] + ":5222" return &xmpp.Config{ TransportConfiguration: xmpp.TransportConfiguration{ Address: server, }, Jid: c.Account, Credential: xmpp.Password(c.Password), }, nil }