mirror of
https://github.com/anope/anope.git
synced 2026-06-23 19:06:39 +02:00
Compare commits
134 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b578e32531 | |||
| 4d8e3b847d | |||
| eaade23f9b | |||
| f20bac996d | |||
| 93bfd4cbe1 | |||
| 6620f9e9bd | |||
| dc64cfc940 | |||
| f8829783d2 | |||
| d6e600f74b | |||
| 5f7113bc0e | |||
| dc4daa25a7 | |||
| 0cadaedfbe | |||
| 11ad788dfd | |||
| 38a60d9142 | |||
| e8ad509aa5 | |||
| 37b3ed8ef3 | |||
| a6af422184 | |||
| 53acb73193 | |||
| 57f6d4f49c | |||
| d0467adea2 | |||
| 16924f68c0 | |||
| d280c48e6b | |||
| f0c0daa644 | |||
| 7a2d027e1d | |||
| f627a3bacd | |||
| 5a1257b7f0 | |||
| 866f3f32ab | |||
| 20ce170024 | |||
| 4034b3054a | |||
| e581158645 | |||
| 01021131ca | |||
| 13ea98a02e | |||
| db56a61f86 | |||
| df321a118e | |||
| 1931fcf0e5 | |||
| 63b02b8c97 | |||
| 1c8a77ab9f | |||
| 0c7d53f81e | |||
| bcc3ae5742 | |||
| 4e67e0897a | |||
| 76a9538441 | |||
| 91c7862579 | |||
| 6b6bc81999 | |||
| 1f2c385bb9 | |||
| d79dd0b7d7 | |||
| 8b2e8137f6 | |||
| 732466d8f4 | |||
| 3049916ade | |||
| 0afd666f22 | |||
| 8021a53ac4 | |||
| 0663f5e412 | |||
| 2ee496b8ac | |||
| 3abb18721b | |||
| 4eb0a3bdb7 | |||
| 6a03eb69eb | |||
| 4fa2a00bd5 | |||
| 82008d507c | |||
| 2ab4f175a8 | |||
| c9473bcc67 | |||
| 75ed5a9b59 | |||
| f010ab7dbf | |||
| 00b2cc9ce6 | |||
| d52cc7bcbc | |||
| 63838fa77d | |||
| e36f8143e3 | |||
| 72b26043b2 | |||
| f369157906 | |||
| ba46b8e4ab | |||
| 254901aace | |||
| c1c45a5db9 | |||
| a65e95837f | |||
| 43219d3906 | |||
| 1f8dec4c24 | |||
| fb5c5e3442 | |||
| e357c39774 | |||
| 10732baec2 | |||
| 068c6989de | |||
| 317d55f3f1 | |||
| 1397fda786 | |||
| 4ccc478830 | |||
| 100ecbb9be | |||
| cdf636e696 | |||
| 45878bf182 | |||
| f1bec3999d | |||
| a259244297 | |||
| c1da009de3 | |||
| 4f412bc213 | |||
| 1882916dc4 | |||
| f436ce9912 | |||
| ef9729fb02 | |||
| 296a75f2a9 | |||
| bce7237d9f | |||
| 85834e19dc | |||
| ca6b3723a9 | |||
| 23b1086072 | |||
| 860deb14ce | |||
| 62885fa462 | |||
| 3fef01e35b | |||
| b0597e35ec | |||
| 8d1ad6fbe5 | |||
| 750569201a | |||
| 1a1a781b72 | |||
| 4b5ce8a972 | |||
| 98cfdd26c4 | |||
| 051a42b547 | |||
| 220e278213 | |||
| 547fe0da1a | |||
| 09bec79b47 | |||
| 55a5affcb8 | |||
| a8b4297023 | |||
| 5969362425 | |||
| 3ceae33b16 | |||
| 5de4c1fc97 | |||
| fd109048dd | |||
| a0747516ce | |||
| 605e1f2a03 | |||
| dc23c58869 | |||
| b7e646ec83 | |||
| 4d54358745 | |||
| ed0882ec04 | |||
| 526c4e4659 | |||
| b70f72bf2b | |||
| 2ad4c1906e | |||
| 049760cc7e | |||
| e2ecec31b5 | |||
| fee016bb84 | |||
| d24fb03917 | |||
| 5adc8bfefc | |||
| abcf0cde5a | |||
| 8f3bd314ed | |||
| e2d456d4ce | |||
| 96202ae545 | |||
| 2b0229d4e2 | |||
| beaa3196b3 |
+16
@@ -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
@@ -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
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
@@ -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
@@ -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
-14
@@ -780,7 +780,7 @@ log
|
||||
* memoserv/sendall memoserv/staff
|
||||
*
|
||||
* nickserv/getpass nickserv/getemail nickserv/suspend nickserv/ajoin
|
||||
* nickserv/resetpass nickserv/list
|
||||
* nickserv/list
|
||||
*
|
||||
* nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password
|
||||
* nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message
|
||||
@@ -826,7 +826,7 @@ opertype
|
||||
inherits = "Helper, Another Helper"
|
||||
|
||||
/* What commands (see above) this opertype may use */
|
||||
commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/resetpass nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline"
|
||||
commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline"
|
||||
|
||||
/* What privs (see above) this opertype has */
|
||||
privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auspex nickserv/confirm"
|
||||
@@ -952,18 +952,6 @@ mail
|
||||
*/
|
||||
sendfrom = "services@localhost.net"
|
||||
|
||||
/*
|
||||
* If set, RESETPASS will be restricted to services operators with access to
|
||||
* nickserv/resetpass in their opertype:commands.
|
||||
* This directive is optional.
|
||||
*
|
||||
* WARNING: If you choose to not enable this option, you should limit the
|
||||
* number of processes that the services user can have at a time (you can
|
||||
* create a special user for this; remember to NEVER launch Services as
|
||||
* root).
|
||||
*/
|
||||
restrict = yes
|
||||
|
||||
/*
|
||||
* This controls the minimum amount of time a user must wait before sending
|
||||
* another e-mail after they have sent one. It also controls the minimum time
|
||||
|
||||
@@ -103,7 +103,20 @@ command { service = "HostServ"; name = "DELALL"; command = "hostserv/delall"; pe
|
||||
*
|
||||
* Used for grouping one vHost to many nicks.
|
||||
*/
|
||||
module { name = "hs_group" }
|
||||
module
|
||||
{
|
||||
name = "hs_group"
|
||||
|
||||
/*
|
||||
* Upon nickserv/group, this option syncs the nick's main vHost to the grouped nick.
|
||||
*/
|
||||
syncongroup = false
|
||||
|
||||
/*
|
||||
* This makes vhosts act as if they are per account.
|
||||
*/
|
||||
synconset = false
|
||||
}
|
||||
command { service = "HostServ"; name = "GROUP"; command = "hostserv/group"; }
|
||||
|
||||
/*
|
||||
|
||||
@@ -519,7 +519,7 @@ module { name = "help" }
|
||||
#module { name = "m_sasl_dh-aes" }
|
||||
|
||||
/*
|
||||
* m_sasl_dh-aes [EXTRA]
|
||||
* m_sasl_dh-blowfish [EXTRA]
|
||||
*
|
||||
* Add the DH-BLOWFISH mechanism to SASL.
|
||||
* Requires m_sasl to be loaded.
|
||||
@@ -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:
|
||||
*
|
||||
|
||||
@@ -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. */
|
||||
@@ -306,7 +307,7 @@ module
|
||||
* The maximum number of entries allowed on a nickname's certificate fingerprint list.
|
||||
* The default is 5. This number cannot be set to 0.
|
||||
*/
|
||||
accessmax = 5
|
||||
max = 5
|
||||
}
|
||||
command { service = "NickServ"; name = "CERT"; command = "nickserv/cert"; }
|
||||
|
||||
@@ -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"; }
|
||||
@@ -640,7 +648,7 @@ command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; }
|
||||
* Limits how many times the same email address may be used in Anope
|
||||
* to register accounts.
|
||||
*/
|
||||
module
|
||||
#module
|
||||
{
|
||||
name = "ns_maxemail"
|
||||
|
||||
@@ -649,5 +657,5 @@ module
|
||||
* commented, there will be no limit enforced when registering new accounts or using
|
||||
* /msg NickServ SET EMAIL.
|
||||
*/
|
||||
#maxemails = 1
|
||||
maxemails = 1
|
||||
}
|
||||
|
||||
-4846
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
git log --pretty=format:"Revision %h - %cD - %s" > version.log
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
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
|
||||
options:hideregisteredcommands added
|
||||
m_ssl renamed to m_ssl_openssl
|
||||
mail:restrict removed
|
||||
|
||||
Anope Version 1.9.9
|
||||
-------------------
|
||||
|
||||
+8
-3
@@ -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 &);
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ class CoreExport BotInfo : public User, public Serializable
|
||||
|
||||
void GenerateUID();
|
||||
|
||||
void OnKill();
|
||||
|
||||
/** Change the nickname for the bot.
|
||||
* @param newnick The nick to change to
|
||||
*/
|
||||
|
||||
+2
-1
@@ -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
@@ -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
|
||||
|
||||
@@ -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
@@ -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" \
|
||||
|
||||
@@ -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
@@ -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> ¶ms) 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> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
+40
-11
@@ -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 ¶m);
|
||||
|
||||
/** 'unwrap' this mode to our internal representation
|
||||
*/
|
||||
ChannelMode *Unwrap(Anope::string ¶m);
|
||||
|
||||
/** called when a mode is being unwrapped, and is asking us if we can unwrap it
|
||||
*/
|
||||
virtual ChannelMode *Unwrap(ChannelMode *, Anope::string ¶m);
|
||||
};
|
||||
|
||||
/** 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 ¶m) anope_override;
|
||||
|
||||
ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) = 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
|
||||
|
||||
+4
-8
@@ -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
|
||||
@@ -1010,7 +1006,7 @@ class CoreExport Module : public Extensible
|
||||
* mostly to ensure mlock/+r are set.
|
||||
* @param c The channel
|
||||
*/
|
||||
virtual void OnCheckModes(Channel *c) { throw NotImplementedException(); }
|
||||
virtual void OnCheckModes(Reference<Channel> &c) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a channel is synced.
|
||||
* Channels are synced after a sjoin is finished processing
|
||||
@@ -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,
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* (C) 2003-2014 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
struct EntryMsg
|
||||
{
|
||||
Anope::string chan;
|
||||
Anope::string creator;
|
||||
Anope::string message;
|
||||
time_t when;
|
||||
|
||||
virtual ~EntryMsg() { }
|
||||
protected:
|
||||
EntryMsg() { }
|
||||
};
|
||||
|
||||
struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
|
||||
{
|
||||
protected:
|
||||
EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { }
|
||||
|
||||
public:
|
||||
virtual ~EntryMessageList()
|
||||
{
|
||||
for (unsigned i = (*this)->size(); i > 0; --i)
|
||||
delete (*this)->at(i - 1);
|
||||
}
|
||||
|
||||
virtual EntryMsg* Create() = 0;
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
+10
-2
@@ -86,12 +86,13 @@ namespace SASL
|
||||
return;
|
||||
|
||||
NickAlias *na = NickAlias::Find(GetAccount());
|
||||
if (!na)
|
||||
if (!na || na->nc->HasExt("NS_SUSPENDED"))
|
||||
return OnFail();
|
||||
|
||||
Session *s = sasl->GetSession(uid);
|
||||
if (s)
|
||||
{
|
||||
Log(Config->GetClient("NickServ")) << "A user identified to account " << this->GetAccount() << " using SASL";
|
||||
sasl->Succeed(s, na->nc);
|
||||
delete s;
|
||||
}
|
||||
@@ -109,7 +110,14 @@ namespace SASL
|
||||
delete s;
|
||||
}
|
||||
|
||||
Log(Config->GetClient("NickServ")) << "A user failed to identify for account " << this->GetAccount() << " using SASL";
|
||||
Anope::string accountstatus;
|
||||
NickAlias *na = NickAlias::Find(GetAccount());
|
||||
if (!na)
|
||||
accountstatus = "nonexistent ";
|
||||
else if (na->nc->HasExt("NS_SUSPENDED"))
|
||||
accountstatus = "suspended ";
|
||||
|
||||
Log(Config->GetClient("NickServ")) << "A user failed to identify for " << accountstatus << "account " << this->GetAccount() << " using SASL";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -111,6 +120,8 @@ class CoreExport IRCDProto : public Service
|
||||
virtual void SendSQLine(User *, const XLine *x) { }
|
||||
virtual void SendSQLineDel(const XLine *x) { }
|
||||
|
||||
virtual void SendKill(const MessageSource &source, const Anope::string &target, const Anope::string &reason);
|
||||
|
||||
/** Kills a user
|
||||
* @param source Who is doing the kill
|
||||
* @param user The user to be killed
|
||||
@@ -230,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
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
+7
-4
@@ -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. */
|
||||
@@ -92,6 +93,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
|
||||
/* Last time this user sent an email */
|
||||
time_t lastmail;
|
||||
|
||||
protected:
|
||||
/** Create a new user object, initialising necessary fields and
|
||||
* adds it to the hash
|
||||
*
|
||||
@@ -102,19 +104,20 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
|
||||
* @param sip The ip of the user
|
||||
* @param sserver The server of the user
|
||||
* @param srealname The realname/gecos of teh user
|
||||
* @param ssignon User's timestamp
|
||||
* @param ts User's timestamp
|
||||
* @param smodes User's modes
|
||||
* @param suid The unique identifier of the user.
|
||||
* @param nc The account the user is identified as, if any
|
||||
*/
|
||||
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ssignon, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
|
||||
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
|
||||
|
||||
protected:
|
||||
/** Destroy a user.
|
||||
*/
|
||||
virtual ~User();
|
||||
|
||||
public:
|
||||
static User* OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
|
||||
|
||||
/** Update the nickname of a user record accordingly, should be
|
||||
* called from ircd protocol.
|
||||
* @param newnick The new username
|
||||
|
||||
+8
-5
@@ -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;
|
||||
|
||||
|
||||
+590
-555
File diff suppressed because it is too large
Load Diff
+595
-555
File diff suppressed because it is too large
Load Diff
+598
-558
File diff suppressed because it is too large
Load Diff
+10964
File diff suppressed because it is too large
Load Diff
+892
-939
File diff suppressed because it is too large
Load Diff
+642
-612
File diff suppressed because it is too large
Load Diff
+590
-555
File diff suppressed because it is too large
Load Diff
+603
-569
File diff suppressed because it is too large
Load Diff
+586
-558
File diff suppressed because it is too large
Load Diff
+590
-555
File diff suppressed because it is too large
Load Diff
+590
-555
File diff suppressed because it is too large
Load Diff
+590
-555
File diff suppressed because it is too large
Load Diff
+590
-555
File diff suppressed because it is too large
Load Diff
+1
-5
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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?";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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]"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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> ¶ms)
|
||||
@@ -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
@@ -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> ¶ms) 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/cs_entrymsg.h"
|
||||
|
||||
struct EntryMsg : Serializable
|
||||
struct EntryMsgImpl : EntryMsg, Serializable
|
||||
{
|
||||
Serialize::Reference<ChannelInfo> ci;
|
||||
Anope::string creator;
|
||||
Anope::string message;
|
||||
time_t when;
|
||||
|
||||
EntryMsg(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) : Serializable("EntryMsg")
|
||||
EntryMsgImpl() : Serializable("EntryMsg")
|
||||
{
|
||||
this->ci = c;
|
||||
}
|
||||
|
||||
EntryMsgImpl(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) : Serializable("EntryMsg")
|
||||
{
|
||||
this->chan = c->name;
|
||||
this->creator = cname;
|
||||
this->message = cmessage;
|
||||
this->when = ct;
|
||||
}
|
||||
|
||||
~EntryMsg();
|
||||
~EntryMsgImpl();
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override
|
||||
{
|
||||
data["ci"] << this->ci->name;
|
||||
data["ci"] << this->chan;
|
||||
data["creator"] << this->creator;
|
||||
data["message"] << this->message;
|
||||
data.SetType("when", Serialize::Data::DT_INT); data["when"] << this->when;
|
||||
@@ -39,30 +39,33 @@ struct EntryMsg : Serializable
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
};
|
||||
|
||||
struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
|
||||
struct EntryMessageListImpl : EntryMessageList
|
||||
{
|
||||
EntryMessageList(Extensible *) : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { }
|
||||
EntryMessageListImpl(Extensible *) { }
|
||||
|
||||
~EntryMessageList()
|
||||
EntryMsg* Create() anope_override
|
||||
{
|
||||
for (unsigned i = (*this)->size(); i > 0; --i)
|
||||
delete (*this)->at(i - 1);
|
||||
return new EntryMsgImpl();
|
||||
}
|
||||
};
|
||||
|
||||
EntryMsg::~EntryMsg()
|
||||
EntryMsgImpl::~EntryMsgImpl()
|
||||
{
|
||||
ChannelInfo *ci = ChannelInfo::Find(this->chan);
|
||||
if (!ci)
|
||||
return;
|
||||
|
||||
EntryMessageList *messages = ci->GetExt<EntryMessageList>("entrymsg");
|
||||
if (messages)
|
||||
{
|
||||
std::vector<EntryMsg *>::iterator it = std::find((*messages)->begin(), (*messages)->end(), this);
|
||||
if (it != (*messages)->end())
|
||||
(*messages)->erase(it);
|
||||
}
|
||||
if (!messages)
|
||||
return;
|
||||
|
||||
std::vector<EntryMsg *>::iterator it = std::find((*messages)->begin(), (*messages)->end(), this);
|
||||
if (it != (*messages)->end())
|
||||
(*messages)->erase(it);
|
||||
}
|
||||
|
||||
|
||||
Serializable* EntryMsg::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
Serializable* EntryMsgImpl::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
Anope::string sci, screator, smessage;
|
||||
time_t swhen;
|
||||
@@ -77,8 +80,8 @@ Serializable* EntryMsg::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
if (obj)
|
||||
{
|
||||
EntryMsg *msg = anope_dynamic_static_cast<EntryMsg *>(obj);
|
||||
msg->ci = ci;
|
||||
EntryMsgImpl *msg = anope_dynamic_static_cast<EntryMsgImpl *>(obj);
|
||||
msg->chan = ci->name;
|
||||
data["creator"] >> msg->creator;
|
||||
data["message"] >> msg->message;
|
||||
data["when"] >> msg->when;
|
||||
@@ -89,7 +92,7 @@ Serializable* EntryMsg::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
data["when"] >> swhen;
|
||||
|
||||
EntryMsg *m = new EntryMsg(ci, screator, smessage, swhen);
|
||||
EntryMsgImpl *m = new EntryMsgImpl(ci, screator, smessage, swhen);
|
||||
(*messages)->push_back(m);
|
||||
return m;
|
||||
}
|
||||
@@ -139,7 +142,7 @@ class CommandEntryMessage : public Command
|
||||
source.Reply(_("The entry message list for \002%s\002 is full."), ci->name.c_str());
|
||||
else
|
||||
{
|
||||
(*messages)->push_back(new EntryMsg(ci, source.GetNick(), message));
|
||||
(*messages)->push_back(new EntryMsgImpl(ci, source.GetNick(), message));
|
||||
Log(source.IsFounder(ci) ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to add a message";
|
||||
source.Reply(_("Entry message added to \002%s\002"), ci->name.c_str());
|
||||
}
|
||||
@@ -257,13 +260,13 @@ class CommandEntryMessage : public Command
|
||||
class CSEntryMessage : public Module
|
||||
{
|
||||
CommandEntryMessage commandentrymsg;
|
||||
ExtensibleItem<EntryMessageList> eml;
|
||||
ExtensibleItem<EntryMessageListImpl> eml;
|
||||
Serialize::Type entrymsg_type;
|
||||
|
||||
public:
|
||||
CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandentrymsg(this),
|
||||
eml(this, "entrymsg"), entrymsg_type("EntryMsg", EntryMsg::Unserialize)
|
||||
eml(this, "entrymsg"), entrymsg_type("EntryMsg", EntryMsgImpl::Unserialize)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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> ¶ms)
|
||||
@@ -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);
|
||||
|
||||
@@ -73,13 +73,14 @@ class CommandCSInvite : public Command
|
||||
if (u2 != u)
|
||||
{
|
||||
source.Reply(_("\002%s\002 has been invited to \002%s\002."), u2->nick.c_str(), c->name.c_str());
|
||||
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002 by \002%s\002."), c->name.c_str(), source.GetNick().c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick;
|
||||
}
|
||||
else
|
||||
{
|
||||
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002."), c->name.c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci);
|
||||
}
|
||||
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002."), c->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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))
|
||||
@@ -902,9 +901,9 @@ class CSMode : public Module
|
||||
}
|
||||
}
|
||||
|
||||
void OnCheckModes(Channel *c) anope_override
|
||||
void OnCheckModes(Reference<Channel> &c) anope_override
|
||||
{
|
||||
if (!c->ci)
|
||||
if (!c || !c->ci)
|
||||
return;
|
||||
|
||||
ModeLocks *locks = modelocks.Get(c->ci);
|
||||
@@ -919,9 +918,9 @@ class CSMode : public Module
|
||||
if (cm->type == MODE_REGULAR)
|
||||
{
|
||||
if (!c->HasMode(cm->name) && ml->set)
|
||||
c->SetMode(NULL, cm);
|
||||
c->SetMode(NULL, cm, "", false);
|
||||
else if (c->HasMode(cm->name) && !ml->set)
|
||||
c->RemoveMode(NULL, cm);
|
||||
c->RemoveMode(NULL, cm, "", false);
|
||||
}
|
||||
else if (cm->type == MODE_PARAM)
|
||||
{
|
||||
@@ -932,26 +931,26 @@ class CSMode : public Module
|
||||
c->GetParam(cm->name, param);
|
||||
|
||||
if (!c->HasMode(cm->name) || (!param.empty() && !ml->param.empty() && !param.equals_cs(ml->param)))
|
||||
c->SetMode(NULL, cm, ml->param);
|
||||
c->SetMode(NULL, cm, ml->param, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (c->HasMode(cm->name))
|
||||
c->RemoveMode(NULL, cm);
|
||||
c->RemoveMode(NULL, cm, "", false);
|
||||
}
|
||||
|
||||
}
|
||||
else if (cm->type == MODE_LIST || cm->type == MODE_STATUS)
|
||||
{
|
||||
if (ml->set)
|
||||
c->SetMode(NULL, cm, ml->param);
|
||||
c->SetMode(NULL, cm, ml->param, false);
|
||||
else
|
||||
c->RemoveMode(NULL, cm, ml->param);
|
||||
c->RemoveMode(NULL, cm, ml->param, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnCreateChan(ChannelInfo *ci) anope_override
|
||||
void OnChanRegistered(ChannelInfo *ci) anope_override
|
||||
{
|
||||
ModeLocks *ml = modelocks.Require(ci);
|
||||
Anope::string mlock;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+20
-16
@@ -1163,18 +1163,27 @@ class CSSet : public Module
|
||||
return;
|
||||
|
||||
bool created;
|
||||
Channel *c = Channel::FindOrCreate(ci->name, created, ci->time_registered);
|
||||
if (!ci->bi)
|
||||
{
|
||||
BotInfo *ChanServ = Config->GetClient("ChanServ");
|
||||
if (ChanServ)
|
||||
ChanServ->Assign(NULL, ci);
|
||||
}
|
||||
Channel *c = Channel::FindOrCreate(ci->name, created);
|
||||
|
||||
if (ci->bi && !c->FindUser(ci->bi))
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName("PERM");
|
||||
if (cm)
|
||||
{
|
||||
ChannelStatus status(BotModes());
|
||||
ci->bi->Join(c, &status);
|
||||
c->SetMode(NULL, cm);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ci->bi)
|
||||
{
|
||||
BotInfo *ChanServ = Config->GetClient("ChanServ");
|
||||
if (ChanServ)
|
||||
ChanServ->Assign(NULL, ci);
|
||||
}
|
||||
|
||||
if (ci->bi && !c->FindUser(ci->bi))
|
||||
{
|
||||
ChannelStatus status(BotModes());
|
||||
ci->bi->Join(c, &status);
|
||||
}
|
||||
}
|
||||
|
||||
if (created)
|
||||
@@ -1280,12 +1289,6 @@ class CSSet : public Module
|
||||
{
|
||||
if (c->ci)
|
||||
persist.Unset(c->ci);
|
||||
|
||||
if (c->CheckDelete())
|
||||
{
|
||||
delete c;
|
||||
return EVENT_STOP;
|
||||
}
|
||||
}
|
||||
|
||||
if (c->ci && mode->type != MODE_STATUS && !c->syncing && Me->IsSynced())
|
||||
@@ -1319,6 +1322,7 @@ class CSSet : public Module
|
||||
if (noautoop.HasExt(chan->ci))
|
||||
give_modes = false;
|
||||
if (secureops.HasExt(chan->ci))
|
||||
// This overrides what chanserv does because it is loaded after chanserv
|
||||
take_modes = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -116,7 +116,7 @@ class CommandCSSetMisc : public Command
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -131,11 +131,13 @@ class CommandCSSetMisc : public Command
|
||||
if (!param.empty())
|
||||
{
|
||||
item->Set(ci, CSMiscData(ci, key, param));
|
||||
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change it to " << param;
|
||||
source.Reply(CHAN_SETTING_CHANGED, scommand.c_str(), ci->name.c_str(), params[1].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
item->Unset(ci);
|
||||
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to unset it";
|
||||
source.Reply(CHAN_SETTING_UNSET, scommand.c_str(), ci->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,13 @@ class CommandCSUnban : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) 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
@@ -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> ¶ms)
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,21 +13,31 @@
|
||||
|
||||
class CommandHSGroup : public Command
|
||||
{
|
||||
bool setting;
|
||||
|
||||
public:
|
||||
void Sync(const NickAlias *na)
|
||||
{
|
||||
if (setting)
|
||||
return;
|
||||
|
||||
if (!na || !na->HasVhost())
|
||||
return;
|
||||
|
||||
|
||||
setting = true;
|
||||
for (unsigned i = 0; i < na->nc->aliases->size(); ++i)
|
||||
{
|
||||
NickAlias *nick = na->nc->aliases->at(i);
|
||||
if (nick)
|
||||
{
|
||||
nick->SetVhost(na->GetVhostIdent(), na->GetVhostHost(), na->GetVhostCreator());
|
||||
FOREACH_MOD(OnSetVhost, (nick));
|
||||
}
|
||||
}
|
||||
setting = false;
|
||||
}
|
||||
|
||||
public:
|
||||
CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0)
|
||||
CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0), setting(false)
|
||||
{
|
||||
this->SetDesc(_("Syncs the vhost for all nicks in a group"));
|
||||
}
|
||||
@@ -69,12 +79,36 @@ class CommandHSGroup : public Command
|
||||
class HSGroup : public Module
|
||||
{
|
||||
CommandHSGroup commandhsgroup;
|
||||
bool syncongroup;
|
||||
bool synconset;
|
||||
|
||||
public:
|
||||
HSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandhsgroup(this)
|
||||
{
|
||||
}
|
||||
|
||||
void OnSetVhost(NickAlias *na) anope_override
|
||||
{
|
||||
if (!synconset)
|
||||
return;
|
||||
|
||||
commandhsgroup.Sync(na);
|
||||
}
|
||||
|
||||
void OnNickGroup(User *u, NickAlias *na) anope_override
|
||||
{
|
||||
if (!syncongroup)
|
||||
return;
|
||||
|
||||
commandhsgroup.Sync(na);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) anope_override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
syncongroup = block->Get<bool>("syncongroup");
|
||||
synconset = block->Get<bool>("synconset");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -148,7 +148,9 @@ struct NSCertListImpl : NSCertList
|
||||
Anope::string buf;
|
||||
data["cert"] >> buf;
|
||||
spacesepstream sep(buf);
|
||||
c->ClearCert();
|
||||
for (unsigned i = 0; i < c->certs.size(); ++i)
|
||||
certmap.erase(c->certs[i]);
|
||||
c->certs.clear();
|
||||
while (sep.GetToken(buf))
|
||||
{
|
||||
c->certs.push_back(buf);
|
||||
@@ -161,28 +163,28 @@ struct NSCertListImpl : NSCertList
|
||||
class CommandNSCert : public Command
|
||||
{
|
||||
private:
|
||||
void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &certfp)
|
||||
void DoAdd(CommandSource &source, NickCore *nc, Anope::string certfp)
|
||||
{
|
||||
NSCertList *cl = nc->Require<NSCertList>("certificates");
|
||||
unsigned max = Config->GetModule(this->owner)->Get<unsigned>("max", "5");
|
||||
|
||||
if (cl->GetCertCount() >= Config->GetModule(this->owner)->Get<unsigned>("accessmax", "5"))
|
||||
if (cl->GetCertCount() >= max)
|
||||
{
|
||||
source.Reply(_("Sorry, the maximum of %d certificate entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("accessmax"));
|
||||
source.Reply(_("Sorry, the maximum of %d certificate entries has been reached."), max);
|
||||
return;
|
||||
}
|
||||
|
||||
if (certfp.empty())
|
||||
if (source.GetAccount() == nc)
|
||||
{
|
||||
if (source.GetUser() && !source.GetUser()->fingerprint.empty() && !cl->FindCert(source.GetUser()->fingerprint))
|
||||
{
|
||||
cl->AddCert(source.GetUser()->fingerprint);
|
||||
Log(LOG_COMMAND, source, this) << "to ADD its current certificate fingerprint " << source.GetUser()->fingerprint;
|
||||
source.Reply(_("\002%s\002 added to your certificate list."), source.GetUser()->fingerprint.c_str());
|
||||
}
|
||||
else
|
||||
this->OnSyntaxError(source, "ADD");
|
||||
User *u = source.GetUser();
|
||||
|
||||
return;
|
||||
if (!u || u->fingerprint.empty())
|
||||
{
|
||||
source.Reply(_("You are not using a client certificate."));
|
||||
return;
|
||||
}
|
||||
|
||||
certfp = u->fingerprint;
|
||||
}
|
||||
|
||||
if (cl->FindCert(certfp))
|
||||
@@ -191,26 +193,31 @@ class CommandNSCert : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (certmap.find(certfp) != certmap.end())
|
||||
{
|
||||
source.Reply(_("Fingerprint \002%s\002 is already in use."), certfp.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
cl->AddCert(certfp);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD certificate fingerprint " << certfp << " to " << nc->display;
|
||||
source.Reply(_("\002%s\002 added to %s's certificate list."), certfp.c_str(), nc->display.c_str());
|
||||
}
|
||||
|
||||
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &certfp)
|
||||
void DoDel(CommandSource &source, NickCore *nc, Anope::string certfp)
|
||||
{
|
||||
NSCertList *cl = nc->Require<NSCertList>("certificates");
|
||||
|
||||
if (certfp.empty())
|
||||
{
|
||||
if (source.GetUser() && !source.GetUser()->fingerprint.empty() && cl->FindCert(source.GetUser()->fingerprint))
|
||||
{
|
||||
cl->EraseCert(source.GetUser()->fingerprint);
|
||||
Log(LOG_COMMAND, source, this) << "to DELETE its current certificate fingerprint " << source.GetUser()->fingerprint;
|
||||
source.Reply(_("\002%s\002 deleted from your certificate list."), source.GetUser()->fingerprint.c_str());
|
||||
}
|
||||
else
|
||||
this->OnSyntaxError(source, "DEL");
|
||||
User *u = source.GetUser();
|
||||
if (u)
|
||||
certfp = u->fingerprint;
|
||||
}
|
||||
|
||||
if (certfp.empty())
|
||||
{
|
||||
this->OnSyntaxError(source, "DEL");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -248,7 +255,7 @@ class CommandNSCert : public Command
|
||||
CommandNSCert(Module *creator) : Command(creator, "nickserv/cert", 1, 3)
|
||||
{
|
||||
this->SetDesc(_("Modify the nickname client certificate list"));
|
||||
this->SetSyntax(_("ADD [\037nickname\037] \037fingerprint\037"));
|
||||
this->SetSyntax(_("ADD [\037nickname\037] [\037fingerprint\037]"));
|
||||
this->SetSyntax(_("DEL [\037nickname\037] \037fingerprint\037"));
|
||||
this->SetSyntax(_("LIST [\037nickname\037]"));
|
||||
}
|
||||
|
||||
@@ -72,10 +72,10 @@ class NSGroupRequest : public IdentifyRequest
|
||||
class CommandNSGroup : public Command
|
||||
{
|
||||
public:
|
||||
CommandNSGroup(Module *creator) : Command(creator, "nickserv/group", 1, 2)
|
||||
CommandNSGroup(Module *creator) : Command(creator, "nickserv/group", 0, 2)
|
||||
{
|
||||
this->SetDesc(_("Join a group"));
|
||||
this->SetSyntax(_("\037target\037 \037password\037"));
|
||||
this->SetSyntax(_("\037[target]\037 \037[password]\037"));
|
||||
this->AllowUnregistered(true);
|
||||
this->RequireUser(true);
|
||||
}
|
||||
@@ -83,7 +83,23 @@ class CommandNSGroup : public Command
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.GetUser();
|
||||
const Anope::string &nick = params[0];
|
||||
|
||||
Anope::string nick;
|
||||
if (params.empty())
|
||||
{
|
||||
NickCore* core = u->Account();
|
||||
if (core)
|
||||
nick = core->display;
|
||||
}
|
||||
else
|
||||
nick = params[0];
|
||||
|
||||
if (nick.empty())
|
||||
{
|
||||
this->SendSyntax(source);
|
||||
return;
|
||||
}
|
||||
|
||||
const Anope::string &pass = params.size() > 1 ? params[1] : "";
|
||||
|
||||
if (Anope::ReadOnly)
|
||||
@@ -123,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 &&
|
||||
@@ -140,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");
|
||||
@@ -297,14 +313,25 @@ class CommandNSGList : public Command
|
||||
|
||||
ListFormatter list(source.GetAccount());
|
||||
list.AddColumn(_("Nick")).AddColumn(_("Expires"));
|
||||
time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire");
|
||||
time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "21d"),
|
||||
unconfirmed_expire = Config->GetModule("nickserv")->Get<time_t>("unconfirmedexpire", "1d");
|
||||
for (unsigned i = 0; i < nc->aliases->size(); ++i)
|
||||
{
|
||||
const NickAlias *na2 = nc->aliases->at(i);
|
||||
|
||||
Anope::string expires;
|
||||
if (na2->HasExt("NS_NO_EXPIRE"))
|
||||
expires = NO_EXPIRE;
|
||||
else if (!nickserv_expire || Anope::NoExpire)
|
||||
;
|
||||
else if (na2->nc->HasExt("UNCONFIRMED") && unconfirmed_expire)
|
||||
expires = Anope::strftime(na2->time_registered + unconfirmed_expire, source.GetAccount());
|
||||
else
|
||||
expires = Anope::strftime(na2->last_seen + nickserv_expire, source.GetAccount());
|
||||
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Nick"] = na2->nick;
|
||||
entry["Expires"] = (na2->HasExt("NS_NO_EXPIRE") || !nickserv_expire || Anope::NoExpire) ? "Does not expire" : Anope::strftime(na2->last_seen + nickserv_expire, source.GetAccount());
|
||||
entry["Expires"] = expires;
|
||||
list.AddEntry(entry);
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -130,12 +130,6 @@ class CommandNSRegister : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsregister.equals_ci("mail") && email.empty())
|
||||
{
|
||||
source.Reply(_("You must specify an email address."));
|
||||
return;
|
||||
}
|
||||
|
||||
time_t nickregdelay = Config->GetModule(this->owner)->Get<time_t>("nickregdelay");
|
||||
time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
|
||||
if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay)
|
||||
@@ -204,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());
|
||||
@@ -222,8 +216,11 @@ class CommandNSRegister : public Command
|
||||
}
|
||||
else if (nsregister.equals_ci("mail"))
|
||||
{
|
||||
nc->Extend<bool>("UNCONFIRMED");
|
||||
SendRegmail(NULL, na, source.service);
|
||||
if (!email.empty())
|
||||
{
|
||||
nc->Extend<bool>("UNCONFIRMED");
|
||||
SendRegmail(NULL, na, source.service);
|
||||
}
|
||||
}
|
||||
|
||||
if (u)
|
||||
|
||||
@@ -27,9 +27,7 @@ class CommandNSResetPass : public Command
|
||||
{
|
||||
const NickAlias *na;
|
||||
|
||||
if (Config->GetBlock("mail")->Get<bool>("restrict") && !source.HasCommand("nickserv/resetpass"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!(na = NickAlias::Find(params[0])))
|
||||
if (!(na = NickAlias::Find(params[0])))
|
||||
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
|
||||
else if (!na->nc->email.equals_ci(params[1]))
|
||||
source.Reply(_("Incorrect email address."));
|
||||
|
||||
@@ -119,7 +119,7 @@ class CommandNSSetPassword : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const Anope::string ¶m = params[1];
|
||||
const Anope::string ¶m = 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());
|
||||
}
|
||||
|
||||
@@ -449,6 +451,12 @@ class CommandNSSetEmail : public Command
|
||||
}
|
||||
NickCore *nc = na->nc;
|
||||
|
||||
if (nc->HasExt("UNCONFIRMED"))
|
||||
{
|
||||
source.Reply(_("You may not change the email of an unconfirmed account."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (param.empty() && Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
{
|
||||
source.Reply(_("You cannot unset the e-mail on this network."));
|
||||
@@ -786,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)
|
||||
@@ -818,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"));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ class OSSession : public Module
|
||||
if (!e->expires || e->expires > Anope::CurTime)
|
||||
continue;
|
||||
BotInfo *OperServ = Config->GetClient("OperServ");
|
||||
Log(OperServ, "expire/exception") << "Session exception for " << e->mask << "has expired.";
|
||||
Log(OperServ, "expire/exception") << "Session exception for " << e->mask << " has expired.";
|
||||
this->ss.DelException(e);
|
||||
delete e;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -91,7 +91,7 @@ class CommandOSSVSJoin : public Command
|
||||
Channel *c = Channel::Find(params[1]);
|
||||
if (target == NULL)
|
||||
source.Reply(NICK_X_NOT_IN_USE, params[0].c_str());
|
||||
else if (target->IsProtected() || target->server == Me)
|
||||
else if (source.GetUser() != target && (target->IsProtected() || target->server == Me))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!IRCD->IsChannelValid(params[1]))
|
||||
source.Reply(CHAN_X_INVALID, params[1].c_str());
|
||||
@@ -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> ¶ms) anope_override
|
||||
@@ -133,9 +133,10 @@ 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 (target->IsProtected() || target->server == Me)
|
||||
else if (source.GetUser() != target && (target->IsProtected() || target->server == Me))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!c)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, params[1].c_str());
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ class DBFlatFile : public Module, public Pipe
|
||||
|
||||
const Anope::string &db_name = Anope::DataDir + "/" + Config->GetModule(this)->Get<const Anope::string>("database", "anope.db");
|
||||
|
||||
std::fstream fd(db_name.c_str(), std::ios_base::in);
|
||||
std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary);
|
||||
if (!fd.is_open())
|
||||
{
|
||||
Log(this) << "Unable to open " << db_name << " for reading!";
|
||||
@@ -310,7 +310,7 @@ class DBFlatFile : public Module, public Pipe
|
||||
if (Anope::IsFile(db_name))
|
||||
rename(db_name.c_str(), (db_name + ".tmp").c_str());
|
||||
|
||||
std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream(db_name.c_str(), std::ios_base::out | std::ios_base::trunc);
|
||||
std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream(db_name.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
|
||||
|
||||
if (!fs->is_open())
|
||||
Log(this) << "Unable to open " << db_name << " for writing";
|
||||
@@ -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())
|
||||
{
|
||||
@@ -382,7 +382,7 @@ class DBFlatFile : public Module, public Pipe
|
||||
else
|
||||
db_name = Anope::DataDir + "/" + Config->GetModule(this)->Get<const Anope::string>("database", "anope.db");
|
||||
|
||||
std::fstream fd(db_name.c_str(), std::ios_base::in);
|
||||
std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary);
|
||||
if (!fd.is_open())
|
||||
{
|
||||
Log(this) << "Unable to open " << db_name << " for reading!";
|
||||
|
||||
+46
-12
@@ -16,6 +16,7 @@
|
||||
#include "modules/os_news.h"
|
||||
#include "modules/suspend.h"
|
||||
#include "modules/os_forbid.h"
|
||||
#include "modules/cs_entrymsg.h"
|
||||
|
||||
#define READ(x) \
|
||||
if (true) \
|
||||
@@ -141,7 +142,7 @@ enum
|
||||
LANG_PL /* Polish */
|
||||
};
|
||||
|
||||
static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status)
|
||||
static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status, uint32_t *limit, Anope::string *key)
|
||||
{
|
||||
ModeLocks *ml = ci->Require<ModeLocks>("modelocks");
|
||||
for (unsigned i = 0; i < (sizeof(mlock_infos) / sizeof(mlock_info)); ++i)
|
||||
@@ -149,7 +150,14 @@ static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status)
|
||||
{
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByChar(mlock_infos[i].c);
|
||||
if (cm && ml)
|
||||
ml->SetMLock(cm, status);
|
||||
{
|
||||
if (limit && mlock_infos[i].c == 'l')
|
||||
ml->SetMLock(cm, status, stringify(*limit));
|
||||
else if (key && mlock_infos[i].c == 'k')
|
||||
ml->SetMLock(cm, status, *key);
|
||||
else
|
||||
ml->SetMLock(cm, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,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;
|
||||
@@ -890,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)
|
||||
@@ -926,9 +934,11 @@ static void LoadChannels()
|
||||
READ(read_uint32(&tmpu32, f)); // mlock off
|
||||
ci->Extend<uint32_t>("mlock_off", tmpu32);
|
||||
READ(read_uint32(&tmpu32, f)); // mlock limit
|
||||
READ(read_string(buffer, f));
|
||||
READ(read_string(buffer, f));
|
||||
READ(read_string(buffer, f));
|
||||
ci->Extend<uint32_t>("mlock_limit", tmpu32);
|
||||
READ(read_string(buffer, f)); // key
|
||||
ci->Extend<Anope::string>("mlock_key", buffer);
|
||||
READ(read_string(buffer, f)); // +f
|
||||
READ(read_string(buffer, f)); // +L
|
||||
|
||||
READ(read_int16(&tmp16, f));
|
||||
READ(read_int16(&ci->memos.memomax, f));
|
||||
@@ -948,9 +958,24 @@ static void LoadChannels()
|
||||
}
|
||||
|
||||
READ(read_string(buffer, f));
|
||||
if (!buffer.empty())
|
||||
{
|
||||
EntryMessageList *eml = ci->Require<EntryMessageList>("entrymsg");
|
||||
if (eml)
|
||||
{
|
||||
EntryMsg *e = eml->Create();
|
||||
|
||||
e->chan = ci->name;
|
||||
e->creator = "Unknown";
|
||||
e->message = buffer;
|
||||
e->when = Anope::CurTime;
|
||||
|
||||
(*eml)->push_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -1270,11 +1295,12 @@ static void LoadNews()
|
||||
|
||||
class DBOld : public Module
|
||||
{
|
||||
PrimitiveExtensibleItem<uint32_t> mlock_on, mlock_off;
|
||||
PrimitiveExtensibleItem<uint32_t> mlock_on, mlock_off, mlock_limit;
|
||||
PrimitiveExtensibleItem<Anope::string> mlock_key;
|
||||
|
||||
public:
|
||||
DBOld(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR),
|
||||
mlock_on(this, "mlock_on"), mlock_off(this, "mlock_off")
|
||||
mlock_on(this, "mlock_on"), mlock_off(this, "mlock_off"), mlock_limit(this, "mlock_limit"), mlock_key(this, "mlock_key")
|
||||
{
|
||||
|
||||
|
||||
@@ -1302,20 +1328,28 @@ class DBOld : public Module
|
||||
for (registered_channel_map::iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
|
||||
{
|
||||
ChannelInfo *ci = it->second;
|
||||
uint32_t *limit = mlock_limit.Get(ci);
|
||||
Anope::string *key = mlock_key.Get(ci);
|
||||
|
||||
uint32_t *u = mlock_on.Get(ci);
|
||||
if (u)
|
||||
{
|
||||
process_mlock(ci, *u, true);
|
||||
process_mlock(ci, *u, true, limit, key);
|
||||
mlock_on.Unset(ci);
|
||||
}
|
||||
|
||||
u = mlock_off.Get(ci);
|
||||
if (u)
|
||||
{
|
||||
process_mlock(ci, *u, false);
|
||||
process_mlock(ci, *u, false, limit, key);
|
||||
mlock_off.Unset(ci);
|
||||
}
|
||||
|
||||
mlock_limit.Unset(ci);
|
||||
mlock_key.Unset(ci);
|
||||
|
||||
if (ci->c)
|
||||
ci->c->CheckModes();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+79
-26
@@ -1,4 +1,5 @@
|
||||
/* RequiredLibraries: ldap,lber */
|
||||
/* RequiredWindowsLibraries: libldap,liblber */
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/ldap.h"
|
||||
@@ -12,6 +13,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
int port;
|
||||
Anope::string admin_binddn;
|
||||
Anope::string admin_pass;
|
||||
time_t timeout;
|
||||
|
||||
LDAP *con;
|
||||
|
||||
@@ -70,20 +72,26 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
}
|
||||
|
||||
public:
|
||||
typedef std::map<int, LDAPInterface *> query_queue;
|
||||
typedef std::map<LDAPQuery, std::pair<time_t, LDAPInterface *> > query_queue;
|
||||
typedef std::vector<std::pair<LDAPInterface *, LDAPResult *> > result_queue;
|
||||
query_queue queries;
|
||||
result_queue results;
|
||||
|
||||
LDAPService(Module *o, const Anope::string &n, const Anope::string &s, int po, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), port(po), admin_binddn(b), admin_pass(p), last_connect(0)
|
||||
LDAPService(Module *o, const Anope::string &n, const Anope::string &s, int po, const Anope::string &b, const Anope::string &p, time_t t) : LDAPProvider(o, n), server(s), port(po), admin_binddn(b), admin_pass(p), timeout(t), last_connect(0)
|
||||
{
|
||||
int i = ldap_initialize(&this->con, this->server.c_str());
|
||||
if (i != LDAP_SUCCESS)
|
||||
throw LDAPException("Unable to connect to LDAP service " + this->name + ": " + ldap_err2string(i));
|
||||
|
||||
const int version = LDAP_VERSION3;
|
||||
i = ldap_set_option(this->con, LDAP_OPT_PROTOCOL_VERSION, &version);
|
||||
if (i != LDAP_OPT_SUCCESS)
|
||||
throw LDAPException("Unable to set protocol version for " + this->name + ": " + ldap_err2string(i));
|
||||
|
||||
const struct timeval tv = { 0, 0 };
|
||||
i = ldap_set_option(this->con, LDAP_OPT_NETWORK_TIMEOUT, &tv);
|
||||
if (i != LDAP_OPT_SUCCESS)
|
||||
throw LDAPException("Unable to set timeout for " + this->name + ": " + ldap_err2string(i));
|
||||
}
|
||||
|
||||
~LDAPService()
|
||||
@@ -92,15 +100,25 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
|
||||
for (query_queue::iterator it = this->queries.begin(), it_end = this->queries.end(); it != it_end; ++it)
|
||||
{
|
||||
ldap_abandon_ext(this->con, it->first, NULL, NULL);
|
||||
it->second->OnDelete();
|
||||
LDAPQuery msgid = it->first;
|
||||
LDAPInterface *i = it->second.second;
|
||||
|
||||
ldap_abandon_ext(this->con, msgid, NULL, NULL);
|
||||
if (i)
|
||||
i->OnDelete();
|
||||
}
|
||||
this->queries.clear();
|
||||
|
||||
for (result_queue::iterator it = this->results.begin(), it_end = this->results.end(); it != it_end; ++it)
|
||||
{
|
||||
it->second->error = "LDAP Interface is going away";
|
||||
it->first->OnError(*it->second);
|
||||
LDAPInterface *i = it->first;
|
||||
LDAPResult *r = it->second;
|
||||
|
||||
r->error = "LDAP Interface is going away";
|
||||
if (i)
|
||||
i->OnError(*r);
|
||||
|
||||
delete r;
|
||||
}
|
||||
this->results.clear();
|
||||
|
||||
@@ -137,7 +155,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
if (i != NULL)
|
||||
{
|
||||
this->Lock();
|
||||
this->queries[msgid] = i;
|
||||
this->queries[msgid] = std::make_pair(Anope::CurTime, i);
|
||||
this->Unlock();
|
||||
}
|
||||
this->Wakeup();
|
||||
@@ -164,7 +182,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
}
|
||||
|
||||
this->Lock();
|
||||
this->queries[msgid] = i;
|
||||
this->queries[msgid] = std::make_pair(Anope::CurTime, i);
|
||||
this->Unlock();
|
||||
this->Wakeup();
|
||||
|
||||
@@ -192,7 +210,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
if (i != NULL)
|
||||
{
|
||||
this->Lock();
|
||||
this->queries[msgid] = i;
|
||||
this->queries[msgid] = std::make_pair(Anope::CurTime, i);
|
||||
this->Unlock();
|
||||
}
|
||||
this->Wakeup();
|
||||
@@ -219,7 +237,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
if (i != NULL)
|
||||
{
|
||||
this->Lock();
|
||||
this->queries[msgid] = i;
|
||||
this->queries[msgid] = std::make_pair(Anope::CurTime, i);
|
||||
this->Unlock();
|
||||
}
|
||||
this->Wakeup();
|
||||
@@ -248,7 +266,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
if (i != NULL)
|
||||
{
|
||||
this->Lock();
|
||||
this->queries[msgid] = i;
|
||||
this->queries[msgid] = std::make_pair(Anope::CurTime, i);
|
||||
this->Unlock();
|
||||
}
|
||||
this->Wakeup();
|
||||
@@ -256,6 +274,33 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
return msgid;
|
||||
}
|
||||
|
||||
private:
|
||||
void Timeout()
|
||||
{
|
||||
this->Lock();
|
||||
for (query_queue::iterator it = this->queries.begin(), it_end = this->queries.end(); it != it_end;)
|
||||
{
|
||||
LDAPQuery msgid = it->first;
|
||||
time_t created = it->second.first;
|
||||
LDAPInterface *i = it->second.second;
|
||||
++it;
|
||||
|
||||
if (Anope::CurTime > created + timeout)
|
||||
{
|
||||
LDAPResult *ldap_result = new LDAPResult();
|
||||
ldap_result->id = msgid;
|
||||
ldap_result->error = "Query timed out";
|
||||
|
||||
this->queries.erase(msgid);
|
||||
this->results.push_back(std::make_pair(i, ldap_result));
|
||||
|
||||
me->Notify();
|
||||
}
|
||||
}
|
||||
this->Unlock();
|
||||
}
|
||||
|
||||
public:
|
||||
void Run() anope_override
|
||||
{
|
||||
while (!this->GetExitState())
|
||||
@@ -265,14 +310,15 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
this->Lock();
|
||||
this->Wait();
|
||||
this->Unlock();
|
||||
if (this->GetExitState())
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
this->Timeout();
|
||||
|
||||
struct timeval tv = { 1, 0 };
|
||||
LDAPMessage *result;
|
||||
int rtype = ldap_result(this->con, LDAP_RES_ANY, 1, &tv, &result);
|
||||
if (rtype <= 0 || this->GetExitState())
|
||||
if (rtype <= 0)
|
||||
continue;
|
||||
|
||||
int cur_id = ldap_msgid(result);
|
||||
@@ -286,7 +332,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
|
||||
ldap_msgfree(result);
|
||||
continue;
|
||||
}
|
||||
LDAPInterface *i = it->second;
|
||||
LDAPInterface *i = it->second.second;
|
||||
this->queries.erase(it);
|
||||
|
||||
this->Unlock();
|
||||
@@ -459,10 +505,11 @@ class ModuleLDAP : public Module, public Pipe
|
||||
int port = ldap->Get<int>("port", "389");
|
||||
const Anope::string &admin_binddn = ldap->Get<const Anope::string>("admin_binddn");
|
||||
const Anope::string &admin_password = ldap->Get<const Anope::string>("admin_password");
|
||||
time_t timeout = ldap->Get<time_t>("timeout", "5");
|
||||
|
||||
try
|
||||
{
|
||||
LDAPService *ss = new LDAPService(this, connname, server, port, admin_binddn, admin_password);
|
||||
LDAPService *ss = new LDAPService(this, connname, server, port, admin_binddn, admin_password, timeout);
|
||||
ss->Start();
|
||||
this->LDAPServices.insert(std::make_pair(connname, ss));
|
||||
|
||||
@@ -484,11 +531,11 @@ class ModuleLDAP : public Module, public Pipe
|
||||
s->Lock();
|
||||
for (LDAPService::query_queue::iterator it2 = s->queries.begin(); it2 != s->queries.end();)
|
||||
{
|
||||
int msgid = it2->first;
|
||||
LDAPInterface *i = it2->second;
|
||||
LDAPQuery msgid = it2->first;
|
||||
LDAPInterface *i = it2->second.second;
|
||||
++it2;
|
||||
|
||||
if (i->owner == m)
|
||||
if (i && i->owner == m)
|
||||
{
|
||||
i->OnDelete();
|
||||
s->queries.erase(msgid);
|
||||
@@ -499,7 +546,7 @@ class ModuleLDAP : public Module, public Pipe
|
||||
LDAPInterface *li = s->results[i - 1].first;
|
||||
LDAPResult *r = s->results[i - 1].second;
|
||||
|
||||
if (li->owner == m)
|
||||
if (li && li->owner == m)
|
||||
{
|
||||
s->results.erase(s->results.begin() + i - 1);
|
||||
delete r;
|
||||
@@ -515,9 +562,9 @@ class ModuleLDAP : public Module, public Pipe
|
||||
{
|
||||
LDAPService *s = it->second;
|
||||
|
||||
LDAPService::result_queue results;
|
||||
s->Lock();
|
||||
LDAPService::result_queue results = s->results;
|
||||
s->results.clear();
|
||||
results.swap(s->results);
|
||||
s->Unlock();
|
||||
|
||||
for (unsigned i = 0; i < results.size(); ++i)
|
||||
@@ -525,10 +572,16 @@ class ModuleLDAP : public Module, public Pipe
|
||||
LDAPInterface *li = results[i].first;
|
||||
LDAPResult *r = results[i].second;
|
||||
|
||||
if (!r->error.empty())
|
||||
li->OnError(*r);
|
||||
else
|
||||
li->OnResult(*r);
|
||||
if (li != NULL)
|
||||
{
|
||||
if (!r->getError().empty())
|
||||
{
|
||||
Log(this) << "Error running LDAP query: " << r->getError();
|
||||
li->OnError(*r);
|
||||
}
|
||||
else
|
||||
li->OnResult(*r);
|
||||
}
|
||||
|
||||
delete r;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,4 +1,5 @@
|
||||
/* RequiredLibraries: pcre */
|
||||
/* RequiredWindowsLibraries: libpcre */
|
||||
|
||||
#include "module.h"
|
||||
#include <pcre.h>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* RequiredLibraries: ssl,crypto */
|
||||
/* RequiredWindowsLibraries: ssleay32,libeay32 */
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/sasl.h"
|
||||
@@ -21,10 +22,10 @@ class DHAES : public Mechanism
|
||||
}
|
||||
|
||||
public:
|
||||
struct Session : SASL::Session
|
||||
struct DHAESSession : SASL::Session
|
||||
{
|
||||
DH* dh;
|
||||
Session(Mechanism *m, const Anope::string &u, DH* dh_params) : SASL::Session(m, u)
|
||||
DHAESSession(Mechanism *m, const Anope::string &u, DH* dh_params) : SASL::Session(m, u)
|
||||
{
|
||||
if (!(dh = DH_new()))
|
||||
return;
|
||||
@@ -39,7 +40,7 @@ class DHAES : public Mechanism
|
||||
}
|
||||
}
|
||||
|
||||
~Session()
|
||||
~DHAESSession()
|
||||
{
|
||||
if (dh)
|
||||
DH_free(dh);
|
||||
@@ -50,7 +51,7 @@ class DHAES : public Mechanism
|
||||
const size_t keysize;
|
||||
SASL::Session* CreateSession(const Anope::string &uid) anope_override
|
||||
{
|
||||
return new Session(this, uid, dh_params);
|
||||
return new DHAESSession(this, uid, dh_params);
|
||||
}
|
||||
|
||||
DHAES(Module *o) : Mechanism(o, "DH-AES"), keysize(256 / 8)
|
||||
@@ -72,7 +73,7 @@ class DHAES : public Mechanism
|
||||
|
||||
void ProcessMessage(SASL::Session *session, const SASL::Message &m) anope_override
|
||||
{
|
||||
Session *sess = anope_dynamic_static_cast<Session *>(session);
|
||||
DHAESSession *sess = anope_dynamic_static_cast<DHAESSession *>(session);
|
||||
|
||||
if (!sess->dh)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* RequiredLibraries: ssl,crypto */
|
||||
/* RequiredWindowsLibraries: ssleay32,libeay32 */
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/sasl.h"
|
||||
@@ -21,10 +22,10 @@ class DHBS : public Mechanism
|
||||
}
|
||||
|
||||
public:
|
||||
struct Session : SASL::Session
|
||||
struct DHBSSession : SASL::Session
|
||||
{
|
||||
DH* dh;
|
||||
Session(Mechanism *m, const Anope::string &u, DH* dh_params) : SASL::Session(m, u)
|
||||
DHBSSession(Mechanism *m, const Anope::string &u, DH* dh_params) : SASL::Session(m, u)
|
||||
{
|
||||
if (!(dh = DH_new()))
|
||||
return;
|
||||
@@ -39,7 +40,7 @@ class DHBS : public Mechanism
|
||||
}
|
||||
}
|
||||
|
||||
~Session()
|
||||
~DHBSSession()
|
||||
{
|
||||
if (dh)
|
||||
DH_free(dh);
|
||||
@@ -50,7 +51,7 @@ class DHBS : public Mechanism
|
||||
const size_t keysize;
|
||||
SASL::Session* CreateSession(const Anope::string &uid) anope_override
|
||||
{
|
||||
return new Session(this, uid, dh_params);
|
||||
return new DHBSSession(this, uid, dh_params);
|
||||
}
|
||||
|
||||
DHBS(Module *o) : Mechanism(o, "DH-BLOWFISH"), keysize(256 / 8)
|
||||
@@ -72,7 +73,7 @@ class DHBS : public Mechanism
|
||||
|
||||
void ProcessMessage(SASL::Session *session, const SASL::Message &m) anope_override
|
||||
{
|
||||
Session *sess = anope_dynamic_static_cast<Session *>(session);
|
||||
DHBSSession *sess = anope_dynamic_static_cast<DHBSSession *>(session);
|
||||
|
||||
if (!sess->dh)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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,4 +1,5 @@
|
||||
/* RequiredLibraries: sqlite3 */
|
||||
/* RequiredWindowsLibraries: sqlite3 */
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/sql.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
/* RequiredLibraries: gnutls */
|
||||
/* RequiredWindowsLibraries: libgnutls-28 */
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/ssl.h"
|
||||
@@ -234,7 +235,11 @@ namespace GnuTLS
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if (GNUTLS_VERSION_MAJOR < 2 || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR < 12))
|
||||
static int cert_callback(gnutls_session_t sess, const gnutls_datum_t* req_ca_rdn, int nreqs, const gnutls_pk_algorithm_t* sign_algos, int sign_algos_length, gnutls_retr_st* st);
|
||||
#else
|
||||
static int cert_callback(gnutls_session_t sess, const gnutls_datum_t* req_ca_rdn, int nreqs, const gnutls_pk_algorithm_t* sign_algos, int sign_algos_length, gnutls_retr2_st* st);
|
||||
#endif
|
||||
|
||||
public:
|
||||
X509CertList certs;
|
||||
@@ -253,7 +258,11 @@ namespace GnuTLS
|
||||
throw ConfigException("Unable to set cert/key pair");
|
||||
}
|
||||
|
||||
#if (GNUTLS_VERSION_MAJOR < 2 || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR < 12))
|
||||
gnutls_certificate_client_set_retrieve_function(cred, cert_callback);
|
||||
#else
|
||||
gnutls_certificate_set_retrieve_function(cred, cert_callback);
|
||||
#endif
|
||||
}
|
||||
|
||||
~X509CertCredentials()
|
||||
@@ -625,9 +634,16 @@ SSLSocketIO::SSLSocketIO() : sess(NULL), mycreds(me->cred)
|
||||
mycreds->incrref();
|
||||
}
|
||||
|
||||
#if (GNUTLS_VERSION_MAJOR < 2 || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR < 12))
|
||||
int GnuTLS::X509CertCredentials::cert_callback(gnutls_session_t sess, const gnutls_datum_t* req_ca_rdn, int nreqs, const gnutls_pk_algorithm_t* sign_algos, int sign_algos_length, gnutls_retr_st* st)
|
||||
{
|
||||
st->type = GNUTLS_CRT_X509;
|
||||
#else
|
||||
int GnuTLS::X509CertCredentials::cert_callback(gnutls_session_t sess, const gnutls_datum_t* req_ca_rdn, int nreqs, const gnutls_pk_algorithm_t* sign_algos, int sign_algos_length, gnutls_retr2_st* st)
|
||||
{
|
||||
st->cert_type = GNUTLS_CRT_X509;
|
||||
st->key_type = GNUTLS_PRIVKEY_X509;
|
||||
#endif
|
||||
st->ncerts = me->cred->certs.size();
|
||||
st->cert.x509 = me->cred->certs.raw();
|
||||
st->key.x509 = me->cred->key.get();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* RequiredLibraries: ssl,crypto */
|
||||
/* RequiredWindowsLibraries: ssleay32,libeay32 */
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/ssl.h"
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -87,7 +87,6 @@ void IRC2SQL::CheckTables()
|
||||
query = "CREATE TABLE `" + prefix + "chan` ("
|
||||
"`chanid` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,"
|
||||
"`channel` varchar(255) NOT NULL,"
|
||||
"`currentusers` int(15) NOT NULL DEFAULT 0,"
|
||||
"`topic` varchar(255) DEFAULT NULL,"
|
||||
"`topicauthor` varchar(255) DEFAULT NULL,"
|
||||
"`topictime` datetime DEFAULT NULL,"
|
||||
@@ -230,47 +229,6 @@ void IRC2SQL::CheckTables()
|
||||
query = "CREATE PROCEDURE " + prefix + "ServerQuit(sname_ varchar(255)) "
|
||||
"BEGIN "
|
||||
/* 1.
|
||||
* loop through all channels and decrease the user count
|
||||
* by the number of users that are on this channel AND
|
||||
* on the splitting server
|
||||
*
|
||||
* we dont have to care about channels that get empty, there will be
|
||||
* an extra OnChannelDelete event triggered from anope.
|
||||
*/
|
||||
"DECLARE no_more_rows BOOLEAN DEFAULT FALSE;"
|
||||
"DECLARE channel_ varchar(255);"
|
||||
"DECLARE ucount_ int;"
|
||||
"DECLARE channel_cursor CURSOR FOR "
|
||||
"SELECT c.channel "
|
||||
"FROM `" + prefix + "chan` as c, `" + prefix + "ison` as i, "
|
||||
"`" + prefix + "user` as u, `" + prefix + "server` as s "
|
||||
"WHERE c.chanid = i.chanid "
|
||||
"AND i.nickid = u.nickid "
|
||||
"AND u.servid = s.id "
|
||||
"AND s.name = sname_;"
|
||||
"DECLARE CONTINUE HANDLER FOR NOT FOUND "
|
||||
"SET no_more_rows = TRUE;"
|
||||
"OPEN channel_cursor;"
|
||||
"the_loop: LOOP "
|
||||
"FETCH channel_cursor INTO channel_;"
|
||||
"IF no_more_rows THEN "
|
||||
"CLOSE channel_cursor;"
|
||||
"LEAVE the_loop;"
|
||||
"END IF;"
|
||||
"SELECT COUNT(*) INTO ucount_ "
|
||||
"FROM `" + prefix + "ison` AS i, `" + prefix + "chan` AS c,"
|
||||
"`" + prefix + "user` AS u, `" + prefix + "server` AS s "
|
||||
"WHERE i.nickid = u.nickid "
|
||||
"AND u.servid = s.id "
|
||||
"AND i.chanid = c.chanid "
|
||||
"AND c.channel = channel_ "
|
||||
"AND s.name = sname_; "
|
||||
"UPDATE `" + prefix + "chan` "
|
||||
"SET currentusers = currentusers - ucount_ "
|
||||
"WHERE channel = channel_;"
|
||||
"END LOOP;"
|
||||
|
||||
/* 2.
|
||||
* remove all users on the splitting server from the ison table
|
||||
*/
|
||||
"DELETE i FROM `" + prefix + "ison` AS i "
|
||||
@@ -280,7 +238,7 @@ void IRC2SQL::CheckTables()
|
||||
"AND u.servid = s.id "
|
||||
"AND s.name = sname_;"
|
||||
|
||||
/* 3.
|
||||
/* 2.
|
||||
* remove all users on the splitting server from the user table
|
||||
*/
|
||||
"DELETE u FROM `" + prefix + "user` AS u "
|
||||
@@ -288,7 +246,7 @@ void IRC2SQL::CheckTables()
|
||||
"WHERE s.id = u.servid "
|
||||
"AND s.name = sname_;"
|
||||
|
||||
/* 4.
|
||||
/* 3.
|
||||
* on the splitting server, set usercount = 0, split_time = now(), online = 'N'
|
||||
*/
|
||||
"UPDATE `" + prefix + "server` SET currentusers = 0, split_time = now(), online = 'N' "
|
||||
@@ -306,12 +264,6 @@ void IRC2SQL::CheckTables()
|
||||
"UPDATE `" + prefix + "user` AS `u`, `" + prefix + "server` AS `s` "
|
||||
"SET s.currentusers = s.currentusers - 1 "
|
||||
"WHERE u.nick=nick_ AND u.servid = s.id; "
|
||||
/* decrease the usercount on all channels where the user was on */
|
||||
"UPDATE `" + prefix + "user` AS u, `" + prefix + "ison` AS i, "
|
||||
"`" + prefix + "chan` AS c "
|
||||
"SET c.currentusers = c.currentusers - 1 "
|
||||
"WHERE u.nick=nick_ AND u.nickid = i.nickid "
|
||||
"AND i.chanid = c.chanid; "
|
||||
/* remove from all channels where the user was on */
|
||||
"DELETE i FROM `" + prefix + "ison` AS i "
|
||||
"INNER JOIN `" + prefix + "user` as u "
|
||||
@@ -345,9 +297,9 @@ void IRC2SQL::CheckTables()
|
||||
"SELECT u.nickid, c.chanid, modes_ "
|
||||
"FROM " + prefix + "user AS u, " + prefix + "chan AS c "
|
||||
"WHERE u.nick=nick_ AND c.channel=channel_;"
|
||||
"UPDATE `" + prefix + "chan` SET currentusers=currentusers+1 "
|
||||
"WHERE channel=channel_;"
|
||||
"SELECT `currentusers` INTO cur FROM `" + prefix + "chan` WHERE channel=channel_;"
|
||||
"SELECT count(i.chanid) INTO cur "
|
||||
"FROM `" + prefix + "chan` AS c, " + prefix + "ison AS i "
|
||||
"WHERE i.chanid = c.chanid AND c.channel=channel_;"
|
||||
"SELECT `maxusers` INTO max FROM `" + prefix + "maxusers` WHERE name=channel_;"
|
||||
"IF found_rows() AND cur <= max THEN "
|
||||
"UPDATE `" + prefix + "maxusers` SET lastused=now() WHERE name=channel_;"
|
||||
@@ -373,8 +325,6 @@ void IRC2SQL::CheckTables()
|
||||
"AND u.nick = nick_ "
|
||||
"AND i.chanid = c.chanid "
|
||||
"AND c.channel = channel_;"
|
||||
"UPDATE `" + prefix + "chan` SET currentusers=currentusers-1 "
|
||||
"WHERE channel=channel_;"
|
||||
"END";
|
||||
this->RunQuery(query);
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user