whatsapp: check comply, make native built default

This commit is contained in:
Mark Joshwel 2024-06-19 01:31:35 +08:00
parent 85f305fb78
commit ad5707408c
2 changed files with 14 additions and 12 deletions

View file

@ -224,19 +224,20 @@ func parseJID(arg string) (types.JID, bool) {
if arg[0] == '+' { if arg[0] == '+' {
arg = arg[1:] arg = arg[1:]
} }
if !strings.ContainsRune(arg, '@') { if !strings.ContainsRune(arg, '@') {
return types.NewJID(arg, types.DefaultUserServer), true return types.NewJID(arg, types.DefaultUserServer), true
} else {
recipient, err := types.ParseJID(arg)
if err != nil {
log.Errorf("s+ow-whatsapp-bridge: Invalid JID %s: %v", arg, err)
return recipient, false
} else if recipient.User == "" {
log.Errorf("s+ow-whatsapp-bridge: Invalid JID %s: no server specified", arg)
return recipient, false
}
return recipient, true
} }
recipient, err := types.ParseJID(arg)
if err != nil {
log.Errorf("s+ow-whatsapp-bridge: Invalid JID %s: %v", arg, err)
return recipient, false
} else if recipient.User == "" {
log.Errorf("s+ow-whatsapp-bridge: Invalid JID %s: no server specified", arg)
return recipient, false
}
return recipient, true
} }
func handleCmd(cmd string, args []string) { func handleCmd(cmd string, args []string) {

View file

@ -83,6 +83,7 @@
devShells.default = mkShell { devShells.default = mkShell {
buildInputs = [ buildInputs = [
go go
golint
gomod2nix.packages.${system}.default gomod2nix.packages.${system}.default
]; ];
}; };
@ -99,8 +100,8 @@
''; '';
}; };
# nix build .#native # nix build
packages.native = stdenvNoCC.mkDerivation { packages.default = stdenvNoCC.mkDerivation {
pname = bridge.name; pname = bridge.name;
version = bridge.version; version = bridge.version;
src = bridgeBuildNative; src = bridgeBuildNative;