Hello, guys! This is module for BotServ fantasy command in channel #vhost.
Is it posiable someone make me any changes. I need before host to be set to be checked is it exist? If is exist will not gonna set it, if is not exist will be set to the user.
-----ANOPE-2.0.12-----
/* BotServ vhost function
*
* Requires Fantasy setting to be on to work using in channel
* command !vhost <host>.
*
* This sets a TEMPORARY vhost. If the user wants a pernanent
* vhost they should use the normal vhost request system in
* hostserv.
*
*
*
* You need to set
* /chanserv levels #channel FANTASIA 0
* to allow anyone in the active channel to issue the command.
*
*
* ***** Configuration: *****
*
* add the folloing to your botserv config file:
module
{
name = "bs_fantasy_vhost";
vHostRestricted = "admin ircop suck fuck shit damn test";
vHostChannel = "#help";
}
command { service = "BotServ"; name = "VHOST"; command = "botserv/vhost"; }
fantasy { name = "VHOST"; command = "botserv/vhost"; }
*
* vHostChannel = "#help"
* ^^^--- only allow it to work in this channel
*
* vHostRestricted = "space speperated list of prohibited words"
* ^^^--- Prohibit these words from appearing. Note, these will match
* within other words as well.
*
* if vHostRestricted is empty, by defalt, only "admin" and "ircop" are protected.
* if vHostRestricted beginxgs with "none" then nothing is protected.
*
* ***** Example: *****
*
* vHostRestricted = "admin ircop damn turn jerk suck";
*
* This would prevent any vhost mask that contained admin, ircop, damn, turn, jerk, or suck.
* Examples:
* !vhost I.am.an.admin
* !vhost Ircops.are.idiots
* !vhost damn.the.torpedos
* !vhost turn.up.the.volume
* !vhost you.are.akk.jerks
* !vhost you.are.suckers
*
* These would be prevented from being set by the example line above.
*
*/
#include "module.h"
class CommandBSVhost : public Command
{
std::vector<Anope::string> defaults;
int vHostRestrictedNr;
private:
bool isvalidchar(char c)
{
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-')
return true;
return false;
}
public:
CommandBSVhost(Module *creator) : Command(creator, "botserv/vhost", 1, 2)
{
this->SetDesc(_("Enable a temporary vhost."));
this->SetSyntax(_("\037host name\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
{
const Anope::string &vhost = params[0];
const Anope::string &vhost2 = params.size() > 1 ? params[1] : "";
const Anope::string &onlychan = Config->GetModule("bs_fantasy_vhost")->Get<const Anope::string>("vHostChannel","#help");
User *u = source.GetUser();
const NickAlias *na = NickAlias::Find(u->nick);
const Anope::string &nid = u->GetIdent();
Anope::string target = "";
Anope::string chan = "";
Anope::string host = "";
Anope::string user = "";
spacesepstream(Config->GetModule("bs_fantasy_vhost")->Get<const Anope::string>("vHostRestricted","")).GetTokens(defaults);
if (defaults.empty())
{
defaults.push_back("ircop");
defaults.push_back("admin");
}
else if (defaults[0].equals_ci("none"))
defaults.clear();
vHostRestrictedNr = defaults.size();
if (vhost[0] == '#')
{
chan = vhost.c_str();
target = vhost2.c_str();
}
else
{
target = vhost.c_str();
}
if (!chan.empty())
{
if(chan.equals_ci(onlychan.c_str()) != 1)
{
source.Reply(_("You can only issue this command in %s"),onlychan.c_str());
return;
}
}
size_t a = target.find('@');
if (a == Anope::string::npos)
host = target.c_str();
else
{
user = target.substr(0, a);
host = target.substr(a + 1);
}
if (host.empty())
{
this->OnSyntaxError(source, "");
return;
}
if (!user.empty())
{
if (user.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen"))
{
source.Reply(HOST_SET_IDENTTOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("userlen"));
return;
}
else if (!IRCD->CanSetVIdent)
{
source.Reply(HOST_NO_VIDENT);
return;
}
for (Anope::string::iterator s = user.begin(), s_end = user.end(); s != s_end; ++s)
if (!isvalidchar(*s))
{
source.Reply(HOST_SET_IDENT_ERROR);
return;
}
}
if (host.length() > Config->GetBlock("networkinfo")->Get<unsigned>("hostlen"))
{
source.Reply(HOST_SET_TOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("hostlen"));
return;
}
if (!IRCD->IsHostValid(host))
{
source.Reply(HOST_SET_ERROR);
return;
}
int idx;
for (idx = 0; idx < vHostRestrictedNr; idx++)
{
if (target.find_ci(defaults[idx]) != Anope::string::npos)
{
source.Reply(_("Vhost invalid. Containes prohibited word %s."),defaults[idx].c_str());
return;
}
}
if(na && u->Account() == na->nc && !na->HasVhost() && (u->chost.equals_ci(u->GetDisplayedHost()) || u->host.equals_ci(u->GetDisplayedHost()) ) )
{
Log(LOG_COMMAND,source,this) << "to set Vhost to " << target.c_str();
IRCD->SendVhost(u, nid.c_str(), target.c_str());
u->SetDisplayedHost(target.c_str());
source.Reply(_("Vhost %s set."),target.c_str());
}
else
{
source.Reply(_("You already have a vhost. You cannot set a temporary one."));
return;
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows you to set a temproary vhost."));
return true;
}
};
class BSVhost : public Module
{
CommandBSVhost commandbsvhost;
public:
BSVhost(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
commandbsvhost(this)
{
if (!IRCD || !IRCD->CanSetVHost)
throw ModuleException("Your IRCd does not support vhosts");
if (Anope::VersionMajor() < 2)
{
throw ModuleException("Requires version 2 of Anope.");
}
this->SetAuthor("Azander");
this->SetVersion("1.0.2");
}
};
MODULE_INIT(BSVhost)
1
on: January 27, 2023, 07:41:14 PM
|
||
Started by sys - Last post by sys | ||
2
on: January 27, 2023, 12:22:11 AM
|
||
Started by Arno - Last post by Arno | ||
The function popen() does not writes a text file.
I misunderstood the function. Something else causes the error when a mail should be send. What that is I don't know. |
3
on: January 25, 2023, 10:01:38 PM
|
||
Started by Arno - Last post by Arno | ||
Thanks for the link.
What I mean is when I register a nick on my own irc server then anope should send a confirmation mail. But no mail is sent. And I can see one reason the mail isn't sent. Not sure if that is the root of the problem but there is at least one bug. Sendmail itself works fine, In a bash script I receive a test mail. Anope tries to write the text of the mail to the file '/usr/sbin/sendmail'. That is a bug, |
4
on: January 25, 2023, 07:08:58 PM
|
||
Started by Arno - Last post by Lord255 | ||
i dont understand what you mean..
https://linux.die.net/man/8/sendmail.sendmail you can send emails with sendmail. anyway.. bugtracker of anope: https://bugs.anope.org/ glhf. |
5
on: January 25, 2023, 06:50:26 PM
|
||
Started by Arno - Last post by Arno | ||
Hi,
In my research on how mails are sent I found a bug. Where to report a bug? At https://github.com/anope/anope there is no possibility to open an issue. Never programmed in C++, but in mail.cpp at line 30 a file is opened to compose the mail. The file is 'sendmail' (configured in services.conf). But sendmail is the program to send mail. This can't be right. |
6
on: January 22, 2023, 02:47:11 PM
|
||
Started by Arno - Last post by Arno | ||
Hi,
After installing and configuring an irc server and anope I'm testing to register a nick. Anope doesn't send a mail to the user. See subject. For mail postfix is installed to relay mails to my ISP. In a shell on same server: sendmail -F "IRC" -f "irc@example.com" user@example.com < mail.txt This command sends mails successfully. In services.conf I tried several settings for sendmailpath. Full path to sendmail, just sendmail. With and without -t option. Postfix first listened on port 587 then also 25. Postfix listens on 127.0.0.1 now. Before I tried <ip address 192.168.x.y> Version of anope is 2.0.9-1 on Debian 11. How can mails be send by anope? The only error message is 'Error delivering mail for ...' How do I debug this? |
7
on: January 16, 2023, 11:29:12 PM
|
||
Started by chris - Last post by chris | ||
Thank you for answering it. I didn't know if it was an Anope or Unreal issue thus it was posted in both locations to cover all the bases.
|
8
on: January 16, 2023, 10:43:04 PM
|
||
Started by chris - Last post by Lord255 | ||
oh god. you spam multiple forums with this. :\
anyway: https://forums.unrealircd.org/viewtopic.php?p=40376#p40376 i answered there. ![]() |
9
on: January 16, 2023, 09:22:50 PM
|
||
Started by chris - Last post by chris | ||
I started a new post since this is similar to low's post but not the same.
server name and password have been edited for security. Config from Unreal: Code: [Select]
and in Anope: Code: [Select]
Starting Anope up with the above configurations and I get this: Attempting to connect to uplink #1 127.0.0.1 (127.0.0.1/6900) with protocol UnrealIRCd 4+ Successfully connected to uplink #1 127.0.0.1:6900 Lost connection from uplink #1 (127.0.0.1:6900): Connection reset by peer If it remove the TLS option from Unreal and change Anope to SSL = no. Then it works. Anope 2.0.12, build #2, compiled 21:35:45 Jan 15 2023 Using configuration file conf/services.conf Attempting to connect to uplink #1 127.0.0.1 (127.0.0.1/6900) with protocol UnrealIRCd 4+ Successfully connected to uplink #1 127.0.0.1:6900 Successfully linked, launching into background... |
10
Anope Support / 2.0.x/1.9.x Support / Re: ChanServ is not a network service! Please inform a server operator as soon as po
on: January 15, 2023, 06:29:31 PM
|
||
Started by Tobi - Last post by Sadie | ||
If you're not a developer you probably want to be using InspIRCd v3 (stable) not v4 (dev).
You can find the docs for that at https://docs.inspircd.org/3/modules/spanningtree/#uline |