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

Compare commits

..

79 Commits

Author SHA1 Message Date
Adam b578e32531 Anope 2.0.1 Release 2014-05-30 20:57:32 -04:00
Adam 4d8e3b847d Fix f627a3bacd, really make BotInfo::Part fire events like the normal user part message does 2014-05-30 20:57:23 -04:00
Adam eaade23f9b Update language files 2014-05-30 18:14:55 -04:00
Adam f20bac996d Fix Windows build and update library names to the newer ones.
Also fix crash on Windows when unloading a module because it threw an
exception.
2014-05-30 18:14:55 -04:00
Adam 93bfd4cbe1 Updates Changes and Changes.conf 2014-05-30 16:16:54 -04:00
Adam 6620f9e9bd Don't allow setting -y on inspircd, secureops etc will try to enforce this 2014-05-30 15:16:03 -04:00
Adam dc64cfc940 Remove version.log 2014-05-30 15:16:03 -04:00
Adam f8829783d2 Queue the grouped nicks to update when NickCore::SetDisplay is called, since they serialize the display field 2014-05-30 15:16:03 -04:00
Adam d6e600f74b Fix access check in ns_group 2014-05-30 15:16:03 -04:00
Adam 5f7113bc0e Merge pull request #80 from attilamolnar/2.0+exampleconf
Fix the name of the SSL modules in comments in modules.conf.example
2014-05-30 15:15:43 -04:00
Robby- dc4daa25a7 example.chk: Use a more reliable way to detect if services are running. 2014-05-30 18:27:15 +02:00
Robby- 0cadaedfbe Update the dutch language file. 2014-05-30 18:24:42 +02:00
Attila Molnar 11ad788dfd Fix the name of the SSL modules in comments in modules.conf.example 2014-05-30 18:12:26 +02:00
Adam 38a60d9142 Merge pull request #78 from H7-25/it_IT
Updated italian lnguage file
2014-05-28 13:48:19 -04:00
Adam e8ad509aa5 Fix dlerror() on Windows and do not abort if err is not set 2014-05-27 12:55:03 -04:00
Adam 37b3ed8ef3 Do not normalize extban masks 2014-05-27 12:55:03 -04:00
Adam a6af422184 Set timer owner for nickserv timers 2014-05-27 12:55:03 -04:00
Adam 53acb73193 Fix default db name in db_flatfifle in a couple places 2014-05-27 12:55:03 -04:00
H7-25 57f6d4f49c Updated italian language 2014-05-22 21:24:38 +02:00
Adam d0467adea2 Merge pull request #79 from Jyzee/langFR-Patch
Make command group descriptions translatable.
2014-05-22 13:21:46 -04:00
Jyzee 16924f68c0 Update french language file. 2014-05-22 19:05:25 +02:00
Jyzee d280c48e6b Regenerate french language file. 2014-05-22 19:04:26 +02:00
Jyzee f0c0daa644 Make command group descriptions translatable. 2014-05-22 19:00:56 +02:00
Adam 7a2d027e1d Fix deflanguage from 4034b3054a, this shouldn't have been removed 2014-05-21 10:47:50 -04:00
Adam f627a3bacd Core prep for p10 stuff 2014-05-21 08:50:40 -04:00
Adam 5a1257b7f0 Fix extra space in log messages with logtype channel and no source 2014-05-21 08:40:54 -04:00
Adam 866f3f32ab Speed up akill xline checks
Cache xline nick, user, host, etc instead of rebuilding it everytime its
requested. Store users ip in sockaddr form and not string form to
prevent having to rebuild sockaddrs when checking xlines.

Also do not try to convert empty config values in Config::Get as this
can be rather common if a non string configuration value is not set, and
the cost of the ConvertException is great.
2014-05-20 21:16:00 -04:00
Adam 20ce170024 Show account names in log messages 2014-05-20 12:19:26 -04:00
Adam 4034b3054a Add English language file which users can edit to modify language strings 2014-05-20 11:41:05 -04:00
Adam e581158645 Fix two compile warnings in access.cpp on newer compiles 2014-05-20 10:00:34 -04:00
Adam 01021131ca Also search channel descriptions and topics in /cs list 2014-05-20 09:52:26 -04:00
Adam 13ea98a02e Fix server usercounter not being incremented when servers are bursting 2014-05-19 22:46:28 -04:00
Adam db56a61f86 Fixup previous commit when serializing access entries 2014-05-19 22:45:45 -04:00
Adam df321a118e Fix access lists showing the wrong mask if the display nick for a group
expires but the group still exists. This can cause access entries for
nicks to not be deleted whenever the nicks are deleted.
2014-05-14 19:10:23 -04:00
Adam 1931fcf0e5 Fix webpanel mode list to only show real list modes 2014-05-13 22:59:41 -04:00
Adam 63b02b8c97 Sanitize nuh masks more to prevent the other side from rewriting them, which screws with our internal tracking of them 2014-05-13 22:57:53 -04:00
Adam 1c8a77ab9f Accept an optional reason for svspart 2014-05-13 19:52:05 -04:00
Adam 0c7d53f81e Don't show both online from's if they have the same mask in ns_info 2014-05-13 18:38:14 -04:00
Adam bcc3ae5742 Merge pull request #76 from miwob/master
Update ircd-hybrid protocol module
2014-05-13 17:50:07 -04:00
Adam 4e67e0897a Merge pull request #77 from Cronus89/patch-2
Update Paramater length for os_dns to fix DNS SET
2014-05-13 17:47:33 -04:00
Michael Wobst 76a9538441 Fix compile warning in base64.cpp:B64Encode
/home/ircd/anope/src/base64.cpp: In function ‘void Anope::B64Encode(const Anope::string&, Anope::string&)’:
/home/ircd/anope/src/base64.cpp:85: warning: ‘input’ is used uninitialized in this function
2014-05-13 18:28:53 +02:00
Cronus89 91c7862579 Update Paramater length for os_dns to fix DNS SET 2014-05-13 11:12:00 -05:00
Michael Wobst 6b6bc81999 Update ircd-hybrid protocol module 2014-05-13 18:00:10 +02:00
Adam 1f2c385bb9 Add config options to ns_suspend and cs_suspend to configure which information is shown to non opers 2014-05-01 21:03:32 -04:00
Adam d79dd0b7d7 Pass password to nick register event so modules like m_ldap_authentication can create the respective account using the decrypted password which might not always be available 2014-05-01 18:38:17 -04:00
Adam 8b2e8137f6 Merge pull request #75 from attilamolnar/2.0+inspircd-globops
InspIRCd 2.0: Recognize GLOBOPS in CAPAB CAPABILITIES
2014-05-01 18:19:23 -04:00
Adam 732466d8f4 Merge pull request #74 from attilamolnar/2.0+fix-os-stats
Fix undefined symbol error when loading os_stats, caused by 82008d50
2014-05-01 18:19:01 -04:00
Attila Molnar 3049916ade Fix undefined symbol error when loading os_stats, caused by 82008d507c 2014-04-30 01:15:10 +02:00
Attila Molnar 0afd666f22 InspIRCd 2.0: Recognize GLOBOPS in CAPAB CAPABILITIES 2014-04-29 22:55:10 +02:00
Adam 8021a53ac4 Fix misc help output to not be case sensitive 2014-04-26 18:30:54 -04:00
Adam 0663f5e412 Fire the on user quit event when bots are deleted too 2014-04-26 17:45:16 -04:00
Adam 2ee496b8ac Change the "does not expire" string in ns_group to NO_EXPIRE which is translatable 2014-04-26 17:30:58 -04:00
Adam 3abb18721b Accept non server sources for SQUIT 2014-04-26 17:21:33 -04:00
Adam 4eb0a3bdb7 Fix ModeManager::RebuildStatusModes, not all modes are in GetChannelModes() at the time this is called 2014-04-26 15:24:19 -04:00
Adam 6a03eb69eb Add "virtual mode" support
This allows fully tracking extbans and other modes set by a different
underlying mode, such as InspIRCd's namedmodes

Add two configuration options to cs_ban to configure which mode is set
and whether or not to kick banned users.

Add default "mute" fantasy command to botserv.example.conf
2014-04-25 16:51:06 -04:00
Adam 4fa2a00bd5 Close timed out proxyscan sockets better 2014-04-25 16:47:10 -04:00
Adam 82008d507c Fix Stas::Unserialize to return the instance 2014-04-25 16:46:37 -04:00
Adam 2ab4f175a8 Don't allow users to join channels they are already in 2014-04-25 16:20:23 -04:00
Adam c9473bcc67 Fix botserv/kick/bolds desc 2014-04-24 17:10:06 -04:00
Adam 75ed5a9b59 Fix os_stats counters not saving with db_sql_live. Bleh. 2014-04-24 01:50:50 -04:00
Adam f010ab7dbf Resend ircd login name on /ns set display 2014-04-24 01:40:56 -04:00
Adam 00b2cc9ce6 Require at least user@host format for akills. Fix XLine::GetHost() not returning anything if an xline only has a host 2014-04-24 01:38:45 -04:00
Adam d52cc7bcbc Bug #1587 - fix bot change not properly reintroducing clients 2014-04-24 01:25:25 -04:00
Adam 63838fa77d Merge pull request #72 from attilamolnar/2.0+svsnickfix
Fix SVSNICK target being a nick even when UIDs are available
2014-04-20 02:03:03 -04:00
Attila Molnar e36f8143e3 Fix SVSNICK target being a nick even when UIDs are available 2014-04-19 14:35:50 +02:00
Adam 72b26043b2 Remove unused event.
Mark some oper only usermodes as oper only.
Fix reading SID in TS6_SID_Retrieve
2014-04-18 02:21:06 -04:00
Adam f369157906 Use OnChanRegistered instead of OnCreateChan to set default mlocks.
Because OnCreateChan is called from ChannelInfo's constructor, during
DB loading it could cause mode locks to be unserialized without having
all channels loaded, which breaks things.
2014-04-17 16:58:04 -04:00
Adam ba46b8e4ab Merge pull request #70 from Jyzee/langFR-Patch
Update French language file.
2014-04-09 02:26:24 -04:00
Jyzee 254901aace Update French language file. 2014-04-09 07:49:14 +02:00
Adam c1c45a5db9 Do not clear all extension items tied to objects when unserializing.
Instead, pass the old object to the unserialization functions and let
them incrementally update the object.
2014-04-07 15:28:07 -04:00
Adam a65e95837f Document that memo_mail can be in nickserv defaults. These should move to memoserv.conf one day. 2014-04-06 23:13:46 -04:00
Adam 43219d3906 Do not apply module changes on rehash until after the new config has been applied. Fix renaming opertypes on reload. 2014-04-06 23:01:10 -04:00
Adam 1f8dec4c24 Fix /os mode to not require a mode when setting param modes which taken no argument when setting 2014-04-06 18:09:36 -04:00
Adam fb5c5e3442 Set minus no arg on +l in all proto mods
Set oper modes/vhost on oper too, evan after iding
Add umode +q to plexus
2014-04-02 22:37:35 -04:00
Adam e357c39774 Add travis config 2014-04-01 23:34:02 -04:00
Adam 10732baec2 Fix compile error in cs_set_misc with C++11 enabled 2014-03-31 22:41:02 -04:00
Zantox 068c6989de Small Grammar Fix 2014-03-31 20:19:03 -04:00
Adam 317d55f3f1 Fix ns_set password to read the correct parameter.
Even though 1 is past the "end" of the vector, because vectors never
shrink and due to how the command parser works, it is always less than
the capacity, and almost always contains what is in params[0] (though
this is of course implementation dependant), which is why this was not
identified sooner, as it executes cleanly under valgrind on every machine I can find.
2014-03-31 20:11:36 -04:00
Adam 1397fda786 Bump to Anope 2.0.1-git 2014-03-31 20:10:51 -04:00
130 changed files with 16910 additions and 9831 deletions
+16
View File
@@ -0,0 +1,16 @@
language: cpp
compiler:
- gcc
before_script:
- mkdir build
- cd build
- cmake -DINSTDIR:STRING=~/services -DDEFUMASK:STRING=077 -DCMAKE_BUILD_TYPE:STRING=DEBUG -DUSE_RUN_CC_PL:BOOLEAN=ON ..
script:
- make
notifications:
irc:
- "irc.anope.org#anope-devel"
+6 -2
View File
@@ -432,11 +432,15 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
# Reset libraries
set(LIBRARIES)
# Check to see if there are any lines matching: /* RequiredLibraries: [something] */
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
if(WIN32)
read_from_file(${SRC} "/\\\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
else(WIN32)
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
endif(WIN32)
# Iterate through those lines
foreach(REQUIRED_LIBRARY ${REQUIRED_LIBRARIES})
# Strip off the /* RequiredLibraries: and */ from the line
string(REGEX REPLACE "/\\*[ \t]*RequiredLibraries:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_LIBRARY ${REQUIRED_LIBRARY})
string(REGEX REPLACE "/\\*[ \t]*Required.*Libraries:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_LIBRARY ${REQUIRED_LIBRARY})
# Replace all commas with semicolons
string(REGEX REPLACE "," ";" REQUIRED_LIBRARY ${REQUIRED_LIBRARY})
# Iterate through the libraries given
+1
View File
@@ -386,6 +386,7 @@ fantasy { name = "LEVELS"; command = "chanserv/levels"; }
fantasy { name = "LIST"; command = "chanserv/list"; prepend_channel = false; }
fantasy { name = "LOG"; command = "chanserv/log"; }
fantasy { name = "MODE"; command = "chanserv/mode"; }
fantasy { name = "MUTE"; command = "chanserv/ban"; kick = no; mode = "QUIET"; }
fantasy { name = "OP"; command = "chanserv/modes"; }
fantasy { name = "OWNER"; command = "chanserv/modes"; }
fantasy { name = "PROTECT"; command = "chanserv/modes"; }
+18 -5
View File
@@ -799,25 +799,25 @@ privilege
command_group
{
name = "chanserv/access"
description = "Used to manage the list of privileged users"
description = _("Used to manage the list of privileged users")
}
command_group
{
name = "chanserv/status"
description = "Used to modify the channel status of you or other users"
description = _("Used to modify the channel status of you or other users")
}
command_group
{
name = "chanserv/management"
description = "Used to manage channels"
description = _("Used to manage channels")
}
command_group
{
name = "chanserv/admin"
description = "Services Operator commands"
description = _("Services Operator commands")
}
/* Give it a help command. */
@@ -868,6 +868,12 @@ command { service = "ChanServ"; name = "AKICK"; command = "chanserv/akick"; grou
*
* Provides the command chanserv/ban.
*
* The configuration option 'kick' may be set in a command block for this command to control
* whether or not users will be kicked from the channel once banned. The default is 'yes'.
*
* The configuration option 'mode' may be set to control which mode is set, such as BAN or QUIET.
* The default is BAN.
*
* Used for banning users from channels.
*/
module { name = "cs_ban" }
@@ -929,7 +935,7 @@ command { service = "ChanServ"; name = "ENTRYMSG"; command = "chanserv/entrymsg"
*
* The "LIST" subcommand of chanserv/flags will show every access entry on the channel, including access
* entries not added by cs_flags. The "Flags" of these entries will be the flags representation of the
* privilege set granted by the access entry.
* privilege set granted by the access entry.
*/
module { name = "cs_flags" }
command { service = "ChanServ"; name = "FLAGS"; command = "chanserv/flags"; group = "chanserv/access"; }
@@ -1209,6 +1215,13 @@ module
* If not set, the default is never.
*/
expire = 90d
/*
* Settings to show to non-opers in ChanServ's INFO output.
* Comment to completely disable showing any information about
* suspended channels to non-opers.
*/
show = "suspended, by, reason, on, expires"
}
command { service = "ChanServ"; name = "SUSPEND"; command = "chanserv/suspend"; permission = "chanserv/suspend"; group = "chanserv/admin"; }
command { service = "ChanServ"; name = "UNSUSPEND"; command = "chanserv/unsuspend"; permission = "chanserv/suspend"; group = "chanserv/admin"; }
+2 -1
View File
@@ -37,7 +37,8 @@ cd $ANOPATH
if [ -f "$ANODATA/$ANOPIDF" ]
then
ANOPID=`cat "$ANODATA/$ANOPIDF"`
if [ `ps auwx | grep $ANOPROG | grep $ANOPID | grep -v -c grep` = 1 ]
kill -0 $ANOPID 2>/dev/null
if [ $? -eq 0 ]
then
exit
fi
+2 -2
View File
@@ -540,7 +540,7 @@ module { name = "help" }
name = "m_ssl_gnutls"
/*
* An optional certificate and key for m_gnutls to give to the uplink.
* An optional certificate and key for m_ssl_gnutls to give to the uplink.
*
* You can generate your own certificate and key pair by using:
*
@@ -579,7 +579,7 @@ module { name = "help" }
name = "m_ssl_openssl"
/*
* An optional certificate and key for m_openssl to give to the uplink.
* An optional certificate and key for m_ssl_openssl to give to the uplink.
*
* You can generate your own certificate and key pair by using:
*
+9 -1
View File
@@ -102,6 +102,7 @@ module
* - hide_quit: Hide's the nick's last quit message
* - memo_signon: Notify user if they have a new memo when they sign into the nick
* - memo_receive: Notify user if they have a new memo as soon as it's received
* - memo_mail: Notify user if they have a new memo by mail
* - autoop: User will be automatically opped in channels they enter and have access to
* - msg: Services messages will be sent as PRIVMSGs instead of NOTICEs, requires
* options:useprivmsg to be enabled as well
@@ -230,7 +231,7 @@ module
command_group
{
name = "nickserv/admin"
description = "Services Operator commands"
description = _("Services Operator commands")
}
/* Give it a help command. */
@@ -615,6 +616,13 @@ module
* This directive is optional. If not set, the default is never.
*/
#suspendexpire = 90d
/*
* Settings to show to non-opers in NickServ's INFO output.
* Comment to completely disable showing any information about
* suspended nicknames to non-opers.
*/
show = "suspended, by, reason, on, expires"
}
command { service = "NickServ"; name = "SUSPEND"; command = "nickserv/suspend"; permission = "nickserv/suspend"; group = "nickserv/admin"; }
command { service = "NickServ"; name = "UNSUSPEND"; command = "nickserv/unsuspend"; permission = "nickserv/suspend"; group = "nickserv/admin"; }
-4901
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
git log --pretty=format:"Revision %h - %cD - %s" > version.log
+14
View File
@@ -1,3 +1,17 @@
Anope Version 2.0.1
-------------------
Fix access entries on accounts sometimes not updating when a user's display name changes
Fix ns_group to properly validate the account of the user against the target
Fix os_stats not saving max user count and time when using SQL
Fix nickalias's 'nc' field sometimes not being updated when using SQL
Fix several crashes on Windows related to being unable to load modules
Fix bs_bot change not properly reintroducing bots after changing their ident, host, or realname
Add English language file to allow users to easily modify language strings
Add configuring which mode cs_ban sets, and added a MUTE command to BotServ's fantasy
Allow SVSPART to take an optional reason
Allow cs_list to search channel topics and descriptions
Anope Version 2.0.0
-------------------
Added irc2sql stats module
+6
View File
@@ -1,3 +1,9 @@
Anope Version 2.0.1
-------------------
Add MUTE command to BotServ fantasy configuration
Document memo_mail option in nickserv.conf
Add 'show' setting to ns_info and cs_info to control which fields are shown to non opers
Anope Version 2.0.0
-------------------
options:passlen, enforceruser, enforcerhost, releasetimeout, and guestnickprefix moved to nickserv's module configuration
+8 -3
View File
@@ -74,6 +74,10 @@ class CoreExport AccessProvider : public Service
/* Represents one entry of an access list on a channel. */
class CoreExport ChanAccess : public Serializable
{
Anope::string mask;
/* account this access entry is for, if any */
Serialize::Reference<NickCore> nc;
public:
typedef std::multimap<const ChanAccess *, const ChanAccess *> Set;
/* shows the 'path' taken to determine if an access entry matches a user
@@ -86,9 +90,6 @@ class CoreExport ChanAccess : public Serializable
AccessProvider *provider;
/* Channel this access entry is on */
Serialize::Reference<ChannelInfo> ci;
/* account this access entry is for, if any */
Serialize::Reference<NickCore> nc;
Anope::string mask;
Anope::string creator;
time_t last_seen;
time_t created;
@@ -96,6 +97,10 @@ class CoreExport ChanAccess : public Serializable
ChanAccess(AccessProvider *p);
virtual ~ChanAccess();
void SetMask(const Anope::string &mask, ChannelInfo *ci);
const Anope::string &Mask() const;
NickCore *GetAccount() const;
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
+2 -1
View File
@@ -276,10 +276,11 @@ class CoreExport Channel : public Base, public Extensible
/** Unbans a user from this channel.
* @param u The user to unban
* @param mode The mode to unban
* @param full Whether or not to match using the user's real host and IP
* @return whether or not a ban was removed
*/
bool Unban(User *u, bool full = false);
bool Unban(User *u, const Anope::string &mode, bool full = false);
/** Check whether a user is permitted to be on this channel
* @param u The user
+10 -8
View File
@@ -51,14 +51,13 @@ namespace Configuration
template<typename T> T Get(const Anope::string &tag, const Anope::string &def) const
{
const Anope::string &value = this->Get<const Anope::string>(tag, def);
try
{
return convertTo<T>(value);
}
catch (const ConvertException &)
{
return T();
}
if (!value.empty())
try
{
return convertTo<T>(value);
}
catch (const ConvertException &) { }
return T();
}
bool Set(const Anope::string &tag, const Anope::string &value);
@@ -132,11 +131,14 @@ namespace Configuration
~Conf();
void LoadConf(File &file);
void Post(Conf *old);
Block *GetModule(Module *);
Block *GetModule(const Anope::string &name);
BotInfo *GetClient(const Anope::string &name);
Block *GetCommand(CommandSource &);
};
struct Uplink
+4
View File
@@ -176,6 +176,8 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem<T>
T t;
if (data[this->name] >> t)
this->Set(e, t);
else
this->Unset(e);
}
};
@@ -196,6 +198,8 @@ class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool>
data[this->name] >> b;
if (b)
this->Set(e);
else
this->Unset(e);
}
};
+1 -1
View File
@@ -107,7 +107,7 @@ namespace Language
#define CHAN_SETTING_UNSET _("%s for %s unset.")
#define CHAN_ACCESS_LEVEL_RANGE _("Access level must be between %d and %d inclusive.")
#define CHAN_INFO_HEADER _("Information for channel \002%s\002:")
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except have been removed.")
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.")
#define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \
"Type \002%s%s READ %s %d\002 to read it.")
#define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \
+5
View File
@@ -96,6 +96,11 @@ class CoreExport Log
~Log();
private:
Anope::string FormatSource() const;
Anope::string FormatCommand() const;
public:
Anope::string BuildPrefix() const;
template<typename T> Log &operator<<(T val)
+2 -2
View File
@@ -82,7 +82,7 @@ namespace Message
struct CoreExport Mode : IRCDMessage
{
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { }
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
@@ -131,7 +131,7 @@ namespace Message
struct CoreExport SQuit : IRCDMessage
{
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
+40 -11
View File
@@ -88,7 +88,7 @@ class CoreExport UserModeParam : public UserMode
* @param value The param
* @return true or false
*/
virtual bool IsValid(const Anope::string &value) const { return true; }
virtual bool IsValid(Anope::string &value) const { return true; }
};
/** This class is a channel mode, all channel modes use this/inherit from this
@@ -96,6 +96,9 @@ class CoreExport UserModeParam : public UserMode
class CoreExport ChannelMode : public Mode
{
public:
/* channel modes that can posssibly unwrap this mode */
std::vector<ChannelMode *> listeners;
/** constructor
* @param name The mode name
* @param mc The mode char
@@ -103,6 +106,18 @@ class CoreExport ChannelMode : public Mode
ChannelMode(const Anope::string &name, char mc);
bool CanSet(User *u) const anope_override;
/** 'wrap' this channel mode and param to the underlying mode and param
*/
virtual ChannelMode *Wrap(Anope::string &param);
/** 'unwrap' this mode to our internal representation
*/
ChannelMode *Unwrap(Anope::string &param);
/** called when a mode is being unwrapped, and is asking us if we can unwrap it
*/
virtual ChannelMode *Unwrap(ChannelMode *, Anope::string &param);
};
/** This is a mode for lists, eg b/e/I. These modes should inherit from this
@@ -120,7 +135,7 @@ class CoreExport ChannelModeList : public ChannelMode
* @param mask The mask
* @return true for yes, false for no
*/
virtual bool IsValid(const Anope::string &mask) const { return true; }
virtual bool IsValid(Anope::string &mask) const;
/** Checks if mask affects user
* Should only be used for extbans or other weird ircd-specific things.
@@ -162,7 +177,7 @@ class CoreExport ChannelModeParam : public ChannelMode
* @param value The param
* @return true for yes, false for no
*/
virtual bool IsValid(const Anope::string &value) const { return true; }
virtual bool IsValid(Anope::string &value) const { return true; }
};
/** This is a mode that is a channel status, eg +v/h/o/a/q.
@@ -186,6 +201,25 @@ class CoreExport ChannelModeStatus : public ChannelMode
ChannelModeStatus(const Anope::string &name, char mc, char msymbol, short mlevel);
};
/** A virtual mode. This mode doesn't natively exist on the IRCd (like extbans),
* but we still have a representation for it.
*/
template<typename T>
class CoreExport ChannelModeVirtual : public T
{
Anope::string base;
ChannelMode *basech;
public:
ChannelModeVirtual(const Anope::string &mname, const Anope::string &basename);
~ChannelModeVirtual();
ChannelMode *Wrap(Anope::string &param) anope_override;
ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) = 0;
};
/* The status a user has on a channel (+v, +h, +o) etc */
class CoreExport ChannelStatus
{
@@ -225,7 +259,7 @@ class CoreExport ChannelModeKey : public ChannelModeParam
public:
ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { }
bool IsValid(const Anope::string &value) const anope_override;
bool IsValid(Anope::string &value) const anope_override;
};
/** This class is used for oper only channel modes
@@ -257,13 +291,6 @@ class CoreExport ChannelModeNoone : public ChannelMode
*/
class CoreExport ModeManager
{
protected:
/* Array of all modes Anope knows about. Modes are in this array at position
* modechar. Additionally, status modes are in this array (again) at statuschar.
*/
static std::vector<ChannelMode *> ChannelModes;
static std::vector<UserMode *> UserModes;
public:
/* Number of generic channel and user modes we are tracking */
@@ -377,6 +404,8 @@ class CoreExport Entry
*/
const Anope::string GetMask() const;
const Anope::string GetNUHMask() const;
/** Check if this entry matches a user
* @param u The user
* @param full True to match against a users real host and IP
+3 -7
View File
@@ -719,11 +719,6 @@ class CoreExport Module : public Extensible
*/
virtual void OnNickDrop(CommandSource &source, NickAlias *na) { throw NotImplementedException(); }
/** Called when a nick is forbidden
* @param na The nick alias of the forbidden nick
*/
virtual void OnNickForbidden(NickAlias *na) { throw NotImplementedException(); }
/** Called when a user groups their nick
* @param u The user grouping
* @param target The target they're grouping to
@@ -748,8 +743,9 @@ class CoreExport Module : public Extensible
/** Called when a nick is registered
* @param user The user registering the nick, of any
* @param The nick
* @param pass The password of the newly registered nick
*/
virtual void OnNickRegister(User *user, NickAlias *na) { throw NotImplementedException(); }
virtual void OnNickRegister(User *user, NickAlias *na, const Anope::string &pass) { throw NotImplementedException(); }
/** Called when a nick is suspended
* @param na The nick alias
@@ -1094,7 +1090,7 @@ enum Implementation
I_OnPreUserLogoff, I_OnPostUserLogoff, I_OnBotCreate, I_OnBotChange, I_OnBotDelete, I_OnAccessDel, I_OnAccessAdd,
I_OnAccessClear, I_OnLevelChange, I_OnChanDrop, I_OnChanRegistered, I_OnChanSuspend, I_OnChanUnsuspend,
I_OnCreateChan, I_OnDelChan, I_OnChannelCreate, I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick,
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnNickDrop, I_OnNickForbidden, I_OnNickGroup, I_OnNickIdentify,
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnNickDrop, I_OnNickGroup, I_OnNickIdentify,
I_OnUserLogin, I_OnNickLogout, I_OnNickRegister, I_OnNickSuspend, I_OnNickUnsuspended, I_OnDelNick, I_OnNickCoreCreate,
I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess, I_OnNickClearCert,
I_OnNickAddCert, I_OnNickEraseCert, I_OnNickInfo, I_OnBotInfo, I_OnCheckAuthentication, I_OnNickUpdate,
+1 -1
View File
@@ -7,7 +7,7 @@ struct Session
unsigned count; /* Number of clients with this host */
unsigned hits; /* Number of subsequent kills for a host */
Session(const Anope::string &ip, int len) : addr(ip, len), count(1), hits(0) { }
Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { }
};
struct Exception : Serializable
+11
View File
@@ -40,6 +40,9 @@ class CoreExport IRCDProto : public Service
virtual void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf);
const Anope::string &GetProtocolName();
virtual void Parse(const Anope::string &, Anope::string &, Anope::string &, std::vector<Anope::string> &);
virtual Anope::string Format(const Anope::string &source, const Anope::string &message);
/* Modes used by default by our clients */
Anope::string DefaultPseudoclientModes;
/* Can we force change a users's nick? */
@@ -64,11 +67,17 @@ class CoreExport IRCDProto : public Service
bool CanCertFP;
/* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */
bool RequiresID;
/* If this IRCd has unique ids, whether the IDs and nicknames are ambiguous */
bool AmbiguousID;
/* The maximum number of modes we are allowed to set with one MODE command */
unsigned MaxModes;
/* The maximum number of bytes a line may have */
unsigned MaxLine;
/* Retrieves the next free UID or SID */
virtual Anope::string UID_Retrieve();
virtual Anope::string SID_Retrieve();
/** Sets the server in NOOP mode. If NOOP mode is enabled, no users
* will be able to oper on the server.
* @param s The server
@@ -232,6 +241,8 @@ class CoreExport IRCDProto : public Service
* Defaults to Config->ListSize
*/
virtual unsigned GetMaxListFor(Channel *c);
virtual Anope::string NormalizeMask(const Anope::string &mask);
};
class CoreExport MessageSource
-4
View File
@@ -23,10 +23,6 @@ extern CoreExport Server *Me;
namespace Servers
{
/* Retrieves the next free TS6 UID or SID */
extern CoreExport const Anope::string TS6_UID_Retrieve();
extern CoreExport const Anope::string TS6_SID_Retrieve();
/* Gets our uplink. Note we don't actually have an "uplink", this is just
* the only server whose uplink *is* Me that is not a juped server.
* @return Our uplink, or NULL if not uplinked to anything
+2 -3
View File
@@ -59,7 +59,7 @@ union CoreExport sockaddrs
/** Check if this sockaddr has data in it
*/
bool operator()() const;
bool valid() const;
/** Compares with sockaddr with another. Compares address type, port, and address
* @return true if they are the same
@@ -82,8 +82,6 @@ union CoreExport sockaddrs
* @throws A socket exception if given an invalid structure
*/
void ntop(int type, const void *src);
bool valid() const;
};
class CoreExport cidr
@@ -94,6 +92,7 @@ class CoreExport cidr
public:
cidr(const Anope::string &ip);
cidr(const Anope::string &ip, unsigned char len);
cidr(const sockaddrs &ip, unsigned char len);
Anope::string mask() const;
bool match(const sockaddrs &other);
bool valid() const;
+2 -1
View File
@@ -20,6 +20,7 @@
#include "serialize.h"
#include "commands.h"
#include "account.h"
#include "sockets.h"
typedef Anope::hash_map<User *> user_map;
@@ -71,7 +72,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
/* SSL Fingerprint */
Anope::string fingerprint;
/* User's IP */
Anope::string ip;
sockaddrs ip;
/* Server user is connected to */
Server *server;
/* When the user signed on. Set on connect and never modified. */
+8 -5
View File
@@ -12,12 +12,15 @@
#include "serialize.h"
#include "service.h"
#include "sockets.h"
/* An Xline, eg, anything added with operserv/akill, or any of the operserv/sxline commands */
class CoreExport XLine : public Serializable
{
void InitRegex();
void Init();
Anope::string nick, user, host, real;
public:
cidr *c;
Anope::string mask;
Regex *regex;
Anope::string by;
@@ -32,10 +35,10 @@ class CoreExport XLine : public Serializable
XLine(const Anope::string &mask, const Anope::string &by, const time_t expires, const Anope::string &reason, const Anope::string &uid = "");
~XLine();
Anope::string GetNick() const;
Anope::string GetUser() const;
Anope::string GetHost() const;
Anope::string GetReal() const;
const Anope::string &GetNick() const;
const Anope::string &GetUser() const;
const Anope::string &GetHost() const;
const Anope::string &GetReal() const;
Anope::string GetReason() const;
+373 -344
View File
File diff suppressed because it is too large Load Diff
+376 -345
View File
File diff suppressed because it is too large Load Diff
+384 -344
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+374 -345
View File
File diff suppressed because it is too large Load Diff
+441 -421
View File
File diff suppressed because it is too large Load Diff
+373 -344
View File
File diff suppressed because it is too large Load Diff
+395 -371
View File
File diff suppressed because it is too large Load Diff
+370 -346
View File
File diff suppressed because it is too large Load Diff
+373 -344
View File
File diff suppressed because it is too large Load Diff
+373 -344
View File
File diff suppressed because it is too large Load Diff
+373 -345
View File
File diff suppressed because it is too large Load Diff
+373 -344
View File
File diff suppressed because it is too large Load Diff
+1 -5
View File
@@ -5,11 +5,7 @@ touch anope.pot
cd ..
FILES=`find ./ -name *.cpp -o -name *.h -o -name *.conf | grep -v /modules/third/`
for f in $FILES
do
xgettext -E -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword --keyword=_ $f
done
xgettext -E -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword --keyword=_ $FILES
cd -
for f in *.po
+1 -1
View File
@@ -50,7 +50,7 @@ macro(build_modules SRC)
add_library(${SO} MODULE ${MODULE_SRC})
# Windows requires this because it's weird
if(WIN32)
set(WIN32_NO_LIBS "/nodefaultlib:\"libcmt.lib\"")
set(WIN32_NO_LIBS "/nodefaultlib:\"libcmt.lib\" /OPT:NOREF")
else(WIN32)
set(WIN32_NO_LIBS)
endif(WIN32)
+1 -1
View File
@@ -22,7 +22,7 @@ class BSAutoAssign : public Module
if (bot.empty())
return;
BotInfo *bi = BotInfo::Find(bot);
BotInfo *bi = BotInfo::Find(bot, true);
if (bi == NULL)
{
Log(this) << "bs_autoassign is configured to assign bot " << bot << ", but it does not exist?";
+4 -12
View File
@@ -189,7 +189,10 @@ class CommandBSBot : public Command
}
if (!user.empty())
{
IRCD->SendQuit(bi, "Quit: Be right back");
bi->introduced = false;
}
else
IRCD->SendNickChange(bi, nick);
@@ -204,18 +207,7 @@ class CommandBSBot : public Command
bi->realname = real;
if (!user.empty())
{
IRCD->SendClientIntroduction(bi);
unsigned minusers = Config->GetBlock("botserv")->Get<unsigned>("minusers");
const std::set<ChannelInfo *> &channels = bi->GetChannels();
for (std::set<ChannelInfo *>::const_iterator it = channels.begin(), it_end = channels.end(); it != it_end; ++it)
{
const ChannelInfo *ci = *it;
if (ci->c && ci->c->users.size() >= minusers)
bi->Join(ci->c);
}
}
bi->OnKill();
source.Reply(_("Bot \002%s\002 has been changed to %s!%s@%s (%s)."), oldnick.c_str(), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str());
Log(LOG_ADMIN, source, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname;
+1 -1
View File
@@ -325,7 +325,7 @@ class CommandBSKickBolds : public CommandBSKickBase
public:
CommandBSKickBolds(Module *creator) : CommandBSKickBase(creator, "botserv/kick/bolds", 2, 3)
{
this->SetDesc(_("Configures badwords kicker"));
this->SetDesc(_("Configures bolds kicker"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]"));
}
+15 -16
View File
@@ -180,7 +180,7 @@ class CommandCSAccess : public Command
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
const ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->mask))
if (mask.equals_ci(access->Mask()))
{
/* Don't allow lowering from a level >= u_level */
if ((!highest || *access >= *highest) && !u_access.founder && !source.HasPriv("chanserv/access/modify"))
@@ -204,8 +204,7 @@ class CommandCSAccess : public Command
if (!provider)
return;
AccessChanAccess *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
access->ci = ci;
access->mask = mask;
access->SetMask(mask, ci);
access->creator = source.GetNick();
access->level = level;
access->last_seen = 0;
@@ -216,9 +215,9 @@ class CommandCSAccess : public Command
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << " with level " << level;
if (p != NULL)
source.Reply(_("\002%s\002 added to %s access list at privilege %s (level %d)"), access->mask.c_str(), ci->name.c_str(), p->name.c_str(), level);
source.Reply(_("\002%s\002 added to %s access list at privilege %s (level %d)"), access->Mask().c_str(), ci->name.c_str(), p->name.c_str(), level);
else
source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), level);
source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->Mask().c_str(), ci->name.c_str(), level);
}
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
@@ -284,7 +283,7 @@ class CommandCSAccess : public Command
AccessGroup ag = source.AccessFor(ci);
const ChanAccess *u_highest = ag.Highest();
if ((!u_highest || *u_highest <= *access) && !ag.founder && !this->override && !access->mask.equals_ci(source.nc->display))
if ((!u_highest || *u_highest <= *access) && !ag.founder && !this->override && access->GetAccount() != source.nc)
{
denied = true;
return;
@@ -292,9 +291,9 @@ class CommandCSAccess : public Command
++deleted;
if (!Nicks.empty())
Nicks += ", " + access->mask;
Nicks += ", " + access->Mask();
else
Nicks = access->mask;
Nicks = access->Mask();
ci->EraseAccess(Number - 1);
@@ -313,15 +312,15 @@ class CommandCSAccess : public Command
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->mask))
if (mask.equals_ci(access->Mask()))
{
if (!access->mask.equals_ci(source.nc->display) && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify"))
if (access->GetAccount() != source.nc && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
else
{
source.Reply(_("\002%s\002 deleted from %s access list."), access->mask.c_str(), ci->name.c_str());
bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->mask.equals_ci(source.nc->display);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->mask;
source.Reply(_("\002%s\002 deleted from %s access list."), access->Mask().c_str(), ci->name.c_str());
bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && access->GetAccount() != source.nc;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->Mask();
ci->EraseAccess(i - 1);
FOREACH_MOD(OnAccessDel, (ci, source, access));
@@ -381,7 +380,7 @@ class CommandCSAccess : public Command
ListFormatter::ListEntry entry;
entry["Number"] = stringify(number);
entry["Level"] = access->AccessSerialize();
entry["Mask"] = access->mask;
entry["Mask"] = access->Mask();
entry["By"] = access->creator;
entry["Last seen"] = timebuf;
this->list.AddEntry(entry);
@@ -396,7 +395,7 @@ class CommandCSAccess : public Command
{
const ChanAccess *access = ci->GetAccess(i);
if (!nick.empty() && !Anope::Match(access->mask, nick))
if (!nick.empty() && !Anope::Match(access->Mask(), nick))
continue;
Anope::string timebuf;
@@ -418,7 +417,7 @@ class CommandCSAccess : public Command
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Level"] = access->AccessSerialize();
entry["Mask"] = access->mask;
entry["Mask"] = access->Mask();
entry["By"] = access->creator;
entry["Last seen"] = timebuf;
list.AddEntry(entry);
+28 -19
View File
@@ -19,15 +19,16 @@ class TempBan : public Timer
private:
Anope::string channel;
Anope::string mask;
Anope::string mode;
public:
TempBan(time_t seconds, Channel *c, const Anope::string &banmask) : Timer(me, seconds), channel(c->name), mask(banmask) { }
TempBan(time_t seconds, Channel *c, const Anope::string &banmask, const Anope::string &mod) : Timer(me, seconds), channel(c->name), mask(banmask), mode(mod) { }
void Tick(time_t ctime) anope_override
{
Channel *c = Channel::Find(this->channel);
if (c)
c->RemoveMode(NULL, "BAN", this->mask);
c->RemoveMode(NULL, mode, this->mask);
}
};
@@ -43,6 +44,8 @@ class CommandCSBan : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &chan = params[0];
Configuration::Block *block = Config->GetCommand(source);
const Anope::string &mode = block->Get<Anope::string>("mode", "BAN");
ChannelInfo *ci = ChannelInfo::Find(chan);
if (ci == NULL)
@@ -57,9 +60,9 @@ class CommandCSBan : public Command
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
return;
}
else if (IRCD->GetMaxListFor(c) && c->HasMode("BAN") >= IRCD->GetMaxListFor(c))
else if (IRCD->GetMaxListFor(c) && c->HasMode(mode) >= IRCD->GetMaxListFor(c))
{
source.Reply(_("The ban list for %s is full."), c->name.c_str());
source.Reply(_("The %s list for %s is full."), mode.lower().c_str(), c->name.c_str());
return;
}
@@ -126,12 +129,12 @@ class CommandCSBan : public Command
bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask;
if (!c->HasMode("BAN", mask))
if (!c->HasMode(mode, mask))
{
c->SetMode(NULL, "BAN", mask);
c->SetMode(NULL, mode, mask);
if (ban_time)
{
new TempBan(ban_time, c, mask);
new TempBan(ban_time, c, mask, mode);
source.Reply(_("Ban on \002%s\002 expires in %s."), mask.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str());
}
}
@@ -140,10 +143,13 @@ class CommandCSBan : public Command
if (!c->FindUser(u2))
return;
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK")))
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str());
else
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
if (block->Get<bool>("kick", "yes"))
{
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK")))
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str());
else
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
}
}
}
else
@@ -152,12 +158,12 @@ class CommandCSBan : public Command
bool override = !founder && !u_access.HasPriv("BAN");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << target;
if (!c->HasMode("BAN", target))
if (!c->HasMode(mode, target))
{
c->SetMode(NULL, "BAN", target);
c->SetMode(NULL, mode, target);
if (ban_time)
{
new TempBan(ban_time, c, target);
new TempBan(ban_time, c, target, mode);
source.Reply(_("Ban on \002%s\002 expires in %s."), target.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str());
}
}
@@ -183,11 +189,14 @@ class CommandCSBan : public Command
else if (uc->user->IsProtected())
continue;
++kicked;
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str());
else
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
if (block->Get<bool>("kick", "yes"))
{
++kicked;
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str());
else
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
}
}
}
+4 -5
View File
@@ -111,7 +111,7 @@ public:
unsigned count = 0;
for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i)
masks.insert(target_ci->GetAccess(i)->mask);
masks.insert(target_ci->GetAccess(i)->Mask());
for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
{
@@ -121,13 +121,12 @@ public:
if (access_max && target_ci->GetDeepAccessCount() >= access_max)
break;
if (masks.count(taccess->mask))
if (masks.count(taccess->Mask()))
continue;
masks.insert(taccess->mask);
masks.insert(taccess->Mask());
ChanAccess *newaccess = provider->Create();
newaccess->ci = target_ci;
newaccess->mask = taccess->mask;
newaccess->SetMask(taccess->Mask(), target_ci);
newaccess->creator = taccess->creator;
newaccess->last_seen = taccess->last_seen;
newaccess->created = taccess->created;
+7 -8
View File
@@ -142,7 +142,7 @@ class CommandCSFlags : public Command
for (current_idx = ci->GetAccessCount(); current_idx > 0; --current_idx)
{
ChanAccess *access = ci->GetAccess(current_idx - 1);
if (mask.equals_ci(access->mask))
if (mask.equals_ci(access->Mask()))
{
// Flags allows removing others that have the same access as you,
// but no other access system does.
@@ -260,8 +260,7 @@ class CommandCSFlags : public Command
if (!provider)
return;
FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
access->ci = ci;
access->mask = mask;
access->SetMask(mask, ci);
access->creator = source.GetNick();
access->last_seen = current ? current->last_seen : 0;
access->created = Anope::CurTime;
@@ -278,12 +277,12 @@ class CommandCSFlags : public Command
if (p != NULL)
{
if (add)
source.Reply(_("Privilege \002%s\002 added to \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
source.Reply(_("Privilege \002%s\002 added to \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
else
source.Reply(_("Privilege \002%s\002 removed from \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
source.Reply(_("Privilege \002%s\002 removed from \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
}
else
source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
}
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
@@ -317,14 +316,14 @@ class CommandCSFlags : public Command
if (pass == false)
continue;
}
else if (!Anope::Match(access->mask, arg))
else if (!Anope::Match(access->Mask(), arg))
continue;
}
ListFormatter::ListEntry entry;
++count;
entry["Number"] = stringify(i + 1);
entry["Mask"] = access->mask;
entry["Mask"] = access->Mask();
entry["Flags"] = flags;
entry["Creator"] = access->creator;
entry["Created"] = Anope::strftime(access->created, source.nc, true);
+7 -1
View File
@@ -10,6 +10,7 @@
*/
#include "module.h"
#include "modules/cs_mode.h"
class CommandCSList : public Command
{
@@ -87,6 +88,11 @@ class CommandCSList : public Command
continue;
if (ci->c && ci->c->HasMode("SECRET"))
continue;
ModeLocks *ml = ci->GetExt<ModeLocks>("modelocks");
const ModeLock *secret = ml ? ml->GetMLock("SECRET") : NULL;
if (secret && secret->set)
continue;
}
if (suspended && !ci->HasExt("CS_SUSPENDED"))
@@ -95,7 +101,7 @@ class CommandCSList : public Command
if (channoexpire && !ci->HasExt("CS_NO_EXPIRE"))
continue;
if (pattern.equals_ci(ci->name) || ci->name.equals_ci(spattern) || Anope::Match(ci->name, pattern, false, true) || Anope::Match(ci->name, spattern, false, true))
if (pattern.equals_ci(ci->name) || ci->name.equals_ci(spattern) || Anope::Match(ci->name, pattern, false, true) || Anope::Match(ci->name, spattern, false, true) || Anope::Match(ci->desc, pattern, false, true) || Anope::Match(ci->last_topic, pattern, false, true))
{
if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nchans <= listmax)
{
+2 -3
View File
@@ -488,8 +488,7 @@ class CommandCSMode : public Command
for (unsigned j = 0; j < ModeManager::GetChannelModes().size(); ++j)
{
ChannelMode *cm = ModeManager::GetChannelModes()[j];
if (!cm)
continue;
if (!u || cm->CanSet(u) || can_override)
{
if (cm->type == MODE_REGULAR || (!adding && cm->type == MODE_PARAM))
@@ -951,7 +950,7 @@ class CSMode : public Module
}
}
void OnCreateChan(ChannelInfo *ci) anope_override
void OnChanRegistered(ChannelInfo *ci) anope_override
{
ModeLocks *ml = modelocks.Require(ci);
Anope::string mlock;
+1 -1
View File
@@ -241,7 +241,7 @@ class CommandSeen : public Command
{
ChanAccess *a = ag[i];
if (*a->nc == na->nc && a->last_seen > last)
if (a->GetAccount() == na->nc && a->last_seen > last)
last = a->last_seen;
}
+2 -2
View File
@@ -13,12 +13,12 @@
static Module *me;
static std::map<Anope::string, Anope::string> descriptions;
static Anope::map<Anope::string> descriptions;
struct CSMiscData;
static Anope::map<ExtensibleItem<CSMiscData> *> items;
static ExtensibleItem<CSMiscData> *GetItem(const Anope::string &name) anope_override
static ExtensibleItem<CSMiscData> *GetItem(const Anope::string &name)
{
ExtensibleItem<CSMiscData>* &it = items[name];
if (!it)
+1 -1
View File
@@ -61,7 +61,7 @@ public:
{
ChanAccess *acc = ag[i];
source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->mask.c_str(), acc->AccessSerialize().c_str());
source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->Mask().c_str(), acc->AccessSerialize().c_str());
}
}
+26 -11
View File
@@ -200,6 +200,20 @@ class CSSuspend : public Module
CommandCSUnSuspend commandcsunsuspend;
ExtensibleItem<CSSuspendInfo> suspend;
Serialize::Type suspend_type;
std::vector<Anope::string> show;
struct trim
{
Anope::string operator()(Anope::string s) const
{
return s.trim();
}
};
bool Show(CommandSource &source, const Anope::string &what) const
{
return source.IsOper() || std::find(show.begin(), show.end(), what) != show.end();
}
public:
CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
@@ -211,18 +225,19 @@ class CSSuspend : public Module
void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) anope_override
{
CSSuspendInfo *si = suspend.Get(ci);
if (si)
{
if (!si)
return;
if (show_hidden || Show(source, "suspended"))
info[_("Suspended")] = _("This channel is \002suspended\002.");
if (!si->by.empty())
info[_("Suspended by")] = si->by;
if (!si->reason.empty())
info[_("Suspend reason")] = si->reason;
if (si->when)
info[_("Suspended on")] = Anope::strftime(si->when, source.GetAccount(), true);
if (si->expires)
info[_("Suspension expires")] = Anope::strftime(si->expires, source.GetAccount(), true);
}
if (!si->by.empty() && (show_hidden || Show(source, "by")))
info[_("Suspended by")] = si->by;
if (!si->reason.empty() && (show_hidden || Show(source, "reason")))
info[_("Suspend reason")] = si->reason;
if (si->when && (show_hidden || Show(source, "on")))
info[_("Suspended on")] = Anope::strftime(si->when, source.GetAccount(), true);
if (si->expires && (show_hidden || Show(source, "expires")))
info[_("Suspension expires")] = Anope::strftime(si->expires, source.GetAccount(), true);
}
void OnPreChanExpire(ChannelInfo *ci, bool &expire) anope_override
+12 -3
View File
@@ -22,6 +22,13 @@ class CommandCSUnban : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelMode *cm = ModeManager::FindChannelModeByName("BAN");
if (!cm)
return;
std::vector<ChannelMode *> modes = cm->listeners;
modes.push_back(cm);
if (params.empty())
{
if (!source.GetUser())
@@ -38,8 +45,9 @@ class CommandCSUnban : public Command
if (!ci->c || !source.AccessFor(ci).HasPriv("UNBAN"))
continue;
if (ci->c->Unban(source.GetUser(), true))
++count;
for (unsigned j = 0; j < modes.size(); ++j)
if (ci->c->Unban(source.GetUser(), modes[j]->name, true))
++count;
}
Log(LOG_COMMAND, source, this, NULL) << "on all channels";
@@ -80,7 +88,8 @@ class CommandCSUnban : public Command
bool override = !source.AccessFor(ci).HasPriv("UNBAN") && source.HasPriv("chanserv/kick");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unban " << u2->nick;
ci->c->Unban(u2, source.GetUser() == u2);
for (unsigned i = 0; i < modes.size(); ++i)
ci->c->Unban(u2, modes[i]->name, source.GetUser() == u2);
if (u2 == source.GetUser())
source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str());
else
+11 -12
View File
@@ -182,7 +182,7 @@ class CommandCSXOP : public Command
{
const ChanAccess *a = ci->GetAccess(i);
if (a->mask.equals_ci(mask))
if (a->Mask().equals_ci(mask))
{
if ((!highest || *a >= *highest) && !access.founder && !source.HasPriv("chanserv/access/modify"))
{
@@ -206,8 +206,7 @@ class CommandCSXOP : public Command
if (!provider)
return;
XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
acc->ci = ci;
acc->mask = mask;
acc->SetMask(mask, ci);
acc->creator = source.GetNick();
acc->type = source.command.upper();
acc->last_seen = 0;
@@ -217,7 +216,7 @@ class CommandCSXOP : public Command
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask;
FOREACH_MOD(OnAccessAdd, (ci, source, acc));
source.Reply(_("\002%s\002 added to %s %s list."), acc->mask.c_str(), ci->name.c_str(), source.command.c_str());
source.Reply(_("\002%s\002 added to %s %s list."), acc->Mask().c_str(), ci->name.c_str(), source.command.c_str());
}
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
@@ -320,9 +319,9 @@ class CommandCSXOP : public Command
++deleted;
if (!nicks.empty())
nicks += ", " + caccess->mask;
nicks += ", " + caccess->Mask();
else
nicks = caccess->mask;
nicks = caccess->Mask();
ci->EraseAccess(number - 1);
FOREACH_MOD(OnAccessDel, (ci, source, caccess));
@@ -341,11 +340,11 @@ class CommandCSXOP : public Command
if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize())
continue;
if (a->mask.equals_ci(mask))
if (a->Mask().equals_ci(mask))
{
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->mask;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->Mask();
source.Reply(_("\002%s\002 deleted from %s %s list."), a->mask.c_str(), ci->name.c_str(), source.command.c_str());
source.Reply(_("\002%s\002 deleted from %s %s list."), a->Mask().c_str(), ci->name.c_str(), source.command.c_str());
ci->EraseAccess(i);
FOREACH_MOD(OnAccessDel, (ci, source, a));
@@ -405,7 +404,7 @@ class CommandCSXOP : public Command
ListFormatter::ListEntry entry;
entry["Number"] = stringify(Number);
entry["Mask"] = a->mask;
entry["Mask"] = a->Mask();
this->list.AddEntry(entry);
}
} nl_list(list, ci, nick, source);
@@ -419,12 +418,12 @@ class CommandCSXOP : public Command
if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize())
continue;
else if (!nick.empty() && !Anope::Match(a->mask, nick))
else if (!nick.empty() && !Anope::Match(a->Mask(), nick))
continue;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Mask"] = a->mask;
entry["Mask"] = a->Mask();
list.AddEntry(entry);
}
}
+1 -1
View File
@@ -196,7 +196,7 @@ class NSAccess : public Module
{
}
void OnNickRegister(User *u, NickAlias *na) anope_override
void OnNickRegister(User *u, NickAlias *na, const Anope::string &) anope_override
{
if (u && Config->GetModule(this)->Get<bool>("addaccessonreg"))
na->nc->AddAccess(u->Mask());
+4 -4
View File
@@ -139,12 +139,12 @@ class CommandNSGroup : public Command
Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick;
source.Reply(NICK_X_SUSPENDED, target->nick.c_str());
}
else if (na && Config->GetModule(this->owner)->Get<bool>("nogroupchange"))
source.Reply(_("Your nick is already registered."));
else if (na && *target->nc == *na->nc)
source.Reply(_("You are already a member of the group of \002%s\002."), target->nick.c_str());
else if (na && na->nc != u->Account())
source.Reply(NICK_IDENTIFY_REQUIRED);
else if (na && Config->GetModule(this->owner)->Get<bool>("nogroupchange"))
source.Reply(_("Your nick is already registered."));
else if (maxaliases && target->nc->aliases->size() >= maxaliases && !target->nc->IsServicesOper())
source.Reply(_("There are too many nicks in your group."));
else if (u->nick.length() <= guestnick.length() + 7 &&
@@ -156,7 +156,7 @@ class CommandNSGroup : public Command
else
{
bool ok = false;
if (!na && u->Account())
if (!na && u->Account() == target->nc)
ok = true;
NSCertList *cl = target->nc->GetExt<NSCertList>("certificates");
@@ -321,7 +321,7 @@ class CommandNSGList : public Command
Anope::string expires;
if (na2->HasExt("NS_NO_EXPIRE"))
expires = "Does not expire";
expires = NO_EXPIRE;
else if (!nickserv_expire || Anope::NoExpire)
;
else if (na2->nc->HasExt("UNCONFIRMED") && unconfirmed_expire)
+5 -1
View File
@@ -62,9 +62,13 @@ class CommandNSInfo : public Command
if (nick_online)
{
bool shown = false;
if (show_hidden && !na->last_realhost.empty())
{
info[_("Online from")] = na->last_realhost;
if (show_hidden || !na->nc->HasExt("HIDE_MASK"))
shown = true;
}
if ((show_hidden || !na->nc->HasExt("HIDE_MASK")) && (!shown || na->last_usermask != na->last_realhost))
info[_("Online from")] = na->last_usermask;
else
source.Reply(_("%s is currently online."), na->nick.c_str());
+1 -1
View File
@@ -198,7 +198,7 @@ class CommandNSRegister : public Command
Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
FOREACH_MOD(OnNickRegister, (source.GetUser(), na));
FOREACH_MOD(OnNickRegister, (source.GetUser(), na, pass));
if (na->nc->GetAccessCount())
source.Reply(_("Nickname \002%s\002 registered under your user@host-mask: %s"), u_nick.c_str(), na->nc->GetAccess(0).c_str());
+6 -4
View File
@@ -119,7 +119,7 @@ class CommandNSSetPassword : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &param = params[1];
const Anope::string &param = params[0];
unsigned len = param.length();
if (Anope::ReadOnly)
@@ -330,7 +330,7 @@ class CommandNSSetDisplay : public Command
return;
}
const NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
{
@@ -356,6 +356,8 @@ class CommandNSSetDisplay : public Command
Log(user_na->nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the display of " << user_na->nc->display << " to " << na->nick;
user_na->nc->SetDisplay(na);
if (source.GetUser())
IRCD->SendLogin(source.GetUser(), na);
source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str());
}
@@ -792,7 +794,7 @@ class CommandNSSetLanguage : public Command
if (MOD_RESULT == EVENT_STOP)
return;
if (param != "en")
if (param != "en_US")
for (unsigned j = 0; j < Language::Languages.size(); ++j)
{
if (Language::Languages[j] == param)
@@ -824,7 +826,7 @@ class CommandNSSetLanguage : public Command
"\037language\037 should be chosen from the following list of\n"
"supported languages:"));
source.Reply(" en (English)");
source.Reply(" en_US (English)");
for (unsigned j = 0; j < Language::Languages.size(); ++j)
{
const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English"));
+1 -1
View File
@@ -14,7 +14,7 @@
static Module *me;
static std::map<Anope::string, Anope::string> descriptions;
static Anope::map<Anope::string> descriptions;
struct NSMiscData;
static Anope::map<ExtensibleItem<NSMiscData> *> items;
+33 -11
View File
@@ -207,6 +207,20 @@ class NSSuspend : public Module
CommandNSUnSuspend commandnsunsuspend;
ExtensibleItem<NSSuspendInfo> suspend;
Serialize::Type suspend_type;
std::vector<Anope::string> show;
struct trim
{
Anope::string operator()(Anope::string s) const
{
return s.trim();
}
};
bool Show(CommandSource &source, const Anope::string &what) const
{
return source.IsOper() || std::find(show.begin(), show.end(), what) != show.end();
}
public:
NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
@@ -215,21 +229,29 @@ class NSSuspend : public Module
{
}
void OnReload(Configuration::Conf *conf) anope_override
{
Anope::string s = conf->GetModule(this)->Get<Anope::string>("show");
commasepstream(s).GetTokens(show);
std::transform(show.begin(), show.end(), show.begin(), trim());
}
void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override
{
NSSuspendInfo *s = suspend.Get(na->nc);
if (s)
{
if (!s)
return;
if (show_hidden || Show(source, "suspended"))
info[_("Suspended")] = _("This nickname is \002suspended\002.");
if (!s->by.empty())
info[_("Suspended by")] = s->by;
if (!s->reason.empty())
info[_("Suspend reason")] = s->reason;
if (s->when)
info[_("Suspended on")] = Anope::strftime(s->when, source.GetAccount(), true);
if (s->expires)
info[_("Suspension expires")] = Anope::strftime(s->expires, source.GetAccount(), true);
}
if (!s->by.empty() && (show_hidden || Show(source, "by")))
info[_("Suspended by")] = s->by;
if (!s->reason.empty() && (show_hidden || Show(source, "reason")))
info[_("Suspend reason")] = s->reason;
if (s->when && (show_hidden || Show(source, "on")))
info[_("Suspended on")] = Anope::strftime(s->when, source.GetAccount(), true);
if (s->expires && (show_hidden || Show(source, "expires")))
info[_("Suspension expires")] = Anope::strftime(s->expires, source.GetAccount(), true);
}
void OnPreNickExpire(NickAlias *na, bool &expire) anope_override
+5
View File
@@ -160,6 +160,11 @@ class CommandOSAKill : public Command
source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str());
return;
}
else if (mask.find('@') == Anope::string::npos)
{
source.Reply(BAD_USERHOST_MASK);
return;
}
if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty())
reason = "[" + source.GetNick() + "] " + reason;
+2 -2
View File
@@ -502,7 +502,7 @@ class OSDefcon : public Module
if (DConfig.sessionlimit <= 0 || !session_service)
return;
Session *session = session_service->FindSession(u->ip);
Session *session = session_service->FindSession(u->ip.addr());
Exception *exception = session_service->FindException(u);
if (DConfig.Check(DEFCON_REDUCE_SESSION) && !exception)
@@ -511,7 +511,7 @@ class OSDefcon : public Module
{
if (!DConfig.sle_reason.empty())
{
Anope::string message = DConfig.sle_reason.replace_all_cs("%IP%", u->ip);
Anope::string message = DConfig.sle_reason.replace_all_cs("%IP%", u->ip.addr());
u->SendMessage(OperServ, message);
}
if (!DConfig.sle_detailsloc.empty())
+1 -1
View File
@@ -653,7 +653,7 @@ class CommandOSDNS : public Command
}
public:
CommandOSDNS(Module *creator) : Command(creator, "operserv/dns", 0, 3)
CommandOSDNS(Module *creator) : Command(creator, "operserv/dns", 0, 4)
{
this->SetDesc(_("Manage DNS zones for this network"));
this->SetSyntax(_("ADDZONE \037zone.name\037"));
+1 -1
View File
@@ -36,7 +36,7 @@ class CommandOSJupe : public Command
{
Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : "");
/* Generate the new sid before quitting the old server, so they can't collide */
Anope::string sid = Servers::TS6_SID_Retrieve();
Anope::string sid = IRCD->SID_Retrieve();
if (server)
{
IRCD->SendSquit(server, rbuf);
+1 -1
View File
@@ -180,7 +180,7 @@ class CommandOSUserList : public Command
if (!pattern.empty())
{
Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), mask2 = u2->nick + "!" + u2->GetIdent() + "@" + u2->host, mask3 = u2->nick + "!" + u2->GetIdent() + "@" + (!u2->ip.empty() ? u2->ip : u2->host);
Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), mask2 = u2->nick + "!" + u2->GetIdent() + "@" + u2->host, mask3 = u2->nick + "!" + u2->GetIdent() + "@" + u2->ip.addr();
if (!Anope::Match(mask, pattern) && !Anope::Match(mask2, pattern) && !Anope::Match(mask3, pattern))
continue;
if (!modes.empty())
+3 -1
View File
@@ -89,7 +89,9 @@ class CommandOSMode : public Command
Anope::string param, param_log;
if (cm->type != MODE_REGULAR)
{
if (!sep.GetToken(param))
if (cm->type == MODE_PARAM && !add && anope_dynamic_static_cast<ChannelModeParam *>(cm)->minus_no_arg)
;
else if (!sep.GetToken(param))
continue;
param_log = param;
+4 -1
View File
@@ -26,8 +26,11 @@ class CommandOSReload : public Command
Log(LOG_ADMIN, source, this);
Configuration::Conf *new_config = new Configuration::Conf();
delete Config;
Configuration::Conf *old = Config;
Config = new_config;
Config->Post(old);
delete old;
source.Reply(_("Services' configuration has been reloaded."));
}
catch (const ConfigException &ex)
+7 -7
View File
@@ -64,10 +64,10 @@ class MySessionService : public SessionService
for (std::vector<Exception *>::const_iterator it = this->Exceptions->begin(), it_end = this->Exceptions->end(); it != it_end; ++it)
{
Exception *e = *it;
if (Anope::Match(u->host, e->mask) || Anope::Match(u->ip, e->mask))
if (Anope::Match(u->host, e->mask) || Anope::Match(u->ip.addr(), e->mask))
return e;
if (cidr(e->mask).match(sockaddrs(u->ip)))
if (cidr(e->mask).match(u->ip))
return e;
}
return NULL;
@@ -109,9 +109,9 @@ class MySessionService : public SessionService
return NULL;
}
SessionMap::iterator FindSessionIterator(const Anope::string &ip)
SessionMap::iterator FindSessionIterator(const sockaddrs &ip)
{
cidr c(ip, ip.find(':') != Anope::string::npos ? ipv6_cidr : ipv4_cidr);
cidr c(ip, ip.ipv6() ? ipv6_cidr : ipv4_cidr);
if (!c.valid())
return this->Sessions.end();
return this->Sessions.find(c);
@@ -668,7 +668,7 @@ class OSSession : public Module
if (u->Quitting() || !session_limit || exempt || !u->server || u->server->IsULined())
return;
cidr u_ip(u->ip, u->ip.find(':') != Anope::string::npos ? ipv6_cidr : ipv4_cidr);
cidr u_ip(u->ip, u->ip.ipv6() ? ipv6_cidr : ipv4_cidr);
if (!u_ip.valid())
return;
@@ -705,7 +705,7 @@ class OSSession : public Module
{
if (!sle_reason.empty())
{
Anope::string message = sle_reason.replace_all_cs("%IP%", u->ip);
Anope::string message = sle_reason.replace_all_cs("%IP%", u->ip.addr());
u->SendMessage(OperServ, message);
}
if (!sle_detailsloc.empty())
@@ -729,7 +729,7 @@ class OSSession : public Module
}
else
{
session = new Session(u->ip, u->ip.find(':') != Anope::string::npos ? ipv6_cidr : ipv4_cidr);
session = new Session(u->ip, u->ip.ipv6() ? ipv6_cidr : ipv4_cidr);
}
}
+15 -2
View File
@@ -14,7 +14,12 @@
struct Stats : Serializable
{
Stats() : Serializable("Stats") { }
static Stats *me;
Stats() : Serializable("Stats")
{
me = this;
}
void Serialize(Serialize::Data &data) const anope_override
{
@@ -26,10 +31,12 @@ struct Stats : Serializable
{
data["maxusercnt"] >> MaxUserCount;
data["maxusertime"] >> MaxUserTime;
return NULL;
return me;
}
};
Stats *Stats::me;
/**
* Count servers connected to server s
* @param s The server to start counting from
@@ -258,6 +265,12 @@ class OSStats : public Module
{
}
void OnUserConnect(User *u, bool &exempt) anope_override
{
if (UserListByNick.size() == MaxUserCount && Anope::CurTime == MaxUserTime)
stats_saver.QueueUpdate();
}
};
MODULE_INIT(OSStats)
+8 -4
View File
@@ -117,10 +117,10 @@ class CommandOSSVSJoin : public Command
class CommandOSSVSPart : public Command
{
public:
CommandOSSVSPart(Module *creator) : Command(creator, "operserv/svspart", 2, 2)
CommandOSSVSPart(Module *creator) : Command(creator, "operserv/svspart", 2, 3)
{
this->SetDesc(_("Forcefully part a user from a channel"));
this->SetSyntax(_("\037nick\037 \037channel\037"));
this->SetSyntax(_("\037nick\037 \037channel\037 [\037reason\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -133,6 +133,7 @@ class CommandOSSVSPart : public Command
User *target = User::Find(params[0], true);
Channel *c = Channel::Find(params[1]);
const Anope::string &reason = params.size() > 2 ? params[2] : "";
if (target == NULL)
source.Reply(NICK_X_NOT_IN_USE, params[0].c_str());
else if (source.GetUser() != target && (target->IsProtected() || target->server == Me))
@@ -143,8 +144,11 @@ class CommandOSSVSPart : public Command
source.Reply(_("\002%s\002 is not in \002%s\002."), target->nick.c_str(), c->name.c_str());
else
{
IRCD->SendSVSPart(*source.service, target, params[1], "");
Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name;
IRCD->SendSVSPart(*source.service, target, params[1], reason);
if (!reason.empty())
Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name << " with reason " << reason;
else
Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name;
source.Reply(_("\002%s\002 has been parted from \002%s\002."), target->nick.c_str(), c->name.c_str());
}
}
+2 -2
View File
@@ -123,7 +123,7 @@ class DBFlatFile : public Module, public Pipe
const std::vector<Anope::string> &type_order = Serialize::Type::GetTypeOrder();
std::set<Anope::string> dbs;
dbs.insert(Config->GetModule(this)->Get<const Anope::string>("database"));
dbs.insert(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
for (unsigned i = 0; i < type_order.size(); ++i)
{
@@ -337,7 +337,7 @@ class DBFlatFile : public Module, public Pipe
for (std::map<Module *, std::fstream *>::iterator it = databases.begin(), it_end = databases.end(); it != it_end; ++it)
{
std::fstream *f = it->second;
const Anope::string &db_name = Anope::DataDir + "/" + (it->first ? (it->first->name + ".db") : Config->GetModule(this)->Get<const Anope::string>("database"));
const Anope::string &db_name = Anope::DataDir + "/" + (it->first ? (it->first->name + ".db") : Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
if (!f->is_open() || !f->good())
{
+3 -3
View File
@@ -719,7 +719,7 @@ static void LoadBots()
READ(read_int32(&created, f));
READ(read_int16(&chancount, f));
BotInfo *bi = BotInfo::Find(nick);
BotInfo *bi = BotInfo::Find(nick, true);
if (!bi)
bi = new BotInfo(nick, user, host, real);
bi->created = created;
@@ -898,7 +898,7 @@ static void LoadChannels()
Anope::string mask;
READ(read_string(mask, f));
if (access)
access->mask = mask;
access->SetMask(mask, ci);
READ(read_int32(&tmp32, f));
if (access)
@@ -975,7 +975,7 @@ static void LoadChannels()
}
READ(read_string(buffer, f));
ci->bi = BotInfo::Find(buffer);
ci->bi = BotInfo::Find(buffer, true);
READ(read_int32(&tmp32, f));
if (tmp32 & OLD_BS_DONTKICKOPS)
+1
View File
@@ -1,4 +1,5 @@
/* RequiredLibraries: ldap,lber */
/* RequiredWindowsLibraries: libldap,liblber */
#include "module.h"
#include "modules/ldap.h"
+3 -3
View File
@@ -104,7 +104,7 @@ class IdentifyInterface : public LDAPInterface
{
na = new NickAlias(ii->req->GetAccount(), new NickCore(ii->req->GetAccount()));
na->last_realname = ii->user ? ii->user->realname : ii->req->GetAccount();
FOREACH_MOD(OnNickRegister, (ii->user, na));
FOREACH_MOD(OnNickRegister, (ii->user, na, ii->req->GetPassword()));
BotInfo *NickServ = Config->GetClient("NickServ");
if (ii->user && NickServ)
ii->user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
@@ -300,7 +300,7 @@ class NSIdentifyLDAP : public Module
}
}
void OnNickRegister(User *, NickAlias *na) anope_override
void OnNickRegister(User *, NickAlias *na, const Anope::string &pass) anope_override
{
if (!this->disable_register_reason.empty() || !this->ldap)
return;
@@ -326,7 +326,7 @@ class NSIdentifyLDAP : public Module
}
attributes[3].name = this->password_attribute;
attributes[3].values.push_back(na->nc->pass);
attributes[3].values.push_back(pass);
Anope::string new_dn = username_attribute + "=" + na->nick + "," + basedn;
this->ldap->Add(&this->orinterface, new_dn, attributes);
+6 -1
View File
@@ -1,9 +1,14 @@
/* RequiredLibraries: mysqlclient */
/* RequiredWindowsLibraries: libmysql */
#include "module.h"
#include "modules/sql.h"
#define NO_CLIENT_LONG_LONG
#include <mysql/mysql.h>
#ifdef WIN32
# include <mysql.h>
#else
# include <mysql/mysql.h>
#endif
using namespace SQL;
+1
View File
@@ -1,4 +1,5 @@
/* RequiredLibraries: pcre */
/* RequiredWindowsLibraries: libpcre */
#include "module.h"
#include <pcre.h>
+1
View File
@@ -1,4 +1,5 @@
/* RequiredLibraries: ssl,crypto */
/* RequiredWindowsLibraries: ssleay32,libeay32 */
#include "module.h"
#include "modules/sasl.h"
+1
View File
@@ -1,4 +1,5 @@
/* RequiredLibraries: ssl,crypto */
/* RequiredWindowsLibraries: ssleay32,libeay32 */
#include "module.h"
#include "modules/sasl.h"
+2 -2
View File
@@ -42,7 +42,7 @@ class SQLAuthenticationResult : public SQL::Interface
if (na == NULL)
{
na = new NickAlias(req->GetAccount(), new NickCore(req->GetAccount()));
FOREACH_MOD(OnNickRegister, (user, na));
FOREACH_MOD(OnNickRegister, (user, na, ""));
if (user && NickServ)
user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
}
@@ -122,7 +122,7 @@ class ModuleSQLAuthentication : public Module
if (u)
{
q.SetValue("n", u->nick);
q.SetValue("i", u->ip);
q.SetValue("i", u->ip.addr());
}
else
{
+1 -1
View File
@@ -135,7 +135,7 @@ class ModuleSQLOper : public Module
SQL::Query q(this->query);
q.SetValue("a", u->Account()->display);
q.SetValue("i", u->ip);
q.SetValue("i", u->ip.addr());
this->SQL->Run(new SQLOperResult(this, u), q);
+1
View File
@@ -1,4 +1,5 @@
/* RequiredLibraries: sqlite3 */
/* RequiredWindowsLibraries: sqlite3 */
#include "module.h"
#include "modules/sql.h"
+1
View File
@@ -7,6 +7,7 @@
*/
/* RequiredLibraries: gnutls */
/* RequiredWindowsLibraries: libgnutls-28 */
#include "module.h"
#include "modules/ssl.h"
+1
View File
@@ -1,4 +1,5 @@
/* RequiredLibraries: ssl,crypto */
/* RequiredWindowsLibraries: ssleay32,libeay32 */
#include "module.h"
#include "modules/ssl.h"
+1 -1
View File
@@ -95,7 +95,7 @@ void IRC2SQL::OnUserConnect(User *u, bool &exempt)
query.SetValue("vhost", u->vhost);
query.SetValue("chost", u->chost);
query.SetValue("realname", u->realname);
query.SetValue("ip", u->ip);
query.SetValue("ip", u->ip.addr());
query.SetValue("ident", u->GetIdent());
query.SetValue("vident", u->GetVIdent());
query.SetValue("secure", u->HasMode("SSL") || u->HasExt("ssl") ? "Y" : "N");
+1 -1
View File
@@ -638,7 +638,7 @@ class MChanstats : public Module
ci->Extend<bool>("CS_STATS");
}
void OnNickRegister(User *user, NickAlias *na)
void OnNickRegister(User *user, NickAlias *na, const Anope::string &)
{
if (NSDefChanstats)
na->nc->Extend<bool>("NS_STATS");
+9 -10
View File
@@ -54,18 +54,18 @@ class DNSBLResolver : public Request
record_reason = this->blacklist.replies[result];
}
Anope::string reason = this->blacklist.reason;
Anope::string reason = this->blacklist.reason, addr = user->ip.addr();
reason = reason.replace_all_cs("%n", user->nick);
reason = reason.replace_all_cs("%u", user->GetIdent());
reason = reason.replace_all_cs("%g", user->realname);
reason = reason.replace_all_cs("%h", user->host);
reason = reason.replace_all_cs("%i", user->ip);
reason = reason.replace_all_cs("%i", addr);
reason = reason.replace_all_cs("%r", record_reason);
reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
BotInfo *OperServ = Config->GetClient("OperServ");
Log(creator, "dnsbl", OperServ) << user->GetMask() << " (" << user->ip << ") appears in " << this->blacklist.name;
XLine *x = new XLine("*@" + user->ip, OperServ ? OperServ->nick : "m_dnsbl", Anope::CurTime + this->blacklist.bantime, reason, XLineManager::GenerateUID());
Log(creator, "dnsbl", OperServ) << user->GetMask() << " (" << addr << ") appears in " << this->blacklist.name;
XLine *x = new XLine("*@" + addr, OperServ ? OperServ->nick : "m_dnsbl", Anope::CurTime + this->blacklist.bantime, reason, XLineManager::GenerateUID());
if (this->add_to_akill && akills)
{
akills->AddXLine(x);
@@ -130,22 +130,21 @@ class ModuleDNSBL : public Module
return;
/* At this time we only support IPv4 */
sockaddrs user_ip;
user_ip.pton(AF_INET, user->ip);
if (!user_ip.valid())
if (!user->ip.valid() || user->ip.sa.sa_family != AF_INET)
/* User doesn't have a valid IPv4 IP (ipv6/spoof/etc) */
return;
const unsigned long &ip = user_ip.sa4.sin_addr.s_addr;
const unsigned long &ip = user->ip.sa4.sin_addr.s_addr;
unsigned long reverse_ip = (ip << 24) | ((ip & 0xFF00) << 8) | ((ip & 0xFF0000) >> 8) | (ip >> 24);
user_ip.sa4.sin_addr.s_addr = reverse_ip;
sockaddrs reverse = user->ip;
reverse.sa4.sin_addr.s_addr = reverse_ip;
for (unsigned i = 0; i < this->blacklists.size(); ++i)
{
const Blacklist &b = this->blacklists[i];
Anope::string dnsbl_host = user_ip.addr() + "." + b.name;
Anope::string dnsbl_host = reverse.addr() + "." + b.name;
DNSBLResolver *res = NULL;
try
{
+6 -7
View File
@@ -206,12 +206,13 @@ class ModuleProxyScan : public Module
void Tick(time_t) anope_override
{
for (std::set<ProxyConnect *>::iterator it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end; ++it)
for (std::set<ProxyConnect *>::iterator it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;)
{
ProxyConnect *p = *it;
++it;
if (p->created + this->GetSecs() < Anope::CurTime)
p->flags[SF_DEAD] = true;
delete p;
}
}
} connectionTimeout;
@@ -333,15 +334,13 @@ class ModuleProxyScan : public Module
return;
/* At this time we only support IPv4 */
sockaddrs user_ip;
user_ip.pton(AF_INET, user->ip);
if (!user_ip.valid())
if (!user->ip.valid() || user->ip.sa.sa_family != AF_INET)
/* User doesn't have a valid IPv4 IP (ipv6/spoof/etc) */
return;
if (!this->con_notice.empty() && !this->con_source.empty())
{
BotInfo *bi = BotInfo::Find(this->con_source);
BotInfo *bi = BotInfo::Find(this->con_source, true);
if (bi)
user->SendMessage(bi, this->con_notice);
}
@@ -363,7 +362,7 @@ class ModuleProxyScan : public Module
con = new SOCKS5ProxyConnect(p, p.ports[k]);
else
continue;
con->Connect(user->ip, p.ports[k]);
con->Connect(user->ip.addr(), p.ports[k]);
}
catch (const SocketException &ex)
{
+1 -1
View File
@@ -115,7 +115,7 @@ class RewriteCommand : public Command
{
Anope::string new_message = r->Process(source, full_params);
Log(LOG_DEBUG) << "m_rewrite: Rewrote '" << source.command << (!params.empty() ? " " + params[0] : "") << "' to '" << new_message << "' using '" << r->source_message << "'";
source.service = BotInfo::Find(r->client);
source.service = BotInfo::Find(r->client, true);
if (!source.service)
return;
Command::Run(source, new_message);
+2 -3
View File
@@ -74,7 +74,7 @@ class MyXMLRPCEvent : public XMLRPCEvent
request.reply("error", "Invalid parameters");
else
{
BotInfo *bi = BotInfo::Find(service);
BotInfo *bi = BotInfo::Find(service, true);
if (!bi)
request.reply("error", "Invalid service");
else
@@ -212,8 +212,7 @@ class MyXMLRPCEvent : public XMLRPCEvent
request.reply("vhost", iface->Sanitize(u->vhost));
if (!u->chost.empty())
request.reply("chost", iface->Sanitize(u->chost));
if (!u->ip.empty())
request.reply("ip", u->ip);
request.reply("ip", u->ip.addr());
request.reply("timestamp", stringify(u->timestamp));
request.reply("signon", stringify(u->signon));
if (u->Account())
+3 -3
View File
@@ -16,7 +16,7 @@ class ChannelModeFlood : public ChannelModeParam
public:
ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
bool IsValid(const Anope::string &value) const anope_override
bool IsValid(Anope::string &value) const anope_override
{
try
{
@@ -175,7 +175,7 @@ class BahamutIRCdProto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
BotInfo *setter = BotInfo::Find(user->nick);
BotInfo *setter = BotInfo::Find(user->GetUID());
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
@@ -522,7 +522,7 @@ class ProtoBahamut : public Module
ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeFlood('f', false));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
+20 -6
View File
@@ -1,7 +1,7 @@
/* ircd-hybrid-8 protocol module
*
* (C) 2003-2014 Anope Team
* (C) 2012-2013 by the Hybrid Development Team
* (C) 2012-2014 ircd-hybrid development team
*
* Please read COPYING and README for further details.
*
@@ -40,10 +40,11 @@ class HybridProto : public IRCDProto
{
DefaultPseudoclientModes = "+oi";
CanSVSNick = true;
CanSVSHold = true;
CanSVSJoin = true;
CanSNLine = true;
CanSQLine = true;
CanSZLine = true;
CanSVSHold = true;
CanCertFP = true;
CanSetVHost = true;
RequiresID = true;
@@ -174,9 +175,9 @@ class HybridProto : public IRCDProto
void SendServer(const Server *server) anope_override
{
if (server == Me)
UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription();
UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() + 1 << " :" << server->GetDescription();
else
UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription();
UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() + 1 << " " << server->GetSID() << " :" << server->GetDescription();
}
void SendConnect() anope_override
@@ -254,6 +255,19 @@ class HybridProto : public IRCDProto
UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick << " " << when;
}
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) anope_override
{
UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan;
}
void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) anope_override
{
if (!param.empty())
UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param;
else
UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan;
}
void SendSVSHold(const Anope::string &nick, time_t t) anope_override
{
XLine x(nick, Me->GetName(), Anope::CurTime + t, "Being held for registered user");
@@ -610,7 +624,7 @@ class ProtoHybrid : public Module
ModeManager::AddUserMode(new UserModeOperOnly("CALLERID", 'g'));
ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l'));
ModeManager::AddUserMode(new UserMode("OPER", 'o'));
ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r'));
ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
@@ -632,7 +646,7 @@ class ProtoHybrid : public Module
ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2));
/* l/k */
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
/* Add channel modes */
+2 -2
View File
@@ -28,7 +28,7 @@ class ChannelModeFlood : public ChannelModeParam
public:
ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
bool IsValid(const Anope::string &value) const anope_override
bool IsValid(Anope::string &value) const anope_override
{
try
{
@@ -269,7 +269,7 @@ class InspIRCd12Proto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
BotInfo *setter = BotInfo::Find(user->nick);
BotInfo *setter = BotInfo::Find(user->GetUID());
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
+180 -43
View File
@@ -77,25 +77,61 @@ class InspIRCd20Proto : public IRCDProto
bool IsIdentValid(const Anope::string &ident) anope_override { return insp12->IsIdentValid(ident); }
};
class InspIRCdExtBan : public ChannelModeList
class InspIRCdExtBan : public ChannelModeVirtual<ChannelModeList>
{
char ext;
public:
InspIRCdExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { }
bool Matches(User *u, const Entry *e) anope_override
InspIRCdExtBan(const Anope::string &mname, const Anope::string &basename, char extban) : ChannelModeVirtual<ChannelModeList>(mname, basename)
, ext(extban)
{
const Anope::string &mask = e->GetMask();
}
if (mask.find("m:") == 0 || mask.find("N:") == 0)
ChannelMode *Wrap(Anope::string &param) anope_override
{
param = Anope::string(ext) + ":" + param;
return ChannelModeVirtual<ChannelModeList>::Wrap(param);
}
ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) anope_override
{
if (cm->type != MODE_LIST || param.length() < 3 || param[0] != ext || param[1] != ':')
return cm;
param = param.substr(2);
return this;
}
};
namespace InspIRCdExtban
{
class EntryMatcher : public InspIRCdExtBan
{
public:
EntryMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(3);
Entry en(this->name, real_mask);
if (en.Matches(u))
return true;
return Entry(this->name, real_mask).Matches(u);
}
else if (mask.find("j:") == 0)
};
class ChannelMatcher : public InspIRCdExtBan
{
public:
ChannelMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string channel = mask.substr(3);
ChannelMode *cm = NULL;
@@ -116,46 +152,94 @@ class InspIRCdExtBan : public ChannelModeList
if (cm == NULL || uc->status.HasMode(cm->mchar))
return true;
}
return false;
}
else if (mask.find("R:") == 0)
};
class AccountMatcher : public InspIRCdExtBan
{
public:
AccountMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(2);
if (u->IsIdentified() && real_mask.equals_ci(u->Account()->display))
return true;
return u->IsIdentified() && real_mask.equals_ci(u->Account()->display);
}
else if (mask.find("r:") == 0)
};
class RealnameMatcher : public InspIRCdExtBan
{
public:
RealnameMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(2);
return Anope::Match(u->realname, real_mask);
}
};
class ServerMatcher : public InspIRCdExtBan
{
public:
ServerMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(2);
return Anope::Match(u->server->GetName(), real_mask);
}
};
class FinerprintMatcher : public InspIRCdExtBan
{
public:
FinerprintMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(2);
return !u->fingerprint.empty() && Anope::Match(u->fingerprint, real_mask);
}
};
class UnidentifiedMatcher : public InspIRCdExtBan
{
public:
UnidentifiedMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
{
Anope::string real_mask = mask.substr(2);
if (Anope::Match(u->realname, real_mask))
return true;
}
else if (mask.find("s:") == 0)
bool Matches(User *u, const Entry *e) anope_override
{
Anope::string real_mask = mask.substr(2);
if (Anope::Match(u->server->GetName(), real_mask))
return true;
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(2);
return !u->Account() && Entry("BAN", real_mask).Matches(u);
}
else if (mask.find("z:") == 0)
{
Anope::string real_mask = mask.substr(2);
if (!u->fingerprint.empty() && Anope::Match(u->fingerprint, real_mask))
return true;
}
return false;
}
};
};
}
class ColonDelimitedParamMode : public ChannelModeParam
{
public:
ColonDelimitedParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { }
bool IsValid(const Anope::string &value) const anope_override
bool IsValid(Anope::string &value) const anope_override
{
return IsValid(value, false);
}
@@ -204,7 +288,7 @@ class SimpleNumberParamMode : public ChannelModeParam
public:
SimpleNumberParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { }
bool IsValid(const Anope::string &value) const anope_override
bool IsValid(Anope::string &value) const anope_override
{
if (value.empty())
return false; // empty param is never valid
@@ -229,11 +313,12 @@ class ChannelModeFlood : public ColonDelimitedParamMode
public:
ChannelModeFlood(char modeChar) : ColonDelimitedParamMode("FLOOD", modeChar) { }
bool IsValid(const Anope::string &value) const anope_override
bool IsValid(Anope::string &value) const anope_override
{
// The parameter of this mode is a bit different, it may begin with a '*',
// ignore it if that's the case
return ((!value.empty()) && (ColonDelimitedParamMode::IsValid(value[0] == '*' ? value.substr(1) : value)));
Anope::string v = value[0] == '*' ? value.substr(1) : value;
return ((!value.empty()) && (ColonDelimitedParamMode::IsValid(v)));
}
};
@@ -242,7 +327,7 @@ class ChannelModeHistory : public ColonDelimitedParamMode
public:
ChannelModeHistory(char modeChar) : ColonDelimitedParamMode("HISTORY", modeChar) { }
bool IsValid(const Anope::string &value) const anope_override
bool IsValid(Anope::string &value) const anope_override
{
return (ColonDelimitedParamMode::IsValid(value, true));
}
@@ -253,7 +338,7 @@ class ChannelModeRedirect : public ChannelModeParam
public:
ChannelModeRedirect(char modeChar) : ChannelModeParam("REDIRECT", modeChar, true) { }
bool IsValid(const Anope::string &value) const anope_override
bool IsValid(Anope::string &value) const anope_override
{
// The parameter of this mode is a channel, and channel names start with '#'
return ((!value.empty()) && (value[0] == '#'));
@@ -304,17 +389,26 @@ struct IRCDMessageCapab : Message::Capab
if (modename.equals_cs("admin"))
cm = new ChannelModeStatus("PROTECT", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 3);
else if (modename.equals_cs("allowinvite"))
{
cm = new ChannelMode("ALLINVITE", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("INVITEBAN", "BAN", 'A'));
}
else if (modename.equals_cs("auditorium"))
cm = new ChannelMode("AUDITORIUM", modechar[0]);
else if (modename.equals_cs("ban"))
cm = new InspIRCdExtBan("BAN", modechar[0]);
cm = new ChannelModeList("BAN", modechar[0]);
else if (modename.equals_cs("banexception"))
cm = new InspIRCdExtBan("EXCEPT", 'e');
cm = new ChannelModeList("EXCEPT", modechar[0]);
else if (modename.equals_cs("blockcaps"))
{
cm = new ChannelMode("BLOCKCAPS", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("BLOCKCAPSBAN", "BAN", 'B'));
}
else if (modename.equals_cs("blockcolor"))
{
cm = new ChannelMode("BLOCKCOLOR", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("BLOCKCOLORBAN", "BAN", 'c'));
}
else if (modename.equals_cs("c_registered"))
cm = new ChannelModeNoone("REGISTERED", modechar[0]);
else if (modename.equals_cs("censor"))
@@ -334,7 +428,7 @@ struct IRCDMessageCapab : Message::Capab
else if (modename.equals_cs("history"))
cm = new ChannelModeHistory(modechar[0]);
else if (modename.equals_cs("invex"))
cm = new InspIRCdExtBan("INVITEOVERRIDE", 'I');
cm = new ChannelModeList("INVITEOVERRIDE", modechar[0]);
else if (modename.equals_cs("inviteonly"))
cm = new ChannelMode("INVITE", modechar[0]);
else if (modename.equals_cs("joinflood"))
@@ -350,17 +444,29 @@ struct IRCDMessageCapab : Message::Capab
else if (modename.equals_cs("nickflood"))
cm = new ColonDelimitedParamMode("NICKFLOOD", modechar[0]);
else if (modename.equals_cs("noctcp"))
{
cm = new ChannelMode("NOCTCP", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NOCTCPBAN", "BAN", 'C'));
}
else if (modename.equals_cs("noextmsg"))
cm = new ChannelMode("NOEXTERNAL", modechar[0]);
else if (modename.equals_cs("nokick"))
{
cm = new ChannelMode("NOKICK", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NOKICKBAN", "BAN", 'Q'));
}
else if (modename.equals_cs("noknock"))
cm = new ChannelMode("NOKNOCK", modechar[0]);
else if (modename.equals_cs("nonick"))
{
cm = new ChannelMode("NONICK", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NONICKBAN", "BAN", 'N'));
}
else if (modename.equals_cs("nonotice"))
{
cm = new ChannelMode("NONOTICE", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NONOTICEBAN", "BAN", 'T'));
}
else if (modename.equals_cs("op"))
cm = new ChannelModeStatus("OP", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 2);
else if (modename.equals_cs("operonly"))
@@ -378,9 +484,15 @@ struct IRCDMessageCapab : Message::Capab
else if (modename.equals_cs("secret"))
cm = new ChannelMode("SECRET", modechar[0]);
else if (modename.equals_cs("sslonly"))
{
cm = new ChannelMode("SSL", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::FinerprintMatcher("SSLBAN", "BAN", 'z'));
}
else if (modename.equals_cs("stripcolor"))
{
cm = new ChannelMode("STRIPCOLOR", modechar[0]);
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("STRIPCOLORBAN", "BAN", 'S'));
}
else if (modename.equals_cs("topiclock"))
cm = new ChannelMode("TOPIC", modechar[0]);
else if (modename.equals_cs("voice"))
@@ -481,11 +593,25 @@ struct IRCDMessageCapab : Message::Capab
while (ssep.GetToken(module))
{
if (module.equals_cs("m_services_account.so"))
{
Servers::Capab.insert("SERVICES");
ModeManager::AddChannelMode(new InspIRCdExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'R'));
ModeManager::AddChannelMode(new InspIRCdExtban::UnidentifiedMatcher("UNREGISTEREDBAN", "BAN", 'U'));
}
else if (module.equals_cs("m_chghost.so"))
Servers::Capab.insert("CHGHOST");
else if (module.equals_cs("m_chgident.so"))
Servers::Capab.insert("CHGIDENT");
else if (module == "m_channelban.so")
ModeManager::AddChannelMode(new InspIRCdExtban::ChannelMatcher("CHANNELBAN", "BAN", 'j'));
else if (module == "m_gecosban.so")
ModeManager::AddChannelMode(new InspIRCdExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r'));
else if (module == "m_nopartmessage.so")
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("PARTMESSAGEBAN", "BAN", 'p'));
else if (module == "m_serverban.so")
ModeManager::AddChannelMode(new InspIRCdExtban::ServerMatcher("SERVERBAN", "BAN", 's'));
else if (module == "m_muteban.so")
ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("QUIET", "BAN", 'm'));
}
}
else if (params[0].equals_cs("CAPABILITIES") && params.size() > 1)
@@ -577,6 +703,8 @@ struct IRCDMessageCapab : Message::Capab
ModeManager::RebuildStatusModes();
}
else if (capab == "GLOBOPS=1")
Servers::Capab.insert("GLOBOPS");
}
}
else if (params[0].equals_cs("END"))
@@ -827,6 +955,15 @@ class ProtoInspIRCd20 : public Module
return EVENT_CONTINUE;
}
EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) anope_override
{
if ((setter.GetUser() && setter.GetUser()->server == Me) || setter.GetServer() == Me || !setter.GetServer())
if (mode->name == "OPERPREFIX")
c->SetMode(c->ci->WhoSends(), mode, param, false);
return EVENT_CONTINUE;
}
};
MODULE_INIT(ProtoInspIRCd20)
+2 -2
View File
@@ -101,7 +101,7 @@ class ngIRCdProto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
BotInfo *setter = BotInfo::Find(user->nick);
BotInfo *setter = BotInfo::Find(user->GetUID());
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
@@ -650,7 +650,7 @@ class ProtongIRCd : public Module
/* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
+5 -4
View File
@@ -67,7 +67,7 @@ class PlexusProto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
BotInfo *setter = BotInfo::Find(user->nick);
BotInfo *setter = BotInfo::Find(user->GetUID());
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
@@ -333,9 +333,10 @@ class ProtoPlexus : public Module
ModeManager::AddUserMode(new UserMode("CALLERID", 'g'));
ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l'));
ModeManager::AddUserMode(new UserMode("OPER", 'o'));
ModeManager::AddUserMode(new UserMode("PRIV", 'p'));
ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
ModeManager::AddUserMode(new UserModeOperOnly("NETADMIN", 'N'));
ModeManager::AddUserMode(new UserMode("PRIV", 'p'));
ModeManager::AddUserMode(new UserModeOperOnly("ROUTING", 'q'));
ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r'));
ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
@@ -359,7 +360,7 @@ class ProtoPlexus : public Module
ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '~', 4));
/* l/k */
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
/* Add channel modes */
+2 -2
View File
@@ -253,7 +253,7 @@ class ProtoRatbox : public Module
// k = skill?
ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l'));
// n = nchange
ModeManager::AddUserMode(new UserMode("OPER", 'o'));
ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
// r = rej
ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'S'));
@@ -274,7 +274,7 @@ class ProtoRatbox : public Module
ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 1));
/* l/k */
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
/* channel modes */
+100 -30
View File
@@ -167,7 +167,7 @@ class UnrealIRCdProto : public IRCDProto
if (uc != NULL)
uc->status.Clear();
BotInfo *setter = BotInfo::Find(user->nick);
BotInfo *setter = BotInfo::Find(user->GetUID());
for (size_t i = 0; i < cs.Modes().length(); ++i)
c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
@@ -415,17 +415,44 @@ class UnrealIRCdProto : public IRCDProto
}
};
class UnrealExtBan : public ChannelModeList
class UnrealExtBan : public ChannelModeVirtual<ChannelModeList>
{
char ext;
public:
UnrealExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { }
bool Matches(User *u, const Entry *e) anope_override
UnrealExtBan(const Anope::string &mname, const Anope::string &basename, char extban) : ChannelModeVirtual<ChannelModeList>(mname, basename)
, ext(extban)
{
const Anope::string &mask = e->GetMask();
}
if (mask.find("~c:") == 0)
ChannelMode *Wrap(Anope::string &param) anope_override
{
param = "~" + Anope::string(ext) + ":" + param;
return ChannelModeVirtual<ChannelModeList>::Wrap(param);
}
ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) anope_override
{
if (cm->type != MODE_LIST || param.length() < 4 || param[0] != '~' || param[1] != ext || param[2] != ':')
return cm;
param = param.substr(3);
return this;
}
};
namespace UnrealExtban
{
class ChannelMatcher : public UnrealExtBan
{
public:
ChannelMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string channel = mask.substr(3);
ChannelMode *cm = NULL;
@@ -446,38 +473,73 @@ class UnrealExtBan : public ChannelModeList
if (cm == NULL || uc->status.HasMode(cm->mchar))
return true;
}
return false;
}
else if (mask.find("~j:") == 0 || mask.find("~n:") == 0 || mask.find("~q:") == 0)
};
class EntryMatcher : public UnrealExtBan
{
public:
EntryMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(3);
Entry en(this->name, real_mask);
if (en.Matches(u))
return true;
return Entry(this->name, real_mask).Matches(u);
}
else if (mask.find("~r:") == 0)
};
class RealnameMatcher : public UnrealExtBan
{
public:
RealnameMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(3);
if (Anope::Match(u->realname, real_mask))
return true;
return Anope::Match(u->realname, real_mask);
}
else if (mask.find("~R:") == 0)
};
class RegisteredMatcher : public UnrealExtBan
{
public:
RegisteredMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
if (u->HasMode("REGISTERED") && mask.equals_ci(u->nick))
return true;
const Anope::string &mask = e->GetMask();
return u->HasMode("REGISTERED") && mask.equals_ci(u->nick);
}
else if (mask.find("~a:") == 0)
{
};
class AccountMatcher : public UnrealExtBan
{
public:
AccountMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
{
}
bool Matches(User *u, const Entry *e) anope_override
{
const Anope::string &mask = e->GetMask();
Anope::string real_mask = mask.substr(3);
if (u->Account() && Anope::Match(u->Account()->display, real_mask))
return true;
}
return false;
}
};
return u->Account() && Anope::Match(u->Account()->display, real_mask);
}
};
}
class ChannelModeFlood : public ChannelModeParam
{
@@ -485,7 +547,7 @@ class ChannelModeFlood : public ChannelModeParam
ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
/* Borrowed part of this check from UnrealIRCd */
bool IsValid(const Anope::string &value) const anope_override
bool IsValid(Anope::string &value) const anope_override
{
if (value.empty())
return false;
@@ -565,13 +627,21 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'b':
ModeManager::AddChannelMode(new UnrealExtBan("BAN", 'b'));
ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b'));
ModeManager::AddChannelMode(new UnrealExtban::ChannelMatcher("CHANNELBAN", "BAN", 'c'));
ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("JOINBAN", "BAN", 'j'));
ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("NONICKBAN", "BAN", 'n'));
ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("QUIET", "BAN", 'q'));
ModeManager::AddChannelMode(new UnrealExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r'));
ModeManager::AddChannelMode(new UnrealExtban::RegisteredMatcher("REGISTEREDBAN", "BAN", 'R'));
ModeManager::AddChannelMode(new UnrealExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'a'));
continue;
case 'e':
ModeManager::AddChannelMode(new UnrealExtBan("EXCEPT", 'e'));
ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e'));
continue;
case 'I':
ModeManager::AddChannelMode(new UnrealExtBan("INVITEOVERRIDE", 'I'));
ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeList("", modebuf[t]));

Some files were not shown because too many files have changed in this diff Show More