X-Git-Url: http://git.pk910.de/?p=TransparentIRC.git;a=blobdiff_plain;f=src%2FUserClient.c;h=d6c0ca564f0c14dd58b63e296f127880221b867f;hp=e64b8a0befd995b3e40f40df74629022ff9e83d9;hb=8889b0aee1dc430e735e2a0df462fd0aeee63847;hpb=4fdc419424dd18df5807ed4218a84fa38e1dd6f6 diff --git a/src/UserClient.c b/src/UserClient.c index e64b8a0..d6c0ca5 100644 --- a/src/UserClient.c +++ b/src/UserClient.c @@ -19,6 +19,7 @@ #include "ServerSocket.h" #include "UserSession.h" #include "tools.h" +#include "IRCClient.h" static void userclient_callback(struct IOEvent *event); @@ -63,6 +64,8 @@ void userclient_close(struct UserClient *client) { } if(login->username) free(login->username); + if(login->realname) + free(login->realname); if(login->password) free(login->password); if(login->nick) @@ -71,6 +74,10 @@ void userclient_close(struct UserClient *client) { free(login->reject_reason); if(login->session_class) free(login->session_class); + if(login->bind_address) + free(login->bind_address); + if(login->server_address) + free(login->server_address); free(login); } iohandler_close(client->iofd); @@ -123,9 +130,10 @@ static void userclient_recv(struct UserClient *client, char *line) { login->password = strdup(delimiter); } else login->password = strdup(argv[2]); - } else if(!stricmp(argv[1], "USER")) { + } else if(!stricmp(argv[1], "USER") && argc >= 6) { if(!login->username) login->username = strdup(argv[2]); + login->realname = strdup(argv[5]); } else if(!stricmp(argv[1], "NICK")) { if(login->nick) free(login->nick); @@ -134,13 +142,18 @@ static void userclient_recv(struct UserClient *client, char *line) { iohandler_printf(client->iofd, "NOTICE AUTH :*** [TransparentIRC] You need to send your LOC data. Try /quote PASS :"); } } - if(login->username && login->password && login->nick && !(client->flags & USERCLIENT_LOGIN_PROCESSING)) { + if(login->username && login->password && login->nick && login->realname && !(client->flags & USERCLIENT_LOGIN_PROCESSING)) { //try to login iohandler_printf(client->iofd, "NOTICE AUTH :*** [TransparentIRC] Checking login..."); usersession_login(login); } } else { + struct UserSession *session = client->user; + if(!stricmplen(line, "QUIT", 4)) + return; + if(session->irc) + ircclient_send(session->irc, line); } } @@ -160,6 +173,7 @@ void userclient_login_successful(struct UserLogin *login, struct UserSession *se free(login->nick); free(login); client->user = session; + client->flags |= USERCLIENT_LOGGED_IN; if(recover) { iohandler_printf(client->iofd, "NOTICE AUTH :*** [TransparentIRC] Recovering previous link (Nick: %s).", session->nick);