summary refs log tree commit diff
path: root/complete.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-07 23:44:03 -0500
committerJune McEnroe <june@causal.agency>2020-02-07 23:44:03 -0500
commit8b7cc1a0ed95e8a3ff413fa77eb12a3dca7fccb4 (patch)
treee43cd273a49365fefd2d3437da811bca350a56f2 /complete.c
parentUpdate completion on join, part, privmsg (diff)
downloadcatgirl-8b7cc1a0ed95e8a3ff413fa77eb12a3dca7fccb4.tar.gz
catgirl-8b7cc1a0ed95e8a3ff413fa77eb12a3dca7fccb4.zip
Clear completion for ID on self-part
Diffstat (limited to '')
-rw-r--r--complete.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/complete.c b/complete.c
index 5067512..437bb7d 100644
--- a/complete.c
+++ b/complete.c
@@ -122,3 +122,15 @@ void completeRemove(size_t id, const char *str) {
 		free(node);
 	}
 }
+
+void completeClear(size_t id) {
+	struct Node *next = NULL;
+	for (struct Node *node = head; node; node = next) {
+		next = node->next;
+		if (node->id != id) continue;
+		if (match == node) match = NULL;
+		detach(node);
+		free(node->str);
+		free(node);
+	}
+}