2000-08-26 15:39:44 +00:00
|
|
|
#ifndef __IRC_SERVERS_H
|
|
|
|
|
#define __IRC_SERVERS_H
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2019-05-01 16:33:47 +02:00
|
|
|
#include <irssi/src/core/chat-protocols.h>
|
|
|
|
|
#include <irssi/src/core/servers.h>
|
|
|
|
|
#include <irssi/src/irc/core/modes.h>
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2000-08-26 15:39:44 +00:00
|
|
|
/* returns IRC_SERVER_REC if it's IRC server, NULL if it isn't */
|
|
|
|
|
#define IRC_SERVER(server) \
|
2000-09-01 00:26:46 +00:00
|
|
|
PROTO_CHECK_CAST(SERVER(server), IRC_SERVER_REC, chat_type, "IRC")
|
2000-08-26 15:39:44 +00:00
|
|
|
|
|
|
|
|
#define IRC_SERVER_CONNECT(conn) \
|
2000-09-01 00:26:46 +00:00
|
|
|
PROTO_CHECK_CAST(SERVER_CONNECT(conn), IRC_SERVER_CONNECT_REC, \
|
|
|
|
|
chat_type, "IRC")
|
2000-08-30 22:29:55 +00:00
|
|
|
|
|
|
|
|
#define IS_IRC_SERVER(server) \
|
|
|
|
|
(IRC_SERVER(server) ? TRUE : FALSE)
|
|
|
|
|
|
|
|
|
|
#define IS_IRC_SERVER_CONNECT(conn) \
|
|
|
|
|
(IRC_SERVER_CONNECT(conn) ? TRUE : FALSE)
|
2000-04-26 08:03:38 +00:00
|
|
|
|
|
|
|
|
/* all strings should be either NULL or dynamically allocated */
|
|
|
|
|
/* address and nick are mandatory, rest are optional */
|
2001-11-02 01:05:14 +00:00
|
|
|
struct _IRC_SERVER_CONNECT_REC {
|
2019-05-01 16:33:47 +02:00
|
|
|
#include <irssi/src/core/server-connect-rec.h>
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2001-02-19 02:15:15 +00:00
|
|
|
char *usermode;
|
2000-07-30 17:30:54 +00:00
|
|
|
char *alternate_nick;
|
|
|
|
|
|
2015-09-10 01:02:44 +02:00
|
|
|
int sasl_mechanism;
|
|
|
|
|
char *sasl_username;
|
|
|
|
|
char *sasl_password;
|
|
|
|
|
|
2000-07-30 17:30:54 +00:00
|
|
|
int max_cmds_at_once;
|
|
|
|
|
int cmd_queue_speed;
|
2000-12-09 19:12:49 +00:00
|
|
|
int max_query_chans;
|
|
|
|
|
|
2000-07-30 17:30:54 +00:00
|
|
|
int max_kicks, max_msgs, max_modes, max_whois;
|
2001-11-02 01:05:14 +00:00
|
|
|
};
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2000-08-26 15:39:44 +00:00
|
|
|
#define STRUCT_SERVER_CONNECT_REC IRC_SERVER_CONNECT_REC
|
2001-11-02 01:05:14 +00:00
|
|
|
struct _IRC_SERVER_REC {
|
2019-05-01 16:33:47 +02:00
|
|
|
#include <irssi/src/core/server-rec.h>
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2001-11-11 18:59:19 +00:00
|
|
|
/* For deciding if event should be redirected */
|
2001-11-11 20:20:43 +00:00
|
|
|
GSList *redirects;
|
|
|
|
|
GSList *redirect_queue; /* should be updated from redirect_next each time cmdqueue is updated */
|
|
|
|
|
REDIRECT_REC *redirect_next;
|
2007-11-14 23:02:40 +00:00
|
|
|
GSList *redirect_active; /* redirects start event has been received for, must have unique prefix */
|
2001-11-11 18:59:19 +00:00
|
|
|
|
2002-01-28 05:28:25 +00:00
|
|
|
char *last_nick; /* last /NICK, kept even if it resulted as not valid change */
|
|
|
|
|
|
2000-04-26 08:03:38 +00:00
|
|
|
char *real_address; /* address the irc server gives */
|
|
|
|
|
char *usermode; /* The whole mode string .. */
|
2001-12-06 23:10:41 +00:00
|
|
|
char *wanted_usermode; /* The usermode we want to use, doesn't include the modes given us by the server (eg. +r) */
|
|
|
|
|
char *userhost; /* /USERHOST <nick> - set when joined to first channel */
|
2001-01-04 08:49:48 +00:00
|
|
|
int channels_formed; /* channels formed in irc network */
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2000-11-23 22:57:59 +00:00
|
|
|
unsigned int whois_found:1; /* Did WHOIS return any entries? */
|
|
|
|
|
unsigned int whowas_found:1; /* Did WHOWAS return any entries? */
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2000-11-23 22:57:59 +00:00
|
|
|
unsigned int emode_known:1; /* Server understands ban exceptions and invite lists */
|
|
|
|
|
unsigned int no_multi_mode:1; /* Server doesn't understand MODE #chan1,#chan2,... */
|
|
|
|
|
unsigned int no_multi_who:1; /* Server doesn't understand WHO #chan1,#chan2,... */
|
|
|
|
|
unsigned int one_endofwho:1; /* /WHO #a,#b,.. replies only with one End of WHO message */
|
2001-12-01 19:44:54 +00:00
|
|
|
unsigned int disable_lag:1; /* Disable lag detection (PING command doesn't exist) */
|
2002-02-10 10:21:46 +00:00
|
|
|
unsigned int nick_collision:1; /* We're just now being killed because of nick collision */
|
2002-10-10 01:55:24 +00:00
|
|
|
unsigned int motd_got:1; /* We've received MOTD */
|
2004-01-20 10:57:57 +00:00
|
|
|
unsigned int isupport_sent:1; /* Server has sent us an isupport reply */
|
2016-09-30 19:30:43 +02:00
|
|
|
unsigned int cap_complete:1; /* We've done the initial CAP negotiation */
|
2017-10-30 17:41:16 +01:00
|
|
|
unsigned int cap_in_multiline:1; /* We're waiting for the multiline response to end */
|
2016-07-12 13:59:46 +02:00
|
|
|
unsigned int sasl_success:1; /* Did we authenticate successfully ? */
|
2000-04-26 08:03:38 +00:00
|
|
|
|
|
|
|
|
int max_kicks_in_cmd; /* max. number of people to kick with one /KICK command */
|
|
|
|
|
int max_modes_in_cmd; /* max. number of mode changes in one /MODE command */
|
|
|
|
|
int max_whois_in_cmd; /* max. number of nicks in one /WHOIS command */
|
|
|
|
|
int max_msgs_in_cmd; /* max. number of targets in one /MSG */
|
|
|
|
|
|
2017-10-21 10:21:03 +02:00
|
|
|
GHashTable *cap_supported; /* A list of caps supported by the server */
|
2015-02-12 00:07:22 +01:00
|
|
|
GSList *cap_active; /* A list of caps active for this session */
|
|
|
|
|
GSList *cap_queue; /* A list of caps to request on connection */
|
|
|
|
|
|
2016-07-03 22:02:02 -07:00
|
|
|
GString *sasl_buffer; /* Buffer used to reassemble a fragmented SASL payload */
|
|
|
|
|
guint sasl_timeout; /* Holds the source id of the running timeout */
|
2015-02-12 00:07:22 +01:00
|
|
|
|
2000-04-26 08:03:38 +00:00
|
|
|
/* Command sending queue */
|
2008-11-29 19:38:00 +00:00
|
|
|
int cmdcount; /* number of commands in `cmdqueue'. Can be more than
|
|
|
|
|
there actually is, to make flood control remember
|
|
|
|
|
how many messages can be sent before starting the
|
|
|
|
|
flood control */
|
2001-11-11 20:20:43 +00:00
|
|
|
GSList *cmdqueue; /* command, redirection, ... */
|
2000-11-30 23:13:15 +00:00
|
|
|
GTimeVal wait_cmd; /* don't send anything to server before this */
|
2000-04-26 08:03:38 +00:00
|
|
|
GTimeVal last_cmd; /* last time command was sent to server */
|
|
|
|
|
|
|
|
|
|
int max_cmds_at_once; /* How many messages can be sent immediately before timeouting starts */
|
|
|
|
|
int cmd_queue_speed; /* Timeout between sending commands */
|
2000-12-09 19:12:49 +00:00
|
|
|
int max_query_chans; /* when syncing, max. number of channels to
|
|
|
|
|
put in one MODE/WHO command */
|
2000-04-26 08:03:38 +00:00
|
|
|
|
|
|
|
|
GSList *idles; /* Idle queue - send these commands to server
|
|
|
|
|
if there's nothing else to do */
|
|
|
|
|
|
|
|
|
|
GSList *ctcpqueue; /* CTCP flood protection - list of tags in idle queue */
|
|
|
|
|
|
|
|
|
|
/* /knockout ban list */
|
|
|
|
|
GSList *knockoutlist;
|
|
|
|
|
|
|
|
|
|
GHashTable *splits; /* For keeping track of netsplits */
|
2000-05-04 10:32:42 +00:00
|
|
|
GSList *split_servers; /* Servers that are currently in split */
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2000-05-15 08:25:45 +00:00
|
|
|
GSList *rejoin_channels; /* try to join to these channels after a while -
|
|
|
|
|
channels go here if they're "temporarily unavailable"
|
|
|
|
|
because of netsplits */
|
2000-08-26 15:39:44 +00:00
|
|
|
void *chanqueries;
|
2004-01-20 10:57:57 +00:00
|
|
|
|
|
|
|
|
GHashTable *isupport;
|
|
|
|
|
struct modes_type modes[256]; /* Stores the modes sent by a server in an isupport reply */
|
|
|
|
|
char prefix[256];
|
|
|
|
|
|
|
|
|
|
int (*nick_comp_func)(const char *, const char *); /* Function for comparing nicknames on this server */
|
2001-11-02 01:05:14 +00:00
|
|
|
};
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2002-05-20 04:12:12 +00:00
|
|
|
SERVER_REC *irc_server_init_connect(SERVER_CONNECT_REC *conn);
|
|
|
|
|
void irc_server_connect(SERVER_REC *server);
|
2000-04-26 08:03:38 +00:00
|
|
|
|
2001-08-14 13:19:06 +00:00
|
|
|
/* Purge server output, either all or for specified target */
|
|
|
|
|
void irc_server_purge_output(IRC_SERVER_REC *server, const char *target);
|
|
|
|
|
|
2000-04-26 08:03:38 +00:00
|
|
|
/* Return a string of all channels (and keys, if any have them) in server,
|
|
|
|
|
like "#a,#b,#c,#d x,b_chan_key,x,x" or just "#e,#f,#g" */
|
|
|
|
|
char *irc_server_get_channels(IRC_SERVER_REC *server);
|
|
|
|
|
|
2002-03-11 03:11:18 +00:00
|
|
|
/* INTERNAL: */
|
2014-06-17 18:17:28 +02:00
|
|
|
void irc_server_send_action(IRC_SERVER_REC *server, const char *target,
|
|
|
|
|
const char *data);
|
|
|
|
|
char **irc_server_split_action(IRC_SERVER_REC *server, const char *target,
|
|
|
|
|
const char *data);
|
2008-11-12 20:31:41 +00:00
|
|
|
void irc_server_send_away(IRC_SERVER_REC *server, const char *reason);
|
2002-03-11 03:11:18 +00:00
|
|
|
void irc_server_send_data(IRC_SERVER_REC *server, const char *data, int len);
|
2005-11-24 18:17:57 +00:00
|
|
|
void irc_server_init_isupport(IRC_SERVER_REC *server);
|
2002-03-11 03:11:18 +00:00
|
|
|
|
2009-02-28 18:15:14 +00:00
|
|
|
void irc_servers_start_cmd_timeout(void);
|
|
|
|
|
|
2000-04-26 08:03:38 +00:00
|
|
|
void irc_servers_init(void);
|
|
|
|
|
void irc_servers_deinit(void);
|
|
|
|
|
|
|
|
|
|
#endif
|