Clear completion for ID on self-part
parent
d314523b90
commit
8b7cc1a0ed
1
chat.h
1
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(
|
||||
|
|
12
complete.c
12
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);
|
||||
}
|
||||
}
|
||||
|
|
3
handle.c
3
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),
|
||||
|
|
Loading…
Reference in New Issue