75 lines
2.2 KiB
C
75 lines
2.2 KiB
C
/*
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "buffer.h"
|
|
#include "channels.h"
|
|
#include "limits.h"
|
|
|
|
#include <stdbool.h> // bool
|
|
#include <sys/types.h> // size_t ssize_t socklen_t
|
|
|
|
#define UIRC_IRCV3
|
|
#define UIRC_HELPERS
|
|
#include <uirc/uirc.h> // Assm_mesg Assm_cmd...
|
|
|
|
#ifndef UIRCD_GUARD_CONNECTION
|
|
#define UIRCD_GUARD_CONNECTION
|
|
|
|
#define INIT_HARDFAIL -1
|
|
#define INIT_SOFTFAIL -2
|
|
|
|
#define CONN_ACTIVE 3
|
|
#define CONN_IDLE 2
|
|
#define CONN_REGISTERED 1
|
|
#define CONN_PENDING 0
|
|
#define CONN_RECONNECTING -1
|
|
#define CONN_CLOSING -2
|
|
#define CONN_CLOSED -3
|
|
|
|
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_connect, l_message;
|
|
Channel* channels;
|
|
signed short state;
|
|
signed int reconinter;
|
|
} Connection_Info; // Connection information [temporary]
|
|
|
|
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);
|
|
int register_user(Connection* conn, Buffer_Info* buf);
|
|
|
|
#endif /* UIRCD_GUARD_CONNECTION */
|
|
|