[srvx-commits] CVS: services/src conf.c,1.29,1.30 conf.h,1.15,1.16 hash.c,1.163,1.164 hash.h,1.90,1.
Brought to you by:
entrope
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24874/src
Modified Files:
conf.c conf.h hash.c hash.h modcmd.c nickserv.c
proto-bahamut.c proto-common.c proto-p10.c
Log Message:
remove conf_server_* functions
send burst "progressively" (send channels as we get them from our uplink) instead of in one huge batch
remove N2K_NICKLEN constant
Index: conf.c
===================================================================
RCS file: /cvsroot/srvx/services/src/conf.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** conf.c 11 Aug 2002 03:26:16 -0000 1.29
--- conf.c 23 Aug 2002 04:49:38 -0000 1.30
***************
*** 23,27 ****
static dict_t conf_db;
- static dict_t conf_server;
static conf_reload_func *reload_funcs;
static int num_rfs, size_rfs;
--- 23,26 ----
***************
*** 52,59 ****
goto fail;
}
- if (!(conf_server = database_get_data(conf_db, "server", RECDB_OBJECT))) {
- log(MAIN_LOG, LOG_ERROR, "No server section found in config file.\n");
- goto fail;
- }
if (!reload_funcs) {
size_rfs = 5;
--- 51,54 ----
***************
*** 96,131 ****
{
return dict_foreach(conf_db, it, extra);
- }
-
- const char *
- conf_network_name(void) {
- return database_get_data(conf_server, "network", RECDB_QSTRING);
- }
-
- const char *
- conf_server_name(void) {
- return database_get_data(conf_server, "hostname", RECDB_QSTRING);
- }
-
- const char *
- conf_server_desc(void) {
- return database_get_data(conf_server, "description", RECDB_QSTRING);
- }
-
- int
- conf_server_num(void) {
- const char *text = database_get_data(conf_server, "numeric", RECDB_QSTRING);
- return text ? atoi(text) : -1;
- }
-
- int
- conf_server_ping_freq(void) {
- const char *text = database_get_data(conf_server, "ping_freq", RECDB_QSTRING);
- return text ? (signed)ParseInterval(text) : -1;
- }
-
- int
- conf_server_ping_timeout(void) {
- const char *text = database_get_data(conf_server, "ping_timeout", RECDB_QSTRING);
- return text ? (signed)ParseInterval(text) : -1;
}
--- 91,93 ----
Index: conf.h
===================================================================
RCS file: /cvsroot/srvx/services/src/conf.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** conf.h 30 Jul 2002 02:15:11 -0000 1.15
--- conf.h 23 Aug 2002 04:49:38 -0000 1.16
***************
*** 27,37 ****
void conf_close(void);
- const char *conf_network_name(void);
- const char *conf_server_name(void);
- const char *conf_server_desc(void);
- int conf_server_num(void);
- int conf_server_ping_freq(void);
- int conf_server_ping_timeout(void);
-
typedef void (*conf_reload_func)(void);
void conf_register_reload(conf_reload_func crf);
--- 27,30 ----
Index: hash.c
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -C2 -r1.163 -r1.164
*** hash.c 14 Aug 2002 01:36:11 -0000 1.163
--- hash.c 23 Aug 2002 04:49:38 -0000 1.164
***************
*** 24,29 ****
#include "log.h"
- extern time_t boot_time;
-
struct server *self;
dict_t channels;
--- 24,27 ----
***************
*** 33,37 ****
time_t max_clients_time;
struct userList curr_opers;
- unsigned int nicklen = NICKLEN, force_n2k;
static void hash_cleanup(void);
--- 31,34 ----
***************
*** 39,44 ****
void init_structs(void)
{
- char numer[COMBO_NUMERIC_LEN+1];
-
channels = dict_new();
clients = dict_new();
--- 36,39 ----
***************
*** 46,64 ****
userList_init(&curr_opers);
reg_exit_func(hash_cleanup);
-
- /* Use a three-digit numeric if we can, else use five. */
- if ((conf_server_num() < 64) && !force_n2k) {
- inttobase64(numer, conf_server_num(), 1);
- numer[1] = ']';
- numer[2] = ']';
- numer[3] = 0;
- } else {
- inttobase64(numer, conf_server_num(), 2);
- numer[2] = ']';
- numer[3] = ']';
- numer[4] = ']';
- numer[5] = 0;
- }
- self = AddServer(NULL, conf_server_name(), 0, boot_time, now, numer, conf_server_desc());
}
--- 41,44 ----
***************
*** 311,314 ****
--- 291,353 ----
int rel_age;
+ static void
+ wipeout_channel(struct chanNode *cNode, time_t new_time, const char *modes, const char *key, int limit) {
+ struct userList reops;
+ unsigned int orig_limit;
+ chan_mode_t orig_modes;
+ char orig_key[KEYLEN+1];
+ unsigned int nn;
+
+ /* remember the old modes, and update them with the new */
+ orig_modes = cNode->modes;
+ orig_limit = cNode->limit;
+ strcpy(orig_key, cNode->key);
+ cNode->modes = 0;
+ mod_chanmode(cNode, NULL, modes, key, limit);
+ cNode->timestamp = new_time;
+
+ /* remove our old ban list, replace it with the new one */
+ for (nn=0; nn<cNode->banlist.used; nn++) {
+ free(cNode->banlist.list[nn]);
+ }
+ cNode->banlist.used = 0;
+
+ /* deop anybody in the channel now, but re-op services */
+ userList_init(&reops);
+ for (nn=0; nn<cNode->members.used; nn++) {
+ struct modeNode *mn = cNode->members.list[nn];
+ if (mn->modes & MODE_CHANOP) {
+ if (IsService(mn->user) && IsLocal(mn->user)) userList_append(&reops, mn->user);
+ mn->modes &= ~MODE_CHANOP;
+ }
+ }
+ if (reops.used) {
+ nn = 0;
+ /* Add ops back. */
+ AddChannelOp(reops.used, reops.list, cNode, reops.list[0], 1);
+ /* Turn on any mode bits that got turned off during the merge. */
+ if ((orig_modes &= ~cNode->modes)) {
+ char modebuf[MAXLEN];
+ if (orig_modes & MODE_NOPRIVMSGS) modebuf[nn++] = 'n';
+ if (orig_modes & MODE_TOPICLIMIT) modebuf[nn++] = 't';
+ if (orig_modes & MODE_SECRET) modebuf[nn++] = 's';
+ if (orig_modes & MODE_PRIVATE) modebuf[nn++] = 'p';
+ if (orig_modes & MODE_INVITEONLY) modebuf[nn++] = 'i';
+ if (orig_modes & MODE_MODERATED) modebuf[nn++] = 'm';
+ if (orig_modes & MODE_DELAYJOINS) modebuf[nn++] = 'D';
+ if (orig_modes & (MODE_LIMIT | MODE_KEY)) {
+ if (orig_modes & MODE_LIMIT) modebuf[nn++] = 'l';
+ if (orig_modes & MODE_KEY) modebuf[nn++] = 'k';
+ if (orig_modes & MODE_LIMIT) nn += sprintf(modebuf+nn, " %u", orig_limit);
+ if (orig_modes & MODE_KEY) nn += sprintf(modebuf+nn, " %s", orig_key);
+ }
+ modebuf[nn] = 0;
+ mod_chanmode(cNode, NULL, modebuf, 0, 0);
+ irc_mode(reops.list[0], cNode, modebuf);
+ }
+ }
+ userList_clean(&reops);
+ }
+
struct chanNode *
AddChannel(const char *name, time_t time_, const char *modes, const char *key, int limit, char *banlist)
***************
*** 328,393 ****
modeList_init(&cNode->members);
dict_insert(channels, cNode->name, cNode);
- }
-
- if ((cNode->timestamp == 0) || (cNode->timestamp > time_)) {
- struct userList reops;
- unsigned int orig_limit;
- chan_mode_t orig_modes;
- char orig_key[KEYLEN+1];
-
- /* remember the old modes, and update them with the new */
- orig_modes = cNode->modes;
- orig_limit = cNode->limit;
- strcpy(orig_key, cNode->key);
- cNode->modes = 0;
- mod_chanmode(cNode, NULL, modes, key, limit);
cNode->timestamp = time_;
rel_age = 1;
-
- /* remove our old ban list, replace it with the new one */
- for (nn=0; nn<cNode->banlist.used; nn++) {
- free(cNode->banlist.list[nn]);
- }
- cNode->banlist.used = 0;
-
- /* deop anybody in the channel now, but re-op services */
- userList_init(&reops);
- for (nn=0; nn<cNode->members.used; nn++) {
- struct modeNode *mn = cNode->members.list[nn];
- if (mn->modes & MODE_CHANOP) {
- if (IsService(mn->user) && IsLocal(mn->user)) userList_append(&reops, mn->user);
- mn->modes &= ~MODE_CHANOP;
- }
- }
- if (reops.used) {
- nn = 0;
- /* Add ops back. */
- AddChannelOp(reops.used, reops.list, cNode, reops.list[0], 1);
- /* Turn on any mode bits that got turned off during the merge. */
- if ((orig_modes &= ~cNode->modes)) {
- char modebuf[MAXLEN];
- if (orig_modes & MODE_NOPRIVMSGS) modebuf[nn++] = 'n';
- if (orig_modes & MODE_TOPICLIMIT) modebuf[nn++] = 't';
- if (orig_modes & MODE_SECRET) modebuf[nn++] = 's';
- if (orig_modes & MODE_PRIVATE) modebuf[nn++] = 'p';
- if (orig_modes & MODE_INVITEONLY) modebuf[nn++] = 'i';
- if (orig_modes & MODE_MODERATED) modebuf[nn++] = 'm';
- if (orig_modes & MODE_DELAYJOINS) modebuf[nn++] = 'D';
- if (orig_modes & (MODE_LIMIT | MODE_KEY)) {
- if (orig_modes & MODE_LIMIT) modebuf[nn++] = 'l';
- if (orig_modes & MODE_KEY) modebuf[nn++] = 'k';
- if (orig_modes & MODE_LIMIT) nn += sprintf(modebuf+nn, " %u", orig_limit);
- if (orig_modes & MODE_KEY) nn += sprintf(modebuf+nn, " %s", orig_key);
- }
- modebuf[nn] = 0;
- mod_chanmode(cNode, NULL, modebuf, 0, 0);
- irc_mode(reops.list[0], cNode, modebuf);
- }
- }
- userList_clean(&reops);
- } else if (cNode->timestamp == time_) {
- rel_age = 0;
} else {
! rel_age = -1;
}
--- 367,381 ----
modeList_init(&cNode->members);
dict_insert(channels, cNode->name, cNode);
cNode->timestamp = time_;
rel_age = 1;
} else {
! if (cNode->timestamp > time_) {
! wipeout_channel(cNode, time_, modes, key, limit);
! rel_age = 1;
! } else if (cNode->timestamp == time_) {
! rel_age = 0;
! } else {
! rel_age = -1;
! }
}
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -r1.90 -r1.91
*** hash.h 21 Aug 2002 05:42:44 -0000 1.90
--- hash.h 23 Aug 2002 04:49:38 -0000 1.91
***************
*** 68,72 ****
#define NICKLEN 30
- #define N2K_NICKLEN 30
#define USERLEN 10
#define HOSTLEN 63
--- 68,71 ----
***************
*** 75,82 ****
#define TOPICLEN 250
#define CHANNELLEN 200
- extern unsigned int nicklen, force_n2k;
- /* NICKLEN is the maximum we allow; nicklen is the maximum we think
- * the server allows. force_n2k is set if we force using five-digit
- * numerics for users. */
#define MAXMODEPARAMS 6
--- 74,77 ----
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** modcmd.c 20 Aug 2002 01:04:20 -0000 1.20
--- modcmd.c 23 Aug 2002 04:49:39 -0000 1.21
***************
*** 480,483 ****
--- 480,485 ----
if ((cmd->flags & MODCMD_REQUIRE_CHANUSER)
&& (uData->access > ulOwner)
+ && (!(uData = _GetChannelUser(channel->channel_info, user->handle_info, 0, 0))
+ || uData->access < cmd->min_channel_access)
&& !(cmd->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING))) {
return 2;
***************
*** 1413,1417 ****
{ "Global", { "Global", NULL } },
{ "NickServ", { "NickServ", NULL } },
! { "OpServ", { "modcmd", "OpServ", "sendmail", "saxdb", NULL } },
{ NULL, { NULL } }
};
--- 1415,1419 ----
{ "Global", { "Global", NULL } },
{ "NickServ", { "NickServ", NULL } },
! { "OpServ", { "OpServ", "modcmd", "sendmail", "saxdb", "proxycheck", NULL } },
{ NULL, { NULL } }
};
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -C2 -r1.199 -r1.200
*** nickserv.c 21 Aug 2002 05:42:45 -0000 1.199
--- nickserv.c 23 Aug 2002 04:49:39 -0000 1.200
***************
*** 167,170 ****
--- 167,171 ----
#define NSMSG_NICK_IN_USE "Nick $b%s$b is already in use."
#define NSMSG_REGNICK_SUCCESS "Nick $b%s$b has been registered to you."
+ #define NSMSG_OREGNICK_SUCCESS "Nick $b%s$b has been registered to account $b%s$b."
#define NSMSG_PASS_SUCCESS "Password changed."
#define NSMSG_MASK_INVALID "$b%s$b is an invalid hostmask."
***************
*** 207,211 ****
#define NSMSG_BAD_EMAIL_ADDR "Please use a well-formed email address."
#define NSMSG_FAIL_RENAME "Account $b%s$b not renamed to $b%s$b because it is in use by a network services, or contains invalid characters."
- #define NSMSG_NO_DIGIT "An account or nickname cannot have a digit as the first character, please try again."
#define NSMSG_SEARCH_MATCH "Match: %s"
#define NSMSG_INVALID_ACTION "%s is an invalid search action."
--- 208,211 ----
***************
*** 278,281 ****
--- 278,282 ----
unsigned long handles_per_email;
char *default_hostmask;
+ char *network_name;
regex_t valid_handle_regex;
regex_t valid_nick_regex;
***************
*** 851,856 ****
inttobase64(cookie->cookie+5, rand(), 5);
! netname = conf_network_name();
! if (!netname) netname = "some IRC network";
subject[0] = 0;
--- 852,856 ----
inttobase64(cookie->cookie+5, rand(), 5);
! netname = nickserv_conf.network_name;
subject[0] = 0;
***************
*** 1272,1280 ****
return 0;
}
- /* just to be consistant with IRC */
- if (isdigit(argv[2][0])) {
- nickserv_notice(user, NSMSG_NO_DIGIT);
- return 0;
- }
if (get_handle_info(argv[2])) {
nickserv_notice(user, NSMSG_HANDLE_EXISTS, argv[2]);
--- 1272,1275 ----
***************
*** 1539,1589 ****
}
! static NICKSERV_FUNC(cmd_regnick)
! {
! const unsigned char *nick;
struct nick_info *ni;
! struct userNode *target;
unsigned n;
/* count their nicks, see if it's too many */
for (n=0,ni=user->handle_info->nicks; ni; n++,ni=ni->next) ;
if (n >= nickserv_conf.nicks_per_handle) {
! nickserv_notice(user, NSMSG_TOO_MANY_NICKS);
! return 0;
! }
! if (is_valid_oper(user, 0, 1)) {
! nick = (argc < 2) ? user->nick : (char*)argv[1];
! if (!is_registerable_nick(nick)) {
! nickserv_notice(user, NSMSG_BAD_NICK, nick);
! return 0;
! }
! if (strlen(nick) > NICKLEN) {
! nickserv_notice(user, NSMSG_NICK_TOO_LONG);
! return 0;
! }
! target = GetUserH(nick);
! if (target && target != user) {
! nickserv_notice(user, NSMSG_NICK_IN_USE, nick);
! return 0;
! }
! } else {
! nick = user->nick;
! if (!is_registerable_nick(nick)) {
! nickserv_notice(user, NSMSG_BAD_NICK, nick);
! return 0;
! }
! /* just to be consistant with IRC */
! if (isdigit(nick[0])) {
! nickserv_notice(user, NSMSG_NO_DIGIT);
! return 0;
! }
}
! ni = dict_find(nickserv_nick_dict, nick, NULL);
if (ni) {
! nickserv_notice(user, NSMSG_NICK_EXISTS, nick);
return 0;
}
! register_nick(nick, user->handle_info);
! nickserv_notice(user, NSMSG_REGNICK_SUCCESS, nick);
return 1;
}
--- 1534,1581 ----
}
! static NICKSERV_FUNC(cmd_oregnick) {
! const char *nick;
! struct handle_info *target;
struct nick_info *ni;
!
! NICKSERV_MIN_PARMS(3);
! if (!(target = nickserv_get_handle_info(user, argv[1]))) return 0;
! nick = argv[2];
! if (!is_registerable_nick(nick)) {
! nickserv_notice(user, NSMSG_BAD_NICK, nick);
! return 0;
! }
! ni = dict_find(nickserv_nick_dict, nick, NULL);
! if (ni) {
! nickserv_notice(user, NSMSG_NICK_EXISTS, nick);
! return 0;
! }
! register_nick(nick, target);
! nickserv_notice(user, NSMSG_OREGNICK_SUCCESS, nick, target->handle);
! return 1;
! }
!
! static NICKSERV_FUNC(cmd_regnick) {
unsigned n;
+ struct nick_info *ni;
+ (void)argv;
+ if (!is_registerable_nick(user->nick)) {
+ nickserv_notice(user, NSMSG_BAD_NICK, user->nick);
+ return 0;
+ }
/* count their nicks, see if it's too many */
for (n=0,ni=user->handle_info->nicks; ni; n++,ni=ni->next) ;
if (n >= nickserv_conf.nicks_per_handle) {
! nickserv_notice(user, NSMSG_TOO_MANY_NICKS);
! return 0;
}
! ni = dict_find(nickserv_nick_dict, user->nick, NULL);
if (ni) {
! nickserv_notice(user, NSMSG_NICK_EXISTS, user->nick);
return 0;
}
! register_nick(user->nick, user->handle_info);
! nickserv_notice(user, NSMSG_REGNICK_SUCCESS, user->nick);
return 1;
}
***************
*** 3008,3011 ****
--- 3000,3005 ----
str = database_get_data(conf_node, KEY_ACCOUNTS_PER_EMAIL, RECDB_QSTRING);
nickserv_conf.handles_per_email = str ? strtoul(str, NULL, 0) : 1;
+ str = conf_get_data("server/network", RECDB_QSTRING);
+ nickserv_conf.network_name = str ? strdup(str) : strdup("some IRC network");
if (!nickserv_conf.auth_policer_params) {
nickserv_conf.auth_policer_params = policer_params_new();
***************
*** 3178,3182 ****
/* nick management commands */
nickserv_define_func("REGNICK", cmd_regnick, -1, 1, 0);
! nickserv_define_func("OREGNICK", cmd_regnick, 0, 1, 0);
nickserv_define_func("UNREGNICK", cmd_unregnick, -1, 1, 0);
nickserv_define_func("OUNREGNICK", cmd_ounregnick, 0, 1, 0);
--- 3172,3176 ----
/* nick management commands */
nickserv_define_func("REGNICK", cmd_regnick, -1, 1, 0);
! nickserv_define_func("OREGNICK", cmd_oregnick, 0, 1, 0);
nickserv_define_func("UNREGNICK", cmd_unregnick, -1, 1, 0);
nickserv_define_func("OUNREGNICK", cmd_ounregnick, 0, 1, 0);
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** proto-bahamut.c 21 Aug 2002 05:42:45 -0000 1.20
--- proto-bahamut.c 23 Aug 2002 04:49:39 -0000 1.21
***************
*** 891,895 ****
void init_parse(void) {
! int tmp;
tmp = conf_server_ping_freq();
--- 891,907 ----
void init_parse(void) {
! const char *str, *desc;
!
! str = conf_get_data("server/ping_freq", RECDB_QSTRING);
! ping_freq = str ? ParseInterval(str) : 120;
! str = conf_get_data("server/ping_timeout", RECDB_QSTRING);
! ping_timeout = str ? ParseInterval(str) : 30;
! str = conf_get_data("server/hostname", RECDB_QSTRING);
! desc = conf_get_data("server/description", RECDB_QSTRING);
! if (!str || !desc) {
! log(MAIN_LOG, LOG_ERROR, "No server/hostname entry in config file.\n");
! exit(1);
! }
! self = AddServer(NULL, str, 0, boot_time, now, NULL, desc);
tmp = conf_server_ping_freq();
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** proto-common.c 20 Aug 2002 03:24:56 -0000 1.11
--- proto-common.c 23 Aug 2002 04:49:39 -0000 1.12
***************
*** 30,38 ****
struct userList dead_users;
struct io_fd *socket_io_fd;
static char replay_line[MAXLEN+80];
! static int ping_freq = 120;
! static int ping_timeout = 30;
static int replay_connected;
extern struct cManagerNode cManager;
--- 30,40 ----
struct userList dead_users;
struct io_fd *socket_io_fd;
+ int force_n2k;
static char replay_line[MAXLEN+80];
! static int ping_freq;
! static int ping_timeout;
static int replay_connected;
+ static unsigned int nicklen = NICKLEN; /* how long do we think servers allow nicks to be? */
extern struct cManagerNode cManager;
***************
*** 46,49 ****
--- 48,53 ----
extern del_user_func_t *duf_list;
extern unsigned int duf_size, duf_used;
+ extern time_t boot_time;
+
void received_ping(void);
***************
*** 356,360 ****
switch (argv[1][0]) {
case 'u': {
- extern time_t boot_time;
unsigned int uptime = now - boot_time;
irc_numeric(un, RPL_STATSUPTIME, ":Server Up %d days %d:%02d:%02d",
--- 360,363 ----
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** proto-p10.c 20 Aug 2002 03:24:56 -0000 1.27
--- proto-p10.c 23 Aug 2002 04:49:39 -0000 1.28
***************
*** 185,189 ****
only checked against the full command list.
*/
! #ifdef ENABLE_TOKENS
#define TYPE(NAME) TOK_ ## NAME
#else /* !ENABLE_TOKENS */
--- 185,189 ----
only checked against the full command list.
*/
! #if defined(ENABLE_TOKENS)
#define TYPE(NAME) TOK_ ## NAME
#else /* !ENABLE_TOKENS */
***************
*** 277,285 ****
static struct server *servers_num[64*64];
static privmsg_func_t *privmsg_funcs;
! static unsigned int num_privmsg_funcs = 0;
static privmsg_func_t *notice_funcs;
! static unsigned int num_notice_funcs = 0;
static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip);
/* Numerics can be XYY, XYYY, or XXYYY; with X's identifying the
--- 277,287 ----
static struct server *servers_num[64*64];
static privmsg_func_t *privmsg_funcs;
! static unsigned int num_privmsg_funcs;
static privmsg_func_t *notice_funcs;
! static unsigned int num_notice_funcs;
! static dict_iterator_t chan_burst_iter;
static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip);
+ static void send_channels(struct chanNode *last);
/* Numerics can be XYY, XYYY, or XXYYY; with X's identifying the
***************
*** 515,519 ****
}
! void
irc_burst(struct chanNode *chan)
{
--- 517,521 ----
}
! static void
irc_burst(struct chanNode *chan)
{
***************
*** 581,584 ****
--- 583,595 ----
}
+ static void
+ send_channels(struct chanNode *last) {
+ for (;
+ chan_burst_iter && (!last || (irccasecmp(iter_key(chan_burst_iter), last->name) <= 0));
+ chan_burst_iter = iter_next(chan_burst_iter)) {
+ irc_burst(iter_data(chan_burst_iter));
+ }
+ }
+
void
irc_quit(struct userNode *user, const char *message)
***************
*** 636,640 ****
who->numeric, what->name, what->timestamp);
} else {
! putsock("%s " P10_JOIN " %s", who->numeric, what->name);
}
}
--- 647,651 ----
who->numeric, what->name, what->timestamp);
} else {
! putsock("%s " P10_JOIN " %s %lu", who->numeric, what->name, what->timestamp);
}
}
***************
*** 725,735 ****
srv = self->uplink = AddServer(self, argv[1], atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), argv[6], argv[argc-1]);
if (!srv) return 0;
srv->self_burst = argv[5][0] == 'J';
srv->burst = 1;
! if (argv[7][0] == '+') {
! /* Looks like an Undernet-derived server. */
! force_n2k = 1;
! change_nicklen(N2K_NICKLEN);
! } /* else ircu-Universal. This is what we assume, so we need no special action. */
send_burst();
}
--- 736,745 ----
srv = self->uplink = AddServer(self, argv[1], atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), argv[6], argv[argc-1]);
if (!srv) return 0;
+ chan_burst_iter = dict_first(channels);
srv->self_burst = argv[5][0] == 'J';
srv->burst = 1;
! if ((argv[7][0] == '+') && !force_n2k) {
! log(MAIN_LOG, LOG_WARNING, "Got Undernet-style SERVER message but \"force_n2k\" not on.");
! }
send_burst();
}
***************
*** 738,742 ****
if (srv->boot <= PREHISTORY) {
/* Server from the mists of time.. */
! if(srv->hops == 1) {
log(MAIN_LOG, LOG_ERROR, "Server %s claims to have booted at time "FMT_TIME_T". This is absurd.\n", srv->name, srv->boot);
}
--- 748,752 ----
if (srv->boot <= PREHISTORY) {
/* Server from the mists of time.. */
! if (srv->hops == 1) {
log(MAIN_LOG, LOG_ERROR, "Server %s claims to have booted at time "FMT_TIME_T". This is absurd.\n", srv->name, srv->boot);
}
***************
*** 770,773 ****
--- 780,785 ----
if (sender == self->uplink) {
cManager.uplink->state = CONNECTED;
+ send_channels(NULL);
+ irc_eob();
irc_eob_ack();
}
***************
*** 883,891 ****
/* The user is +r and has an ACCOUNT stamp in argv[7]. */
user = AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[9], argv[10], (time_t)atoi(argv[3]), argv[8]);
!
! if(user)
! {
! call_account_func(user, argv[7]);
! }
} else {
AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
--- 895,899 ----
/* The user is +r and has an ACCOUNT stamp in argv[7]. */
user = AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[9], argv[10], (time_t)atoi(argv[3]), argv[8]);
! if (user) call_account_func(user, argv[7]);
} else {
AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
***************
*** 950,954 ****
--- 958,967 ----
}
+ if (self->burst && (cNode = GetChannel(argv[1]))) {
+ cNode->timestamp = atoi(argv[2]);
+ send_channels(cNode);
+ }
cNode = AddChannel(argv[1], (time_t)atoi(argv[2]), modes, key, limit, banlist);
+
/* Burst channel members in now. */
for (user = members, sep = *members, mode = 0; sep; user = end) {
***************
*** 1282,1291 ****
init_parse(void)
{
! int tmp;
!
! tmp = conf_server_ping_freq();
! if (tmp != -1) ping_freq = tmp;
! tmp = conf_server_ping_timeout();
! if (tmp != -1) ping_timeout = tmp;
irc_func_dict = dict_new();
--- 1295,1335 ----
init_parse(void)
{
! const char *str, *desc;
! int numnick;
! char numer[COMBO_NUMERIC_LEN+1];
!
! /* read config items */
! str = conf_get_data("server/ping_freq", RECDB_QSTRING);
! ping_freq = str ? ParseInterval(str) : 120;
! str = conf_get_data("server/ping_timeout", RECDB_QSTRING);
! ping_timeout = str ? ParseInterval(str) : 30;
! str = conf_get_data("server/force_n2k", RECDB_QSTRING);
! force_n2k = str ? enabled_string(str) : 1;
! str = conf_get_data("server/numeric", RECDB_QSTRING);
! if (!str) {
! log(MAIN_LOG, LOG_ERROR, "No server/numeric entry in config file.\n");
! exit(1);
! }
! numnick = atoi(str);
! if ((numnick < 64) && !force_n2k) {
! /* Use a three-digit numeric if we can, else use five. */
! inttobase64(numer, numnick, 1);
! numer[1] = ']';
! numer[2] = ']';
! numer[3] = 0;
! } else {
! inttobase64(numer, numnick, 2);
! numer[2] = ']';
! numer[3] = ']';
! numer[4] = ']';
! numer[5] = 0;
! }
! str = conf_get_data("server/hostname", RECDB_QSTRING);
! desc = conf_get_data("server/description", RECDB_QSTRING);
! if (!str || !desc) {
! log(MAIN_LOG, LOG_ERROR, "No server/hostname entry in config file.\n");
! exit(1);
! }
! self = AddServer(NULL, str, 0, boot_time, now, numer, desc);
irc_func_dict = dict_new();
***************
*** 2236,2242 ****
{
unsigned int i, hop, max_hop=1;
- dict_iterator_t it;
! /* burst servers, closest first (but self is sent during auth) */
for (i=0; i<ArrayLength(servers_num); i++) {
if (servers_num[i] && servers_num[i]->hops > max_hop) {
--- 2280,2285 ----
{
unsigned int i, hop, max_hop=1;
! /* burst (juped) servers, closest first (except self, which is sent already) */
for (i=0; i<ArrayLength(servers_num); i++) {
if (servers_num[i] && servers_num[i]->hops > max_hop) {
***************
*** 2257,2266 ****
if (self->users[i]) irc_user(self->users[i]);
}
-
- /* burst channels */
- for (it=dict_first(channels); it; it=iter_next(it)) {
- irc_burst(iter_data(it));
- }
-
- irc_eob();
}
--- 2300,2302 ----
|