mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-12 17:14:46 +02:00
SVSLOGIN: Move to its own file
Moved SVSLOGIN command to its own file.
This commit is contained in:
committed by
Bram Matthys
parent
b3f0165773
commit
1a4b701776
@@ -139,6 +139,7 @@ loadmodule "svssilence";
|
||||
loadmodule "svssno";
|
||||
loadmodule "svswatch";
|
||||
loadmodule "svso";
|
||||
loadmodule "svslogin";
|
||||
|
||||
|
||||
/*** Channel modes ***/
|
||||
|
||||
@@ -39,7 +39,7 @@ MODULES= \
|
||||
sethost.so chghost.so chgident.so setname.so \
|
||||
setident.so sdesc.so svsmode.so swhois.so\
|
||||
svsmotd.so svsnline.so who_old.so whox.so mkpasswd.so \
|
||||
away.so svsnoop.so svsnick.so svso.so \
|
||||
away.so svsnoop.so svsnick.so svso.so svslogin.so \
|
||||
chgname.so kill.so \
|
||||
lag.so message.so oper.so pingpong.so \
|
||||
quit.so sendumode.so sqline.so \
|
||||
|
||||
@@ -43,7 +43,6 @@ EVENT(sasl_timeout);
|
||||
/* Macros */
|
||||
#define MSG_AUTHENTICATE "AUTHENTICATE"
|
||||
#define MSG_SASL "SASL"
|
||||
#define MSG_SVSLOGIN "SVSLOGIN"
|
||||
#define AGENT_SID(agent_p) (agent_p->user != NULL ? agent_p->user->server : agent_p->name)
|
||||
|
||||
/* Variables */
|
||||
@@ -89,53 +88,6 @@ int sasl_account_login(Client *client, MessageTag *mtags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* SVSLOGIN message
|
||||
*
|
||||
* parv[1]: propagation mask
|
||||
* parv[2]: target
|
||||
* parv[3]: account name (SVID)
|
||||
*/
|
||||
CMD_FUNC(cmd_svslogin)
|
||||
{
|
||||
Client *target;
|
||||
|
||||
if (MyUser(client) || (parc < 3) || !parv[3])
|
||||
return;
|
||||
|
||||
/* We actually ignore parv[1] since this is a broadcast message.
|
||||
* It is a broadcast message because we want ALL servers to know
|
||||
* that the user is now logged in under account xyz.
|
||||
*/
|
||||
|
||||
target = find_client(parv[2], NULL);
|
||||
if (target)
|
||||
{
|
||||
if (IsServer(target))
|
||||
return;
|
||||
|
||||
if (target->user == NULL)
|
||||
make_user(target);
|
||||
|
||||
strlcpy(target->user->account, parv[3], sizeof(target->user->account));
|
||||
user_account_login(recv_mtags, target);
|
||||
if (MyConnect(target) && IsDead(target))
|
||||
return; /* was killed due to *LINE on ~a probably */
|
||||
} else {
|
||||
/* It is perfectly normal for target to be NULL as this
|
||||
* happens during registration phase (pre-connect).
|
||||
* It just means we cannot set any properties for this user,
|
||||
* which is fine in that case, since it will be synced via
|
||||
* the UID message instead.
|
||||
* We still have to broadcast the message, which is why
|
||||
* we do not return here.
|
||||
*/
|
||||
}
|
||||
|
||||
/* Propagate to the rest of the network */
|
||||
sendto_server(client, 0, 0, NULL, ":%s SVSLOGIN %s %s %s",
|
||||
client->name, parv[1], parv[2], parv[3]);
|
||||
}
|
||||
|
||||
/*
|
||||
* SASL message
|
||||
@@ -370,7 +322,6 @@ MOD_INIT()
|
||||
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||
|
||||
CommandAdd(modinfo->handle, MSG_SASL, cmd_sasl, MAXPARA, CMD_USER|CMD_SERVER);
|
||||
CommandAdd(modinfo->handle, MSG_SVSLOGIN, cmd_svslogin, MAXPARA, CMD_USER|CMD_SERVER);
|
||||
CommandAdd(modinfo->handle, MSG_AUTHENTICATE, cmd_authenticate, MAXPARA, CMD_UNREGISTERED|CMD_USER);
|
||||
|
||||
HookAdd(modinfo->handle, HOOKTYPE_LOCAL_CONNECT, 0, sasl_connect);
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* IRC - Internet Relay Chat, src/modules/svslogin.c
|
||||
* (C) 2022 The UnrealIRCd Team
|
||||
*
|
||||
* See file AUTHORS in IRC package for additional names of
|
||||
* the programmers.
|
||||
*
|
||||
* This program 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 1, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "unrealircd.h"
|
||||
|
||||
#define MSG_SVSLOGIN "SVSLOGIN"
|
||||
|
||||
CMD_FUNC(cmd_svslogin);
|
||||
|
||||
ModuleHeader MOD_HEADER
|
||||
= {
|
||||
"svslogin",
|
||||
"6.0",
|
||||
"command /SVSLOGIN",
|
||||
"UnrealIRCd Team",
|
||||
"unrealircd-6",
|
||||
};
|
||||
|
||||
MOD_INIT()
|
||||
{
|
||||
CommandAdd(modinfo->handle, MSG_SVSLOGIN, cmd_svslogin, MAXPARA, CMD_USER|CMD_SERVER);
|
||||
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
MOD_LOAD()
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
MOD_UNLOAD()
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* SVSLOGIN message
|
||||
*
|
||||
* parv[1]: propagation mask
|
||||
* parv[2]: target
|
||||
* parv[3]: account name (SVID)
|
||||
*/
|
||||
CMD_FUNC(cmd_svslogin)
|
||||
{
|
||||
Client *target;
|
||||
|
||||
if (MyUser(client) || (parc < 3) || !parv[3])
|
||||
return;
|
||||
|
||||
/* We actually ignore parv[1] since this is a broadcast message.
|
||||
* It is a broadcast message because we want ALL servers to know
|
||||
* that the user is now logged in under account xyz.
|
||||
*/
|
||||
|
||||
target = find_client(parv[2], NULL);
|
||||
if (target)
|
||||
{
|
||||
if (IsServer(target))
|
||||
return;
|
||||
|
||||
if (target->user == NULL)
|
||||
make_user(target);
|
||||
|
||||
strlcpy(target->user->account, parv[3], sizeof(target->user->account));
|
||||
user_account_login(recv_mtags, target);
|
||||
if (MyConnect(target) && IsDead(target))
|
||||
return; /* was killed due to *LINE on ~a probably */
|
||||
} else {
|
||||
/* It is perfectly normal for target to be NULL as this
|
||||
* happens during registration phase (pre-connect).
|
||||
* It just means we cannot set any properties for this user,
|
||||
* which is fine in that case, since it will be synced via
|
||||
* the UID message instead.
|
||||
* We still have to broadcast the message, which is why
|
||||
* we do not return here.
|
||||
*/
|
||||
}
|
||||
|
||||
/* Propagate to the rest of the network */
|
||||
sendto_server(client, 0, 0, NULL, ":%s SVSLOGIN %s %s %s",
|
||||
client->name, parv[1], parv[2], parv[3]);
|
||||
}
|
||||
Reference in New Issue
Block a user