31 lines
586 B
Go
31 lines
586 B
Go
package prosody
|
|
|
|
import (
|
|
"fmt"
|
|
"net/url"
|
|
)
|
|
|
|
type Prosody struct {
|
|
binPath string
|
|
plainDomain string
|
|
accountsPath string
|
|
}
|
|
|
|
// /var/lib/prosody/xmpp%%2eurkob%%2ecom/accounts/
|
|
func NewProsody(domain string) *Prosody {
|
|
plainDomain, err := url.QueryUnescape(domain)
|
|
if err != nil {
|
|
panic(fmt.Errorf("urlQueryUnescape %w", err))
|
|
}
|
|
return &Prosody{
|
|
binPath: "/usr/bin/prosodyctl",
|
|
accountsPath: "/var/lib/prosody/" + domain + "/accounts/",
|
|
plainDomain: plainDomain,
|
|
}
|
|
}
|
|
|
|
func (p *Prosody) WithBinPath(binPath string) *Prosody {
|
|
p.binPath = binPath
|
|
return p
|
|
}
|