/* All variables are 0 by default */
memset(cli_user(cptr), 0, sizeof(struct User));
-#ifdef DEBUGMODE
++userCount;
-#endif
cli_user(cptr)->refcnt = 1;
}
return cli_user(cptr);
assert(0 == user->channel);
MyFree(user);
-#ifdef DEBUGMODE
--userCount;
-#endif
}
}
{
last_too_many1 = CurrentTime;
sendto_opmask_butone(0, SNO_TOOMANY, "Too many connections in "
- "class %i for %s.", get_client_class(sptr),
+ "class %s for %s.", get_client_class(sptr),
get_client_name(sptr, SHOW_IP));
}
++ServerStats->is_ref;
return exit_client(cptr, sptr, &me, "USER: Bogus userid.");
if (!EmptyString(aconf->passwd)
- && !(IsDigit(*aconf->passwd) && !aconf->passwd[1])
&& strcmp(cli_passwd(sptr), aconf->passwd))
{
ServerStats->is_ref++;
return exit_client(cptr, sptr, &me, "USER: Bad username");
}
Count_unknownbecomesclient(sptr, UserStats);
- }
- else {
- ircd_strncpy(user->username, username, USERLEN);
- Count_newremoteclient(UserStats, user->server);
- }
- SetUser(sptr);
- if (IsInvisible(sptr))
- ++UserStats.inv_clients;
- if (IsOper(sptr))
- ++UserStats.opers;
-
- if (MyConnect(sptr)) {
+ SetUser(sptr);
cli_handler(sptr) = CLIENT_HANDLER;
- release_dns_reply(sptr);
SetLocalNumNick(sptr);
send_reply(sptr,
RPL_WELCOME,
*/
send_reply(sptr, RPL_YOURHOST, cli_name(&me), version);
send_reply(sptr, RPL_CREATED, creation);
- send_reply(sptr, RPL_MYINFO, cli_name(&me), infousermodes, infochanmodes,
- infochanmodeswithparams, version);
+ send_reply(sptr, RPL_MYINFO, cli_name(&me), version, infousermodes,
+ infochanmodes, infochanmodeswithparams);
send_supported(sptr);
m_lusers(sptr, sptr, 1, parv);
update_load();
motd_signon(sptr);
-/* nextping = CurrentTime; */
if (cli_snomask(sptr) & SNO_NOISY)
set_snomask(sptr, cli_snomask(sptr) & SNO_NOISY, SNO_ADD);
if (feature_bool(FEAT_CONNEXIT_NOTICES))
/*
* Set user's initial modes
*/
- parv[0] = (char*)nick;
- parv[1] = (char*)nick;
- parv[2] = (char*)client_get_default_umode(sptr);
- parv[3] = NULL; /* needed in case of +s */
- set_user_mode(sptr, sptr, 3, parv);
- ClearHiddenHost(sptr); /* just in case somebody stuck +x in there */
+ tmpstr = (char*)client_get_default_umode(sptr);
+ if (tmpstr) for (; *tmpstr; ++tmpstr) {
+ switch (*tmpstr) {
+ case 's':
+ if (!feature_bool(FEAT_HIS_SNOTICES_OPER_ONLY)) {
+ SetServNotice(sptr);
+ set_snomask(sptr, SNO_DEFAULT, SNO_SET);
+ }
+ break;
+ case 'w':
+ if (!feature_bool(FEAT_WALLOPS_OPER_ONLY))
+ SetWallops(sptr);
+ break;
+ case 'i':
+ SetInvisible(sptr);
+ break;
+ case 'd':
+ SetDeaf(sptr);
+ break;
+ case 'g':
+ if (!feature_bool(FEAT_HIS_DEBUG_OPER_ONLY))
+ SetDebug(sptr);
+ break;
+ }
+ }
}
- else
- /* if (IsServer(cptr)) */
- {
+ else {
struct Client *acptr;
+ ircd_strncpy(user->username, username, USERLEN);
+ Count_newremoteclient(UserStats, user->server);
+
acptr = user->server;
if (cli_from(acptr) != cli_from(sptr))
{
* FIXME: This can be sped up - its stupid to check it for
* every NICK message in a burst again --Run.
*/
- for (acptr = user->server; acptr != &me; acptr = cli_serv(acptr)->up)
+ for (; acptr != &me; acptr = cli_serv(acptr)->up)
{
if (IsBurst(acptr) || Protocol(acptr) < 10)
break;
sptr, cli_name(&me));
return exit_client(cptr, sptr, &me,"Too many connections from your host -- throttled");
}
+ SetUser(sptr);
}
+
+ if (IsInvisible(sptr))
+ ++UserStats.inv_clients;
+ if (IsOper(sptr))
+ ++UserStats.opers;
+
tmpstr = umode_str(sptr);
/* Send full IP address to IPv6-grokking servers. */
sendcmdto_flag_serv_butone(user->server, CMD_NICK, cptr,
iptobase64(ip_base64, &cli_ip(sptr), sizeof(ip_base64), 0),
NumNick(sptr), cli_info(sptr));
- /* Send server notice mask to client */
- if (MyUser(sptr) && (cli_snomask(sptr) != SNO_DEFAULT) && HasFlag(sptr, FLAG_SERVNOTICE))
- send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
-
+ /* Send user mode to client */
+ if (MyUser(sptr))
+ {
+ static struct Flags flags; /* automatically initialized to zeros */
+ send_umode(cptr, sptr, &flags, ALL_UMODES);
+ if ((cli_snomask(sptr) != SNO_DEFAULT) && HasFlag(sptr, FLAG_SERVNOTICE))
+ send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
+ }
return 0;
}
sendcmdto_channel_butserv_butone(cptr, CMD_JOIN, chan->channel, cptr, 0,
"%H", chan->channel);
if (IsChanOp(chan) && HasVoice(chan))
- sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr, 0,
+ sendcmdto_channel_butserv_butone(&his, CMD_MODE, chan->channel, cptr, 0,
"%H +ov %C %C", chan->channel, cptr,
cptr);
else if (IsChanOp(chan) || HasVoice(chan))
- sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan->channel, cptr, 0,
+ sendcmdto_channel_butserv_butone(&his, CMD_MODE, chan->channel, cptr, 0,
"%H +%c %C", chan->channel, IsChanOp(chan) ? 'o' : 'v', cptr);
}
return 0;
int i;
struct Flags c_flags = cli_flags(cptr);
- if (HasPriv(cptr, PRIV_PROPAGATE))
- FlagSet(&c_flags, FLAG_OPER);
- else
+ if (!HasPriv(cptr, PRIV_PROPAGATE))
FlagClr(&c_flags, FLAG_OPER);
for (i = 0; i < USERMODELIST_SIZE; ++i)