1
0
Fork 0
mirror of https://github.com/pissnet/angiosperm.git synced 2025-08-03 17:12:29 +01:00

Add extensions/m_getid

This commit is contained in:
Ron Nazarov 2022-04-16 02:36:59 +01:00
parent d264eea1b5
commit 336cf5f3a9
Signed by: noisytoot
GPG key ID: 1D43EF4F4492268B
3 changed files with 90 additions and 2 deletions

View file

@ -34,6 +34,7 @@ loadmodule "extensions/invite_notify";
loadmodule "extensions/m_adminwall";
loadmodule "extensions/m_extendchans";
loadmodule "extensions/m_findforwards";
loadmodule "extensions/m_getid";
loadmodule "extensions/m_identify";
loadmodule "extensions/m_locops";
loadmodule "extensions/m_mkpasswd";
@ -595,8 +596,7 @@ general {
not_authorised_client_message = "You are not authorised to access this server.";
illegal_hostname_client_message = "You have an illegal character in your hostname.";
server_full_client_message = "Sorry, server is full - try later";
illegal_name_long_client_message = "Your username is invalid. Please make sure that your username contains "
"only alphanumeric characters.";
illegal_name_long_client_message = "Your username is invalid. Please make sure that your username contains only alphanumeric characters.";
illegal_name_short_client_message = "Invalid username";
identify_service = "NickServ@services.int";
identify_command = "IDENTIFY";

View file

@ -47,6 +47,7 @@ extension_LTLIBRARIES = \
m_echotags.la \
m_extendchans.la \
m_findforwards.la \
m_getid.la \
m_identify.la \
m_locops.la \
m_mkpasswd.la \

87
extensions/m_getid.c Normal file
View file

@ -0,0 +1,87 @@
/*
* Copyright (C) 2022 Noisytoot
*
* 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.
*/
#include "stdinc.h"
#include "modules.h"
#include "numeric.h"
#include "send.h"
#include "hash.h"
#include "s_newconf.h"
static char getid_desc[] = "Provides the GETID command to resolve a nick or server name to a UID or SID";
static void m_getid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message getid_msgtab = {
"GETID", 0, 0, 0, 0,
{mg_ignore, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {m_getid, 0}}
};
mapi_clist_av1 getid_clist[] = { &getid_msgtab, NULL };
DECLARE_MODULE_AV2(getid, NULL, NULL, getid_clist, NULL, NULL, NULL, NULL, getid_desc);
/*
** m_getid
** parv[1] = optional client, defaults to sender
** parv[2] = optional nonce
*/
static void
m_getid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
const char *target_name;
struct Client *target_p;
const char *nonce;
if(!HasPrivilege(source_p, "auspex:id"))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "getid");
return;
}
/* Default to sender if target not specified */
if ((parc < 1) || EmptyString(parv[1]))
{
target_p = client_p;
} else
{
target_name = parv[1];
if (!(target_p = find_client(target_name)))
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), target_name);
return;
}
}
if ((parc < 2) || EmptyString(parv[2]))
{
nonce = NULL;
} else
{
nonce = parv[2];
}
if (nonce)
{
sendto_one_notice(client_p, ":GETID: %s is %s, nonce: %s", target_p->name, target_p->id, nonce);
} else
{
sendto_one_notice(client_p, ":GETID: %s is %s", target_p->name, target_p->id);
}
}