1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 18:54:47 +02:00

Compare commits

...

29 Commits

Author SHA1 Message Date
Adam 4b25719177 Fixed Windows build - this is the real 1.9.2-p2 release 2010-07-27 03:42:27 -04:00
Adam ebdb2fc6e3 Anope 1.9.2-p2 Release 2010-07-27 02:56:01 -04:00
Adam 2a79be7f91 Added hostserv/del command permission, fixed example.conf to show that hostserv/* is a command, not a permission 2010-07-26 20:15:38 -04:00
Adam d2b34c45c3 Added support for m_customprefix in inspircd20 2010-07-25 04:18:20 -04:00
Adam cbe7885f68 Fixed a typo in inspircd20.cpp that could cause not adding some modes 2010-07-25 03:39:49 -04:00
Adam 0af849cc05 Backported changes to inspircd20.cpp from 1.9 2010-07-25 03:27:26 -04:00
Adam 0d817b0572 Properly handle FMODEs from InspIRCd with more than 25 arguments.. reported by Angel-SL 2010-07-25 02:34:48 -04:00
Adam 48742435f5 Properly handle single messages received that have no newline 2010-07-24 03:32:43 -04:00
Adam 5ec1ca86b4 Fixed bug #1173, Made hs_request reject actually reject vhosts 2010-07-06 14:10:31 -04:00
Adam e29014c00a Fixed a crash on Windows and unreal when juped servers quit 2010-06-30 15:54:08 -04:00
Adam 147c58bd32 Delete all of our known users when we lose connection to the uplink 2010-06-28 13:16:55 -04:00
Adam 77ec1f2fa7 Log out users when they log in to another account. 2010-06-27 18:00:40 -04:00
Adam 2979a0e975 Log out users from their groups when they disconnect, keeps us from storing invalid pointers in the nickcore user list 2010-06-27 14:41:57 -04:00
Adam de4f0cc28f Anope 1.9.2-p1 Release 2010-06-26 13:52:20 -04:00
Adam d747f544c4 Made db-convert handle old corrupted databases from 1.8 that used mysql with rdb 2010-06-25 19:07:50 -05:00
Adam b1f85c575f Backported the example.conf change from r7bb90e1922b7 2010-06-24 00:41:53 -05:00
DukePyrolator 9104822c09 Merge branch '1.9.2-p1' of ssh://dukepyrolator@anope.git.sourceforge.net/gitroot/anope/anope into 1.9.2-p1 2010-06-22 22:27:35 +02:00
DukePyrolator f58d611edc changed the name of the logfile from servics.log.<date> to <date>.services.log to make windows users happy 2010-06-22 22:21:49 +02:00
Adam 0ac122c2d8 Made db-convert really convert nickalias lastseen/lastused/lastquit 2010-06-22 13:45:07 -04:00
Adam 40db8af50a Fixed a typo in the example.conf for m_helpchan 2010-06-22 11:27:29 -04:00
Adam 4d8f68e0cc Fixed some more problems with db-convert 2010-06-21 17:51:34 -04:00
Adam 7956bd839c Fixed db_plain to write databases on windows 2010-06-21 17:51:34 -04:00
Adam f63aed908f Fixed windows problems with clearing the runtime directory 2010-06-21 17:51:34 -04:00
Adam 8b9ba96767 Added m_helpchan to replace the cores helpchannel functionality 2010-06-20 19:45:10 -04:00
Adam 64b9fa419f Fixed the name of cs_forbid in chanserv:modules so it really loads 2010-06-20 19:43:09 -04:00
Adam 63c5fa3a44 Made db-converter add all of the core clients when converting a 1.8 database 2010-06-20 19:41:50 -04:00
Adam 87aa70f2a9 Made db-converter only write mlock params if there really is one, fixes some problems with converting mlock for certain databases 2010-06-20 19:41:43 -04:00
Adam- 89412e46c2 Fixed bug #1171 - Fixed defcon so it works on Windows
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@3010 5417fbe8-f217-4b02-8779-1006273d7864
2010-06-20 19:41:34 -04:00
Adam dacdafef0f Branch for 1.9.2-p1 2010-06-20 19:38:58 -04:00
28 changed files with 451 additions and 377 deletions
+22 -11
View File
@@ -195,12 +195,6 @@ serverinfo
*/
networkinfo
{
/*
* For the given channel, every user that has or gets op status of the channel
* will automatically receive the +h user mode. This directive is optional.
*/
helpchannel = "#help"
/*
* If set, Services will output log messages to the given channel. This
* directive is optional.
@@ -266,6 +260,13 @@ options
* NOTE: enc_old is Anope's previous (broken) MD5 implementation, if your databases
* were made using that module, continue to use it and do not use enc_md5.
*
* NOTE: enc_sha1 relies on how the OS stores 2+ byte data internally, and is
* potentially broken when moving between 2 different OSes, such as moving from
* Linux to Windows. It is recommended that you use enc_sha256 instead if you want
* to use an SHA-based encryption. If you choose to do so, it is also recommended
* that you first try to get everyone's passwords converted to enc_sha256 before
* switching OSes by placing enc_sha256 at the beginning of the list.
*
* Supported:
* - enc_none (plain text, no encryption)
* - enc_old (old, broken MD5 encryption)
@@ -273,8 +274,8 @@ options
* - enc_sha1 (SHA1 encryption)
* - enc_sha256 (SHA256 encryption with random salts)
*
* The first module in this list is the active encryption module. All new passwords are
* encrypted by this module. Old passwords stored in another encryption method are
* The first module in this list is the active encryption module. All new passwords are
* encrypted by this module. Old passwords stored in another encryption method are
* automatically re-encrypted by the active encryption module on next identify.
* Changing the order of the modules requires the services to restart.
*/
@@ -592,7 +593,7 @@ options
* nickserv/getpass nickserv/sendpass nickserv/getemail nickserv/suspend
* nickserv/resetpass
*
* hostserv/set - Can add/modify/delete any vhost
* hostserv/set hostserv/del
*
* operserv/global operserv/news operserv/stats operserv/kick
* operserv/mode operserv/session operserv/modlist operserv/ignore
@@ -632,7 +633,7 @@ opertype
opertype
{
name = "Helper"
privs = "hostserv/set"
privs = "hostserv/*"
}
/*
@@ -929,7 +930,7 @@ chanserv
* The core modules to load for ChanServ. This is a space separated list that corresponds
* to the base names of the modules for ChanServ. This directive is optional, but highly recommended.
*/
modules = "cs_help cs_register cs_set cs_xop cs_access cs_akick cs_drop cs_ban cs_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info forbid cs_suspend cs_status cs_unban"
modules = "cs_help cs_register cs_set cs_xop cs_access cs_akick cs_drop cs_ban cs_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info cs_forbid cs_suspend cs_status cs_unban"
/*
* The default options for newly registered channels. Note that changing these options
@@ -1520,6 +1521,16 @@ db_plain
database = "anope.db"
}
#module { name = "m_helpchan" }
m_helpchan
{
/*
* For the given channel, every user that has or gets op status of the channel
* will automatically receive the +h user mode. This directive is optional.
*/
helpchannel = "#help"
}
hs_request
{
/*
+1
View File
@@ -16,6 +16,7 @@ A Added a sha_256 encryption module
A Added the ability to load multiple encryption modules, and the ability to seamlessly convert your database between diferent encryptions
A Added configuration options to allow Anope to reconnect if it disconnects from the uplink instead of dieing
A Added support for linking with IPv6
A Added support for InspIRCd2.0's customprefix module
F Unban command to accept an optional nick arg
F Some typos in services.conf
F Crash when users change their host that are identified to a group, but not a nick
+1
View File
@@ -13,6 +13,7 @@ uplink:ipv6 added to enable IPv6 connectivity
options:maxretries added to specify the number of reconnect attempts allowed
options:retrywait added to specify how long to wait between reconnect attempts
opertype command chanserv/aop/list removed as it was unnecessary, use chanserv/access/list instead
opertype command privilege hostserv/del added
** MODIFIED CONFIGURATION DIRECTIVES **
options:encryption added enc_sha256
+4 -4
View File
@@ -117,7 +117,7 @@ class CoreExport UserMode : public Mode
virtual ~UserMode();
};
class UserModeParam : public UserMode
class CoreExport UserModeParam : public UserMode
{
public:
/** Default constructor
@@ -269,10 +269,10 @@ class CoreExport ChannelModeExcept : public ChannelModeList
/** Channel mode +I
*/
class CoreExport ChannelModeInvite : public ChannelModeList
class CoreExport ChannelModeInvex : public ChannelModeList
{
public:
ChannelModeInvite(char modeChar) : ChannelModeList(CMODE_INVITEOVERRIDE, modeChar) { }
public:
ChannelModeInvex(char modeChar) : ChannelModeList(CMODE_INVITEOVERRIDE, modeChar) { }
void AddMask(Channel *chan, const char *mask);
+3 -3
View File
@@ -608,7 +608,6 @@ int ServerConfig::Read(bool bail)
{"serverinfo", "hostname", "", new ValueContainerChar(&Config.ServiceHost), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"serverinfo", "pid", "services.pid", new ValueContainerChar(&Config.PIDFilename), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"serverinfo", "motd", "services.motd", new ValueContainerChar(&Config.MOTDFilename), DT_CHARPTR, ValidateNotEmpty},
{"networkinfo", "helpchannel", "", new ValueContainerChar(&Config.HelpChannel), DT_CHARPTR, NoValidation},
{"networkinfo", "logchannel", "", new ValueContainerChar(&Config.LogChannel), DT_CHARPTR, NoValidation},
{"networkinfo", "logbot", "no", new ValueContainerBool(&Config.LogBot), DT_BOOLEAN, NoValidation},
{"networkinfo", "networkname", "", new ValueContainerChar(&Config.NetworkName), DT_CHARPTR, ValidateNotEmpty},
@@ -1701,9 +1700,10 @@ int read_config(int reload)
/**
* Check all DEFCON dependiencies...
**/
if (Config.DefConLevel) {
if (Config.DefConLevel)
{
/* Build DefCon's */
DefCon.reserve(6);
DefCon.resize(6);
DefCon[5].reset();
for (unsigned int level = 1; level < 5; ++level) {
DefCon[level] = 0;
+5 -1
View File
@@ -44,6 +44,7 @@ static void ReadDatabase(Module *m = NULL)
EventReturn MOD_RESULT;
MDType Type = MD_NONE;
db.clear();
db.open(DatabaseFile.c_str(), std::ios_base::in);
if (!db.is_open())
@@ -71,6 +72,8 @@ static void ReadDatabase(Module *m = NULL)
buf.erase(buf.begin());
if (!buf.empty() && !sep.StreamEnd())
params.push_back(buf + " " + sep.GetRemaining());
else if (!sep.StreamEnd())
params.push_back(sep.GetRemaining());
else if (!buf.empty())
params.push_back(buf);
break;
@@ -584,7 +587,7 @@ class DBPlain : public Module
{
ircdproto->SendGlobops(findbot(Config.s_OperServ), "Unable to backup database!");
Alog() << "Unable to back up database!";
if (!Config.NoBackupOkay)
quitting = 1;
@@ -928,6 +931,7 @@ class DBPlain : public Module
{
BackupDatabase();
db.clear();
db.open(DatabaseFile.c_str(), std::ios_base::out | std::ios_base::trunc);
if (!db.is_open())
+1 -1
View File
@@ -18,7 +18,7 @@
class CommandHSDel : public Command
{
public:
CommandHSDel() : Command("DEL", 1, 1, "hostserv/set")
CommandHSDel() : Command("DEL", 1, 1, "hostserv/del")
{
}
+1 -1
View File
@@ -18,7 +18,7 @@
class CommandHSDelAll : public Command
{
public:
CommandHSDelAll() : Command("DELALL", 1, 1, "hostserv/set")
CommandHSDelAll() : Command("DELALL", 1, 1, "hostserv/del")
{
}
+4 -2
View File
@@ -89,10 +89,12 @@ class CommandNSDrop : public Command
notice_lang(Config.s_NickServ, u, NICK_X_DROPPED, nick);
else
notice_lang(Config.s_NickServ, u, NICK_DROPPED);
if (my_nick)
delete [] my_nick;
}
}
if (my_nick)
delete [] my_nick;
return MOD_CONT;
}
+1 -1
View File
@@ -34,7 +34,7 @@ static int get_logname(char *name, int count, struct tm *tm)
/* fix bug 577 */
strftime(timestamp, sizeof(timestamp), "%Y%m%d", tm);
snprintf(name, count, "logs/%s.%s", log_filename.c_str(), timestamp);
snprintf(name, count, "logs/%s.%s", timestamp, log_filename.c_str());
curday = tm->tm_yday;
return 1;
+9
View File
@@ -557,6 +557,15 @@ int main(int ac, char **av, char **envp)
{
FOREACH_MOD(I_OnServerDisconnect, OnServerDisconnect());
/* Clear all of our users */
User *u = firstuser();
while (u)
{
User *unext = nextuser();
delete u;
u = unext;
}
unsigned j = 0;
for (; j < (Config.MaxRetries ? Config.MaxRetries : j + 1); ++j)
{
+2 -2
View File
@@ -361,7 +361,7 @@ void ChannelModeExcept::DelMask(Channel *chan, const char *mask)
* @param chan The channel
* @param mask The invex
*/
void ChannelModeInvite::AddMask(Channel *chan, const char *mask)
void ChannelModeInvex::AddMask(Channel *chan, const char *mask)
{
Entry *invite;
@@ -388,7 +388,7 @@ void ChannelModeInvite::AddMask(Channel *chan, const char *mask)
* @param chan The channel
* @param mask The index
*/
void ChannelModeInvite::DelMask(Channel *chan, const char *mask)
void ChannelModeInvex::DelMask(Channel *chan, const char *mask)
{
Entry *invite;
-2
View File
@@ -59,8 +59,6 @@ Module::~Module()
for (i = 0; i < NUM_LANGS; i++)
this->DeleteLanguage(i);
remove(this->filename.c_str());
int idx;
CommandHash *current = NULL;
+10 -5
View File
@@ -19,9 +19,7 @@ void ModuleManager::LoadModuleList(std::list<std::string> &ModuleList)
{
for (std::list<std::string>::iterator it = ModuleList.begin(); it != ModuleList.end(); ++it)
{
Module *m = findModule(it->c_str());
if (!m)
ModuleManager::LoadModule(*it, NULL);
ModuleManager::LoadModule(*it, NULL);
}
}
@@ -53,11 +51,13 @@ static int moduleCopyFile(const char *name, const char *output)
#ifndef _WIN32
if ((srcfp = mkstemp(const_cast<char *>(output))) == -1)
return MOD_ERR_FILE_IO;
#else
if (!mktemp(const_cast<char *>(output)))
return MOD_ERR_FILE_IO;
#endif
{
fclose(source);
return MOD_ERR_FILE_IO;
}
Alog(LOG_DEBUG) << "Runtime module location: " << output;
@@ -66,6 +66,7 @@ static int moduleCopyFile(const char *name, const char *output)
#else
if ((target = fopen(output, "wb")) == NULL) {
#endif
fclose(source);
return MOD_ERR_FILE_IO;
}
while ((ch = fgetc(source)) != EOF) {
@@ -291,6 +292,7 @@ void ModuleManager::DeleteModule(Module *m)
DetachAll(m);
handle = m->handle;
std::string filename = m->filename;
ano_modclearerr();
destroy_func = function_cast<void (*)(Module *)>(dlsym(m->handle, "destroy_module"));
@@ -309,6 +311,9 @@ void ModuleManager::DeleteModule(Module *m)
if ((dlclose(handle)) != 0)
Alog() << dlerror();
}
if (!filename.empty())
DeleteFile(filename.c_str());
}
bool ModuleManager::Attach(Implementation i, Module* mod)
+13 -19
View File
@@ -717,16 +717,6 @@ void Module::DeleteLanguage(int langNumber)
void ModuleRunTimeDirCleanUp()
{
#ifndef _WIN32
DIR *dirp;
struct dirent *dp;
#else
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH + 1];
WIN32_FIND_DATA FileData;
char buffer[_MAX_PATH];
#endif
char dirbuf[BUFSIZE];
char filebuf[BUFSIZE];
@@ -736,9 +726,12 @@ void ModuleRunTimeDirCleanUp()
#ifndef _WIN32
DIR *dirp;
struct dirent *dp;
if ((dirp = opendir(dirbuf)) == NULL)
{
Alog(LOG_DEBUG) << "cannot open directory (" << dirbuf << ")";
Alog(LOG_DEBUG) << "Cannot open directory (" << dirbuf << ")";
return;
}
while ((dp = readdir(dirp)) != NULL) {
@@ -749,16 +742,16 @@ void ModuleRunTimeDirCleanUp()
continue;
}
snprintf(filebuf, BUFSIZE, "%s/%s", dirbuf, dp->d_name);
unlink(filebuf);
DeleteFile(filebuf);
}
closedir(dirp);
#else
/* Get the current working directory: */
if (_getcwd(buffer, _MAX_PATH) == NULL)
{
Alog(LOG_DEBUG) << "Unable to set Current working directory";
}
snprintf(szDir, sizeof(szDir), "%s\\%s\\*", buffer, dirbuf);
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH + 1];
WIN32_FIND_DATA FileData;
snprintf(szDir, sizeof(szDir), "%s/*", dirbuf);
hList = FindFirstFile(szDir, &FileData);
if (hList != INVALID_HANDLE_VALUE) {
@@ -766,7 +759,8 @@ void ModuleRunTimeDirCleanUp()
while (!fFinished) {
if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
snprintf(filebuf, BUFSIZE, "%s/%s", dirbuf, FileData.cFileName);
DeleteFile(filebuf);
if (!DeleteFile(filebuf))
Alog(LOG_DEBUG) << "Error deleting file " << filebuf << " - GetLastError() reports " << dlerror();
}
if (!FindNextFile(hList, &FileData)) {
if (GetLastError() == ERROR_NO_MORE_FILES) {
+15 -8
View File
@@ -65,7 +65,7 @@ struct HostRequest
time_t time;
};
std::map<std::string, HostRequest *> Requests;
std::map<ci::string, HostRequest *> Requests;
static Module *me;
@@ -221,10 +221,11 @@ class CommandHSActivate : public Command
if ((na = findnick(nick)))
{
std::map<std::string, HostRequest *>::iterator it = Requests.find(na->nick);
std::map<ci::string, HostRequest *>::iterator it = Requests.find(na->nick);
if (it != Requests.end())
{
na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time);
na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time);
delete it->second;
Requests.erase(it);
if (HSRequestMemoUser)
@@ -271,9 +272,12 @@ class CommandHSReject : public Command
const char *nick = params[0].c_str();
const char *reason = params.size() > 1 ? params[1].c_str() : NULL;
std::map<std::string, HostRequest *>::iterator it = Requests.find(nick);
std::map<ci::string, HostRequest *>::iterator it = Requests.find(nick);
if (it != Requests.end())
{
delete it->second;
Requests.erase(it);
if (HSRequestMemoUser)
{
if (reason)
@@ -319,7 +323,7 @@ class HSListBase : public Command
unsigned display_counter = 0;
tm *tm;
for (std::map<std::string, HostRequest *>::iterator it = Requests.begin(); it != Requests.end(); ++it)
for (std::map<ci::string, HostRequest *>::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it)
{
HostRequest *hr = it->second;
if (((counter >= from && counter <= to) || (!from && !to)) && display_counter < Config.NSListMax)
@@ -684,7 +688,7 @@ class HSRequest : public Module
if (na)
{
std::map<std::string, HostRequest *>::iterator it = Requests.find(na->nick);
std::map<ci::string, HostRequest *>::iterator it = Requests.find(na->nick);
if (it != Requests.end())
{
@@ -719,7 +723,7 @@ class HSRequest : public Module
void OnDatabaseWrite(void (*Write)(const std::string &))
{
for (std::map<std::string, HostRequest *>::iterator it = Requests.begin(); it != Requests.end(); ++it)
for (std::map<ci::string, HostRequest *>::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it)
{
HostRequest *hr = it->second;
std::stringstream buf;
@@ -806,9 +810,12 @@ void my_add_host_request(char *nick, char *vIdent, char *vhost, char *creator, t
hr->ident = vIdent ? vIdent : "";
hr->host = vhost;
hr->time = tmp_time;
std::map<std::string, HostRequest *>::iterator it = Requests.find(nick);
std::map<ci::string, HostRequest *>::iterator it = Requests.find(nick);
if (it != Requests.end())
{
delete it->second;
Requests.erase(it);
}
Requests.insert(std::make_pair(nick, hr));
}
+48
View File
@@ -0,0 +1,48 @@
/*
* (C) 2003-2010 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#include "module.h"
class HelpChannel : public Module
{
ci::string HelpChan;
public:
HelpChannel(const std::string &modname, const std::string &creator) : Module(modname, creator)
{
this->SetAuthor("Anope");
this->SetVersion(VERSION_STRING);
this->SetType(SUPPORTED);
Implementation i[] = { I_OnChannelModeSet, I_OnReload };
ModuleManager::Attach(i, this, 2);
OnReload(true);
}
EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name, const std::string &param)
{
if (Name == CMODE_OP && c && c->ci && c->name == this->HelpChan)
{
User *u = finduser(param);
if (u)
u->SetMode(findbot(Config.s_OperServ), UMODE_HELPOP);
}
return EVENT_CONTINUE;
}
void OnReload(bool)
{
ConfigReader config;
this->HelpChan = config.ReadValue("m_helpchan", "helpchannel", "", 0).c_str();
}
};
MODULE_INIT(HelpChannel)
+4 -5
View File
@@ -284,14 +284,13 @@ int split_buf(char *buf, const char ***argv, int colon_special)
void process(const std::string &buffer)
{
int retVal = 0;
Message *current = NULL;
char source[64];
char cmd[64];
char buf[512]; /* Longest legal IRC command line */
char source[64] = "";
char cmd[64] = "";
char buf[1024] = ""; // XXX InspIRCd 2.0 can send messages longer than 512 characters to servers... how disappointing.
char *s;
int ac; /* Parameters for the command */
const char **av;
Message *m;
Message *m, *current = NULL;
/* zero out the buffers before we do much else */
*buf = '\0';
+2 -2
View File
@@ -386,7 +386,7 @@ int anope_event_opertype(const char *source, int ac, const char **av)
int anope_event_fmode(const char *source, int ac, const char **av)
{
const char *newav[25];
const char *newav[128];
int n, o;
Channel *c;
@@ -920,7 +920,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+2 -5
View File
@@ -432,7 +432,7 @@ int anope_event_opertype(const char *source, int ac, const char **av)
int anope_event_fmode(const char *source, int ac, const char **av)
{
const char *newav[25];
const char *newav[128];
int n, o;
Channel *c;
@@ -1022,7 +1022,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
continue;
/* InspIRCd sends q and a here if they have no prefixes */
case 'q':
@@ -1175,9 +1175,6 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'h':
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
continue;
case 's':
ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
case 'B':
ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
continue;
+242 -273
View File
@@ -76,14 +76,9 @@ IRCDVar myIrcd[] = {
};
static int has_servicesmod = 0;
static int has_globopsmod = 0;
static int has_svsholdmod = 0;
static int has_chghostmod = 0;
static int has_chgidentmod = 0;
static int has_messagefloodmod = 0;
static int has_banexceptionmod = 0;
static int has_inviteexceptionmod = 0;
static int has_hidechansmod = 0;
/* Previously introduced user during burst */
static User *prev_u_intro = NULL;
@@ -251,6 +246,9 @@ class InspIRCdProto : public IRCDProto
void SendConnect()
{
send_cmd(NULL, "CAPAB START 1202");
send_cmd(NULL, "CAPAB CAPABILITIES :PROTOCOL=1202");
send_cmd(NULL, "CAPAB END");
inspircd_cmd_pass(uplink_server->password);
me_server = new_server(NULL, Config.ServerName, Config.ServerDesc, SERVER_ISME, TS6SID);
SendServer(me_server);
@@ -332,10 +330,7 @@ class InspIRCdProto : public IRCDProto
void SendGlobopsInternal(BotInfo *source, const char *buf)
{
if (has_globopsmod)
send_cmd(source ? source->uid : TS6SID, "SNONOTICE g :%s", buf);
else
send_cmd(source ? source->uid : TS6SID, "SNONOTICE A :%s", buf);
send_cmd(source ? source->uid : TS6SID, "SNONOTICE g :%s", buf);
}
void SendAccountLogin(User *u, NickCore *account)
@@ -431,7 +426,7 @@ int anope_event_opertype(const char *source, int ac, const char **av)
int anope_event_fmode(const char *source, int ac, const char **av)
{
const char *newav[25];
const char *newav[128];
int n, o;
Channel *c;
@@ -781,16 +776,15 @@ int anope_event_setident(const char *source, int ac, const char **av)
int anope_event_chgident(const char *source, int ac, const char **av)
{
User *u;
User *u = finduser(source);
u = finduser(av[0]);
if (!u)
{
Alog(LOG_DEBUG) << "CHGIDENT for nonexistent user " << av[0];
Alog(LOG_DEBUG) << "FIDENT for nonexistent user " << source;
return MOD_CONT;
}
u->SetIdent(av[1]);
u->SetIdent(av[0]);
return MOD_CONT;
}
@@ -955,50 +949,217 @@ int anope_event_metadata(const char *source, int ac, const char **av)
int anope_event_capab(const char *source, int ac, const char **av)
{
if (strcasecmp(av[0], "START") == 0) {
if (strcasecmp(av[0], "START") == 0)
{
if (ac < 2 || atoi(av[1]) < 1202)
{
send_cmd(NULL, "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START");
quitmsg = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
quitting = 1;
return MOD_STOP;
}
/* reset CAPAB */
has_servicesmod = 0;
has_globopsmod = 0;
has_svsholdmod = 0;
has_chghostmod = 0;
has_chgidentmod = 0;
has_messagefloodmod = 0;
has_banexceptionmod = 0;
has_inviteexceptionmod = 0;
has_hidechansmod = 0;
}
else if (strcasecmp(av[0], "CHANMODES") == 0)
{
spacesepstream ssep(av[1]);
std::string capab;
} else if (strcasecmp(av[0], "MODULES") == 0) {
if (strstr(av[1], "m_globops.so")) {
has_globopsmod = 1;
while (ssep.GetToken(capab))
{
std::string modename = capab.substr(0, capab.find('='));
std::string modechar = capab.substr(capab.find('=') + 1);
ChannelMode *cm = NULL;
if (modename == "admin")
cm = new ChannelModeStatus(CMODE_PROTECT, modechar[1], modechar[0]);
else if (modename == "allowinvite")
cm = new ChannelMode(CMODE_ALLINVITE, modechar[0]);
else if (modename == "auditorium")
cm = new ChannelMode(CMODE_AUDITORIUM, modechar[0]);
else if (modename == "autoop")
continue; // XXX Not currently tracked
else if (modename == "ban")
cm = new ChannelModeBan(modechar[0]);
else if (modename == "banexception")
cm = new ChannelModeExcept(modechar[0]);
else if (modename == "blockcaps")
cm = new ChannelMode(CMODE_BLOCKCAPS, modechar[0]);
else if (modename == "blockcolor")
cm = new ChannelMode(CMODE_BLOCKCOLOR, modechar[0]);
else if (modename == "c_registered")
cm = new ChannelModeRegistered(modechar[0]);
else if (modename == "censor")
cm = new ChannelMode(CMODE_FILTER, modechar[0]);
else if (modename == "delayjoin")
cm = new ChannelMode(CMODE_DELAYEDJOIN, modechar[0]);
else if (modename == "delaymsg")
continue;
else if (modename == "exemptchanops")
continue; // XXX
else if (modename == "filter")
continue; // XXX
else if (modename == "flood")
cm = new ChannelModeFlood(modechar[0], true);
else if (modename == "founder")
cm = new ChannelModeStatus(CMODE_OWNER, modechar[1], modechar[0]);
else if (modename == "halfop")
cm = new ChannelModeStatus(CMODE_HALFOP, modechar[1], modechar[0]);
else if (modename == "history")
continue; // XXX
else if (modename == "invex")
cm = new ChannelModeInvex(modechar[0]);
else if (modename == "inviteonly")
cm = new ChannelMode(CMODE_INVITE, modechar[0]);
else if (modename == "joinflood")
cm = new ChannelModeParam(CMODE_JOINFLOOD, modechar[0], true);
else if (modename == "key")
cm = new ChannelModeKey(modechar[0]);
else if (modename == "kicknorejoin")
cm = new ChannelModeParam(CMODE_NOREJOIN, modechar[0], true);
else if (modename == "limit")
cm = new ChannelModeParam(CMODE_LIMIT, modechar[0], true);
else if (modename == "moderated")
cm = new ChannelMode(CMODE_MODERATED, modechar[0]);
else if (modename == "namebase")
continue; // XXX
else if (modename == "nickflood")
cm = new ChannelModeParam(CMODE_NICKFLOOD, modechar[0], true);
else if (modename == "noctcp")
cm = new ChannelMode(CMODE_NOCTCP, modechar[0]);
else if (modename == "noextmsg")
cm = new ChannelMode(CMODE_NOEXTERNAL, modechar[0]);
else if (modename == "nokick")
cm = new ChannelMode(CMODE_NOKICK, modechar[0]);
else if (modename == "noknock")
cm = new ChannelMode(CMODE_NOKNOCK, modechar[0]);
else if (modename == "nonick")
cm = new ChannelMode(CMODE_NONICK, modechar[0]);
else if (modename == "nonotice")
cm = new ChannelMode(CMODE_NONOTICE, modechar[0]);
else if (modename == "op")
cm = new ChannelModeStatus(CMODE_OP, modechar[1], modechar[0]);
else if (modename == "operonly")
cm = new ChannelModeOper(modechar[0]);
else if (modename == "permanent")
cm = new ChannelMode(CMODE_PERM, modechar[0]);
else if (modename == "private")
cm = new ChannelMode(CMODE_PRIVATE, modechar[0]);
else if (modename == "redirect")
cm = new ChannelModeParam(CMODE_REDIRECT, modechar[0], true);
else if (modename == "reginvite")
cm = new ChannelMode(CMODE_REGISTEREDONLY, modechar[0]);
else if (modename == "regmoderated")
cm = new ChannelMode(CMODE_REGMODERATED, modechar[0]);
else if (modename == "secret")
cm = new ChannelMode(CMODE_SECRET, modechar[0]);
else if (modename == "sslonly")
cm = new ChannelMode(CMODE_SSL, modechar[0]);
else if (modename == "stripcolor")
cm = new ChannelMode(CMODE_STRIPCOLOR, modechar[0]);
else if (modename == "topiclock")
cm = new ChannelMode(CMODE_TOPIC, modechar[0]);
else if (modename == "voice")
cm = new ChannelModeStatus(CMODE_VOICE, modechar[1], modechar[0]);
/* Unknown status mode, (customprefix) - add it */
else if (modechar.length() == 2)
cm = new ChannelModeStatus(CMODE_END, modechar[1], modechar[0]);
if (cm)
ModeManager::AddChannelMode(cm);
else
Alog() << "Unrecognized mode string in CAPAB CHANMODES: " << capab;
}
if (strstr(av[1], "m_services_account.so")) {
has_servicesmod = 1;
}
else if (strcasecmp(av[0], "USERMODES") == 0)
{
spacesepstream ssep(av[1]);
std::string capab;
while (ssep.GetToken(capab))
{
std::string modename = capab.substr(0, capab.find('='));
std::string modechar = capab.substr(capab.find('=') + 1);
UserMode *um = NULL;
if (modename == "bot")
um = new UserMode(UMODE_BOT, modechar[0]);
else if (modename == "callerid")
um = new UserMode(UMODE_CALLERID, modechar[0]);
else if (modename == "cloak")
um = new UserMode(UMODE_CLOAK, modechar[0]);
else if (modename == "deaf")
um = new UserMode(UMODE_DEAF, modechar[0]);
else if (modename == "deaf_commonchan")
um = new UserMode(UMODE_COMMONCHANS, modechar[0]);
else if (modename == "helpop")
um = new UserMode(UMODE_HELPOP, modechar[0]);
else if (modename == "hidechans")
um = new UserMode(UMODE_PRIV, modechar[0]);
else if (modename == "hideoper")
um = new UserMode(UMODE_HIDEOPER, modechar[0]);
else if (modename == "invisible")
um = new UserMode(UMODE_INVIS, modechar[0]);
else if (modename == "oper")
um = new UserMode(UMODE_OPER, modechar[0]);
else if (modename == "regdeaf")
um = new UserMode(UMODE_REGPRIV, modechar[0]);
else if (modename == "servprotect")
um = new UserMode(UMODE_PROTECTED, modechar[0]);
else if (modename == "showwhois")
um = new UserMode(UMODE_WHOIS, modechar[0]);
else if (modename == "snomask")
continue; // XXX
else if (modename == "u_censor")
um = new UserMode(UMODE_FILTER, modechar[0]);
else if (modename == "u_registered")
um = new UserMode(UMODE_REGISTERED, modechar[0]);
else if (modename == "u_stripcolor")
um = new UserMode(UMODE_STRIPCOLOR, modechar[0]);
else if (modename == "wallops")
um = new UserMode(UMODE_WALLOPS, modechar[0]);
if (um)
ModeManager::AddUserMode(um);
else
Alog() << "Unrecognized mode string in CAPAB USERMODES: " << capab;
}
if (strstr(av[1], "m_svshold.so")) {
has_svsholdmod = 1;
}
else if (strcasecmp(av[0], "MODULES") == 0)
{
spacesepstream ssep(av[1]);
std::string module;
while (ssep.GetToken(module))
{
if (module == "m_svshold.so")
has_svsholdmod = 1;
}
if (strstr(av[1], "m_chghost.so")) {
has_chghostmod = 1;
}
else if (strcasecmp(av[0], "MODSUPPORT") == 0)
{
spacesepstream ssep(av[1]);
std::string module;
while (ssep.GetToken(module))
{
if (module == "m_services_account.so")
has_servicesmod = 1;
else if (module == "m_chghost.so")
has_chghostmod = 1;
else if (module == "m_chgident.so")
has_chgidentmod = 1;
else if (module == "m_servprotect.so")
ircd->pseudoclient_mode = "+Ik";
}
if (strstr(av[1], "m_chgident.so")) {
has_chgidentmod = 1;
}
if (strstr(av[1], "m_messageflood.so")) {
has_messagefloodmod = 1;
}
if (strstr(av[1], "m_banexception.so")) {
has_banexceptionmod = 1;
}
if (strstr(av[1], "m_inviteexception.so")) {
has_inviteexceptionmod = 1;
}
if (strstr(av[1], "m_hidechans.so")) {
has_hidechansmod = 1;
}
if (strstr(av[1], "m_servprotect.so")) {
ircd->pseudoclient_mode = "+Ik";
}
} else if (strcasecmp(av[0], "CAPABILITIES") == 0) {
}
else if (strcasecmp(av[0], "CAPABILITIES") == 0)
{
spacesepstream ssep(av[1]);
std::string capab;
while (ssep.GetToken(capab))
@@ -1012,151 +1173,34 @@ int anope_event_capab(const char *source, int ac, const char **av)
sep.GetToken(modebuf);
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'b':
ModeManager::AddChannelMode(new ChannelModeBan('b'));
continue;
case 'e':
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
/* InspIRCd sends q and a here if they have no prefixes */
case 'q':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '@'));
continue;
case 'a':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT , 'a', '@'));
continue;
// XXX list modes needs a bit of a rewrite, we need to be able to support +g here
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
}
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
// XXX list modes needs a bit of a rewrite
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
}
sep.GetToken(modebuf);
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'k':
ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
}
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
}
sep.GetToken(modebuf);
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'F':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NICKFLOOD, 'F', true));
continue;
case 'J':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NOREJOIN, 'J', true));
continue;
case 'L':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L', true));
continue;
case 'f':
ModeManager::AddChannelMode(new ChannelModeFlood('f', true));
continue;
case 'j':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
continue;
case 'l':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
}
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
}
sep.GetToken(modebuf);
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'A':
ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, 'A'));
continue;
case 'B':
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCAPS, 'B'));
continue;
case 'C':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
continue;
case 'D':
ModeManager::AddChannelMode(new ChannelMode(CMODE_DELAYEDJOIN, 'D'));
continue;
case 'G':
ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
continue;
case 'K':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
continue;
case 'M':
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
continue;
case 'N':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
continue;
case 'O':
ModeManager::AddChannelMode(new ChannelModeOper('O'));
continue;
case 'P':
ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, 'P'));
continue;
case 'Q':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
continue;
case 'R':
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
continue;
case 'S':
ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
continue;
case 'T':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'T'));
continue;
case 'c':
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
continue;
case 'i':
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
continue;
case 'm':
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
continue;
case 'n':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
continue;
case 'p':
ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
continue;
case 'r':
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 's':
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
continue;
case 't':
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
continue;
case 'u':
ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
continue;
case 'z':
ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
continue;
default:
ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
}
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
}
}
else if (capab.find("USERMODES") != std::string::npos)
@@ -1165,99 +1209,26 @@ int anope_event_capab(const char *source, int ac, const char **av)
commasepstream sep(modes);
std::string modebuf;
while (sep.GetToken(modebuf))
sep.GetToken(modebuf);
sep.GetToken(modebuf);
if (sep.GetToken(modebuf))
{
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'h':
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
continue;
case 's':
ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
case 'B':
ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
continue;
case 'G':
ModeManager::AddUserMode(new UserMode(UMODE_FILTER, 'G'));
continue;
case 'H':
ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, 'H'));
continue;
case 'I':
ModeManager::AddUserMode(new UserMode(UMODE_PRIV, 'I'));
continue;
case 'Q':
ModeManager::AddUserMode(new UserMode(UMODE_HIDDEN, 'Q'));
continue;
case 'R':
ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
continue;
case 'S':
ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
case 'W':
ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, 'W'));
continue;
case 'c':
ModeManager::AddUserMode(new UserMode(UMODE_COMMONCHANS, 'c'));
continue;
case 'g':
ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g'));
continue;
case 'i':
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
continue;
case 'k':
ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'k'));
continue;
case 'o':
ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
continue;
case 'r':
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
continue;
case 'w':
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
continue;
case 'x':
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
continue;
case 'd':
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
continue;
default:
ModeManager::AddUserMode(new UserMode(UMODE_END, modebuf[t]));
}
if (ModeManager::FindUserModeByChar(modebuf[t]))
continue;
ModeManager::AddUserMode(new UserModeParam(UMODE_END, modebuf[t]));
}
}
}
else if (capab.find("PREFIX=(") != std::string::npos)
{
std::string modes(capab.begin() + 8, capab.begin() + capab.find(")"));
std::string chars(capab.begin() + capab.find(")") + 1, capab.end());
for (size_t t = 0; t < modes.size(); ++t)
if (sep.GetToken(modebuf))
{
switch (modes[t])
for (size_t t = 0; t < modebuf.size(); ++t)
{
case 'q':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', chars[t]));
continue;
case 'a':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', chars[t]));
continue;
case 'o':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', chars[t]));
continue;
case 'h':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', chars[t]));
continue;
case 'v':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', chars[t]));
if (ModeManager::FindUserModeByChar(modebuf[t]))
continue;
ModeManager::AddUserMode(new UserMode(UMODE_END, modebuf[t]));
}
}
}
@@ -1267,20 +1238,18 @@ int anope_event_capab(const char *source, int ac, const char **av)
ircd->maxmodes = atoi(maxmodes.c_str());
}
}
} else if (strcasecmp(av[0], "END") == 0) {
if (!has_globopsmod) {
send_cmd(NULL, "ERROR :m_globops is not loaded. This is required by Anope");
quitmsg = "Remote server does not have the m_globops module loaded, and this is required.";
quitting = 1;
return MOD_STOP;
}
if (!has_servicesmod) {
}
else if (strcasecmp(av[0], "END") == 0)
{
if (!has_servicesmod)
{
send_cmd(NULL, "ERROR :m_services_account.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
quitting = 1;
return MOD_STOP;
}
if (!has_hidechansmod) {
if (!ModeManager::FindUserModeByName(UMODE_PRIV))
{
send_cmd(NULL, "ERROR :m_hidechans.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
quitting = 1;
@@ -1356,7 +1325,7 @@ void moduleAddIRCDMsgs() {
m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
m = createMessage("SVSMODE", anope_event_mode) ;addCoreMessage(IRCD,m);
m = createMessage("FHOST", anope_event_chghost); addCoreMessage(IRCD,m);
m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m);
m = createMessage("FIDENT", anope_event_chgident); addCoreMessage(IRCD,m);
m = createMessage("FNAME", anope_event_chgname); addCoreMessage(IRCD,m);
m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m);
m = createMessage("SETIDENT", anope_event_setident); addCoreMessage(IRCD,m);
+1 -1
View File
@@ -854,7 +854,7 @@ void moduleAddModes()
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
+1 -1
View File
@@ -459,7 +459,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+2 -5
View File
@@ -199,9 +199,9 @@ static void delete_server(Server * serv, const char *quitreason)
return;
}
Alog(LOG_DEBUG) << "delete_server() called, deleting " << serv->name << "(" << serv->suid << ") uplinked to "
Alog(LOG_DEBUG) << "delete_server() called, deleting " << serv->name << "(" << (serv->suid ? serv->suid : "") << ") uplinked to "
<< (serv->uplink ? serv->uplink->name : "NOTHING") << "("
<< (serv->uplink ? serv->uplink->suid : "NOSUIDUPLINK") << ")";
<< (serv->uplink && serv->uplink->suid ? serv->uplink->suid : "") << ")";
if (Capab.HasFlag(CAPAB_NOQUIT) || Capab.HasFlag(CAPAB_QS))
{
@@ -218,9 +218,6 @@ static void delete_server(Server * serv, const char *quitreason)
if (na->last_quit)
delete [] na->last_quit;
na->last_quit = (quitreason ? sstrdup(quitreason) : NULL);
}
if (Config.LimitSessions && !is_ulined(u->server->name)) {
del_session(u->host);
}
delete u;
}
+5
View File
@@ -202,6 +202,11 @@ bool Socket::ProcessRead()
sbuffer.append(buffer);
extrabuf.clear();
size_t lastnewline = sbuffer.find_last_of('\n');
if (lastnewline == std::string::npos)
{
extrabuf = sbuffer;
return true;
}
if (lastnewline < sbuffer.size() - 1)
{
extrabuf = sbuffer.substr(lastnewline);
+42 -17
View File
@@ -280,12 +280,9 @@ int main(int argc, char *argv[])
na = (NickAlias *)calloc(1, sizeof(NickAlias));
READ(read_string(&na->nick, f));
char *mask;
char *real;
char *quit;
READ(read_string(&mask, f));
READ(read_string(&real, f));
READ(read_string(&quit, f));
READ(read_string(&na->last_usermask, f));
READ(read_string(&na->last_realname, f));
READ(read_string(&na->last_quit, f));
READ(read_int32(&tmp32, f));
na->time_registered = tmp32;
@@ -296,9 +293,6 @@ int main(int argc, char *argv[])
na->nc = findcore(s, 0);
na->nc->aliascount++;
free(s);
free(mask);
free(real);
free(quit);
*nalast = na;
nalast = &na->next;
@@ -397,7 +391,7 @@ int main(int argc, char *argv[])
if (nc->accesscount)
{
for (j = 0, access = nc->access; j < nc->accesscount; j++, access++)
for (j = 0, access = nc->access; j < nc->accesscount && *access; j++, access++)
fs << "MD ACCESS " << *access << std::endl;
}
@@ -497,6 +491,37 @@ int main(int argc, char *argv[])
}
if (input == "y")
broken = 1;
input = "";
while (input != "y" && input != "n")
{
std::cout << std::endl << "Are you converting a 1.8.x database? (y/n) " << std::endl << "? ";
std::cin >> input;
}
/* 1.8 doesn't have nickserv etc in bot.db, create them */
if (input == "y")
{
time_t now = time(NULL);
fs << "BI NickServ NickServ services.anope.org " << now << " 0 :NickServ" << std::endl;
fs << "MD FLAGS NICKSERV" << std::endl;
fs << "BI ChanServ ChanServ services.anope.org " << now << " 0 :ChanServ" << std::endl;
fs << "MD FLAGS CHANSERV" << std::endl;
fs << "BI BotServ BotServ services.anope.org " << now << " 0 :BotServ" << std::endl;
fs << "MD FLAGS BOTSERV" << std::endl;
fs << "BI HostServ HostServ services.anope.org " << now << " 0 :HostServ" << std::endl;
fs << "MD FLAGS HOSTSERV" << std::endl;
fs << "BI OperServ OperServ services.anope.org " << now << " 0 :OperServ" << std::endl;
fs << "MD FLAGS OPERSERV" << std::endl;
fs << "BI MemoServ MemoServ services.anope.org " << now << " 0 :MemoServ" << std::endl;
fs << "MD FLAGS MEMOSERV" << std::endl;
fs << "BI Global Global services.anope.org " << now << " 0: Global" << std::endl;
fs << "MD FLAGS GLOBAL" << std::endl;
}
while ((c = getc_db(f)) == 1) {
READ(read_string(&nick, f));
@@ -808,7 +833,7 @@ int main(int argc, char *argv[])
<< ((ci->flags & CI_SIGNKICK_LEVEL) ? " SIGNKICKLEVEL" : "")
<< ((ci->flags & CI_XOP ) ? " XOP" : "")
<< ((ci->flags & CI_SUSPENDED ) ? " SUSPENDED" : "") << std::endl;
if (ci->desc)
if (ci->desc && *ci->desc)
fs << "MD DESC :" << ci->desc << std::endl;
if (ci->url)
fs << "MD URL :" << ci->url << std::endl;
@@ -854,16 +879,16 @@ int main(int argc, char *argv[])
process_mlock_modes(fs, ci->mlock_off, ircd);
fs << std::endl;
}
if (ci->mlock_limit || ci->mlock_key || ci->mlock_flood || ci->mlock_redirect)
if (ci->mlock_limit || (ci->mlock_key && *ci->mlock_key) || (ci->mlock_flood && *ci->mlock_flood) || (ci->mlock_redirect && *ci->mlock_redirect))
{
fs << "MD MLP";
if (ci->mlock_limit)
fs << " CMODE_LIMIT " << ci->mlock_limit;
if (ci->mlock_key)
if (ci->mlock_key && *ci->mlock_key)
fs << " CMODE_KEY " << ci->mlock_key;
if (ci->mlock_flood)
if (ci->mlock_flood && *ci->mlock_flood)
fs << " CMODE_FLOOD " << ci->mlock_flood;
if (ci->mlock_redirect)
if (ci->mlock_redirect && *ci->mlock_redirect)
fs << " CMODE_REDIRECT " << ci->mlock_redirect;
fs << std::endl;
}
@@ -931,8 +956,8 @@ int main(int argc, char *argv[])
fs << "MD BI BADWORD "
<< (( ci->badwords[j].type == 0 ) ? "ANY " : "" )
<< (( ci->badwords[j].type == 1 ) ? "SINGLE " : "" )
<< (( ci->badwords[j].type == 3 ) ? "START " : "" )
<< (( ci->badwords[j].type == 4 ) ? "END " : "" )
<< (( ci->badwords[j].type == 2 ) ? "START " : "" )
<< (( ci->badwords[j].type == 3 ) ? "END " : "" )
<< ":" << ci->badwords[j].word << std::endl;
}
}
+8 -6
View File
@@ -226,6 +226,8 @@ User::~User()
{
Alog(LOG_DEBUG_2) << "User::~User() called";
this->Logout();
if (Config.LogUsers)
{
const char *srealname = normalizeBuffer(this->realname);
@@ -249,6 +251,11 @@ User::~User()
this->chans.front()->chan->DeleteUser(this);
}
if (Config.LimitSessions && !is_ulined(this->server->name))
{
del_session(this->host);
}
if (this->prev)
this->prev->next = this->next;
else
@@ -450,6 +457,7 @@ void User::AutoID(const std::string &account)
*/
void User::Login(NickCore *core)
{
this->Logout();
nc = core;
core->Users.push_back(this);
}
@@ -1056,9 +1064,6 @@ void do_quit(const char *source, int ac, const char **av)
delete [] na->last_quit;
na->last_quit = *av[0] ? sstrdup(av[0]) : NULL;
}
if (Config.LimitSessions && !is_ulined(user->server->name)) {
del_session(user->host);
}
FOREACH_MOD(I_OnUserQuit, OnUserQuit(user, *av[0] ? av[0] : ""));
delete user;
}
@@ -1089,9 +1094,6 @@ void do_kill(const std::string &nick, const std::string &msg)
delete [] na->last_quit;
na->last_quit = !msg.empty() ? sstrdup(msg.c_str()) : NULL;
}
if (Config.LimitSessions && !is_ulined(user->server->name)) {
del_session(user->host);
}
delete user;
}
+2 -2
View File
@@ -8,8 +8,8 @@
VERSION_MAJOR="1"
VERSION_MINOR="9"
VERSION_PATCH="2"
VERSION_EXTRA=""
VERSION_BUILD="3007"
VERSION_EXTRA="-p2"
VERSION_BUILD="2"