mirror of
https://github.com/anope/anope.git
synced 2026-07-10 14:23:14 +02:00
Merge branch '2.0' into 2.1.
This commit is contained in:
+6
-4
@@ -126,6 +126,12 @@ if(EXTRA_LIBS)
|
||||
link_directories(${EXTRA_LIBS})
|
||||
endif()
|
||||
|
||||
# setup conan
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")
|
||||
conan_basic_setup()
|
||||
endif()
|
||||
|
||||
# Find gettext
|
||||
find_package(Gettext)
|
||||
find_package(Intl)
|
||||
@@ -371,10 +377,6 @@ if(WIN32)
|
||||
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
|
||||
DESTINATION ${BIN_DIR}
|
||||
)
|
||||
|
||||
# Package any DLLs in src/win/
|
||||
file(GLOB EXTRA_DLLS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${Anope_SOURCE_DIR}/src/win32/*.dll")
|
||||
install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR})
|
||||
endif()
|
||||
|
||||
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")")
|
||||
|
||||
+12
-1
@@ -1,7 +1,18 @@
|
||||
Anope Version 2.0.13-git
|
||||
Anope Version 2.0.14-git
|
||||
------------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.13
|
||||
--------------------
|
||||
Fixed a crash on some compilers when trying to call methods on a null pointer
|
||||
Fixed a crash when encountering an unterminated commented config block
|
||||
Fixed erroneously rejecting spaces in fantasy:name
|
||||
Fixed marking services pseudoclients as an oper on InspIRCd
|
||||
Fixed not checking user@ip as well as user@host when logging into an operator account
|
||||
Fixed setting the vhost/vident during SASL on UnrealIRCd
|
||||
Updated the German translation
|
||||
Updated the Italian translation
|
||||
|
||||
Anope Version 2.0.12
|
||||
--------------------
|
||||
Added account confirmation to the web panel
|
||||
|
||||
+5
-1
@@ -9,10 +9,14 @@ Renamed the inspircd3 module to inspircd.
|
||||
Renamed the unreal4 module to unrealircd.
|
||||
Replaced uplink:ipv6 with uplink:protocol.
|
||||
|
||||
Anope Version 2.0.13-git
|
||||
Anope Version 2.0.14-git
|
||||
------------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.13
|
||||
--------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.12
|
||||
--------------------
|
||||
Added the regex_pcre2 module
|
||||
|
||||
@@ -4,6 +4,7 @@ Anope Multi Language Support
|
||||
1) Building Anope with gettext support
|
||||
2) Adding a new language
|
||||
3) Using languages with modules
|
||||
4) Updating a language file
|
||||
|
||||
1) Building Anope with gettext support
|
||||
|
||||
@@ -51,3 +52,14 @@ Anope Multi Language Support
|
||||
|
||||
All .po and .pot files should be placed in modules/third/language. Additionally an update script is provided there
|
||||
that will create .pot files and merge any changes to it with existing .po files.
|
||||
|
||||
4) Updating a language file
|
||||
|
||||
Poedit (https://poedit.net/) is a popular po file editor, and we recommend using it or another editor designed to edit
|
||||
po files (especially on Windows).
|
||||
|
||||
Before editing the relevant file in languages/, run `update.sh` in the languages/ folder, i.e. `cd` to it and run
|
||||
./update.sh
|
||||
This will update the language file to contain all strings that need a translation.
|
||||
|
||||
Then commit only the changed .po files in git.
|
||||
|
||||
@@ -6,8 +6,8 @@ set_target_properties(version-bin PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${L
|
||||
set(version_BINARY "$<TARGET_FILE:version-bin>")
|
||||
# Modify version.h from the above executable, with dependencies to version.cpp
|
||||
# and all of the source files in the main build
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_build
|
||||
COMMAND ${version_BINARY} ${Anope_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h
|
||||
COMMAND version-bin ${Anope_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h
|
||||
DEPENDS version-bin ${SRC_SRCS}
|
||||
)
|
||||
# Add version-bin to list of files for CPack to ignore
|
||||
@@ -19,4 +19,4 @@ if(NOT WIN32)
|
||||
endif()
|
||||
|
||||
# Add a custom target to the above file
|
||||
add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build)
|
||||
add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h)
|
||||
|
||||
@@ -288,6 +288,11 @@ class CoreExport Channel : public Base, public Extensible
|
||||
*/
|
||||
bool CheckKick(User *user);
|
||||
|
||||
/** Find which bot should send mode/topic/etc changes for this channel
|
||||
* @return The bot
|
||||
*/
|
||||
BotInfo *WhoSends() const;
|
||||
|
||||
/** Finds a channel
|
||||
* @param name The channel to find
|
||||
* @return The channel, if found
|
||||
|
||||
+15
-8
@@ -19,9 +19,11 @@
|
||||
|
||||
namespace Configuration
|
||||
{
|
||||
namespace Internal
|
||||
{
|
||||
class CoreExport Block
|
||||
{
|
||||
friend struct Conf;
|
||||
friend struct Configuration::Conf;
|
||||
|
||||
public:
|
||||
typedef Anope::map<Anope::string> item_map;
|
||||
@@ -33,13 +35,17 @@ namespace Configuration
|
||||
block_map blocks;
|
||||
int linenum;
|
||||
|
||||
/* Represents a missing tag. */
|
||||
static Block EmptyBlock;
|
||||
|
||||
public:
|
||||
Block(const Anope::string &);
|
||||
const Anope::string &GetName() const;
|
||||
int CountBlock(const Anope::string &name);
|
||||
Block* GetBlock(const Anope::string &name, int num = 0);
|
||||
int CountBlock(const Anope::string &name) const;
|
||||
const Block* GetBlock(const Anope::string &name, int num = 0) const;
|
||||
Block* GetMutableBlock(const Anope::string &name, int num = 0);
|
||||
|
||||
template<typename T> inline T Get(const Anope::string &tag)
|
||||
template<typename T> inline T Get(const Anope::string &tag) const
|
||||
{
|
||||
return this->Get<T>(tag, "");
|
||||
}
|
||||
@@ -65,6 +71,10 @@ namespace Configuration
|
||||
template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const;
|
||||
template<> CoreExport time_t Block::Get(const Anope::string &tag, const Anope::string &def) const;
|
||||
template<> CoreExport bool Block::Get(const Anope::string &tag, const Anope::string &def) const;
|
||||
} // namespace Internal
|
||||
|
||||
typedef const Internal::Block Block;
|
||||
typedef Internal::Block MutableBlock;
|
||||
|
||||
/** Represents a configuration file
|
||||
*/
|
||||
@@ -128,9 +138,6 @@ namespace Configuration
|
||||
std::map<Anope::string, Block *> modules;
|
||||
Anope::map<Anope::string> bots;
|
||||
|
||||
/* Represents a missing tag. */
|
||||
Block EmptyBlock;
|
||||
|
||||
Conf();
|
||||
~Conf();
|
||||
|
||||
@@ -142,7 +149,7 @@ namespace Configuration
|
||||
|
||||
BotInfo *GetClient(const Anope::string &name);
|
||||
|
||||
Block *GetCommand(CommandSource &);
|
||||
const Block *GetCommand(CommandSource &);
|
||||
};
|
||||
|
||||
struct Uplink
|
||||
|
||||
+261
-160
File diff suppressed because it is too large
Load Diff
+950
-1224
File diff suppressed because it is too large
Load Diff
+40
-9
@@ -1,17 +1,48 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
rm -f anope.pot
|
||||
touch anope.pot
|
||||
if [ "${PWD##*/}" != "language" ]
|
||||
then
|
||||
echo "Please run this script in the language/ subfolder of an anope source tree."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ..
|
||||
FILES=`find ./ -name *.cpp -o -name *.h -o -name *.conf | grep -v /docs/ | grep -v /modules/third/`
|
||||
xgettext -E -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword --keyword=_ $FILES
|
||||
cd -
|
||||
# truncate
|
||||
: > anope.pot
|
||||
|
||||
# find .cpp, .h, and .conf files
|
||||
# exclude docs and third party modules
|
||||
# run xgettext on found files
|
||||
find ../ \
|
||||
! -path '../docs/*' \
|
||||
-a ! -path '../modules/third/*' \
|
||||
-a \( -name '*.cpp' \
|
||||
-o -name '*.h' \
|
||||
-o -name '*.conf' \
|
||||
\) \
|
||||
-exec \
|
||||
xgettext \
|
||||
--escape \
|
||||
--language=C++ \
|
||||
--sort-output \
|
||||
--default-domain=Anope \
|
||||
--join-existing \
|
||||
--output=anope.pot \
|
||||
--from-code=utf-8 \
|
||||
--keyword \
|
||||
--keyword=_ \
|
||||
{} +
|
||||
|
||||
for f in *.po
|
||||
do
|
||||
echo "Merging $f"
|
||||
msgmerge --no-location --no-wrap --sort-output --update --verbose $f `echo $f | cut -d'.' -f1`.pot
|
||||
msgmerge \
|
||||
--no-location \
|
||||
--no-wrap \
|
||||
--sort-output \
|
||||
--update \
|
||||
--verbose \
|
||||
"${f}" \
|
||||
"${f%%.*}.pot"
|
||||
done
|
||||
|
||||
rm -f *~
|
||||
rm -f -- *~
|
||||
|
||||
@@ -3,6 +3,40 @@ if(WIN32)
|
||||
add_definitions(-DMODULE_COMPILE)
|
||||
endif()
|
||||
|
||||
# enable extra modules if conan is used
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../conanbuildinfo.cmake")
|
||||
function(enable_extra NAME PACKAGE)
|
||||
if(DEFINED "CONAN_${PACKAGE}_ROOT")
|
||||
message("Enabling the ${NAME} module")
|
||||
# copy the modules out of extra so it gets picked up by build_modules
|
||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/extra/${NAME}.cpp" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
else()
|
||||
message("Unable to enable the ${NAME} module (missing library)")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(copy_extra NAME)
|
||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/extra/${NAME}.cpp" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endfunction()
|
||||
|
||||
enable_extra("m_mysql" "LIBMYSQLCLIENT")
|
||||
enable_extra("m_regex_pcre2" "PCRE2")
|
||||
enable_extra("m_sqlite" "SQLITE3")
|
||||
enable_extra("m_ssl_openssl" "OPENSSL")
|
||||
# this uses Wldap so should always be available
|
||||
copy_extra("m_ldap")
|
||||
# these don't actually have extra dependencies, but require a module which does
|
||||
copy_extra("m_sql_authentication")
|
||||
copy_extra("m_sql_log")
|
||||
copy_extra("m_sql_oper")
|
||||
copy_extra("m_ldap_authentication")
|
||||
copy_extra("m_ldap_oper")
|
||||
|
||||
# Package extra dlls
|
||||
file(GLOB EXTRA_DLLS "${Anope_SOURCE_DIR}/extradll/bin/*.dll" "${Anope_SOURCE_DIR}/extradll/lib/*.dll")
|
||||
install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR})
|
||||
endif()
|
||||
|
||||
macro(build_modules SRC)
|
||||
if(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt")
|
||||
add_subdirectory("${SRC}")
|
||||
|
||||
@@ -284,7 +284,7 @@ class NSRecover : public Module
|
||||
if (it != ei->end())
|
||||
{
|
||||
for (size_t i = 0; i < it->second.Modes().length(); ++i)
|
||||
c->SetMode(c->ci->WhoSends(), ModeManager::FindChannelModeByChar(it->second.Modes()[i]), u->GetUID());
|
||||
c->SetMode(c->WhoSends(), ModeManager::FindChannelModeByChar(it->second.Modes()[i]), u->GetUID());
|
||||
|
||||
ei->erase(it);
|
||||
if (ei->empty())
|
||||
|
||||
@@ -32,7 +32,7 @@ class CommandOSConfig : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
Configuration::Block *block = Config->GetBlock(params[1]);
|
||||
Configuration::MutableBlock *block = Config->GetMutableBlock(params[1]);
|
||||
if (!block)
|
||||
block = Config->GetModule(params[1]);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class CommandOSMode : public Command
|
||||
|
||||
const Channel::ModeList chmodes = c->GetModes();
|
||||
for (Channel::ModeList::const_iterator it = chmodes.begin(), it_end = chmodes.end(); it != it_end && c; ++it)
|
||||
c->RemoveMode(c->ci->WhoSends(), it->first, it->second, false);
|
||||
c->RemoveMode(c->WhoSends(), it->first, it->second, false);
|
||||
|
||||
if (!c)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ class CommandOSMode : public Command
|
||||
continue;
|
||||
|
||||
for (size_t i = uc->status.Modes().length(); i > 0; --i)
|
||||
c->RemoveMode(c->ci->WhoSends(), ModeManager::FindChannelModeByChar(uc->status.Modes()[i - 1]), uc->user->GetUID(), false);
|
||||
c->RemoveMode(c->WhoSends(), ModeManager::FindChannelModeByChar(uc->status.Modes()[i - 1]), uc->user->GetUID(), false);
|
||||
}
|
||||
|
||||
source.Reply(_("All modes cleared on %s."), c->name.c_str());
|
||||
|
||||
+86
-11
@@ -10,11 +10,29 @@
|
||||
*/
|
||||
|
||||
/* RequiredLibraries: ldap_r|ldap,lber */
|
||||
/* RequiredWindowsLibraries: libldap_r|libldap,liblber */
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/ldap.h"
|
||||
#include <ldap.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <Winldap.h>
|
||||
# include <WinBer.h>
|
||||
# include <wininet.h>
|
||||
# define LDAP_OPT_SUCCESS LDAP_SUCCESS
|
||||
# define LDAP_OPT_NETWORK_TIMEOUT LDAP_OPT_SEND_TIMEOUT
|
||||
# define LDAP_STR(X) const_cast<PSTR>((X).c_str())
|
||||
# define LDAP_SASL_SIMPLE static_cast<PSTR>(0)
|
||||
# define LDAP_TIME(X) reinterpret_cast<PLDAP_TIMEVAL>(&(X))
|
||||
# define ldap_first_message ldap_first_entry
|
||||
# define ldap_next_message ldap_next_entry
|
||||
# define ldap_unbind_ext(LDAP, UNUSED1, UNUSED2) ldap_unbind(LDAP)
|
||||
# pragma comment(lib, "Wldap32.lib")
|
||||
# pragma comment(lib, "Wininet.lib")
|
||||
#else
|
||||
# include <ldap.h>
|
||||
# define LDAP_STR(X) ((X).c_str())
|
||||
# define LDAP_TIME(X) (&(X))
|
||||
#endif
|
||||
|
||||
#if defined LDAP_API_FEATURE_X_OPENLDAP_REENTRANT && !LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
|
||||
# error Anope requires OpenLDAP to be built as reentrant.
|
||||
@@ -70,13 +88,13 @@ class LDAPBind : public LDAPRequest
|
||||
int run() override;
|
||||
};
|
||||
|
||||
class LDAPSearch : public LDAPRequest
|
||||
class LDAPSearchRequest : public LDAPRequest
|
||||
{
|
||||
Anope::string base;
|
||||
Anope::string filter;
|
||||
|
||||
public:
|
||||
LDAPSearch(LDAPService *s, LDAPInterface *i, const Anope::string &b, const Anope::string &f)
|
||||
LDAPSearchRequest(LDAPService *s, LDAPInterface *i, const Anope::string &b, const Anope::string &f)
|
||||
: LDAPRequest(s, i)
|
||||
, base(b)
|
||||
, filter(f)
|
||||
@@ -187,6 +205,63 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
// Windows LDAP does not implement this so we need to do it.
|
||||
int ldap_initialize(LDAP** ldap, const char* url)
|
||||
{
|
||||
URL_COMPONENTS urlComponents;
|
||||
memset(&urlComponents, 0, sizeof(urlComponents));
|
||||
urlComponents.dwStructSize = sizeof(urlComponents);
|
||||
|
||||
urlComponents.lpszScheme = new char[8];
|
||||
urlComponents.dwSchemeLength = 8;
|
||||
|
||||
urlComponents.lpszHostName = new char[1024];
|
||||
urlComponents.dwHostNameLength = 1024;
|
||||
|
||||
if (!InternetCrackUrlA(url, 0, 0, &urlComponents))
|
||||
{
|
||||
delete[] urlComponents.lpszScheme;
|
||||
delete[] urlComponents.lpszHostName;
|
||||
return LDAP_CONNECT_ERROR; // Malformed url.
|
||||
}
|
||||
|
||||
unsigned long port = 389; // Default plaintext port.
|
||||
bool secure = false; // LDAP defaults to plaintext.
|
||||
if (urlComponents.dwSchemeLength > 0)
|
||||
{
|
||||
const Anope::string scheme(urlComponents.lpszScheme);
|
||||
if (scheme.equals_ci("ldaps"))
|
||||
{
|
||||
port = 636; // Default encrypted port.
|
||||
secure = true;
|
||||
}
|
||||
else if (!scheme.equals_ci("ldap"))
|
||||
{
|
||||
delete[] urlComponents.lpszScheme;
|
||||
delete[] urlComponents.lpszHostName;
|
||||
return LDAP_CONNECT_ERROR; // Invalid protocol.
|
||||
}
|
||||
}
|
||||
|
||||
if (urlComponents.nPort > 0)
|
||||
{
|
||||
port = urlComponents.nPort;
|
||||
}
|
||||
|
||||
*ldap = ldap_sslinit(urlComponents.lpszHostName, port, secure);
|
||||
delete[] urlComponents.lpszScheme;
|
||||
delete[] urlComponents.lpszHostName;
|
||||
if (!*ldap)
|
||||
{
|
||||
return LdapGetLastError(); // Something went wrong, find out what.
|
||||
}
|
||||
|
||||
// We're connected to the LDAP server!
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Connect()
|
||||
{
|
||||
int i = ldap_initialize(&this->con, this->server.c_str());
|
||||
@@ -288,7 +363,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
if (i == NULL)
|
||||
throw LDAPException("No interface");
|
||||
|
||||
LDAPSearch *s = new LDAPSearch(this, i, base, filter);
|
||||
LDAPSearchRequest *s = new LDAPSearchRequest(this, i, base, filter);
|
||||
QueueRequest(s);
|
||||
}
|
||||
|
||||
@@ -587,35 +662,35 @@ int LDAPBind::run()
|
||||
cred.bv_val = strdup(pass.c_str());
|
||||
cred.bv_len = pass.length();
|
||||
|
||||
int i = ldap_sasl_bind_s(service->GetConnection(), who.c_str(), LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
|
||||
int i = ldap_sasl_bind_s(service->GetConnection(), LDAP_STR(who), LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
|
||||
|
||||
free(cred.bv_val);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int LDAPSearch::run()
|
||||
int LDAPSearchRequest::run()
|
||||
{
|
||||
return ldap_search_ext_s(service->GetConnection(), base.c_str(), LDAP_SCOPE_SUBTREE, filter.c_str(), NULL, 0, NULL, NULL, &tv, 0, &message);
|
||||
return ldap_search_ext_s(service->GetConnection(), LDAP_STR(base), LDAP_SCOPE_SUBTREE, LDAP_STR(filter), NULL, 0, NULL, NULL, LDAP_TIME(tv), 0, &message);
|
||||
}
|
||||
|
||||
int LDAPAdd::run()
|
||||
{
|
||||
LDAPMod **mods = LDAPService::BuildMods(attributes);
|
||||
int i = ldap_add_ext_s(service->GetConnection(), dn.c_str(), mods, NULL, NULL);
|
||||
int i = ldap_add_ext_s(service->GetConnection(), LDAP_STR(dn), mods, NULL, NULL);
|
||||
LDAPService::FreeMods(mods);
|
||||
return i;
|
||||
}
|
||||
|
||||
int LDAPDel::run()
|
||||
{
|
||||
return ldap_delete_ext_s(service->GetConnection(), dn.c_str(), NULL, NULL);
|
||||
return ldap_delete_ext_s(service->GetConnection(), LDAP_STR(dn), NULL, NULL);
|
||||
}
|
||||
|
||||
int LDAPModify::run()
|
||||
{
|
||||
LDAPMod **mods = LDAPService::BuildMods(attributes);
|
||||
int i = ldap_modify_ext_s(service->GetConnection(), base.c_str(), mods, NULL, NULL);
|
||||
int i = ldap_modify_ext_s(service->GetConnection(), LDAP_STR(base), mods, NULL, NULL);
|
||||
LDAPService::FreeMods(mods);
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/* RequiredLibraries: pcre2-8 */
|
||||
/* RequiredWindowsLibraries: libpcre2-8 */
|
||||
/* RequiredWindowsLibraries: pcre2-8 */
|
||||
|
||||
#include "module.h"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/* RequiredLibraries: ssl,crypto */
|
||||
/* RequiredWindowsLibraries: ssleay32,libeay32 */
|
||||
/* RequiredWindowsLibraries: libssl,libcrypto */
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/ssl.h"
|
||||
|
||||
@@ -180,7 +180,7 @@ class InspIRCdProto : public IRCDProto
|
||||
{
|
||||
if (Servers::Capab.count("SVSTOPIC"))
|
||||
{
|
||||
UplinkSocket::Message(c->ci->WhoSends()) << "SVSTOPIC " << c->name << " " << c->topic_ts << " " << c->topic_setter << " :" << c->topic;
|
||||
UplinkSocket::Message(c->WhoSends()) << "SVSTOPIC " << c->name << " " << c->topic_ts << " " << c->topic_setter << " :" << c->topic;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -288,7 +288,7 @@ class ChanServCore : public Module, public ChanServService
|
||||
if (c->ci)
|
||||
c->SetMode(c->ci->WhoSends(), "REGISTERED", "", false);
|
||||
else
|
||||
c->RemoveMode(ChanServ, "REGISTERED", "", false);
|
||||
c->RemoveMode(c->WhoSends(), "REGISTERED", "", false);
|
||||
|
||||
const Anope::string &require = Config->GetModule(this)->Get<const Anope::string>("require");
|
||||
if (!require.empty())
|
||||
@@ -296,7 +296,7 @@ class ChanServCore : public Module, public ChanServService
|
||||
if (c->ci)
|
||||
c->SetModes(c->ci->WhoSends(), false, "+%s", require.c_str());
|
||||
else
|
||||
c->SetModes(ChanServ, false, "-%s", require.c_str());
|
||||
c->SetModes(c->WhoSends(), false, "-%s", require.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-3
@@ -783,7 +783,7 @@ bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...)
|
||||
return false;
|
||||
|
||||
if (bi == NULL)
|
||||
bi = this->ci->WhoSends();
|
||||
bi = this->WhoSends();
|
||||
|
||||
EventReturn MOD_RESULT;
|
||||
FOREACH_RESULT(OnBotKick, MOD_RESULT, (bi, this, u, buf));
|
||||
@@ -812,7 +812,7 @@ void Channel::ChangeTopic(const Anope::string &user, const Anope::string &newtop
|
||||
this->topic_setter = user;
|
||||
this->topic_ts = ts;
|
||||
|
||||
IRCD->SendTopic(this->ci->WhoSends(), this);
|
||||
IRCD->SendTopic(this->WhoSends(), this);
|
||||
|
||||
/* Now that the topic is set update the time set. This is *after* we set it so the protocol modules are able to tell the old last set time */
|
||||
this->topic_time = Anope::CurTime;
|
||||
@@ -911,8 +911,10 @@ bool Channel::CheckKick(User *user)
|
||||
if (MOD_RESULT != EVENT_STOP)
|
||||
return false;
|
||||
|
||||
if (mask.empty() && this->ci)
|
||||
mask = this->ci->GetIdealBan(user);
|
||||
if (mask.empty())
|
||||
mask = this->ci ? this->ci->GetIdealBan(user) : "*!*@" + user->GetDisplayedHost();
|
||||
mask = "*!*@" + user->GetDisplayedHost();
|
||||
if (reason.empty())
|
||||
reason = Language::Translate(user->Account(), CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
|
||||
@@ -924,6 +926,21 @@ bool Channel::CheckKick(User *user)
|
||||
return true;
|
||||
}
|
||||
|
||||
BotInfo* Channel::WhoSends() const
|
||||
{
|
||||
if (ci)
|
||||
return ci->WhoSends();
|
||||
|
||||
BotInfo *ChanServ = Config->GetClient("ChanServ");
|
||||
if (ChanServ)
|
||||
return ChanServ;
|
||||
|
||||
if (!BotListByNick->empty())
|
||||
return BotListByNick->begin()->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Channel* Channel::Find(const Anope::string &name)
|
||||
{
|
||||
channel_map::const_iterator it = ChannelList.find(name);
|
||||
|
||||
+36
-22
@@ -17,11 +17,15 @@
|
||||
#include "channels.h"
|
||||
#include "hashcomp.h"
|
||||
|
||||
using namespace Configuration;
|
||||
using Configuration::File;
|
||||
using Configuration::Conf;
|
||||
using Configuration::Internal::Block;
|
||||
|
||||
File ServicesConf("anope.conf", false); // Configuration file name
|
||||
Conf *Config = NULL;
|
||||
|
||||
Block Block::EmptyBlock("");
|
||||
|
||||
Block::Block(const Anope::string &n) : name(n), linenum(-1)
|
||||
{
|
||||
}
|
||||
@@ -31,19 +35,29 @@ const Anope::string &Block::GetName() const
|
||||
return name;
|
||||
}
|
||||
|
||||
int Block::CountBlock(const Anope::string &bname)
|
||||
int Block::CountBlock(const Anope::string &bname) const
|
||||
{
|
||||
return blocks.count(bname);
|
||||
}
|
||||
|
||||
Block* Block::GetBlock(const Anope::string &bname, int num)
|
||||
const Block* Block::GetBlock(const Anope::string &bname, int num) const
|
||||
{
|
||||
std::pair<block_map::const_iterator, block_map::const_iterator> it = blocks.equal_range(bname);
|
||||
|
||||
for (int i = 0; it.first != it.second; ++it.first, ++i)
|
||||
if (i == num)
|
||||
return &it.first->second;
|
||||
return &EmptyBlock;
|
||||
}
|
||||
|
||||
Block* Block::GetMutableBlock(const Anope::string &bname, int num)
|
||||
{
|
||||
std::pair<block_map::iterator, block_map::iterator> it = blocks.equal_range(bname);
|
||||
|
||||
for (int i = 0; it.first != it.second; ++it.first, ++i)
|
||||
if (i == num)
|
||||
return &it.first->second;
|
||||
return &(Config->EmptyBlock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Block::Set(const Anope::string &tag, const Anope::string &value)
|
||||
@@ -52,7 +66,7 @@ bool Block::Set(const Anope::string &tag, const Anope::string &value)
|
||||
return true;
|
||||
}
|
||||
|
||||
const Block::item_map& Block::GetItems() const
|
||||
const Block::item_map &Block::GetItems() const
|
||||
{
|
||||
return items;
|
||||
}
|
||||
@@ -101,7 +115,7 @@ template<typename T> static void ValidateNotZero(const Anope::string &block, con
|
||||
throw ConfigException("The value for <" + block + ":" + name + "> cannot be zero!");
|
||||
}
|
||||
|
||||
Conf::Conf() : Block(""), EmptyBlock("")
|
||||
Conf::Conf() : Block("")
|
||||
{
|
||||
ReadTimeout = 0;
|
||||
UsePrivmsg = DefPrivmsg = false;
|
||||
@@ -110,7 +124,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
|
||||
for (int i = 0; i < this->CountBlock("include"); ++i)
|
||||
{
|
||||
Block *include = this->GetBlock("include", i);
|
||||
const Block *include = this->GetBlock("include", i);
|
||||
|
||||
const Anope::string &type = include->Get<const Anope::string>("type"),
|
||||
&file = include->Get<const Anope::string>("name");
|
||||
@@ -145,7 +159,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
throw ConfigException("<" + noreload[i].block + ":" + noreload[i].name + "> can not be modified once set");
|
||||
}
|
||||
|
||||
Block *serverinfo = this->GetBlock("serverinfo"), *options = this->GetBlock("options"),
|
||||
const Block *serverinfo = this->GetBlock("serverinfo"), *options = this->GetBlock("options"),
|
||||
*mail = this->GetBlock("mail"), *networkinfo = this->GetBlock("networkinfo");
|
||||
|
||||
const Anope::string &servername = serverinfo->Get<Anope::string>("name");
|
||||
@@ -191,7 +205,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
|
||||
for (int i = 0; i < this->CountBlock("uplink"); ++i)
|
||||
{
|
||||
Block *uplink = this->GetBlock("uplink", i);
|
||||
const Block *uplink = this->GetBlock("uplink", i);
|
||||
|
||||
int protocol;
|
||||
const Anope::string &protocolstr = uplink->Get<const Anope::string>("protocol", "ipv4");
|
||||
@@ -224,7 +238,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
|
||||
for (int i = 0; i < this->CountBlock("module"); ++i)
|
||||
{
|
||||
Block *module = this->GetBlock("module", i);
|
||||
const Block *module = this->GetBlock("module", i);
|
||||
|
||||
const Anope::string &modname = module->Get<const Anope::string>("name");
|
||||
|
||||
@@ -235,7 +249,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
|
||||
for (int i = 0; i < this->CountBlock("opertype"); ++i)
|
||||
{
|
||||
Block *opertype = this->GetBlock("opertype", i);
|
||||
const Block *opertype = this->GetBlock("opertype", i);
|
||||
|
||||
const Anope::string &oname = opertype->Get<const Anope::string>("name"),
|
||||
&modes = opertype->Get<const Anope::string>("modes"),
|
||||
@@ -280,7 +294,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
|
||||
for (int i = 0; i < this->CountBlock("oper"); ++i)
|
||||
{
|
||||
Block *oper = this->GetBlock("oper", i);
|
||||
const Block *oper = this->GetBlock("oper", i);
|
||||
|
||||
const Anope::string &nname = oper->Get<const Anope::string>("name"),
|
||||
&type = oper->Get<const Anope::string>("type"),
|
||||
@@ -314,7 +328,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
it->second->conf = false;
|
||||
for (int i = 0; i < this->CountBlock("service"); ++i)
|
||||
{
|
||||
Block *service = this->GetBlock("service", i);
|
||||
const Block *service = this->GetBlock("service", i);
|
||||
|
||||
const Anope::string &nick = service->Get<const Anope::string>("nick"),
|
||||
&user = service->Get<const Anope::string>("user"),
|
||||
@@ -400,7 +414,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
|
||||
for (int i = 0; i < this->CountBlock("log"); ++i)
|
||||
{
|
||||
Block *log = this->GetBlock("log", i);
|
||||
const Block *log = this->GetBlock("log", i);
|
||||
|
||||
int logage = log->Get<int>("logage");
|
||||
bool rawio = log->Get<bool>("rawio");
|
||||
@@ -426,7 +440,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
it->second->commands.clear();
|
||||
for (int i = 0; i < this->CountBlock("command"); ++i)
|
||||
{
|
||||
Block *command = this->GetBlock("command", i);
|
||||
const Block *command = this->GetBlock("command", i);
|
||||
|
||||
const Anope::string &service = command->Get<const Anope::string>("service"),
|
||||
&nname = command->Get<const Anope::string>("name"),
|
||||
@@ -451,7 +465,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
PrivilegeManager::ClearPrivileges();
|
||||
for (int i = 0; i < this->CountBlock("privilege"); ++i)
|
||||
{
|
||||
Block *privilege = this->GetBlock("privilege", i);
|
||||
const Block *privilege = this->GetBlock("privilege", i);
|
||||
|
||||
const Anope::string &nname = privilege->Get<const Anope::string>("name"),
|
||||
&desc = privilege->Get<const Anope::string>("desc");
|
||||
@@ -462,7 +476,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
|
||||
for (int i = 0; i < this->CountBlock("fantasy"); ++i)
|
||||
{
|
||||
Block *fantasy = this->GetBlock("fantasy", i);
|
||||
const Block *fantasy = this->GetBlock("fantasy", i);
|
||||
|
||||
const Anope::string &nname = fantasy->Get<const Anope::string>("name"),
|
||||
&service = fantasy->Get<const Anope::string>("command"),
|
||||
@@ -484,7 +498,7 @@ Conf::Conf() : Block(""), EmptyBlock("")
|
||||
|
||||
for (int i = 0; i < this->CountBlock("command_group"); ++i)
|
||||
{
|
||||
Block *command_group = this->GetBlock("command_group", i);
|
||||
const Block *command_group = this->GetBlock("command_group", i);
|
||||
|
||||
const Anope::string &nname = command_group->Get<const Anope::string>("name"),
|
||||
&description = command_group->Get<const Anope::string>("description");
|
||||
@@ -601,7 +615,7 @@ void Conf::Post(Conf *old)
|
||||
Block *Conf::GetModule(Module *m)
|
||||
{
|
||||
if (!m)
|
||||
return &(Config->EmptyBlock);
|
||||
return NULL;
|
||||
|
||||
return GetModule(m->name);
|
||||
}
|
||||
@@ -641,7 +655,7 @@ BotInfo *Conf::GetClient(const Anope::string &cname)
|
||||
return GetClient(cname);
|
||||
}
|
||||
|
||||
Block *Conf::GetCommand(CommandSource &source)
|
||||
const Block *Conf::GetCommand(CommandSource &source)
|
||||
{
|
||||
const Anope::string &block_name = source.c ? "fantasy" : "command";
|
||||
|
||||
@@ -653,7 +667,7 @@ Block *Conf::GetCommand(CommandSource &source)
|
||||
return b;
|
||||
}
|
||||
|
||||
return &(Config->EmptyBlock);
|
||||
return &Block::EmptyBlock;
|
||||
}
|
||||
|
||||
File::File(const Anope::string &n, bool e) : name(n), executable(e)
|
||||
@@ -904,7 +918,7 @@ void Conf::LoadConf(File &file)
|
||||
/* Check defines */
|
||||
for (int i = 0; i < this->CountBlock("define"); ++i)
|
||||
{
|
||||
Block *define = this->GetBlock("define", i);
|
||||
const Block *define = this->GetBlock("define", i);
|
||||
|
||||
const Anope::string &dname = define->Get<const Anope::string>("name");
|
||||
|
||||
|
||||
+14
-14
@@ -422,20 +422,6 @@ void Anope::Init(int ac, char **av)
|
||||
#ifdef _WIN32
|
||||
if (!SupportedWindowsVersion())
|
||||
throw CoreException(GetWindowsVersion() + " is not a supported version of Windows");
|
||||
#else
|
||||
/* If we're root, issue a warning now */
|
||||
if (!getuid() && !getgid())
|
||||
{
|
||||
/* If we are configured to setuid later, don't issue a warning */
|
||||
Configuration::Block *options = Config->GetBlock("options");
|
||||
if (options->Get<const Anope::string>("user").empty())
|
||||
{
|
||||
std::cerr << "WARNING: You are currently running Anope as the root superuser. Anope does not" << std::endl;
|
||||
std::cerr << " require root privileges to run, and it is discouraged that you run Anope" << std::endl;
|
||||
std::cerr << " as the root superuser." << std::endl;
|
||||
sleep(3);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -527,6 +513,20 @@ void Anope::Init(int ac, char **av)
|
||||
ModuleManager::LoadModule(Config->GetBlock("module", i)->Get<const Anope::string>("name"), NULL);
|
||||
|
||||
#ifndef _WIN32
|
||||
/* If we're root, issue a warning now */
|
||||
if (!getuid() && !getgid())
|
||||
{
|
||||
/* If we are configured to setuid later, don't issue a warning */
|
||||
Configuration::Block *options = Config->GetBlock("options");
|
||||
if (options->Get<const Anope::string>("user").empty())
|
||||
{
|
||||
std::cerr << "WARNING: You are currently running Anope as the root superuser. Anope does not" << std::endl;
|
||||
std::cerr << " require root privileges to run, and it is discouraged that you run Anope" << std::endl;
|
||||
std::cerr << " as the root superuser." << std::endl;
|
||||
sleep(3);
|
||||
}
|
||||
}
|
||||
|
||||
/* We won't background later, so we should setuid now */
|
||||
if (Anope::NoFork)
|
||||
setuidgid();
|
||||
|
||||
+1
-1
@@ -368,7 +368,7 @@ void LogInfo::ProcessMessage(const Log *l)
|
||||
if (!bi)
|
||||
bi = this->bot;
|
||||
if (!bi)
|
||||
bi = c->ci->WhoSends();
|
||||
bi = c->WhoSends();
|
||||
if (bi)
|
||||
IRCD->SendPrivmsg(bi, c->name, "%s", buffer.c_str());
|
||||
}
|
||||
|
||||
+1
-1
@@ -607,7 +607,7 @@ void ModeManager::StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool Set,
|
||||
if (bi)
|
||||
s->bi = bi;
|
||||
else
|
||||
s->bi = c->ci->WhoSends();
|
||||
s->bi = c->WhoSends();
|
||||
|
||||
if (!modePipe)
|
||||
modePipe = new ModePipe();
|
||||
|
||||
+2
-2
@@ -121,11 +121,11 @@ Server::Server(Server *up, const Anope::string &sname, unsigned shops, const Ano
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName(it2->first);
|
||||
if (!cm || cm->type != MODE_LIST)
|
||||
continue;
|
||||
ModeManager::StackerAdd(c->ci->WhoSends(), c, cm, true, it2->second);
|
||||
ModeManager::StackerAdd(c->WhoSends(), c, cm, true, it2->second);
|
||||
}
|
||||
|
||||
if (!c->topic.empty() && !c->topic_setter.empty())
|
||||
IRCD->SendTopic(c->ci->WhoSends(), c);
|
||||
IRCD->SendTopic(c->WhoSends(), c);
|
||||
|
||||
c->syncing = true;
|
||||
}
|
||||
|
||||
+8
-1
@@ -467,9 +467,16 @@ bool User::IsServicesOper()
|
||||
{
|
||||
bool match = false;
|
||||
Anope::string match_host = this->GetIdent() + "@" + this->host;
|
||||
Anope::string match_ip = this->GetIdent() + "@" + this->ip.addr();
|
||||
for (unsigned i = 0; i < this->nc->o->hosts.size(); ++i)
|
||||
if (Anope::Match(match_host, this->nc->o->hosts[i]))
|
||||
{
|
||||
const Anope::string &userhost = this->nc->o->hosts[i];
|
||||
if (Anope::Match(match_host, userhost) || Anope::Match(match_ip, userhost))
|
||||
{
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
[requires]
|
||||
libmysqlclient/8.0.31
|
||||
openssl/1.1.1t
|
||||
pcre2/10.42
|
||||
sqlite3/3.41.1
|
||||
gettext/0.21
|
||||
libgettext/0.21
|
||||
|
||||
[options]
|
||||
libmysqlclient/*:shared=True
|
||||
openssl/*:shared=True
|
||||
pcre2/*:shared=True
|
||||
sqlite3/*:shared=True
|
||||
libgettext/*:shared=True
|
||||
|
||||
[imports]
|
||||
., *.dll -> extradll
|
||||
., *.lib -> extralib
|
||||
|
||||
[generators]
|
||||
cmake
|
||||
Reference in New Issue
Block a user