some changes and fixes related to sub.Sub().

This commit is contained in:
fiatjaf
2022-05-04 12:34:12 -03:00
parent 5f3221e966
commit 1f1d3cfe7f
3 changed files with 14 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ import (
"strings"
)
func queryName(fullname string) string {
func QueryIdentifier(fullname string) string {
spl := strings.Split(fullname, "@")
if len(spl) != 2 {
return ""
@@ -30,3 +30,11 @@ func queryName(fullname string) string {
pubkey, _ := result.Names[name]
return pubkey
}
func NormalizeIdentifier(fullname string) string {
if strings.HasPrefix(fullname, "_@") {
return fullname[2:]
}
return fullname
}