/* * This file is part of uIRCd. (https://git.redxen.eu/caskd/uIRCd) * Copyright (c) 2019, 2020 Alex-David Denes * * uIRCd is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * uIRCd is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with uIRCd. If not, see . */ #include "channels.h" #include "limits.h" #include // bool #include // size_t ssize_t socklen_t #define UIRC_IRCV3 #define UIRC_HELPERS #include // Assm_mesg Assm_cmd... #ifndef UIRCD_GUARD_CONNECTION #define UIRCD_GUARD_CONNECTION #define INIT_HARDFAIL -1 #define INIT_SOFTFAIL -2 #define CONN_ACTIVE 2 #define CONN_REGISTERED 1 #define CONN_PENDING 0 #define CONN_RECONNECTING -1 #define CONN_CLOSING -2 #define CONN_CLOSED -3 #define CHANNELMASK(STR) (strchr("#&+!", *STR) != NULL) typedef struct { char * address, *service, *quitmsg, *path; time_t timeout; } Connection_Data; // Session/Configuration data [persistent] typedef struct { char *nickname, *username, *realname, *password; } Connection_User; // User information [persistent] typedef struct { time_t l_ping, l_pong, l_connect, l_message; Channel* channels; signed short state; signed int reconinter; bool active; } Connection_Info; // Connection information [temporary] typedef struct { char buffer[UIRCD_LIMITS_LINE + 1]; size_t append_pos; int fd; } Buffer_Info; typedef struct { Connection_User user; Connection_Data data; Connection_Info info; } Connection; signed int init_connection(Connection* conn); signed int get_msgchannel(IRC_Message* mesg); int auto_msg_actions(IRC_Message* mesg, Connection* conn, Buffer_Info* buf); int commit_channelist(Buffer_Info* buf, Connection* conn); const char* get_categ(IRC_Message* mesg); #endif /* UIRCD_GUARD_CONNECTION */