summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chat.h1
-rw-r--r--complete.c12
-rw-r--r--handle.c3
3 files changed, 16 insertions, 0 deletions
diff --git a/chat.h b/chat.h
index aec5a68..6eeed60 100644
--- a/chat.h
+++ b/chat.h
@@ -154,6 +154,7 @@ void completeReject(void);
void completeAdd(size_t id, const char *str, enum Color color);
void completeTouch(size_t id, const char *str, enum Color color);
void completeRemove(size_t id, const char *str);
+void completeClear(size_t id);
FILE *configOpen(const char *path, const char *mode);
int getopt_config(
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);
+ }
+}
diff --git a/handle.c b/handle.c
index 4faabba..b73d200 100644
--- a/handle.c
+++ b/handle.c
@@ -212,6 +212,9 @@ static void handleJoin(struct Message *msg) {
static void handlePart(struct Message *msg) {
require(msg, true, 1);
size_t id = idFor(msg->params[0]);
+ if (self.nick && !strcmp(msg->nick, self.nick)) {
+ completeClear(id);
+ }
completeRemove(id, msg->nick);
uiFormat(
id, Cold, tagTime(msg),