mirror of
https://github.com/mjl-/mox.git
synced 2025-07-14 17:34:37 +03:00
move config-changing code from package mox-/ to admin/
needed for upcoming changes, where (now) package admin needs to import package store. before, because package store imports mox- (for accessing the active config), that would lead to a cyclic import. package mox- keeps its active config, package admin has the higher-level config-changing functions.
This commit is contained in:
24
mox-/txt.go
Normal file
24
mox-/txt.go
Normal file
@ -0,0 +1,24 @@
|
||||
package mox
|
||||
|
||||
// TXTStrings returns a TXT record value as one or more quoted strings, each max
|
||||
// 100 characters. In case of multiple strings, a multi-line record is returned.
|
||||
func TXTStrings(s string) string {
|
||||
if len(s) <= 100 {
|
||||
return `"` + s + `"`
|
||||
}
|
||||
|
||||
r := "(\n"
|
||||
for len(s) > 0 {
|
||||
n := len(s)
|
||||
if n > 100 {
|
||||
n = 100
|
||||
}
|
||||
if r != "" {
|
||||
r += " "
|
||||
}
|
||||
r += "\t\t\"" + s[:n] + "\"\n"
|
||||
s = s[n:]
|
||||
}
|
||||
r += "\t)"
|
||||
return r
|
||||
}
|
Reference in New Issue
Block a user