about summary refs log tree commit diff
path: root/complete.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-07 23:33:23 -0500
committerJune McEnroe <june@causal.agency>2020-02-07 23:33:23 -0500
commitd314523b90f41cfdbca867ad0ad48f2f68f66c58 (patch)
treed448e4b1cbdde3580fd2238c4a80daacb92adff4 /complete.c
parentUse atexit instead of err_set_exit (diff)
downloadcatgirl-d314523b90f41cfdbca867ad0ad48f2f68f66c58.tar.gz
catgirl-d314523b90f41cfdbca867ad0ad48f2f68f66c58.zip
Update completion on join, part, privmsg
Diffstat (limited to '')
-rw-r--r--complete.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/complete.c b/complete.c
index 8247149..5067512 100644
--- a/complete.c
+++ b/complete.c
@@ -109,3 +109,16 @@ void completeAccept(void) {
 void completeReject(void) {
 	match = NULL;
 }
+
+void completeRemove(size_t id, const char *str) {
+	struct Node *next = NULL;
+	for (struct Node *node = head; node; node = next) {
+		next = node->next;
+		if (id && node->id != id) continue;
+		if (strcmp(node->str, str)) continue;
+		if (match == node) match = NULL;
+		detach(node);
+		free(node->str);
+		free(node);
+	}
+}