ticl

tiny irc channel linker
git clone git://git.ircforever.org/ticl
Log | Files | Refs | Submodules | README | LICENSE

commit c8499f76236656b20c24d0e2bc0690d4ae049b8f
parent fb90d152ef67420872ed6f7a479b0fa6f201a725
Author: libredev <libredev@ircforever.org>
Date:   Thu, 16 Feb 2023 16:24:49 +0530

fixed NICK command

Diffstat:
Mconfig.mk | 1+
Mmain.c | 9++++++---
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/config.mk b/config.mk @@ -9,6 +9,7 @@ MANPREFIX = $(PREFIX)/share/man CPPFLAGS = -D_DEFAULT_SOURCE -DVERSION=\"$(VERSION)\" CFLAGS = -g -std=c89 -Wall -Wextra -pedantic -Wfatal-errors -Wconversion\ -Wstrict-prototypes -Wold-style-definition $(CPPFLAGS) +CFLAGS += -rdynamic LDFLAGS = $(LIBS) CC = cc diff --git a/main.c b/main.c @@ -228,7 +228,6 @@ main(int argc, char *argv[]) free(networks); free(fdtodata); - printf("table len: %d\n", usertofds->len); htdestroy(usertofds); return 0; } @@ -307,7 +306,7 @@ fifo_read(void) int i; for (i = 0; i < netlen; i++) { if (strcmp(name, networks[i].name) == 0) { - snprintf(msg, sizeof(msg), "QUIT :unlinking %s\r\n", networks[i].name); + snprintf(msg, sizeof(msg), "QUIT :netdel: %s\r\n", networks[i].name); net_del(i, msg, FALSE); return; } @@ -622,14 +621,18 @@ fd_read(int fd) /* allocate a new nick with net symbol and replace the old one */ newnick = emalloc((strlen(buf) + strlen(networks[netid].symb) + 2 + 1) * sizeof(char)); sprintf(newnick, "%s[%s]", buf, networks[netid].symb); - htmodkey(usertofds, nick, newnick); snprintf(msg, sizeof(msg), "NICK %s\r\n", newnick); for (i = 0; i < netlen; i++) { if (fds[i] > 0) { fdtodata[fds[i]]->user = newnick; + fdtodata[fds[i]]->suffix = 0; writeall(fds[i], msg); + } else if (fds[i] == -3) { + reconn_list_del(nick, i); + reconn_list_add(newnick, i); } } + htmodkey(usertofds, nick, newnick); return; } else if (strcmp(cmd, "KICK") == 0) { /* :<user_who_kicked>!~username@host KICK <channel> <user_who_is_being_kicked> :<kick_msg> */