diff --git a/main.go b/main.go
index aed5870..296cf24 100644
--- a/main.go
+++ b/main.go
@@ -74,7 +74,6 @@ These are the available commands:
- **sub foo**: subscribe to package foo
- **unsub foo**: unsubscribe from package foo
- **follow foo**: subscribe to all packages maintained by Nixpkgs maintainer foo
-- **unfollow foo**: unsubscribe to all packages maintained by Nixpkgs maintainer foo
- **subs**: list subscriptions
- **help**: show this help message
diff --git a/message_handlers.go b/message_handlers.go
index aa6bb4c..3feae5c 100644
--- a/message_handlers.go
+++ b/message_handlers.go
@@ -162,8 +162,7 @@ func handleSubs(evt *event.Event) {
func handleFollowUnfollow(msg string, evt *event.Event) {
matches := regexes.Follow().FindStringSubmatch(msg)
- un := matches[1]
- handle := matches[2]
+ handle := matches[1]
pjson := h.packagesJSONFetcher()
slog.Info("received follow", "handle", handle, "sender", evt.Sender)
@@ -178,16 +177,10 @@ func handleFollowUnfollow(msg string, evt *event.Event) {
}
}
- if un != "" {
- if _, err := clients.db.Exec("DELETE FROM subscriptions WHERE mxid = ? AND attr_path IN ?", evt.Sender, aps); err != nil {
+ for _, ap := range aps {
+ if err := subscribe(ap, evt); err != nil {
panic(err)
}
- } else {
- for _, ap := range aps {
- if err := subscribe(ap, evt); err != nil {
- panic(err)
- }
- }
}
var l []string
diff --git a/regexes/regexes.go b/regexes/regexes.go
index 71f5ecc..81558c1 100644
--- a/regexes/regexes.go
+++ b/regexes/regexes.go
@@ -12,7 +12,7 @@ import "regexp"
var (
dangerous = regexp.MustCompile(`^sub (?:[*?]+|\w+\.\*)$`)
subscribe = regexp.MustCompile(`^(un)?sub ([\w_?*.-]+)$`)
- follow = regexp.MustCompile(`^(un)?follow (\w+)$`)
+ follow = regexp.MustCompile(`^follow (\w+)$`)
)
// These two regexps are for parsing logs.
diff --git a/regexes/regexes_test.go b/regexes/regexes_test.go
index ba10970..30c18f4 100644
--- a/regexes/regexes_test.go
+++ b/regexes/regexes_test.go
@@ -80,7 +80,6 @@ func TestFollowRegexp(t *testing.T) {
t.Run("should match", func(t *testing.T) {
ss := []string{
"follow foo",
- "unfollow bar",
}
for _, s := range ss {
if !Follow().MatchString(s) {