summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--general_network.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/general_network.c b/general_network.c
index 861fadc..86b60ca 100644
--- a/general_network.c
+++ b/general_network.c
@@ -140,14 +140,15 @@ int PRIVMSG(struct string source, struct string target, struct string message) {
}
int remove_user(struct string uid, struct string reason) { // If disconnecting the local client, set client_connected = 0 *before* calling this
- struct user_info *info = remove_table_index(&user_list, uid);
+ struct user_info *info = get_table_index(user_list, uid);
if (!info)
return 1;
+ int send_client = client_connected;
for (uint64_t i = 0; i < channel_list.len; i++) { // TODO: Use channel list attached to the user (doesn't exist yet)
struct channel_info *chan_info = channel_list.array[i].ptr;
if (has_table_index(chan_info->user_list, uid)) {
- if (client_connected && has_table_index(chan_info->user_list, STRING("1HC000001"))) {
+ if (send_client && has_table_index(chan_info->user_list, STRING("1HC000001"))) {
SENDCLIENT(STRING(":"));
SENDCLIENT(info->nick);
SENDCLIENT(STRING("!"));
@@ -161,12 +162,16 @@ int remove_user(struct string uid, struct string reason) { // If disconnecting t
} else {
SENDCLIENT(STRING(" QUIT\r\n"));
}
+
+ send_client = 0;
}
remove_table_index(&(chan_info->user_list), uid);
}
}
+ remove_table_index(&user_list, uid);
+
free(info->server.data);
free(info->nick.data);
free(info->opertype.data);