1
0
mirror of https://github.com/anope/anope.git synced 2026-06-19 06:04:46 +02:00

Compare commits

..

670 Commits

Author SHA1 Message Date
Adam ce094f4d01 Anope 1.9.8 Release 2013-03-02 23:42:01 -05:00
Adam 178056096f Regenerate language files 2013-03-02 23:42:00 -05:00
Adam a32c897bf9 Update Changes and Changes.conf 2013-03-02 23:42:00 -05:00
Adam 367b662c83 Fix compile warning in webcpanel/memos 2013-03-02 23:42:00 -05:00
Adam 75999e05b9 Fix Anope::Duration showing years failing 2013-03-02 23:42:00 -05:00
Adam 45c02f8e4e Fix build with -std=c++11 2013-03-02 23:42:00 -05:00
Adam ae4421b8a2 Unset founder/successors when channels are deleted 2013-03-02 23:42:00 -05:00
Adam 2d309da0f6 Fix /ns drop nick showing "your nick" and not the nick you specified if the nick isn't registered 2013-03-02 18:52:15 -05:00
Adam b9bbb3747b Fixed logic fail in /ns resend 2013-03-02 18:46:56 -05:00
Adam 0b05eaa020 Only shrink extensible items that are metadata in ExtensibleUnserialize 2013-03-01 01:40:14 -05:00
Adam 91ad9d22ca Fix Windows build 2013-03-01 00:57:24 -05:00
Adam 6aa9ad938a Don't have cs_seen update data for users on syncing servers 2013-03-01 00:56:47 -05:00
Adam 6808498ead Fix entrymsg's creation time being reset from restarts 2013-02-28 23:09:03 -05:00
Adam 8561941e22 Don't enforce session limit on clients with no IP on Unreal, fix typo in /cs down syntax, fix os_session messages to reference ip 2013-02-25 00:26:49 -05:00
Adam 5d4db2b854 Allow /cs up and /cs down to take an optional nick arg 2013-02-24 20:15:49 -05:00
Adam 501503b7a5 On startup check all object types 2013-02-24 20:14:15 -05:00
DukePyrolator a980e32581 fixed wrong parameter count in cs_updown 2013-02-24 21:07:10 +01:00
DukePyrolator da2fea338a fixed some stupid typos in the german language file 2013-02-24 09:48:20 +01:00
DukePyrolator 7cb70f5fa1 some updates to the german langfile 2013-02-24 08:14:13 +01:00
Adam d04db3d38b Add SVSNICK and SVSHOLD to hybrid 2013-02-23 17:41:52 -05:00
DukePyrolator 35c260877f Revert "do not send RESV from operserv when its not introduced"
This reverts commit 2336b4723c.
2013-02-23 11:20:31 +01:00
Adam 8cf7ec9cfe Add missing SVSHold funcs to plexus protocol module 2013-02-23 04:32:41 -05:00
Adam c67087d750 Fix akick list/view not showing masks sometimes 2013-02-23 04:32:41 -05:00
DukePyrolator 2336b4723c do not send RESV from operserv when its not introduced 2013-02-23 09:54:03 +01:00
Adam da61734860 Made FindService less dumb and able to do aliases to aliases 2013-02-22 04:42:08 -05:00
Adam a911354f24 Fix "leave" channel log level 2013-02-22 00:39:13 -05:00
Adam ae902443db Merge branch '1.9' of github.com:anope/anope into 1.9 2013-02-22 00:30:22 -05:00
Adam 5547c3ed24 This OnServerSync event hook in inspircd20 can go away (it does nothing currently) 2013-02-22 00:29:00 -05:00
Charles Kingsley e844cdf4f6 Update COPYING 2013-02-21 07:38:42 +00:00
Adam 2fa5cfa508 Add Matthew to webpanel credits, fix alignment of akill list 2013-02-20 18:00:46 -05:00
Adam 59792173e7 Merge pull request #12 from MatthewM/webcpanel
Web Panel Modifications
2013-02-20 14:58:59 -08:00
Adam ed68482b4e Add /cs mode clear command that behaves like the old /cs clear modes/bans/etc 2013-02-20 15:51:40 -05:00
Adam 32592987c8 Allow /os mode clear [all] to unset modes, similar to old clearmodes 2013-02-19 04:07:53 -05:00
Adam a1f92638e3 Merge branch '1.9' of github.com:anope/anope into 1.9 2013-02-19 01:28:27 -05:00
Adam 7d50818ee1 Fix some OpenBSD build issues, and bugs #1485 #1486 #1487 2013-02-19 00:48:21 -05:00
DukePyrolator d0e1f3b66a fixed a typo in the last SASL commit 2013-02-19 05:21:01 +01:00
Adam cb91f991a3 Made the mode bouncing detector harder to hit and ignore syncing channels 2013-02-18 22:10:57 -05:00
Jens Voß a49d7b12cb Merge pull request #11 from grawity/mailmap
Add mailmap for Git
2013-02-17 05:31:04 -08:00
Mantas Mikulėnas eda7b55bac Add mailmap for Git
...to clean up `git shortlog -nes` (and `git log` in future git
versions).
2013-02-17 15:19:11 +02:00
DukePyrolator bcf99d5998 SASL sends AUTHFAIL on unsupported mechanisms, fixes bug #1482 2013-02-17 12:26:51 +01:00
Adam 3ab6706993 InsIRCd only sends QUIT on KILL for users 1 hop from us, so always internally kill users that we kill. Bug #1481 2013-02-16 03:59:28 -05:00
Adam c40e9c3996 Fix missing CheckInit check in db_sql_live 2013-02-16 00:31:42 -05:00
Adam 7be23b7e37 Fix setting modes on botserv bots in channels that have other bots in them on startup 2013-02-15 23:18:34 -05:00
Adam d9c18a6072 Store hashes of the last commit instead of the last commit 2013-02-15 19:01:46 -05:00
Adam 73099b82e8 Fixed unserializing servers in dns zones 2013-02-15 18:32:06 -05:00
Adam fc1d7ea89b Switch Destroy methods to delete 2013-02-14 20:58:01 -05:00
Adam 391f2822c8 This Serialize::Destroy method isn't actually needed anymore. Fixes weirdness from a few Serializable items we had on the stack. Added a comment about why operator< in Reference fails. 2013-02-14 20:57:40 -05:00
Adam f0875c5d85 Iterators suck 2013-02-14 20:11:52 -05:00
Adam f6ef706909 Magiobiwan is silly 2013-02-14 01:24:29 -05:00
Adam 7656c25e38 Made chanserv/unban with no parameters unban you in every channel you have access in 2013-02-14 01:20:18 -05:00
Adam 5cf1edeb6e Fix CommandCSMode::CanSet letting everyone set voice 2013-02-14 01:20:18 -05:00
Adam 9e544a6443 Store what channels have references to accounts in NickCore to prevent having to iterate over all channels and then all access entries when nicks expire or from nickserv/alist 2013-02-14 01:20:18 -05:00
Adam 225b7c38c1 Make NickCore::aliases a vector 2013-02-14 01:20:18 -05:00
Adam 994866461c Update obj ts when constructed in db_sql 2013-02-14 01:20:18 -05:00
Adam fc4b884d0e Sort output in ns_list and cs_list 2013-02-10 12:31:37 -05:00
Adam 9b3ecfe777 Fixed sepstream::GetToken logic fail 2013-02-09 22:48:05 -05:00
Adam 20794981b3 (re?)add mlock set as a simple way to clear all mlocks and add new ones at once 2013-02-09 00:24:15 -05:00
Adam 01413dd3cc Use channel mode +r to determine if a channel has either been newly created or
created while we were offline (eg, during the inital burst to the
uplink). Fixes not knowing whether or not channels ops in non-secureop
non-persistent channels obtained op while we were offline by creating
the channel or legitimately by being set op by another channel op.
2013-02-07 21:49:49 -05:00
Adam 9d1fe6102c Made DNSServer::Find case insensitive 2013-02-07 21:49:49 -05:00
Adam 2472a41561 Merge pull request #9 from Robby-/1.9-ns_set_misc
Fixed ns_set_misc not showing help for its SASET commands
2013-02-05 08:04:45 -08:00
Robby- 65fbdcfa87 Fixed ns_set_misc not showing help for its SASET commands.
Added descriptions and SASETs for the remaining commented ns_set_misc examples, without a description they won't show up in HELP if someone actually enabled those.
2013-02-05 16:31:14 +01:00
Adam 25cec015e8 Made access del by nick and other functions from 326f1a really delete objects 2013-02-05 09:45:48 -05:00
Adam 62e3c8c4f8 Merge pull request #7 from artemiiav/patch-2
Fix validating nickserv:registration when it is set to disable.
2013-02-02 10:53:05 -08:00
Adam 8902c1f038 Merge pull request #8 from Robby-/1.9
Some more typo and help text fixes, missing privileges, settings corrections, and cs_enforce changes
2013-02-02 10:51:08 -08:00
Robby- 6c43bcc3e0 cs_enforce: Make the logging also show the channel it was used on, added 2 missing log calls, can now handle overrides by services operators. 2013-02-02 07:32:32 +01:00
Robby- 15b37c1e38 Some more typo and help text fixes, proper formatting of control codes, missing privileges, and settings corrections. 2013-02-02 07:30:53 +01:00
MatthewM 29fcdc5f40 Updated jquery API to v1.9.0 2013-01-31 21:24:48 -05:00
artemiiav 1075bb1dbc Update src/config.cpp 2013-01-31 22:33:14 +03:00
Jens Voß dccb0ee313 Merge pull request #5 from Robby-/1.9
Config file updates: text changes, ...
2013-01-30 22:50:11 -08:00
Robby- aea86906f4 Some configuration file updates: Removed now non-existing settings. Redid some existing settings to look more consistent/uniform. Added some missing commands/permissions.
Merged operserv/modlist permission into operserv/modinfo.
Fixed ChanServ INFO privilege to actually work for /BotServ INFO too for those users who have it, instead of only for founders.
Fixed some typos aswell as removed whitespaces along the way.
2013-01-31 06:19:14 +01:00
Adam a62698a14a Remove sendpass from the configs and the config reader since it no longer exists 2013-01-30 17:44:07 -05:00
Adam 47af43c281 Made Anope::Duration also show years 2013-01-30 11:24:57 -05:00
Adam ae2c82adbc Don't expire session exceptions if in noexpire mode 2013-01-30 10:39:52 -05:00
Adam 594b1a136d Evidently Persistant is not a word 2013-01-30 10:39:52 -05:00
DukePyrolator ae46cc7f73 fixed an infinite loop in ns_recover, caused by a very small typo. 2013-01-30 09:18:56 +01:00
Adam 6b2aad734e Fixed SQL::Data::IsEqual to really only return if the two are completely equal. Fixes oddities with caching objects that are actually updated. 2013-01-27 13:55:42 -05:00
Adam 98ccbe2b06 Old botserv flags need BS_ prepended to them 2013-01-27 10:50:55 -05:00
Adam 5ae100fea2 Add nickserv/alist priv, merge botserv/botlist and botserev/assign/private to botserv/administration 2013-01-27 05:00:00 -05:00
Adam 0052dd29a7 Fix db_flatfile not clearing databases on save if there are no objects left of that type (it will leave the old database with old objects currently) 2013-01-27 01:59:38 -05:00
Adam 50a42d2cbf Fix os_session to work with sql properly 2013-01-26 22:17:25 -05:00
Adam 49cb6a07a2 Fixed db_sql etc being confused on empty vs not set metadata 2013-01-26 20:52:49 -05:00
Adam ed7c4dc2e1 Made Anope::DoTime default to seconds to fix os_akill etc defaulting expiries to days 2013-01-25 04:05:38 -05:00
Adam c376fb0a2b I forgot to add this change to a634c7be65 2013-01-25 03:31:35 -05:00
Adam 76d9e58ae5 mysql_insert_id doesn't return an id if one isnt generated, so
check that it really returns a value before using it.
Also fix memos to cleanup after themselves when deleted.
2013-01-25 03:09:51 -05:00
Adam 3769cc1a35 Fix memo signon and memo receive default flag names 2013-01-24 08:53:35 -05:00
CuleX 74ace7d4b9 Channel::HasUserStatus: Don't just return false if cms is NULL. 2013-01-24 00:34:41 -05:00
Adam 647245a71f Add missing KeySet() func to SQL::Data 2013-01-23 22:16:01 -05:00
Adam a634c7be65 Fix some compile errors 2013-01-22 21:20:05 -05:00
Adam f656e3195f Add hidenetsplitquit config option to not show splits in /ns info's last quit field 2013-01-22 19:47:16 -05:00
lethality 8811545472 Fixed few minor typos 2013-01-22 17:32:23 +00:00
Adam cad3850f3d Move channel mode set and unset events to be after the action has been done internally to allow easially canceling it 2013-01-22 01:23:55 -05:00
Adam 7de058ba35 Fix crash trying to unset the permanent channel mode during channel syncs of empty channels 2013-01-22 00:24:58 -05:00
Adam ddaa001daf Merge usefulness of Flags and Extensible classes into Extensible, made most flags we have juse strings instead of defines/enums 2013-01-21 22:31:16 -05:00
Adam 51c049e1a7 Really fix Channel::GetModes 2013-01-21 18:03:31 -05:00
Adam 93472f84bd Revert "Fix Channel::GetModes, we can never have a negative mode set on a channel so this check is unnecessary"
This reverts commit 678d27fdb7.
2013-01-21 17:59:22 -05:00
Adam 678d27fdb7 Fix Channel::GetModes, we can never have a negative mode set on a channel so this check is unnecessary 2013-01-21 17:55:27 -05:00
Adam 369ca89c2e Allow channels that have users in them that are not the access list to expire while in use. 2013-01-21 06:46:28 -05:00
Adam 421db75528 Fix not logging debug info to the logfile when debug mode is enabled 2013-01-21 06:38:13 -05:00
Adam 846b56c724 Fix defcon timeout timer 2013-01-21 02:31:28 -05:00
DukePyrolator e62d2fe56e removed old cs_modes fantasy{} command blocks 2013-01-21 07:15:16 +01:00
DukePyrolator bb3abab784 removed loading of ns_set_chanstats and cs_set_chanstats from the chanstats.example.conf, this functionality is now part of ns_set/cs_set 2013-01-20 15:03:15 +01:00
Adam da6543d17b Allow grouping commands to make help output easier to comprehend 2013-01-13 22:07:27 -05:00
Adam 29a018088e Add svsjoin and svspart commands 2013-01-13 22:07:27 -05:00
Adam 7e7fc757d5 Allow ns_set_misc/cs_set_misc to have configurable help descriptions 2013-01-13 22:07:27 -05:00
Adam d3a6bdc68b Allow the config parser to skip over gettext's _() to allow translating config values 2013-01-13 22:07:27 -05:00
DukePyrolator 402e42fd15 check if the database exists before we try to backup it 2013-01-12 09:01:44 +01:00
Adam 5007b72b28 Update copyright to 2013. This was done with:
find include/ src/ lang/ docs/ modules/ *.* Config -exec sed -i 's/-2012 Anope Team/-2013 Anope Team/i' {} \;
2013-01-09 04:20:55 -05:00
Adam 9931ec2994 Use m_rewrite to rewrite op, deop, halfop, ... etc 2013-01-08 20:25:01 -05:00
Adam 5f3dfc2960 Track +g on inspircd, fix saving/loading mode locks for generic modes 2013-01-07 21:30:07 -05:00
Adam dc9e81a6fc Fix deleting access by number 2013-01-06 18:38:04 -05:00
Adam ed719c80e7 Buggy compilers are buggy 2013-01-06 16:13:35 -05:00
Adam 77dc2e4746 And really check for them using ssl... 2013-01-06 01:46:53 -05:00
Adam c5f4c8d174 Fixed enforce ssl to not ban users if the channel is ssl only 2013-01-06 01:19:25 -05:00
Adam 6ba49642d0 Fix fmode handling on inspircd20 2013-01-06 00:48:50 -05:00
Adam 9a2ef9dc00 Add sslonly, bans, and limit to /cs enforce 2013-01-05 22:42:07 -05:00
Adam 6ccf0a3428 Fixed os_dns not readding connected servers if configured 2013-01-03 13:39:50 -05:00
Adam 23e303aaa2 Move enforcer checks on nick and logout to nickserv.cpp 2013-01-03 13:20:10 -05:00
Adam 098157dca8 Don't delete users immediately when quit or killed, instead wait until message processing is done 2013-01-03 12:34:01 -05:00
Adam 827469600e Move nickserv validate stuff to an event in nickserv.cpp 2013-01-02 13:59:33 -05:00
Adam bf718e8698 Evidently not specifying NOT NULL is not enough to allow null timestamps 2012-12-30 10:30:29 -05:00
Adam 326f1a9c8b Cleanup after mode locks, badwords, akick, access, if destructed 2012-12-29 20:29:41 -05:00
Adam 793c438286 Remove clearuser references from configs 2012-12-29 11:09:54 -05:00
Adam 6b1f323bb5 Move some of CheckKick to the respective modules 2012-12-28 15:59:33 -05:00
Adam 761849083d Dumb iterators 2012-12-28 13:00:36 -05:00
Adam ae6ddf295a fixup part of 379b2c, dont use iterators after theyre erased 2012-12-28 11:17:01 -05:00
Adam b591e8cdc8 Use the same object for chanusercontainer and userchancontainer 2012-12-28 10:43:30 -05:00
Adam 379b2ccf92 The timestamp column in SQL should actually be null sometimes, and fixed some valgrind errors with db_sql_live 2012-12-28 10:43:30 -05:00
Adam 3fb4cf56b6 Merge pull request #4 from alexbarton/ngircd-fix-NJOIN
ngircd protocol module: Fix NJOIN, actually join users to the channel
2012-12-27 13:25:33 -08:00
Alexander Barton fdc62daa8b ngircd protocol module: Fix NJOIN, actually join users to the channel
Bug introduced by commit d33a0f75: "Pretty large coding style cleanup,
in source doc cleanup, and allow protocol mods to depend on each other":
Since then, the NJOIN command has been "ignored", no users were added
to channels at all while linking ...
2012-12-27 22:15:33 +01:00
Adam 05094b0da5 When processing many modes don't enforce mlock until all are set 2012-12-27 15:03:38 -05:00
Adam 4ab8a70b21 Add an expiry option to /cs ban 2012-12-27 11:06:00 -05:00
Adam c88a3fffd5 Remove clearusers. There is still kick * for this. 2012-12-27 09:50:44 -05:00
Adam 7b1ae9602d Put appendtopic and topiclock into /cs topic 2012-12-27 09:43:19 -05:00
Adam c7a22dff87 Add register type to os_forbid to prevent users from registering nicks or channels 2012-12-26 19:42:37 -05:00
Naram Qashat 45ee7c12d0 Clean up the logic in adding extra library directories, adding to LDFLAGS isn't needed. 2012-12-25 17:10:43 -05:00
Adam 392b591d09 Allow modules loaded after startup to magically reobtain their database objects. Fix os_dns for sql(live) 2012-12-25 15:52:58 -05:00
Adam 556a4375e2 Cleanup after os_dns on unload 2012-12-25 12:40:09 -05:00
Adam eab583310d Don't check userlimit when servers first connect, servers wont have any users at that point anyway 2012-12-25 12:36:58 -05:00
Naram Qashat 077ae27369 Fix linking libraries so their rpath is set correctly and isn't stripped on install. 2012-12-25 02:20:00 -05:00
Adam d4e1c958e2 packet->answers isnt always empty initially, like with axfrs 2012-12-25 01:09:03 -05:00
Adam 33ae442aa1 We can svsjoin on plexus 2012-12-24 18:15:38 -05:00
Adam 1285c7f0ca Allow os_dns to manage multiple zones 2012-12-23 15:30:08 -05:00
MatthewM 8c72892de1 Made the overlay resize and the alert box reposition when the window is resized 2012-12-23 14:56:02 -05:00
Adam dc751bd2f1 Combine all of the set modules now that having them split apart is almost completely pointless 2012-12-22 14:49:48 -05:00
Adam 0cde0aee34 Fixed memo mail messages, and allow %N to be in them. Bug #1462 2012-12-22 09:10:32 -05:00
MatthewM 503bda5b28 Move the var to set the time out into the same javascript tag that is used for the modal as it's related 2012-12-20 23:48:20 -05:00
MatthewM a4d5c40d63 Added the overlay to the vHost request function 2012-12-20 16:22:58 -05:00
MatthewM 8e219bdd77 Moved the javascript to header.html from memos.html to make it easier to intergrate the overlay feedback and do tweaks 2012-12-20 16:12:16 -05:00
MatthewM 5acc93dd34 Made the table cells for the memo table have no spacing and color the read and unread memos different colors 2012-12-20 01:19:04 -05:00
Adam 276247b463 Add a command flag to require that a user is executing the command 2012-12-19 16:03:53 -05:00
MatthewM d277f49423 Minor style tweaks to make the links look more like a button 2012-12-19 13:17:44 -05:00
Adam 67bd2c6b2d Add version flags for debug, git, and Windows 2012-12-19 09:21:25 -05:00
Adam 784683a68d Having these references to bots bugged out older compilers, so simplify this by just moving pointers to the core 2012-12-19 08:48:23 -05:00
Adam 3b2094301d Fixed typo in b6407afa06 2012-12-18 10:35:11 -05:00
MatthewM 6572754c10 Cleaned up the overlay layout, added some minor visual and js fixes 2012-12-18 10:34:33 -05:00
MatthewM f157ea3fdb Added a click reply function to the MemoServ memos page that autofills the senders name 2012-12-18 10:04:26 -05:00
MatthewM ddd7fe6f05 Bug that was experinced seems to be somewhat related to Windows 8 and maybe an extension on chrome. Reverting to previous commit 2012-12-17 22:03:21 -05:00
MatthewM 47a351acb2 Fixed a minor bug that overlapped the nav links and the content from .content in Chrome on Windows 2012-12-17 19:26:07 -05:00
MatthewM ff9f670871 Give the overlay window a rounded edge to make it look a bit nicer and fade the main content a little less 2012-12-17 18:28:15 -05:00
MatthewM f33f7d98c4 Added a modal window interface to MemoServs page that will automaticly fade out after a give time (currently 5s) 2012-12-17 14:32:28 -05:00
Adam c49f03f985 Allow escaping brackets in webpanel templates and redirect users to the homepage when their session is not found 2012-12-15 23:51:25 -05:00
MatthewM 6b5f583ff3 Merge Adams commit to allow escaping of brackets 2012-12-15 21:46:14 -05:00
Adam 8e3ab0d10b Made all langauges default to the UTF-8 charset 2012-12-15 21:35:38 -05:00
MatthewM a049092526 Merge branch '1.9' into webcpanel 2012-12-15 21:05:05 -05:00
Adam b6407afa06 Fix chghost/chgident/etc on inspircd20 2012-12-15 05:13:09 -05:00
Adam fbd3cda320 Merge pull request #2 from czaks/conv-languages-to-utf-8/1.9
Convert locales to utf-8 charset
2012-12-15 01:15:03 -08:00
Marcin Łabanowski 05341828b5 Convert the language files to utf-8 encoding.
The files have been converted using the following script:

for i in *.po; do
  cat $i | grep charset | cut -d= -f2 | cut -d\\ -f1 > charset
  echo Converting $i from `cat charset` to UTF-8
  iconv -f `cat charset` -t UTF-8 < $i | sed "s/`cat charset`/UTF-8/g" > $i~
  mv -f $i~ $i
  rm -f charset
done
2012-12-15 09:39:12 +01:00
Marcin Łabanowski 280ba89b26 Fix the language files to state the correct charset. 2012-12-15 09:28:19 +01:00
Adam fe7fcc2dc3 Check for NOJOIN being < 0 but restricted on in db_old 2012-12-15 02:44:53 -05:00
Adam dcd34d3728 Move DNS handling to a module 2012-12-15 01:33:31 -05:00
MatthewM dced01fc24 Added a large scroll box for the chanserv main page 2012-12-15 01:14:52 -05:00
Adam cdec0a3f96 Fixed some html errors in the last commit 2012-12-14 16:47:45 -05:00
MatthewM 1075f3b457 Allow opers to drop channels
Added chanserv drop to web panel
Allow long lists of akills to scroll
2012-12-14 16:44:14 -05:00
Adam c1077faa28 Optimize much of the database code and serialize code. 2012-12-13 06:12:56 -05:00
Adam 76ba147c22 Unregister operserv_akill page on unload in cpanel 2012-12-12 02:28:19 -05:00
Adam 1c1a216df1 Only allow non-user sources to register nonexistant channels 2012-12-12 01:33:58 -05:00
Adam 04f96a54b8 Some small improvements to last few commits, and fixed some problems with the template engine 2012-12-12 01:30:50 -05:00
Adam 5f72d1fda5 Squashed commit of the following:
commit 317ead6b39
Author: MatthewM <mcm@they-got.us>
Date:   Tue Dec 11 02:14:06 2012 -0500

    Added the HostServ link to the navigation bar

commit 6b15d7fc5e
Author: MatthewM <mcm@they-got.us>
Date:   Tue Dec 11 01:58:18 2012 -0500

    Correct some slight over sights that was missed eariler

commit b356a46789
Author: MatthewM <mcm@they-got.us>
Date:   Mon Dec 10 23:44:51 2012 -0500

    Started work on adding HostServ to the web panel
2012-12-12 01:04:08 -05:00
Adam dfff54425b Fixed webpanel fail on nondebug builds 2012-12-12 00:49:16 -05:00
DukePyrolator 0edd26467e IsNickValid() now accepts '[' and ']' in the nickname 2012-12-11 05:27:56 +01:00
DukePyrolator e71c890cf5 added a missing permission for operserv/global to the Services Administrator block in example.conf 2012-12-09 14:32:16 +01:00
DukePyrolator eada35df36 fixed a problem with the webcpanel logout when using apache + mod_proxy 2012-12-09 14:21:42 +01:00
DukePyrolator 8d4a08ccc1 fixed a log message showing the wrong IP 2012-12-09 14:19:30 +01:00
Naram Qashat 9dec093676 Modified the Config scripts to ask the user explicitly for additional include and library directories. 2012-12-07 03:02:15 -05:00
DukePyrolator f711dd3460 ngircd protocol module: improved vhost support 2012-12-05 06:18:36 +01:00
Adam 7a865b6b28 Only bad-password users when the account theyre trying to identify for actually exists 2012-12-02 04:31:50 -05:00
DukePyrolator faaaae365a enc_sha256: the length of the digest is SHA256_DIGEST_SIZE, not SHA256_BLOCK_SIZE. also removed an unneeded trailing NULL byte. 2012-12-02 09:16:40 +01:00
Adam 705d1efeab Allow services to return more than one NS record 2012-11-30 20:49:59 -05:00
Adam c0f60d56a1 Change /os reload to not unnecessarially rebuild httpd servers. Change m_httpds Log methods to the module version. 2012-11-30 20:44:21 -05:00
Adam a4468dd56e Allow modules to use the encryption modules to encrypt arbitrary things.
Made enc_old depend on enc_md5.
Allow not loading any encryption modules if you want to only use an
external mechanism.
Removed ns_sendpass since it's just a bad idea.
2012-11-30 02:53:03 -05:00
Adam 337f361526 Fix warnings from classes with virtual functions not having virtual destructors 2012-11-29 17:03:53 -05:00
Adam 26a048e5c4 Rewrite/simplify some of m_httpd 2012-11-28 22:54:26 -05:00
Adam ccd41e7efe Use signon for svid on bahamut, not timestamp 2012-11-28 00:42:07 -05:00
Adam a1a5ba0723 Use signon for svid on unreal, not timestamp 2012-11-27 21:43:17 -05:00
Adam 8a6962fc36 Keep track on what ircds we can svsjoin, add an svspart method 2012-11-26 23:09:26 -05:00
Adam f23bad140b Revert a small part of 90930619bc, evidently this was important 2012-11-26 19:50:29 -05:00
Adam 1bfafd9eb6 Fixed rehasing doing weird things to botmodes due to trying to set on nick not uid 2012-11-26 04:30:30 -05:00
Adam 1bdb756b25 Restrict the length of kick reasons in cs_kick, cs_ban, and cs_akick 2012-11-25 22:37:54 -05:00
Adam 80c573eed7 Merge remote branch 'cronus/1.9+unrealtokens' into 1.9 2012-11-25 21:47:10 -05:00
Cronus 78607ea60c Remove UnrealIRCd's TOKENS, they are kinda useless 2012-11-25 20:35:45 -06:00
Adam 0110214abc Fix build the last arg on fantasy commands to chanserv 2012-11-25 20:58:35 -05:00
Adam 54d8695e70 Add commented command{} blocks for how 1.8 worked, don't show saset in the help list to registered users. 2012-11-25 20:36:57 -05:00
Adam a2441fd326 Rename restoreonghost in nickserv.conf 2012-11-25 19:47:09 -05:00
Adam 831a1d15d5 Merge ns_ghost, ns_recover, and ns_release. Fix svskilling users on Unreal. 2012-11-25 19:41:36 -05:00
DukePyrolator 6b5df8e62f added a config block for cs_seen in chanserv.example.conf 2012-11-25 05:44:31 +01:00
Adam 0210cf2b17 Make the actual clients into services too 2012-11-24 21:22:32 -05:00
Adam f0708340ef Fix parsing fjoin on inspircd 2012-11-24 19:10:07 -05:00
Adam a44bf31d27 Helps to name ping right 2012-11-24 17:19:08 -05:00
Adam 002f00d7eb Add IP.Board m_sql_authentication query to modules.example.conf, from Genesis2001 2012-11-24 02:15:19 -05:00
Adam ded89b0d49 Made IRCDProto a Service 2012-11-23 23:10:41 -05:00
Adam 36b1166cf6 Change the return type of ircdmessage to void now that we don't use it, add an ircd message module event, and a few more fixups 2012-11-23 16:56:06 -05:00
Adam 0e7bd9f3ba Fix compile/pch generation 2012-11-22 20:27:42 -05:00
DukePyrolator 7963534940 fixed some compile errors 2012-11-22 21:44:51 +01:00
Adam d33a0f75a5 Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each
other
2012-11-22 00:50:33 -05:00
DukePyrolator 368d469631 added METADATA and vhost support to the ngircd protocol module 2012-11-18 10:34:35 +01:00
DukePyrolator efd3c04f37 fixed a typo in IRCDMessageSetName in the unreal protocol module 2012-11-18 09:50:23 +01:00
Adam 5fe6f0b2ec This should be find, not find_first_of 2012-11-16 00:06:07 -05:00
Adam 5d6fb2427e Fixed some stuff spotted by Cronus, made db_old convert ACCESS_INVALID levels to ACCESS_FOUNDER, fix cs_enforce +R from an earlier commit, fixed ChangeModeInternal TS checking when IRCds don't send TS on mode 2012-11-16 00:03:15 -05:00
Adam ad3d1d381a Never log debug levels >= 2 using a log block 2012-11-10 13:57:06 -05:00
Adam b51f60cc1e Fix user account logout message 2012-11-10 13:57:06 -05:00
DukePyrolator 504232b388 added support for the ngircd SQUERY command 2012-11-10 18:29:35 +01:00
Adam 8f36f65f39 Made access del and xop del behave like access add/xop add by using a users mask if given an unregistered nick 2012-11-09 19:20:17 -05:00
Adam ff3e396e92 Add a config option to disable sasl 2012-11-09 19:13:33 -05:00
Adam 2fe387b4f0 Update bi->lastmsg in cs_log when something is logged via privmsg 2012-11-07 23:23:02 -05:00
Adam 9ec482b7c2 I haven't a clue why this was here but its not even remotely right.. fixes #1448 2012-11-07 22:20:48 -05:00
Adam 53e8cd18dc Duplicate check some of these larger hashmaps on insert, just incase 2012-11-07 21:57:31 -05:00
Adam ac57f41c87 We no longer have to use the rungroup provided at build time, it is specified in the config now 2012-11-07 19:36:59 -05:00
Adam 8b78b6bb10 Fix crash on suspend etc if kicking a user causes the service bot to part when the service bot is next in the userlist (as we have an iterator to it) 2012-11-07 15:41:49 -05:00
Adam 52fa66820c Give suspend the correct permission in botserv.conf, fix pch build 2012-11-07 15:17:58 -05:00
Adam 72eb2ccf50 Sometimes capab is sent as one parameter 2012-11-06 11:02:12 -05:00
Adam 4cfd468863 Made os_noop more useful 2012-11-06 11:02:12 -05:00
Adam 0cf8d73395 Added log messages for all of the other chanserv commands that should be logged 2012-11-06 11:02:12 -05:00
Adam 53b2bdfe5e Use std::tr1::unordered_map for a few of the larger maps 2012-11-06 11:02:12 -05:00
Adam 27ab6a686c Windows fixes 2012-11-06 11:02:12 -05:00
lethality 22c8297a03 Added chanserv/status to fantasy commands 2012-11-06 15:19:56 +00:00
Adam d22e86376b Catch the exception from /os session view invalidip 2012-11-05 15:59:11 -05:00
Adam fb56b3a53f Made m_xmlrpc use m_httpd 2012-11-03 22:04:19 -04:00
DukePyrolator 0c47017046 added support for SVSNICK in the ngircd protocol module 2012-11-03 09:40:01 +01:00
DukePyrolator 792091b23c cs_seen: do not read duplicate SeenInfo entries from the database 2012-11-02 18:35:33 +01:00
Adam b917361de8 Fix pch generation 2012-11-01 16:26:59 -04:00
Adam a0a54fdfe0 Expand options:hideprivilegedcommands to not show commands requiring authentication to unidentified users 2012-11-01 16:15:44 -04:00
Adam d90d5d538b Fixed operserv/umode serv help entry 2012-11-01 14:54:14 -04:00
Adam c2ae76248e Made db_old load exceptions.db 2012-11-01 14:47:23 -04:00
Adam 9aa71af1e5 Accept 1.8s svid ts on plexus too 2012-11-01 14:47:23 -04:00
Adam b64abebd24 Made os_logsearch search oldest logs first so the newest entries are at the bottom of the list 2012-11-01 14:47:23 -04:00
Adam 90930619bc Fixed quite a bit of dumbness with m_ssl. Had to
modify socketengines to allow polling for write &
no read, but is it cleaner now. Made m_httpd able
to listen using SSL.
2012-11-01 14:47:23 -04:00
DukePyrolator 5b1c823019 fixed importing mode locks in db_old 2012-11-01 05:28:57 +01:00
Adam b2b4f21e39 Clarify the path given to Config isnt actually the bin path, but the path Anope is installed to 2012-10-31 23:11:06 -04:00
Adam 22e55165c9 Fixed anopesmtp logging 2012-10-31 22:57:11 -04:00
Adam 35c2256849 Apparently sending this all at once didn't work that great, so wait for the events before sending the joins/modes etc 2012-10-31 17:37:19 -04:00
Adam 3a10fca75f Fix ns_ghost and ns_recover, add nicksev:restoreonghost 2012-10-31 12:37:43 -04:00
Adam a39947cd3c Made os_forbid honor nssecureadmins 2012-10-30 22:07:15 -04:00
Adam 1730bfb2bc Send uids everywhere when setting modes on clients 2012-10-30 21:22:10 -04:00
Adam 26a4a13cdf Made os_mode a bit smarter 2012-10-30 20:40:42 -04:00
Adam 36f357c354 Fixed build errors and warnings with -std=c++11 2012-10-30 17:10:31 -04:00
Adam b07928eea9 Clean up ngircd proto mod slightly, and send sqlines before introducing clients 2012-10-30 15:50:39 -04:00
Adam 1ef7480380 Fix inspircd mode message for channel modes. It never actually uses this, but other pseudoservers may send modes using this and not fmode (it has no timestamp) 2012-10-30 15:21:47 -04:00
Adam e4c2dcc0c7 Made db_old load up most of the old mode locks 2012-10-29 21:51:34 -04:00
Adam 7bdad857e4 Only show mode lock in /cs info if there really is a mode lock 2012-10-29 21:28:43 -04:00
Adam c2a8ad26af Fix formatting fail in cs_status 2012-10-29 17:47:26 -04:00
Adam fedf235c83 Update Config.cs for VS 2012 and fix it failing if the source directory path has spaces in it 2012-10-29 17:07:10 -04:00
Naram Qashat e88d2c2031 Make it so CMake doesn't complain if packing on a system using Visual Studio Express. 2012-10-29 16:40:19 -04:00
Adam 20e4685057 Readd cs_status 2012-10-29 14:54:49 -04:00
Naram Qashat ca55e15d44 Fix building under Mac OS X via Makefiles if not using an Xcode project. This is a hack but CMake currently provides no other way to determine if the detected C++ compiler was identified as Clang. 2012-10-29 14:06:42 -04:00
Adam bb5e4127d7 Made MailThread completely threadsafe, currently theres a race condition with config reload + sending mail at once 2012-10-29 13:51:38 -04:00
Adam 30028a2404 This include is unncessary 2012-10-29 13:46:21 -04:00
Adam 6883309927 Made anopesmtp less hard to debug 2012-10-29 13:46:21 -04:00
DukePyrolator 9c8570ac68 readded ngircd protocol support 2012-10-29 04:17:24 +01:00
Naram Qashat 4dfc0f952f Fix cmake generation due to this if not being updated. 2012-10-27 12:09:07 -04:00
Adam d6e1b92059 Add a module log type 2012-10-27 08:12:04 -04:00
Adam bb5f4555dc Ues timestamp for dns serial not yyyymmddnn.. there are too many problems with this (restarts, >99 zone updates/day, etc) 2012-10-27 05:34:36 -04:00
Adam 32d33ca8e5 Expand single digit serial revisions to match nn 2012-10-27 04:44:10 -04:00
Adam e1dcf24c98 Add nickserv:modesonid config option to set what modes users get on identify 2012-10-26 17:30:41 -04:00
Adam 3b24311db6 Sometimes zone transfers can be really big 2012-10-26 12:57:25 -04:00
Adam 8fd3fc7c13 Add sasl support to unreal, inspircd 2012-10-26 10:46:19 -04:00
Adam 8d27b25bf8 Don't attempt to process any query packets if we aren't explicitly given permission to bind to a port (we do anyway currently for m_dnsbl to get replies) 2012-10-26 00:55:04 -04:00
Adam 727b35536f This code isn't used 2012-10-25 23:44:34 -04:00
Adam bbe667dc74 Fixed two memory leaks in cs_seen 2012-10-25 22:29:10 -04:00
Naram Qashat 3608d42ae9 This version needs a better tag than "-git", so there. 2012-10-25 22:26:59 -04:00
Adam 8f33933dd8 Default xlines to be set by OperServ 2012-10-25 21:31:58 -04:00
Adam e5efe42ecb Fixed showing users from the right server on unreal/bahamut 2012-10-25 04:30:22 -04:00
Adam 10e21bfeda Fix handling clients on unreal that have no ip (it sends a *) 2012-10-25 01:30:41 -04:00
Adam 00256fdba8 Made access provider modules permanent. They don't cleanup their access entries currently and if they did it would delete them. 2012-10-24 23:30:21 -04:00
Adam 3b8fb7bb88 When db_sql_live gets new objects immediately update cache on them to prevent rewriting later if they aren't changed 2012-10-24 22:48:12 -04:00
Adam 1057fa8421 BIND's forward ability did not work as I expected
because it will not forward non recursive queries.
So, added support for SOA, NS, and AXFR requests.
2012-10-24 19:32:26 -04:00
attilamolnar fca9ec085e InspIRCd: Add handler for FIDENT to 2.0 protocol, so we know when someone changes ident on the network 2012-10-24 07:40:16 -04:00
DukePyrolator ef5c6684c7 Merge branch '1.9' of ssh://anope.git.sourceforge.net/gitroot/anope/anope into 1.9 2012-10-24 05:12:47 +02:00
DukePyrolator e0438e3a7e fixed calculating the correct channelcount for an user when loading the db. fixes bug #1450 2012-10-24 05:12:13 +02:00
Adam 04632bd381 Cleanup of last few commits/warning fix 2012-10-22 17:02:01 -04:00
Adam 0b9db15efc Add os_dns, a way to control your DNS zone via services 2012-10-22 00:54:30 -04:00
DukePyrolator d5b2f9cfa7 Base has to destruct before Extensible does because objects that destruct due to Extensible destructing don't have their references to the already destroyed object for Base invalidated. (fixed for NickAlias and NickCore) 2012-10-21 18:29:10 +02:00
Adam 727c3d5b75 Base has to destruct before Extensible does because objects that destruct due to Extensible destructing don't have their references to the already destroyed object for Base invalidated 2012-10-18 20:06:02 -04:00
Adam eddb7684c1 Fixed protoctl parsing on Unreal + fix SendLogout now the usage has changed 2012-10-17 20:22:44 -04:00
Adam 484baba6ad Actually show the correct number of entries on /os logsearch output 2012-10-15 03:54:26 -04:00
DukePyrolator 88f10a2c3c Updated the hybrid protocol module, patch provided by Michael
- Change mode handler to use UIDs within SVSMODE messages
- The IP can be 0 in UID messages depending whether or not a client is spoofed
- Removed SendGlobopsInternal handler. Anope is using GLOBOPS by default
- Set user's services timestamp/account to 0 instead of 1 on /ns logout, otherwise the UID message handler will
2012-10-14 20:13:41 +02:00
Adam ffa1c976f5 Use account name for svid on hybrid 2012-10-14 01:50:14 -04:00
Adam 4fdc157f68 Better clarify signon vs timestamp and allow updating users timestamp to an ircd given value from NICK 2012-10-14 01:05:24 -04:00
Adam 0a950669cb Add a hybrid 8 protocol module courtesy of Michael <michael@wobst.at> 2012-10-13 23:49:15 -04:00
Adam 1232018332 Allow services operators to modify/view other users autojoin lists 2012-10-13 06:21:53 -04:00
Adam 6237613439 And update modules.example.conf 2012-10-13 00:40:44 -04:00
Adam 4424abd15d Add m_sql_oper 2012-10-13 00:37:10 -04:00
Adam 76a0471c29 Simplify the db_sql_live code since this isn't actually necessary. Fixes a problem internally ovwrwriting data on objects that we have modified and are queued because of assigning something to a serialize_obj reference 2012-10-13 00:37:10 -04:00
DukePyrolator e08422a4ea fixed MODE handling in the ratbox protocol module 2012-10-12 22:47:35 +02:00
Adam 757ff06011 Fix m_ldap to reconnect automatically if the ldap server goes away 2012-10-10 23:08:00 -04:00
Adam 06defe014b Merge remote branch 'attila/1.9+topiclockmsg' into 1.9 2012-10-09 19:34:24 -04:00
Adam 63bf134321 Merge remote branch 'attila/1.9+msgfix' into 1.9 2012-10-09 19:34:11 -04:00
Adam 2113494274 Send privmsgs and notices to uids if applicable 2012-10-09 19:33:24 -04:00
attilamolnar 912f068fe4 Fix wrong error message when --dbdir has no argument 2012-10-09 23:31:20 +02:00
Adam 8f5d786f0e Cleanup ok if modules with pending identify requests are unloaded 2012-10-09 05:22:02 -04:00
Adam 1dacc648a0 Made the warnings given by cmake for not having
the dependencies for modules look less scary as
they confuse dumb people currently
2012-10-09 04:13:04 -04:00
Adam 3af786d4c9 Fix fantasy !help & give it its own help header, not ChanServ's 2012-10-08 20:58:47 -04:00
Adam e57b470e83 Made fantasy commands configurable 2012-10-08 04:16:23 -04:00
Adam b8b63ff115 Remove the asynchronous identifing hack and replace it with something better. Fixes m_*_authentication only being able to properly work when people identify normally using nickserv/identify 2012-10-07 22:39:58 -04:00
attilamolnar 959a3f3cca InspIRCd: Log when server-side topiclocking is enabled in the config but the module is not loaded 2012-10-07 11:49:38 +02:00
Adam 0a111c1976 Fix compile from bda3b1fa3a 2012-10-07 02:13:14 -04:00
DukePyrolator 4b68f0447c updated docs/LANGUAGE to point to the right directory where users should put module language files 2012-10-07 08:00:31 +02:00
Adam 31914b200b Merge remote branch 'remotes/attila/1.9+addline' into 1.9 2012-10-07 01:46:44 -04:00
Adam ebb3fca698 Release holds on a nick on identify, if there is one 2012-10-07 01:45:43 -04:00
Adam 7f72b466ac Set sane default last_topic_setter and last_topic_time in the event an empty topic is locked right after registering a channel without previously being set 2012-10-07 01:29:49 -04:00
Adam 4751c735ec Fixed module language file path 2012-10-06 22:54:52 -04:00
attilamolnar bda3b1fa3a InspIRCd: Make functions that send ADDLINE and DELLINE, call them from the rest of the module 2012-10-07 03:15:42 +02:00
Adam 4ec10d798b Fixups and cleanup for the last few commits 2012-10-06 20:11:47 -04:00
attilamolnar 3dd21e4dcd InspIRCd: Add support for server side topic locks using METADATA topiclock 2012-10-07 01:35:14 +02:00
attilamolnar 682d76835e InspIRCd: Add support for sending detecting m_topiclock and sending SVSTOPIC when it is available 2012-10-07 01:33:49 +02:00
attilamolnar 42aa367f16 InspIRCd: Send channel METADATA using a dedicated function 2012-10-07 01:32:31 +02:00
attilamolnar ec8a1bcc82 Add a config option for server side topic locks 2012-10-07 00:59:49 +02:00
attilamolnar 2d9541c4c8 Parse and store the spanningtree protocol version for InspIRCd 2012-10-06 02:18:48 -04:00
attilamolnar e747ba6c26 InspIRCd: Add metadata handler to recognize when a module is loaded or unloaded on the ircd side and adjust our behavior accordingly 2012-10-06 02:06:23 -04:00
attilamolnar 4431a34987 InspIRCd: Allow METADATA handler to differentiate between user, channel and other/server metadata 2012-10-06 02:06:23 -04:00
attilamolnar 14d7de0cf3 InspIRCd: Remove has_svshold, use IRCDProto::CanSVSHold 2012-10-06 02:06:18 -04:00
Adam cd28fdc192 Show the correct reciever nick when use strict privmsg is enabled 2012-10-06 01:01:45 -04:00
Adam 25fe9c7084 Do not process() socket engine on shutdown 2012-10-05 16:23:40 -04:00
lethality 94fc2ba9c9 Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9 2012-10-05 15:15:50 +01:00
lethality 2f87b8e430 Revert this strangeness I created ;) 2012-10-05 15:14:19 +01:00
Adam eff61c7a97 Add an event for when nick or channel options are set 2012-10-05 05:03:55 -04:00
Adam 7c96227cd3 Use memcpy for Anope::Unhex not strcpy 2012-10-05 01:20:32 -04:00
lethality dcfae6332e Some minor fixes/typos 2012-10-03 21:22:03 +01:00
Adam 69437bb324 Fixed parsing squit (it has a reason) 2012-10-03 05:17:32 -04:00
Adam 7551245f57 Attempt #2 at silly topic ts thing, this is actually must cleaner 2012-10-02 23:30:31 -04:00
Adam 47bc551485 Revert "Fix topiclock on inspircd"
This reverts commit 87478187af.
2012-10-02 22:59:20 -04:00
Adam 87478187af Fix topiclock on inspircd 2012-10-02 22:16:35 -04:00
Adam 7042223f2e Somehow the kick handler got lost in the confusion. Send the topic time with ftopic on inspircd not the current time. Removed some unneeded protocol functions 2012-10-02 21:21:37 -04:00
Adam 93698f0d61 Added operserv/logsearch 2012-10-02 05:18:42 -04:00
Adam f7aa837696 Don't unassociate accounts with users on nick changes 2012-10-02 01:30:35 -04:00
DukePyrolator e1d1d18288 added an operserv/akill page to webcpanel 2012-10-02 05:36:31 +02:00
DukePyrolator 20a6f82753 modified the nickserv alist command to return nc->display instead of the parameter provided by the user 2012-10-02 05:35:44 +02:00
DukePyrolator aec6cac8ca Merge branch '1.9' of ssh://anope.git.sourceforge.net/gitroot/anope/anope into 1.9 2012-10-02 04:14:50 +02:00
DukePyrolator ffca6a762d fixed a small bug in the inspircd protocol modules 2012-10-02 04:11:52 +02:00
Adam 2d2ab4fec4 Fixed handling TOPIC on unreal, dont set topics in Channel::Reset unless we are synced, and fixed ts checking in Channel::SetModesInternal 2012-10-01 21:26:41 -04:00
Adam a434baed91 Allow modules to store data in their own databases. 2012-10-01 18:50:29 -04:00
Adam f14a3dfb8a Fix a few problems found by Cronusa and KindOne 2012-10-01 04:35:36 -04:00
Adam b19a3af4db Add networkinfo:chanlen config directive 2012-10-01 02:29:31 -04:00
Adam 89428a9d10 Cleanup of all of the protocol modules, rewrote message handling system to be a bit more C++ ish 2012-10-01 01:56:57 -04:00
Adam b937d6310d timestamp column is a special case too 2012-09-30 21:36:49 -04:00
Adam ad37bc9639 Bug #1445 - Empty out columns in SQL we have no data for on
insert. This is caused from serialize() only setting a key on
certain conditions and otherwise doing nothing at all.
2012-09-30 20:30:27 -04:00
Adam 56df1abdd8 Place runtime module binaries in data/runtime instead of lib/ incase of a system wide install where lib/ is not writable 2012-09-30 20:30:27 -04:00
Adam 0ea5e57298 Use RTLD_NOW when loading modules to resolve all symbols immediately.
This prevents modules with unresolved symbols from loading instead
of loading and crashing later.
2012-09-30 20:30:27 -04:00
Adam 3838eb1f05 Add webpanel contributors to readme and remove todo since its way out of date and has nothing more in it we want 2012-09-30 20:30:27 -04:00
Adam 9ba7196881 Make CommandSource use references, sometimes we hold them for awhile 2012-09-30 20:30:27 -04:00
DukePyrolator 1e71303ffa fixed nickserv alist 2012-09-30 13:58:17 +02:00
lethality 74117a1e1e added some example sql queries 2012-09-29 23:55:55 +01:00
Naram Qashat 38ad523f91 Fix a few oddball warnings that came up from clang, and also make it so webcpanel.so can be compiled under Mac OS X. 2012-09-24 15:54:49 -04:00
DukePyrolator a71e2fb64e make nickserv glist check if the given nickname is in the group of the user before checking for services oper 2012-09-23 20:57:35 +02:00
Naram Qashat 1b20ec8747 Forgot to delete a line in the last commit. 2012-09-22 04:18:41 -04:00
Naram Qashat d30e53ee2c OK, so the FIND sub-command of string() in CMake was only added with 2.8.5, change this to use the REGEX sub-commands instead. Also while I'm at it, make -pthread only get added when not on Mac OS X, it's auto-included there. 2012-09-22 03:45:51 -04:00
Naram Qashat aa57ad6082 Fix issues with CMake trying to add /System/Library/Frameworks/Kernel.framework/Headers/sys to the include paths. 2012-09-22 02:10:49 -04:00
lethality 097893bfbf Updated example query to include a valid value 2012-09-13 15:29:04 +01:00
Adam 16019c9827 Add m_sql_authentication to allow authenticating users against an external SQL database 2012-09-12 21:10:02 -04:00
Adam f391100586 Fixed gettext on freebsd/any other system that uses LANG not LANGUAGE 2012-09-10 21:39:04 -04:00
Adam c4a1e1bb0c Fixed os_defcon too 2012-09-08 04:51:44 -04:00
Adam 7e3b5bed50 Add chanserv/set/autoop, like nickserv/set/autoop but for channels 2012-09-07 23:44:15 -04:00
Adam c9c477ff9d These saset command stubs can go away 2012-09-07 22:27:28 -04:00
Adam 4eb7db80a6 Fix os_session to really use ips for quits, don't enforce session for spoofed users/other users who have no ip, clean up warnings 2012-09-07 21:22:19 -04:00
Adam 9d6626f70c Made session tracking ip based, not host based, and allow using CIDR to group multiple ips from one subnet to one session 2012-09-07 12:04:25 -04:00
Adam 5c07863ad5 Allow configuring killquick and kill delays 2012-09-07 08:46:28 -04:00
Adam 3060375251 Fixed m_ldap_authentication not returning anything if the search for an account game back empty 2012-09-07 06:52:56 -04:00
Adam 3c63e44d32 Allow ; and } in quoted strings 2012-09-07 05:59:28 -04:00
Adam 02d943bfb0 Not quite sure what I was thinking here 2012-09-05 02:56:59 -04:00
DukePyrolator 4c8fef264e updated example.conf 2012-09-03 11:05:17 +02:00
Adam 082cf8ace8 Windows cares this is escaped + chmod too 2012-09-02 22:56:17 -04:00
Adam 1fd193840d Fix CMake to actually make directories on install ..... 2012-09-02 22:39:05 -04:00
Adam b1f8e910eb Version bump for 1.9.8-git 2012-09-02 09:48:13 -04:00
Adam 81cf9f0c71 Anope 1.9.7 Release 2012-09-02 08:31:43 -04:00
Adam 3264669e03 Update version.log 2012-09-02 08:31:34 -04:00
Adam 271d723bbd Update Changes 2012-09-02 08:31:11 -04:00
Adam a0c4575122 Regenerate language files 2012-09-02 08:31:04 -04:00
Adam 1af64a9bbb Fix Windows 2012-09-02 08:30:54 -04:00
Adam e3d5140dcc Added a web panel module + a default template 2012-09-01 18:54:51 -04:00
Adam f81d0113a2 Actually set xline's manager... 2012-08-28 00:39:50 -04:00
Adam fde42899e7 Fixed db_old loading encrypted passwords from 1.8 2012-08-09 23:28:02 -04:00
Robby f7bf2fa960 Put motd in conf/ not data/ and fixed the default values in the config 2012-08-08 17:09:34 -04:00
Cronus b894a569c9 Update pid and motd file paths 2012-08-08 04:28:33 -04:00
Adam 48022c3ddf Warn about really big integer values in the config 2012-07-18 16:52:14 -04:00
Adam 28aa981464 Actually the core can't handle empty realnames, just ignore them 2012-07-01 23:50:38 -04:00
Adam 2b8a09bf55 Remove some unused code in inspircd20 protocol module & allow /chghost/ident/naming services clients 2012-07-01 22:26:05 -04:00
Adam a12788e8f4 Don't crash on empty setnames on inspircd1.2 2012-07-01 22:26:05 -04:00
Adam 9b5f6d3c45 Remove ExtensibleString everywhere 2012-07-01 22:26:05 -04:00
lethality af24dc6050 Removed old set xop references and cleared up some other stuff. 2012-06-26 16:21:24 +01:00
lethality f27560cc1e Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9 2012-06-26 02:01:01 +01:00
Adam 4b309b5044 Fixed accidentally recursion in User::SendMessage from last commit 2012-06-25 20:51:08 -04:00
lethality d8a99d619f Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9 2012-06-22 21:26:33 +01:00
Adam 2dec8e767a Allow userless command sources 2012-06-18 05:04:30 -04:00
lethality ba53c7eb03 Updated MODULES somewhat 2012-06-17 22:23:22 +01:00
Adam 873d4287de Split up bs_set 2012-06-11 15:44:48 -04:00
Adam 3626fb246e Fixed fd leak in win32/pipe.cpp 2012-06-06 15:16:46 -04:00
lethality a661098ef2 Some more fantasy character help output 2012-06-04 05:45:13 +01:00
lethality a4bf5ce609 minor help output changes, including some confusion in fantasy chars 2012-06-04 04:50:35 +01:00
Adam 437944d416 Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9 2012-06-01 04:43:26 -04:00
DukePyrolator db37b1c634 updated chanstats 2012-06-01 07:37:34 +02:00
Adam 1e49e9b9dc This should actually be LOG_TERMINAL, quitmsg isn't logged to terminal on shutdown 2012-05-26 02:36:02 -04:00
Adam 2cbfbc98e9 Some access level fixes from Robby to more closely match the historic levels, and some code cleanup 2012-05-26 02:15:48 -04:00
Adam 38d5f20deb Added a ./Config option for using precompiled headers 2012-05-24 21:54:15 -04:00
Adam 70fb5900a2 Add support for inspircd2.0+s mlock, improved on Unreal's, and made server side mlock usage configurable 2012-05-23 19:35:56 -04:00
Adam bf7d1a55af Fixed some problems found by Robby 2012-05-23 15:09:41 -04:00
Robby 1f73e27870 Updated help messages for ns_list, cs_list, cs_entrymsg, and cs_info. Also fixed logging for cs_entrymsg. 2012-05-20 04:14:26 -04:00
Adam 699087b2bf Fixed cs_entrymsg loading entries from the database 2012-05-20 03:57:22 -04:00
Adam ccd29085a9 reinterpret_cast off of a virtual base does Bad Things 2012-05-17 03:57:19 -04:00
Adam a883362c14 Fixed not always calling operator bool() in dynamic_reference, which would mess up service references and do weird things 2012-05-17 02:03:22 -04:00
Jeremy ef88385d85 m_ldap_authentication: Removed the dependency on a specific binddn in favour of searching the tree for matching criteria and using the returned DN 2012-05-15 17:19:50 -04:00
Adam 90b0283160 Grab the DN for every LDAP query and send it in the result 2012-05-15 04:27:36 -04:00
Adam 0a8d46b538 Fixed parsing FMODE on inspircd 1.1 2012-05-14 22:30:03 -04:00
Adam a84226edf0 Do not show help for set message if useprivmsg is disabled 2012-05-11 00:50:58 -04:00
Adam 9370b063d0 Fixed crash on access del + valgrind errors 2012-05-10 17:53:53 -04:00
Adam d5ffae0e46 Made ssl cert and keyfiles configurable 2012-05-09 03:37:37 -04:00
lethality f89599726e fixed paste error (failed awesomeness) in last commit. 2012-05-09 03:11:57 +01:00
lethality a81b3aaff1 Fixed saving backups 2012-05-09 01:23:34 +01:00
Adam 820e4edc2b Fixed some 100% cpu bugs with the new SQL stuff, and fixed sqlite+db_sql_live 2012-05-08 18:04:49 -04:00
Robby 25586f3246 Allow services operators to release other user's nicks, and allow services operators to view the access list of other operators 2012-05-08 02:01:44 -04:00
Adam b7149fc940 Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9 2012-05-06 21:44:11 -04:00
Adam 675b113c3e Split up db/conf/lib/locale install directories, and allow alternate ones to be specified at runtime 2012-05-06 21:43:50 -04:00
DukePyrolator c797987615 Readding missing valid nick check to ns register/group removed in os_forbid commit 2012-05-05 09:35:18 +02:00
Adam eb0e07d564 Use Unreal's MLOCK command if supported 2012-05-04 16:03:02 -04:00
Adam 1b5805eeb0 Set quitmsg on ERROR 2012-04-29 20:39:33 -04:00
Adam 42e652cae7 Pull table schemas from SQL on startup so we can alter the schemas if we need to, fixed sqlite to work again 2012-04-29 19:24:37 -04:00
Adam 62818abbf4 Added options:casemap to chose how case insensitive strings are compared, using ascii, rfc1459, or a locale installed on the system 2012-04-29 15:43:51 -04:00
Adam 4d9a96e8df Fixes to db_sql 2012-04-27 17:06:16 -04:00
Adam e490a5461f Process defines even before includes, fixes defining{} pseudoclient names to something else in their respective configurations 2012-04-27 16:05:49 -04:00
Adam 5068483cb9 Add db_sql:prefix allow prefixing all anope tables similarly, and changed db_sql to update the databases incrementally instead of one big flush 2012-04-27 15:38:50 -04:00
Adam 83ee20fc29 Clarify access denied messages caused by NSSecureAdmins 2012-04-25 19:02:09 -04:00
Adam b08aa4ed92 Check for os_sesion to exist before having defcon try and place session bans 2012-04-25 18:49:53 -04:00
Adam 1081ecdae8 Fixed non-debug build 2012-04-25 14:29:50 -04:00
Adam 2370c16f1e Fixed build from the previous merge 2012-04-24 16:02:07 -04:00
Adam 3d84dc91f6 Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9 2012-04-23 05:17:02 -04:00
Adam 573e49a7ea Reworked live SQL support yet again 2012-04-23 05:08:26 -04:00
Adam 63c639e108 Fixed hashm checking in db_old and loading 1.9.1 databases 2012-04-23 05:07:06 -04:00
Adam fc00406079 Fixed ./services --version etc not getting printed when stdout is a file/pipe/not a tty 2012-04-22 02:57:17 -04:00
DukePyrolator b752c3a668 fixed a bug in chanstats 2012-04-13 18:33:22 +02:00
DukePyrolator 7372b457cc fixed a compile error in m_sqlite 2012-04-08 19:29:56 +02:00
DukePyrolator deb5196101 Added Chanstats. It uses a new, improved database format and is not compatible with current phpdenora or magirc installations. 2012-04-08 12:43:34 +02:00
DukePyrolator 9e1fda2a44 Modified the SQL API to allow unescaped parameters (useful for passing row names and NULL values) 2012-04-08 12:30:48 +02:00
Adam 9d249ef96f Fixed unpacking questions from dns packets 2012-04-06 14:41:28 -04:00
Viper e03b73e8cd Revert changes made to line endings. 2012-04-06 15:36:49 +02:00
Hal9000 6b473f22bd Revert last commit cause guess what, I screwed things up 2012-04-06 15:12:22 +02:00
Hal9000 05bb80c06c Fixed mail function causing some MTAs to sent blank messages 2012-04-06 14:35:34 +02:00
DukePyrolator e6edc6586e updated the german language file 2012-04-01 20:50:46 +02:00
DukePyrolator cf3124c063 fixed some typos 2012-04-01 20:50:04 +02:00
Adam 12a6a27b52 Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9 2012-03-27 19:14:55 -04:00
Adam 31a0e673b2 Fixed unpacking multiple names from dns packets when one has multiple compression pointers.
Currently this will just fail at unpacking the later name due to offsets being invalid.
Also cleaned up the existing code and made unpacking error messages more helpful.
2012-03-27 19:01:29 -04:00
DukePyrolator 8d0b4a1bf5 added a missing error message when a module file does not exist. this fixes bug #1401. also moved some debug messages to debug level 2 2012-03-22 07:30:38 +01:00
DukePyrolator 1b0ebcadfa fixed bug #1399 2012-03-21 22:20:18 +01:00
DukePyrolator 0d100ffacc fixed ns_ajoin 2012-03-21 20:25:25 +01:00
Adam 88fd1da803 Fixed typos 2012-03-13 21:07:10 -04:00
Adam a06934777c Actually check if the nicks arent registered, oops 2012-03-13 19:26:11 -04:00
Adam a26f4b9a9a Bug #1389 - readd RNG seed in the config and start DNS query ids off on a random number 2012-03-13 17:45:07 -04:00
Adam 053d6a2247 Add a nickserv:unregistered_notice config option to send a message to unregistered users on connect. Suggested by Cronus. 2012-03-13 17:18:11 -04:00
Adam beae4775cf Bug #1382 - Save maxusercount and maxusertime 2012-03-13 16:58:14 -04:00
Adam cff91a532f Made gch files depend on the header they were generated from 2012-03-11 21:21:47 -04:00
Adam 92ed5d7208 Fixed having multiple uplink blocks work right if the first uplink fails on startup 2012-03-11 16:44:44 -04:00
Adam 7800375510 Bug #1384 - Fixed spacing of connection log message if users have no vhost - patch from cbiedl 2012-03-11 05:20:28 -04:00
Adam ab25815694 Fixed backup databases having their names collide due to not separating month and day, #1383 2012-03-05 20:15:56 -05:00
Adam 8e0104363f Fixed bs_kick syntax error 2012-03-05 14:29:48 -05:00
DukePyrolator b7a6d518b0 fixed the --dir commandline parameter 2012-03-04 10:18:25 +01:00
Adam 4ed844ffd5 Escape all column names when building sql queries 2012-03-02 17:05:59 -05:00
Adam 020467d472 Fixed db_old loading noexpire 2012-02-27 00:16:15 -05:00
Adam 141b87bd14 Changed the OnChanDrop event to be called right before channels are dropped, not after 2012-02-26 23:28:02 -05:00
Adam a5b9e235ae Added chanserv:require config option to set which modes must be on all registered channels. Prevents the core from always enforcing +r on every channel, even if chanserv is not loaded. 2012-02-26 23:23:15 -05:00
Adam a78790eac4 Fixed vhost check on identify 2012-02-26 20:18:22 -05:00
Adam 07226feec4 Track plexus umode and cmode +C and renamed UMODE_NO_CTCP to match up with the names of other modes. 2012-02-26 19:49:02 -05:00
Adam e73013830d Fixed missing #include in init.cpp 2012-02-25 22:45:51 -05:00
Adam 2bc3bd3fcf Do not send kills after sending XLines because it causes us to internally remove the user and then recieve a quit from the user (who is now nonexistant) once the IRCd processes the XLine 2012-02-25 00:06:02 -05:00
Adam 83456f6040 Fixed akill setter and ids showing in akill reasons 2012-02-24 23:25:29 -05:00
Adam 601dc41baf Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9 2012-02-24 14:54:44 -05:00
Adam 2337b7717d Fixed calculating bots channel count of assigned channels and fixed the order of saving memos (among other things) 2012-02-24 14:53:34 -05:00
lethality fde40dee7a Tell users to use NickServ for registering nicks, not chanserv... 2012-02-24 01:50:21 +00:00
lethality ba32aad4cb Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9 2012-02-23 02:32:49 +00:00
Adam 24811e5970 Added a configuration option to make all nick registrations require admin verification 2012-02-22 20:55:59 -05:00
lethality f01aab5f9b Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9 2012-02-23 00:04:36 +00:00
Adam 3850b073dd Added regex support for many commands, such as akill, sqline, snline,
all of the */list commands, etc.

Also extended the ability of akill to match a full nick!user@host and
real name of users.
2012-02-22 18:12:02 -05:00
Adam 81e50dd1f4 Fixed db_old loading memo owners 2012-02-22 16:25:20 -05:00
Adam bd31fbb9f0 Also fixed m_proxyscan to handle users with invalid ips 2012-02-22 14:41:36 -05:00
Adam 000660608e Fixed m_dnsbl handling users with spoofs/other non ips 2012-02-21 20:50:14 -05:00
lethality 826de43724 Fixed some trivial formatting 2012-02-22 00:28:58 +00:00
Adam b84e080463 Made our message sources actual clients/servers, and put in a few more default messages for very standard things (KICK etc) 2012-02-19 20:54:55 -05:00
Adam 0ba58d7d0e Fixed some events 2012-02-18 18:07:34 -05:00
Adam 1536c5cf60 Add users hostmask to access lists not nick when access add is used on a non registered user 2012-02-18 17:21:55 -05:00
Adam f2ce9cd85c Made mode lock del check status of the mode lock before removing it 2012-02-18 15:47:16 -05:00
Adam ee5cd8493e Use C++11's explicit override feature if available 2012-02-18 15:04:26 -05:00
Adam 41e8d27602 Fixed FreeBSD build 2012-02-16 16:02:17 -05:00
Adam e1f5fc6a0c Remove revision numbers as they're only ever set by Config reading git since we've switched off of SVN. Instead just use the hash for the current head when building. Also recheck the hash on every make not just Config. 2012-02-15 00:06:25 -05:00
Adam db59f1a70f Fixed detecting when to set +r and fixed crash on shutdown introduced by the last commit 2012-02-14 19:03:09 -05:00
Adam a9772cde21 Clean up and reorganize our header files 2012-02-14 15:13:27 -05:00
Adam 086790d633 Removed our RNG and just use the systems, it's not very widely used. Also made DNS query ids not random as they don't need to be. 2012-02-13 00:10:45 -05:00
Adam 1bc8e2ab82 Removed operserv:notifications in favor of log blocks, as well as some other notifiications 2012-02-08 18:00:24 -05:00
Adam 089c85b27e Fixed WallBadOS 2012-02-04 17:28:38 -05:00
Adam 01194e3958 Bump for 1.9.7-git 2012-02-04 13:12:11 -05:00
Adam f082530f89 Anope 1.9.6 Release 2012-02-03 15:19:09 -05:00
Adam b906656caa Update version.log 2012-02-03 15:18:27 -05:00
Adam 378ae4c4f1 Regenerate language files 2012-02-03 15:18:06 -05:00
Adam ce2a0f72d4 Fixed a memory leak in m_ldap 2012-01-31 16:19:47 -05:00
Adam be5ba495f9 Not sure what I was thinking here 2012-01-31 15:44:04 -05:00
Adam b4f27da51c Bug #1365 - Fixed nickserv/confirm syntax for services opers 2012-01-31 15:35:51 -05:00
Adam d09a30295b Also refuse to load memoserv modules if memoserv isn't loaded 2012-01-26 17:04:59 -05:00
Adam 0f909273e1 Added two common warning messages on Windows to ignore 2012-01-25 16:13:38 -05:00
Adam 52eaa7d6d6 Windows 2012-01-25 15:48:07 -05:00
Adam e88e37c59b Add some checks in ms_* to make sure memoserv really exists 2012-01-24 18:28:37 -05:00
Adam f10f49d6fc Added missing expires column in /os akill view 2012-01-24 16:42:21 -05:00
Adam d06cdaab29 Fixed os_ignore to check against users real IPs, not to match against opers, and check for expired ignores on /os ignore list 2012-01-24 16:35:54 -05:00
Adam fc20bd7b22 Add tracking for Unreal's usermode +I 2012-01-24 16:03:44 -05:00
DukePyrolator b3d9412452 added a french INSTALL file, thanks to MacLeod for translating 2012-01-22 17:49:23 +01:00
Adam 98feb1b76d Cleaned up bs_kick and fixed amsg kicker 2012-01-21 00:50:48 -05:00
lethality 94c302baf3 Fixed param check from last commit 2012-01-20 20:50:36 +00:00
lethality cdb6bb8ec2 Updated DEFCON and fixed Defcons disabling of the removed mlock command 2012-01-20 17:50:09 +00:00
lethality a851f849df Corrected some incorrect English 2012-01-20 15:03:49 +00:00
Adam a270a13010 Fixed crash from last commit 2012-01-15 02:59:09 -05:00
Adam 964d63cdac Improve on db_sql_live_read 2012-01-15 01:47:31 -05:00
lethality f38faedbda Fixed an incorrect crash-causing response when an invalid option is specified in botservs kickers 2012-01-14 15:58:51 +00:00
Adam c462a69b7d Only match users nicks against access list entries if the entry is a mask... accidentally removed from an earlier fix for #1368 2012-01-13 15:37:17 -05:00
Adam 14a2c9cec0 Fixed loading db_sql_live_read's configuration values on startup 2012-01-11 19:04:40 -05:00
Adam a52ed70ea0 Don't ever attempt to process CTCPs as regular messages 2012-01-10 17:58:56 -05:00
Adam 7c03e60299 Removed this "valid" ip check in cidr::cidr, is wrong for IPv6 and ::pton checks this anyway using inet_pton. Also fixed a comment Robby broke in chanserv.conf 2012-01-10 17:53:48 -05:00
Adam 1e9d88af01 Add support for Unreals extban ~a: 2012-01-10 17:06:08 -05:00
Adam 815e140ecf Fixed loading akill reasons 2012-01-08 19:42:48 -05:00
Adam f8245574dc Fixed topic lock on inspircd 2012-01-08 18:14:07 -05:00
Adam 830c5ca725 Cleanup of cs_tban 2012-01-07 16:21:31 -05:00
Robby 9e71394127 Cleaned up a lot of log messages, help replies, fixed cs_tban, and other small fixes 2012-01-07 04:10:30 -05:00
Adam dd64eac782 Fixed users not being able to delete their own access with /cs access when using numbers, and clean up cs_xop slightly 2012-01-07 03:44:43 -05:00
Adam 4204ece7a8 Updated Copyright to 2012 2012-01-02 21:28:24 -05:00
Adam 60a5cc1a61 Bug #1369 - Fixed os_svsnick to allow changing the case of a users' nick 2011-12-31 03:04:44 -05:00
Adam 20aa4e85ce Bug #1368 - check all members of a users gruop against the access list 2011-12-31 01:33:32 -05:00
Adam f1b05acf26 Fixed this back now unreal sends 0 for non logged in users 2011-12-28 12:49:04 -05:00
Adam a4bf770a49 Added ESVID support to unreal32
Also fixes a crash due to unreal's ESVID change when users connect.
2011-12-28 04:31:44 -05:00
Adam 150831c1a6 Made capab management a bit simplier 2011-12-27 23:11:14 -05:00
Adam 1a4157b7f4 Add DT_ALLOW_EMPTY config flag, allow fantasychars to be empty 2011-12-23 12:29:30 -05:00
Adam 3bcb285690 Somehow these two modules got mixed up.. 2011-12-22 03:46:35 -05:00
Adam 704dbe27bf Updated /bs info output and note db_sql can truncate entire databases 2011-12-20 18:38:37 -05:00
Adam bbddf50c9d Fixed botserv kickers 2011-12-19 17:13:38 -05:00
Adam e5851addd6 Fixed saving databases with MySQL when shut down by SIGINT 2011-12-19 16:07:28 -05:00
Adam 03119f2aa9 Made m_dnsbl ban IPs not hostnames 2011-12-19 15:41:14 -05:00
Adam 45fc3ce1c4 Fixed formatting of many lists and INFO outputs 2011-12-19 15:37:15 -05:00
lethality d320c73f23 Fixed entry messages not displaying. 2011-12-17 10:30:13 +00:00
lethality ca8ce89de4 Fixed a slight error in email registration/resend and some minor typos. 2011-12-17 02:06:53 +00:00
Adam c88a751eab Add privilege ranks to determine how powerful privileges are 2011-12-15 02:29:13 -05:00
Adam 9ea030d060 Fixed access comparators 2011-12-15 01:14:13 -05:00
Adam ad14c8145b Update channel last used times when founders use the channel, too 2011-12-12 15:37:08 -05:00
Adam 255a8da347 Added oper:require_oper configuration option 2011-12-12 15:26:59 -05:00
Adam 4211dcf6f9 Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9 2011-12-11 17:03:33 -05:00
Adam 3c5337fb8a Fixed translating messages with varargs sent directly to users, too 2011-12-11 17:01:56 -05:00
lethality d2f788c61e Added K to vhost_chars... 2011-12-11 05:17:19 +00:00
Adam fa54d5acb7 Fixed a memory leak in m_sqlite 2011-12-08 17:29:17 -05:00
Adam aeefe1650e Bug #1364 - fixed crash in /cs kick 2011-12-05 11:52:40 -05:00
Naram Qashat c80e7844b7 Attempt to fix issue with modules having their link libraries in the wrong order. 2011-12-03 19:17:41 -05:00
lethality 620c08bd7a Fixed some more errors in sql live-write, hopefully the last. 2011-11-25 23:12:23 +00:00
lethality 23a92709c0 Fixed a crash in ns saset when using mysql-write module 2011-11-25 23:10:26 +00:00
Adam cef3eb78df Remove send_cmd and replace it with a stringstream 2011-11-25 00:44:31 -05:00
Adam 12d0a7302f Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9 2011-11-21 16:24:45 -05:00
Adam 0dd85f7761 Fixed not translating messages using varargs 2011-11-21 16:17:17 -05:00
Naram Qashat 51d6e8ebfb CMake handles strings and lists differently, so this should hopefully finally fix the linking issue. 2011-11-20 18:41:46 -05:00
Naram Qashat 3f14882992 Apparently pstdint.h was NOT included way back with commit 377a7a9 to use something similar to stdint.h 2011-11-20 18:34:13 -05:00
Naram Qashat 5a17b060fe Really fix linking in libraries (even if gettext isn't found on *nix), and a minor nitpick about the leading spaces on LINK_LIBS. 2011-11-20 18:32:47 -05:00
Naram Qashat bf8e4ac714 Attempt to fix where link libraries are set when compiling to fix failed builds on systems that require -ldl. 2011-11-20 16:09:59 -05:00
Adam 781ed11ba8 Allow services operators to modify other users access list 2011-11-20 15:31:01 -05:00
Adam 6f8f7491db Allow kicking and banning by mask 2011-11-18 16:20:17 -05:00
Adam c43cdf438f Added operserv/logout 2011-11-18 11:22:01 -05:00
Adam 8374211239 Allow having multiple fantasy characters 2011-11-18 00:36:54 -05:00
Adam 69dfc729e9 Fixed storing mode locks 2011-11-17 12:46:18 -05:00
Adam 5281282a61 Fixed compile error 2011-11-16 16:22:58 -05:00
Adam 503eb42e40 Made looking up a level for a nonexistant privilege debugg log a warning, not abort 2011-11-15 16:30:31 -05:00
Adam 38d90c76e0 Fixed loading ssl certs for users 2011-11-15 16:27:32 -05:00
Adam 1356498320 Prevent locking mode Z on unrealircd 2011-11-15 16:22:02 -05:00
Adam 9ed203c0cb Fixed crash on shutdown & a compiler warning 2011-11-15 16:16:38 -05:00
Adam b5ff856f47 Windows 2011-11-08 17:29:16 -05:00
Adam 97b9055f92 Remove xlines from the IRCd aswell as from our list when the clear command is used, and fixed adding timed Zlines to inspircd 2011-11-05 15:05:15 -04:00
Adam 5f0b9338dc Set proper expirys on ZLines if the IRCd supports it 2011-11-05 00:11:49 -04:00
Adam b3194a10c5 Updated Changes 2011-11-04 19:39:27 -04:00
Adam d01f4ea3ce Allow /os userlist to match host and ip too 2011-11-04 18:04:12 -04:00
Adam a42cafbf69 Store flags for memos, fixed the expiring very soon message, fixed /os session view when a session exception is added at a lower limit than th default 2011-11-04 17:55:14 -04:00
Adam 066e5b3fc0 Delete all tables before flushing not just ones we know about 2011-11-04 02:28:21 -04:00
Adam 09dba47653 Added an assignment operator for Serializable because some STL containers use it which causes iterators to become invalidated 2011-11-03 18:59:51 -04:00
Adam ca33ac608d Bug #1354 - Allow mode chars to be used for channel prefixs in services.conf 2011-11-03 02:28:29 -04:00
Adam 302989bed1 Clarify the message when users try to lock modes they don't have access to lock 2011-11-01 01:11:26 -04:00
Adam 22b7d9fbee Added a copy constructor to dynamic_reference to allow references to reference other references correctly 2011-11-01 00:15:28 -04:00
Adam 9dd71c427d Fixed the signal/fork/wait mess hopefully once and for all. fork() did not copy kqueue descriptors on freebsd which caused problems 2011-10-29 21:16:50 -04:00
Naram Qashat 655c1cc1f7 Fix a few warnings that only showed up with gcc 3.4.6 here (sadly, there is one on every file about anonymous variadic macros that I can't get rid of). 2011-10-27 18:21:49 -04:00
Adam d9333e02fa Clear flags before rebuilding them from the databases. Fixes bug #1351 where default flags would always be set when unserializing objects. 2011-10-27 18:01:56 -04:00
Adam 39ac438b8d Ignore sigchld/usr2 sent to the child process after fork 2011-10-27 15:09:31 -04:00
Adam 0761a4a692 Bug #1350 + other related fixes 2011-10-27 14:46:20 -04:00
Adam 66ca256cfc Fixed loading exceptions in db_plain 2011-10-27 13:50:32 -04:00
lethality 961bb6e27e Fixed some typos/errors in the example configs comments. 2011-10-27 00:13:00 +01:00
Adam b14f5ea884 Fixed accidentally clearing botmodes when joins are sent 2011-10-26 16:52:00 -04:00
Adam bf66336e2c Bug #1347, fixed incorrect param parsing in cs_set_misc 2011-10-26 15:29:45 -04:00
Adam c79a575452 Bug #1348 - Fixed /cs entrymsg list 2011-10-26 15:17:05 -04:00
Adam 8334128680 Removed the old unordered_map code 2011-10-26 14:31:58 -04:00
Adam 7c62de1f27 Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9 2011-10-24 16:37:29 -04:00
Naram Qashat 377a7a968b Fixed bug #1349 (m_sqlite compiles without error under FreeBSD), as well as use C99's stdint.h (or cstdint if available) to get (u)intX_t types instead of our stupid typedefs. pstdint.h included in case there is no cstdint or stdint.h available. 2011-10-24 16:32:29 -04:00
Adam ccf29c0134 Fixed the capab parser to parse capab tokens prefixed with :. Fixes not detecting quitstorm support on ratbox 2011-10-24 13:19:51 -04:00
Adam d0513d6506 A few minor fixups 2011-10-22 16:11:26 -04:00
Adam f4a0bdd54d Added our own eventfd test for openvz machines which have eventfd but can not be used 2011-10-22 12:45:55 -04:00
Adam 3e2ac3640d Bug #1343 - don't allow recovering and ghosting enforcers 2011-10-22 11:35:31 -04:00
Adam c8b3809fc9 Added akill ids 2011-10-22 11:21:21 -04:00
Adam ad2ef75cbe Fixed a race condition with installing signal handlers and forking 2011-10-22 11:20:50 -04:00
Adam 6ce9010324 Fixed extracting multiple words from our serializable stringstream 2011-10-21 18:01:51 -04:00
Adam d0afc8c509 Added m_rewrite 2011-10-21 00:21:34 -04:00
Adam 230b3bc884 Only fork if we are at term 2011-10-20 13:38:37 -04:00
Adam 1cfb630ede Fixed a crash in clearusers 2011-10-20 11:54:56 -04:00
Adam d16f9620d5 Bug #1342 - fixed tracking chmodes in bahamuts sjoin 2011-10-19 12:59:16 -04:00
Adam fc16746352 Prevent chankill from akilling my clients 2011-10-18 12:18:18 -04:00
Adam eb5b5f97d1 Fixed compile errors on release build 2011-10-18 12:06:51 -04:00
Adam faea45245d Reorder some stuff in Init & the ts6 proto mods to fix weirdness from bots being introduced by 3rd party modules 2011-10-18 01:48:05 -04:00
Adam 2c614d5aab Fixed up anoperc to work with the newer startup method 2011-10-15 02:08:52 -04:00
Adam 89b4be681d Fixed crash on /os oper del 2011-10-15 00:54:32 -04:00
Adam 28ca0e1007 Fork earlier in startup to prevent it messing up threads, if there are any 2011-10-14 22:07:13 -04:00
Adam 2504af7d0f Fixed os_forbid adds reason if no expiry is given 2011-10-14 12:53:28 -04:00
Adam ddc3c2f38c Added options:nonicknameownership config option 2011-10-14 12:20:07 -04:00
Adam 53275c362c Don't add new levels to existing channels default, screws with stuff when the config is reloaded 2011-10-11 02:50:37 -04:00
Adam f3f6727cdd Bug #1337 2011-10-11 00:09:26 -04:00
Adam 4681e3a0ef Allow chanserv/suspend to take an expiry time 2011-10-10 17:19:06 -04:00
Adam 80f4f317b2 Put serialized_items on the heap to prevent weird crashes on shutdown from the list being destructed before members in it 2011-10-10 15:04:23 -04:00
Adam 9f3d735d9d Allow nickserv/suspend to take an expiry time 2011-10-10 14:16:59 -04:00
Adam 0e012f73d4 Check for being at terminal before forking 2011-10-09 21:29:34 -04:00
Adam 9f850334a1 Give more verbose messages on startup 2011-10-09 02:52:13 -04:00
Adam af273e3da5 Store flags for objects, also fixes bug #1333 2011-09-25 15:34:56 -04:00
Adam 1f3e96f4ad Made channel privileges case insensitive 2011-09-25 14:42:09 -04:00
Adam e7ba639beb Remove opnotice from example configs 2011-09-25 14:38:21 -04:00
Adam 1f2399de36 Added a new database format and sqlite support. Also moved db-convert to a module. 2011-09-25 04:19:15 -04:00
Adam 43201ead95 Fixed /os reload doing weird things to service channels, and allow setting modes by clients on burst 2011-09-19 18:35:40 -04:00
Adam 7dce64e540 Fixed missing _ in cs_appendtopic 2011-09-19 13:14:20 -04:00
Adam 1184eb59c5 Allow OnPreHelp to stop processing 2011-09-19 13:12:52 -04:00
Adam 4c2a4929ea Call fantasy events even if the commands for them don't exist 2011-09-19 12:36:52 -04:00
Adam be77a7e27e Bug #1334 - fixed crash on /os oper info 2011-09-19 12:29:54 -04:00
Adam 934723faa5 LOG_COMMAND must now always give a valid command 2011-09-19 12:14:02 -04:00
Adam f07295cc78 Bug #1332 - Fixed ValidateUser to not require secure off to disable nickserv kill 2011-09-16 14:07:33 -04:00
Adam 26c1d67556 Fixed compile errors & warnings from 1.9.6 to 1.9 merge 2011-09-10 16:27:10 -04:00
Adam 3d5889c308 Updated channel flag names to remove LOGCHAN 2011-09-10 16:08:58 -04:00
Adam 213c1c4860 Changed msgmerge to not use -E.. it will escape all of some languages and mess up poedit etc. Keep it in xgettext for the bold/underline characters. 2011-09-10 02:42:18 -04:00
Adam 63cb8ca24c Moved signal/thread/mode checking to use signal pipes 2011-09-10 02:06:31 -04:00
Adam dc5d1fa21c Made ChanServ privileges configurable 2011-09-10 02:06:31 -04:00
Adam 563d158e49 Allow Config to install cmake 2011-09-10 02:06:31 -04:00
Adam 1478b5bbd7 Added chanserv/log 2011-09-10 02:06:29 -04:00
Adam 19e0b87aa1 Removed /bs set msg 2011-09-10 02:05:56 -04:00
Adam 17ea4ed8f5 Fixed service_reference to work correctly with external classes 2011-09-10 02:05:03 -04:00
Adam feaef7cc4a Allow services to register or unregister themselves 2011-09-10 02:05:03 -04:00
Adam c6d3fbdfab Added kqueue 2011-09-10 02:05:02 -04:00
Adam 700a585b1b Allow modules to add their own channel levels 2011-09-10 02:05:00 -04:00
Adam 62752db4c4 Rewrote mlock saving/loading code to not use this silly extensible hack 2011-09-10 01:58:39 -04:00
Adam f025d1b495 Made service_reference type safe 2011-09-10 01:58:38 -04:00
Adam 8c4417cad1 Removed opnotice 2011-09-10 01:58:38 -04:00
Adam d4db2b84f2 Made the IsValidHost checks configurable 2011-09-10 01:58:38 -04:00
Adam bb8e04c835 Added oper:host and oper:vhost 2011-09-10 01:58:35 -04:00
Adam b504791bad Cleaned up the dns engine, and fixed sometimes parsing multiple answer queries incorrectly 2011-09-10 01:55:37 -04:00
Adam d5749c11f3 Fixed eventfd pipeengine to not add the same socket twice 2011-09-10 01:55:37 -04:00
Adam f54ab5e2ca Squash merge of 1.9 to 1.9.6 2011-09-10 01:55:29 -04:00
Adam 1e45019f8a Added m_proxyscan 2011-09-10 01:55:11 -04:00
Adam 2eb708e5ad Cleaned up some of the socket code, cleaned up the pipe engines, added support for binary sockets, and cleaned up the asynch connect/accept code 2011-09-10 01:55:09 -04:00
Adam 4fcb371bc8 Track what "level" channel status modes are, which allows us to have chanserv/mode determine if a status mode can be set by users better 2011-09-10 01:52:59 -04:00
Adam 6401d93b8e Added chanserv/up and chanserv/down 2011-09-10 01:52:59 -04:00
Adam 8a9a39c065 Renamed the core pseudoclient modules to match their names 2011-09-10 01:52:59 -04:00
Adam 13e8b26989 Made email messages sent by services configurable 2011-09-10 01:52:59 -04:00
Adam 8a6d6577bd Removed log:inhabitlogchannel and replaced it with service:channels 2011-09-10 01:52:46 -04:00
Adam 4a7ba7ef4c Removed SZLine. Instead, have AKILL determine whether or not a ZLINE should be set. 2011-09-10 00:58:35 -04:00
Adam 2b5d9f349f Bump for 1.9.6 git 2011-09-10 00:54:29 -04:00
452 changed files with 122926 additions and 123668 deletions
+37
View File
@@ -0,0 +1,37 @@
Adam <adam@anope.org> <adam-@5417fbe8-f217-4b02-8779-1006273d7864>
Adam <adam@anope.org> <adam@adam-laptop.(none)>
Adam <adam@anope.org> <Adam@anope.org>
Adam <adam@anope.org> <Adam@drink-coca-cola.info>
Adam <adam@anope.org> <Adam@sigterm.info>
Adam Kramer <ribosome@anope.org> <ribosome ribosome@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Alvaro Toledo <atoledo@keldon.org> <atoledo atoledo@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Björn Stiddien <keeper@anope.org> <keeper keeper@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Charles Kingsley <chaz@anope.org>
Charles Kingsley <chaz@anope.org> <sjaz@5417fbe8-f217-4b02-8779-1006273d7864>
Daniel Engel <dane@zero.org> <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
David Robson <rob@anope.org> <robbeh@5417fbe8-f217-4b02-8779-1006273d7864>
David Robson <rob@anope.org> <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Dennis Friis <peavey@inspircd.org> <peavey peavey@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>
Fabio Scotoni <cculex@gmail.com>
Florian Schulze <certus@anope.org> <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Gabriel Acevedo H. <drstein@anope.org> <drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Jan Milants <viper@anope.org>
Jan Milants <viper@anope.org> <jantje_85@5417fbe8-f217-4b02-8779-1006273d7864>
Jan Milants <viper@anope.org> <viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Jens Voss <dukepyrolator@anope.org> <anope@s15355730.onlinehome-server.info>
Jens Voss <dukepyrolator@anope.org> <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>
Jens Voss <dukepyrolator@anope.org> <DukePyrolator@anope.org>
Jens Voss <dukepyrolator@anope.org> Jens Voß <jens@pyrobook.(none)>
Lee Holmes <lethality@anope.org>
Mark Summers <mark@goopler.net> <mark mark@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Naram Qashat <cyberbotx@anope.org> <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>
Naram Qashat <cyberbotx@anope.org> <cyberbotx@cyberbotx.com>
Naram Qashat <cyberbotx@anope.org> <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864>
Pieter Bootsma <geniusdex@anope.org> <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Robby <robby@chat.be>
Robin Burchell <w00t@inspircd.org> <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>
Robin Burchell <w00t@inspircd.org> <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>
Sebastian V. <hal9000@denorastats.org>
Sebastian V. <hal9000@denorastats.org> <pimpmylinux@5417fbe8-f217-4b02-8779-1006273d7864>
(svnadmin) <svn@localhost> <svn svn@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Trystan S. Lee <trystan@nomadirc.net> <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
+57 -32
View File
@@ -80,7 +80,7 @@ set(DEFAULT_LIBRARY_DIRS)
set(DEFAULT_INCLUDE_DIRS)
# If we are using a GNU compiler (have to use CXX because it seems to fail on C), we will be able to determine it's default paths for libraries and includes
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# First look for the compiler's default library directories
execute_process(COMMAND ${CMAKE_C_COMPILER} -print-search-dirs OUTPUT_VARIABLE LINES OUTPUT_STRIP_TRAILING_WHITESPACE)
# Find only the part after "libraries: "
@@ -132,6 +132,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
string(LENGTH ${LINE} LINE_LENGTH)
math(EXPR LINE_LENGTH "${LINE_LENGTH} - 1")
string(SUBSTRING ${LINE} 1 ${LINE_LENGTH} INCLUDE)
# For systems like Mac OS X, look for include paths that say " (framework directory)" at the end of them and strip that off
string(REGEX REPLACE " \\(framework directory\\)$" "" INCLUDE ${INCLUDE})
# Convert the path to an absolute one, just in case it wasn't
get_filename_component(INCLUDE ${INCLUDE} ABSOLUTE)
# Add that directory to the list of default include directories
@@ -144,7 +146,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
if(DEFAULT_INCLUDE_DIRS)
remove_list_duplicates(DEFAULT_INCLUDE_DIRS)
endif(DEFAULT_INCLUDE_DIRS)
endif(CMAKE_COMPILER_IS_GNUCXX)
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# If we are using Visual Studio, locate the path of the Windows Server 2008 SDK or Windows Server 2003 Platform SDK, depending on which is installed
if(MSVC)
@@ -207,17 +209,22 @@ else(CMAKE244_OR_BETTER)
include(TestCXXAcceptsFlag)
endif(CMAKE244_OR_BETTER)
# If extra directories were specified, tell cmake about them.
# If extra include directories were specified, tell cmake about them.
if(EXTRA_INCLUDE)
include_directories(${EXTRA_INCLUDE})
link_directories(${EXTRA_INCLUDE})
endif(EXTRA_INCLUDE)
# If extra library directories were specified, tell cmake about them.
if(EXTRA_LIBS)
link_directories(${EXTRA_LIBS})
endif(EXTRA_LIBS)
# Find gettext
find_package(Gettext)
# Add an optional variable for using run-cc.pl for building, Perl will be checked later regardless of this setting
option(USE_RUN_CC_PL "Use run-cc.pl for building" OFF)
option(USE_PCH "Use precompiled headers" OFF)
# Use the following directories as includes
# Note that it is important the binary include directory comes before the
@@ -238,7 +245,7 @@ if(MSVC)
string(REPLACE "/GX " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# Set the compile flags to have warnings on the max setting (but disable a few annoying ones), exception handling turned on, the proper defines
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4251 /wd4706 /wd4800 /wd4996 /EHs")
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4355 /wd4706 /wd4800 /wd4996 /EHs")
add_definitions(-DMSVCPP -D_CRT_SECURE_NO_WARNINGS)
# Otherwise, we're not using Visual Studio
else(MSVC)
@@ -246,9 +253,9 @@ else(MSVC)
set(CXXFLAGS "${CXXFLAGS} -Wall -Wshadow")
# If on a *nix system, also set the compile flags to remove GNU extensions (favor ISO C++) as well as reject non-ISO C++ code, also remove all leading underscores in exported symbols (only on GNU compiler)
if(UNIX)
set(CXXFLAGS "${CXXFLAGS} -ansi -pedantic")
set(CXXFLAGS "${CXXFLAGS} -ansi -pedantic ${CMAKE_CXX_FLAGS}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CXXFLAGS "${CXXFLAGS} -fno-leading-underscore")
set(CXXFLAGS "${CXXFLAGS} -Wno-long-long -fno-leading-underscore")
endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# If we aren't on a *nix system, we are using MinGW
else(UNIX)
@@ -261,7 +268,7 @@ endif(MSVC)
# If CMake has found that the given system requires a special library for dl* calls, include it with the linker flags
if(CMAKE_DL_LIBS)
set(LDFLAGS "${LDFLAGS} -l${CMAKE_DL_LIBS}")
append_to_list(LINK_LIBS ${CMAKE_DL_LIBS})
endif(CMAKE_DL_LIBS)
# Under MinGW, the -shared flag isn't properly set in the module-specific linker flags, add it from the C flags for shared libraries
@@ -297,17 +304,19 @@ if(NOT MSVC)
# Check if socket is within the socket library (if the library exists), and add it to the linker flags if needed
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
if(HAVE_SOCKET_LIB)
set(LDFLAGS "${LDFLAGS} -lsocket")
append_to_list(LINK_LIBS socket)
endif(HAVE_SOCKET_LIB)
# Check if inet_addr is within the nsl library (if the library exists), and add it to the linker flags if needed
check_library_exists(nsl inet_addr "" HAVE_NSL_LIB)
if(HAVE_NSL_LIB)
set(LDFLAGS "${LDFLAGS} -lnsl")
append_to_list(LINK_LIBS nsl)
endif(HAVE_NSL_LIB)
# Check if pthread_create is within the pthread library (if the library exists), and add it to the linker flags if needed
check_library_exists(pthread pthread_create "" HAVE_PTHREAD)
if(HAVE_PTHREAD)
set(LDFLAGS "${LDFLAGS} -pthread")
if(NOT APPLE)
set(LDFLAGS "${LDFLAGS} -pthread")
endif(NOT APPLE)
else(HAVE_PTHREAD)
message(FATAL_ERROR "The pthread library is required to build Anope")
endif(HAVE_PTHREAD)
@@ -329,28 +338,17 @@ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINF
endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
# Check for the existance of the following include files
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(cstdint HAVE_CSTDINT)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(strings.h HAVE_STRINGS_H)
check_include_file(sys/eventfd.h HAVE_SYS_EVENTFD_H)
# Check for the existance of the following functions
check_function_exists(setgrent HAVE_SETGRENT)
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(stricmp HAVE_STRICMP)
check_function_exists(umask HAVE_UMASK)
check_function_exists(eventfd HAVE_EVENTFD)
check_function_exists(epoll_wait HAVE_EPOLL)
check_function_exists(poll HAVE_POLL)
# Check for the existance of the following types
check_type_size(uint8_t UINT8_T)
check_type_size(u_int8_t U_INT8_T)
check_type_size(int16_t INT16_T)
check_type_size(uint16_t UINT16_T)
check_type_size(u_int16_t U_INT16_T)
check_type_size(int32_t INT32_T)
check_type_size(uint32_t UINT32_T)
check_type_size(u_int32_t U_INT32_T)
check_function_exists(kqueue HAVE_KQUEUE)
# Strip the leading and trailing spaces from the compile flags
if(CXXFLAGS)
@@ -382,6 +380,29 @@ else(INSTDIR)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/services")
endif(INSTDIR)
# Set default paths for various directories if not already defined
if(NOT BIN_DIR)
set(BIN_DIR "bin")
endif(NOT BIN_DIR)
if(NOT DB_DIR)
set(DB_DIR "data")
endif(NOT DB_DIR)
if(NOT DOC_DIR)
set(DOC_DIR "doc")
endif(NOT DOC_DIR)
if(NOT CONF_DIR)
set(CONF_DIR "conf")
endif(NOT CONF_DIR)
if(NOT LIB_DIR)
set(LIB_DIR "lib")
endif(NOT LIB_DIR)
if(NOT LOCALE_DIR)
set(LOCALE_DIR "locale")
endif(NOT LOCALE_DIR)
if(NOT LOGS_DIR)
set(LOGS_DIR "logs")
endif(NOT LOGS_DIR)
# Version number processing
# Find all lines in src/version.sh that start with VERSION_
read_from_file(${Anope_SOURCE_DIR}/src/version.sh "^VERSION_" VERSIONS)
@@ -460,20 +481,20 @@ get_target_property(SERVICES_BINARY ${PROGRAM_NAME} LOCATION)
get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME)
# At install time, create the following additional directories
install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/data/backups\")")
install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/data/logs\")")
install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/data/modules/runtime\")")
install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/backups\")")
install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")")
install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/runtime\")")
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the below directories, as well as the group of the data directory
if(NOT WIN32 AND RUNGROUP)
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\${CMAKE_INSTALL_PREFIX}/data/backups\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\${CMAKE_INSTALL_PREFIX}/data/logs\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\${CMAKE_INSTALL_PREFIX}/data/modules/runtime\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/backups\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\${CMAKE_INSTALL_PREFIX}/\${LOGS_DIR}\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/runtime\")")
install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\${CMAKE_INSTALL_PREFIX}\")")
endif(NOT WIN32 AND RUNGROUP)
# On Windows platforms, install extra files
if(WIN32)
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
DESTINATION bin
DESTINATION ${BIN_DIR}
)
endif(WIN32)
@@ -491,6 +512,10 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
#set(CPACK_RESOURCE_FILE_README "${Anope_SOURCE_DIR}/docs/README")
# The following is primarily for NSIS
if(WIN32)
# By default, do not warn when built on machines using only VS Express:
IF(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
ENDIF(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
# Also for Windows, include installing the MSVCRT library
include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR "NSIS")
+125 -29
View File
@@ -40,7 +40,8 @@ Run_Build_System () {
WITH_INST=""
WITH_RUN=""
WITH_PERM=""
RUN_CC_PL=""
EXTRA_INCLUDE=""
EXTRA_LIBS=""
GEN_TYPE=""
if [ "$INSTDIR" != "" ] ; then
@@ -67,6 +68,20 @@ Run_Build_System () {
RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=OFF"
fi
if [ "$USE_PCH" = "yes" ] ; then
PCH="-DUSE_PCH:BOOLEAN=ON"
else
PCH="-DUSE_PCH:BOOLEAN=OFF"
fi
if [ "$EXTRA_INCLUDE_DIRS" != "" ] ; then
EXTRA_INCLUDE="-DEXTRA_INCLUDE:STRING=$EXTRA_INCLUDE_DIRS"
fi
if [ "$EXTRA_LIB_DIRS" != "" ] ; then
EXTRA_LIBS="-DEXTRA_LIBS:STRING=$EXTRA_LIB_DIRS"
fi
case `uname -s` in
MINGW*)
GEN_TYPE="-G\"MSYS Makefiles\""
@@ -82,9 +97,9 @@ Run_Build_System () {
REAL_SOURCE_DIR="$SOURCE_DIR"
fi
echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
echo ""
if [ "$SOURCE_DIR" = "." ] ; then
@@ -117,6 +132,9 @@ RUNGROUP=
UMASK=
DEBUG="yes"
USE_RUN_CC_PL="no"
USE_PCH="no"
EXTRA_INCLUDE_DIRS=
EXTRA_LIB_DIRS=
EXTRA_CONFIG_ARGS=
CAN_QUICK="no"
SOURCE_DIR=`dirname $0`
@@ -151,15 +169,49 @@ while [ $# -ge 1 ] ; do
shift 1
done
###########################################################################
# Check for CMake and (optionally) install it
###########################################################################
which cmake > /dev/null
if [ $? -ne 0 ] ; then
clear
echo "Anope requires CMake 2.4 or newer to be configured, which can"
echo "be downloaded at http://www.cmake.org/. If you have installed"
echo "CMake already, ensure it is in your PATH environment variable."
exit 0
if exists "cmake-bin" ; then :
else
echo "Anope requires CMake 2.4 or newer, which can be downloaded at http://cmake.org"
echo "If you have installed CMake already, ensure it is in your PATH environment variable."
if [ `uname` = "Linux" ] ; then
echo ""
echo "Config can attempt to install CMake for you now, which"
echo "will take approximately 50 MB of disk space."
echo "Would you like to install CMake now?"
echo2 "[y] "
read YN
if [ "$YN" = "n" ] ; then
exit 0
fi
echo "Downloading CMake... this may take a minute or two."
wget -q http://anope.org/cmake/linux-i386.php -O cmake-bin.tar.gz
if [ $? -ne 0 ] ; then
rm -f cmake-bin.tar.gz
echo "Unable to download CMake"
exit 0
fi
mkdir -p cmake-bin
tar zxf cmake-bin.tar.gz -C cmake-bin
rm -f cmake-bin.tar.gz
echo "Done!"
else
exit 0
fi
fi
CMAKE_BIN=`find cmake-bin -name cmake`
CMAKE_BIN="`pwd`/`dirname $CMAKE_BIN`"
PATH="$PATH:$CMAKE_BIN"
fi
###########################################################################
@@ -175,23 +227,7 @@ if [ ! "$NO_INTRO" ] ; then
;;
esac
. $SOURCE_DIR/src/version.sh
if [ -d .git ] ; then
VERSION=`git describe --tags`
VERSION_BUILD=`echo "$VERSION" | cut -d'-' -f2`
if [ "$SOURCE_DIR" = "." ] ; then
test -d build || mkdir -p build/include
BUILD_DIR="build"
else
BUILD_DIR="."
fi
VERSION_EXTRA=`echo "$VERSION" | cut -d'-' -f3`
# Only do this if we are not on a tag, src/version.sh will be all we need then.
if [ "$VERSION_BUILD" != "$VERSION_EXTRA" ] ; then
echo "#define VERSION_BUILD $VERSION_BUILD" > $BUILD_DIR/include/version.h
echo "#define VERSION_EXTRA \"-$VERSION_EXTRA\"" >> $BUILD_DIR/include/version.h
fi
fi
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
echo ""
else
echo ""
@@ -215,7 +251,7 @@ export ok INPUT
####
ok=0
echo "In what directory do you want the binaries to be installed?"
echo "In what directory should Anope be installed?"
while [ $ok -eq 0 ] ; do
echo2 "[$INSTDIR] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
@@ -342,14 +378,71 @@ echo ""
####
echo "Are there any extra arguments you wish to pass to cmake?"
echo "You may only need to do this if cmake is unable to locate"
TEMP_YN="n"
if [ "$USE_PCH" = "yes" ] ; then
TEMP_YN="y"
fi
echo "Do you want to build using precompiled headers? This can speed up"
echo "the build, but uses more disk space."
echo2 "[$TEMP_YN] "
read YN
if [ "$YN" ] ; then
if [ "$YN" = "y" ] ; then
USE_PCH="yes"
else
USE_PCH="no"
fi
fi
echo ""
####
echo "Are there any extra include directories you wish to use?"
echo "You may only need to do this if CMake is unable to locate"
echo "missing dependencies without hints."
echo "You can do this by: -DEXTRA_INCLUDE:STRING=/path/to/files;/path/to/more/files"
echo "Separate directories with semicolons."
echo "If you need no extra include directories, enter NONE in all caps."
echo2 "[$EXTRA_INCLUDE_DIRS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "NONE" ] ; then
EXTRA_INCLUDE_DIRS=""
else
EXTRA_INCLUDE_DIRS=$INPUT
fi
fi
echo ""
####
echo "Are there any extra library directories you wish to use?"
echo "You may only need to do this if CMake is unable to locate"
echo "missing dependencies without hints."
echo "Separate directories with semicolons."
echo "If you need no extra library directories, enter NONE in all caps."
echo2 "[$EXTRA_LIB_DIRS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "NONE" ] ; then
EXTRA_LIB_DIRS=""
else
EXTRA_LIB_DIRS=$INPUT
fi
fi
echo ""
####
echo "Are there any extra arguments you wish to pass to CMake?"
echo "If you need no extra arugments to CMake, enter NONE in all caps."
echo2 "[$EXTRA_CONFIG_ARGS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
EXTRA_CONFIG_ARGS=$INPUT
if [ "$INPUT" = "NONE" ] ; then
EXTRA_CONFIG_ARGS=""
else
EXTRA_CONFIG_ARGS=$INPUT
fi
fi
echo ""
@@ -367,6 +460,9 @@ RUNGROUP="$RUNGROUP"
UMASK=$UMASK
DEBUG="$DEBUG"
USE_RUN_CC_PL="$USE_RUN_CC_PL"
USE_PCH="$USE_PCH"
EXTRA_INCLUDE_DIRS="$EXTRA_INCLUDE_DIRS"
EXTRA_LIB_DIRS="$EXTRA_LIB_DIRS"
EXTRA_CONFIG_ARGS="$EXTRA_CONFIG_ARGS"
EOT
echo "done."
BIN
View File
Binary file not shown.
+28 -16
View File
@@ -359,18 +359,18 @@ macro(find_includes SRC INCLUDES)
endmacro(find_includes)
###############################################################################
# calculate_depends(<source filename> <output variable set to TRUE on fail> [<optional output variable for includes>])
# calculate_depends(<source filename> <output variable set to TRUE on fail> <TRUE to output error messages> [<optional output variable for includes>])
#
# This macro is used in most of the src (sub)directories to calculate the
# header file dependencies for the given source file.
###############################################################################
macro(calculate_depends SRC SKIP)
# Temporarily set that we didn't get a 3nd argument before we actually check if we did get one or not
macro(calculate_depends SRC SKIP VERBOSE)
# Temporarily set that we didn't get a 3rd argument before we actually check if we did get one or not
set(CHECK_ANGLE_INCLUDES FALSE)
# Check for a third argument
if(${ARGC} GREATER 2)
if(${ARGC} GREATER 3)
set(CHECK_ANGLE_INCLUDES TRUE)
endif(${ARGC} GREATER 2)
endif(${ARGC} GREATER 3)
# Find all the lines in the given source file that have any form of #include on them, regardless of whitespace, but only if they are valid for the platform we are on
find_includes(${SRC} INCLUDES)
# Reset the list of headers to empty
@@ -392,16 +392,26 @@ macro(calculate_depends SRC SKIP)
endif(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
# If the include file was found, add it's path to the list of include paths, but only if it doesn't already exist and isn't in the defaults for the compiler
if(FOUND_${FILENAME}_INCLUDE)
find_in_list(DEFAULT_INCLUDE_DIRS "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_DEFAULTS)
# This used to be find_in_list, but it was changed to this loop to do a find on each default include directory, this fixes Mac OS X trying to get it's framework directories in here
set(FOUND_IN_DEFAULTS -1)
foreach(DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIRS})
string(REGEX REPLACE "\\+" "\\\\+" DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIR})
string(REGEX MATCH ${DEFAULT_INCLUDE_DIR} FOUND_DEFAULT ${FOUND_${FILENAME}_INCLUDE})
if(FOUND_DEFAULT)
set(FOUND_IN_DEFAULTS 0)
endif(FOUND_DEFAULT)
endforeach(DEFAULT_INCLUDE_DIR)
if(FOUND_IN_DEFAULTS EQUAL -1)
find_in_list(${ARGV2} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)
find_in_list(${ARGV3} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)
if(FOUND_IN_INCLUDES EQUAL -1)
append_to_list(${ARGV2} "${FOUND_${FILENAME}_INCLUDE}")
append_to_list(${ARGV3} "${FOUND_${FILENAME}_INCLUDE}")
endif(FOUND_IN_INCLUDES EQUAL -1)
endif(FOUND_IN_DEFAULTS EQUAL -1)
else(FOUND_${FILENAME}_INCLUDE)
set(${SKIP} TRUE)
message("${SRC} needs header file ${FILENAME} but we were unable to locate that header file! Check that the header file is within the search path of your OS.")
if(VERBOSE)
message("${SRC} needs header file ${FILENAME} but we were unable to locate that header file! Check that the header file is within the search path of your OS.")
endif(VERBOSE)
endif(FOUND_${FILENAME}_INCLUDE)
endif(CHECK_ANGLE_INCLUDES)
endif(QUOTE_TYPE STREQUAL "angle brackets")
@@ -409,12 +419,12 @@ macro(calculate_depends SRC SKIP)
endmacro(calculate_depends)
###############################################################################
# calculate_libraries(<source filename> <output variable set to TRUE on fail> <output variable for linker flags> <output variable for extra depends>)
# calculate_libraries(<source filename> <output variable set to TRUE on fail> <TRUE to output error messages> <output variable for linker flags> <output variable for extra depends>)
#
# This macro is used in most of the module (sub)directories to calculate the
# library dependencies for the given source file.
###############################################################################
macro(calculate_libraries SRC SKIP SRC_LDFLAGS EXTRA_DEPENDS)
macro(calculate_libraries SRC SKIP VERBOSE SRC_LDFLAGS EXTRA_DEPENDS)
# Set up a temporary LDFLAGS for this file
set(THIS_LDFLAGS "${LDFLAGS}")
# Reset extra dependencies
@@ -437,9 +447,9 @@ macro(calculate_libraries SRC SKIP SRC_LDFLAGS EXTRA_DEPENDS)
foreach(LIBRARY ${REQUIRED_LIBRARY})
# Locate the library to see if it exists
if(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE})
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE} ${EXTRA_LIBS})
else(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${EXTRA_INCLUDE})
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${EXTRA_INCLUDE} ${EXTRA_LIBS})
endif(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
# If the library was found, we will add it to the linker flags
if(FOUND_${LIBRARY}_LIBRARY)
@@ -456,8 +466,10 @@ macro(calculate_libraries SRC SKIP SRC_LDFLAGS EXTRA_DEPENDS)
else(FOUND_${LIBRARY}_LIBRARY)
# Skip this file
set(${SKIP} TRUE)
# In the case of the library not being found, we fatally error so CMake stops trying to generate
message("${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.")
if(VERBOSE)
# In the case of the library not being found, we fatally error so CMake stops trying to generate
message(FATAL_ERROR "${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.")
endif(VERBOSE)
endif(FOUND_${LIBRARY}_LIBRARY)
endforeach(LIBRARY)
endforeach(REQUIRED_LIBRARY)
@@ -479,7 +491,7 @@ macro(calculate_libraries SRC SKIP SRC_LDFLAGS EXTRA_DEPENDS)
endforeach(LIBRARY_PATH)
# Iterate through libraries and add them to the linker flags
foreach(LIBRARY ${LIBRARIES})
set(THIS_LDFLAGS "${THIS_LDFLAGS} -l${LIBRARY}")
append_to_list(EXTRA_DEPENDENCIES "${LIBRARY}")
endforeach(LIBRARY)
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
+7 -6
View File
@@ -1,17 +1,18 @@
# Find the header files, libs, and executables for gettext
if(NOT WIN32)
find_path(GETTEXT_INCLUDE libintl.h /usr/include /usr/local/include ${EXTRA_INCLUDE})
find_library(GETTEXT_LIBRARY intl PATHS /usr/lib /usr/lib64 ${EXTRA_INCLUDE})
find_library(GETTEXT_LIBRARY intl PATHS /usr/lib /usr/lib64 ${EXTRA_LIBS})
find_library(ICONV_LIBRARY iconv PATHS /usr/lib /usr/lib64 ${EXTRA_LIBS})
find_program(GETTEXT_MSGFMT msgfmt PATHS /usr/bin/ /usr/local/bin ${EXTRA_INCLUDE})
if(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
set(GETTEXT_FOUND TRUE)
endif(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
else(NOT WIN32)
find_path(GETTEXT_INCLUDE libintl.h ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include gettext/include ${EXTRA_INCLUDE})
find_library(GETTEXT_LIBRARY libintl PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_INCLUDE})
find_library(ICONV_LIBRARY libiconv PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_INCLUDE})
find_library(MINGWEX_LIBRARY libmingwex PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_INCLUDE})
find_library(GCC_LIBRARY libgcc PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_INCLUDE})
find_library(GETTEXT_LIBRARY libintl PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_LIBS})
find_library(ICONV_LIBRARY libiconv PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_LIBS})
find_library(MINGWEX_LIBRARY libmingwex PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_LIBS})
find_library(GCC_LIBRARY libgcc PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_LIBS})
find_program(GETTEXT_MSGFMT msgfmt PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/bin $ENV{VCINSTALLDIR}/bin gettext/bin ${EXTRA_INCLUDE})
if(GETTEXT_INCLUDE AND GETTEXT_MSGFMT AND ICONV_LIBRARY AND MINGWEX_LIBRARY AND GCC_LIBRARY)
set(GETTEXT_FOUND TRUE)
@@ -27,7 +28,7 @@ if(GETTEXT_FOUND)
set(GETTEXT_LIBRARIES libiconv libintl libmingwex libgcc)
else(WIN32)
if(GETTEXT_LIBRARY)
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY} ${ICONV_LIBRARY})
endif(GETTEXT_LIBRARY)
endif(WIN32)
endif(GETTEXT_FOUND)
+1 -1
View File
@@ -525,7 +525,7 @@ FunctionEnd
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\docs\README.txt"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\doc\README.txt"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
+2 -2
View File
@@ -1,6 +1,6 @@
# Only install example.chk and example.conf from this directory
# NOTE: I would've had this just find all files in the directory, but that would include files not needed (like this file)
set(DATA example.chk tables.sql botserv.example.conf example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf)
set(DATA example.chk botserv.example.conf example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf chanstats.example.conf)
install(FILES ${DATA}
DESTINATION data
DESTINATION ${CONF_DIR}
)
+85 -8
View File
@@ -4,11 +4,12 @@
/*
* First, create the service.
* Note that an easy way to rename this service is to define{} the client name to something else.
*/
service
{
/*
* The name of the BotServ client
* The name of the BotServ client.
*/
nick = "BotServ"
@@ -34,11 +35,20 @@ service
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* Note that setting this option incorrectly could potentially BREAK some, if
* not all, usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
/*
* An optional comma separated list of channels this service should join. Outside
* of log channels this is not very useful, as the service will just idle in the
* specified channels, and will not accept any types of commands.
*
* Prefixes may be given to the channels in the form of mode characters or prefix symbols.
*/
#channels = "@#services,#mychan"
}
/*
@@ -46,7 +56,7 @@ service
*
* Provides essential functionality for BotServ.
*/
module { name = "bs_main" }
module { name = "botserv" }
/*
* Configuration for BotServ provided by bs_main.
@@ -121,11 +131,11 @@ botserv
#casesensitive = yes
/*
* Defines the prefix for fantasy commands in channels. This character will have to be prepended
* Defines the prefixes for fantasy commands in channels. One of these characters will have to be prepended
* to all fantasy commands. If you choose "!", for example, fantasy commands will be "!kick",
* "!op", etc. This directive is optional, if left out, the default fantasy character is "!".
*/
#fantasycharacter = "!"
#fantasycharacter = "!."
}
/*
@@ -139,7 +149,7 @@ botserv
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
/* Give it a help command. */
command { service = "BotServ"; name = "HELP"; command = "generic/help"; }
/*
@@ -231,10 +241,77 @@ command { service = "BotServ"; name = "KICK"; command = "botserv/kick"; }
/*
* bs_set
*
* Provides the command botserv/set.
* Provides the commands:
* botserv/set/dontkickops - Used for preventing BotServ from kicking channel operators.
* botserv/set/dontkickvoices - Used for preventing BotServ from kicking voices.
* botserv/set/fantasy - Used for enabling or disabling BotServ's fantasist commands.
* botserv/set/greet - Used for enabling or disabling BotServ's greet messages in a channel.
* botserv/set/nobot - Used to prohibit specific channels from being assigned BotServ bots.
* botserv/set/private - Used to prohibit specific BotServ bots from being assigned to channels.
*
* Used for setting options such as kickers and fantasy replies.
*/
module { name = "bs_set" }
command { service = "BotServ"; name = "SET"; command = "botserv/set"; }
command { service = "BotServ"; name = "SET DONTKICKOPS"; command = "botserv/set/dontkickops"; }
command { service = "BotServ"; name = "SET DONTKICKVOICES"; command = "botserv/set/dontkickvoices"; }
command { service = "BotServ"; name = "SET FANTASY"; command = "botserv/set/fantasy"; }
command { service = "BotServ"; name = "SET GREET"; command = "botserv/set/greet"; }
command { service = "BotServ"; name = "SET NOBOT"; command = "botserv/set/nobot"; permission = "botserv/set/nobot"; }
command { service = "BotServ"; name = "SET PRIVATE"; command = "botserv/set/private"; permission = "botserv/set/private"; }
/* Fantasy commands
*
* Fantasy commands can be executed in channels that have a BotServ bot by prefixing the
* command with one of the fantasy characters configured in botserv:fantasycharacter.
*
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
fantasy { name = "ACCESS"; command = "chanserv/access"; }
fantasy { name = "AKICK"; command = "chanserv/akick"; }
fantasy { name = "AOP"; command = "chanserv/aop"; }
fantasy { name = "BAN"; command = "chanserv/ban"; }
fantasy { name = "CLONE"; command = "chanserv/clone"; }
fantasy { name = "DOWN"; command = "chanserv/down"; }
fantasy { name = "ENFORCE"; command = "chanserv/enforce"; }
fantasy { name = "ENTRYMSG"; command = "chanserv/entrymsg"; }
fantasy { name = "FLAGS"; command = "chanserv/flags"; }
fantasy { name = "HELP"; command = "generic/help"; prepend_channel = false; }
fantasy { name = "HOP"; command = "chanserv/hop"; }
fantasy { name = "INFO"; command = "chanserv/info"; prepend_channel = false; }
fantasy { name = "INVITE"; command = "chanserv/invite"; }
fantasy { name = "K"; command = "chanserv/kick"; }
fantasy { name = "KB"; command = "chanserv/ban"; }
fantasy { name = "KICK"; command = "chanserv/kick"; }
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 = "QOP"; command = "chanserv/qop"; }
fantasy { name = "SEEN"; command = "chanserv/seen"; prepend_channel = false; }
fantasy { name = "SOP"; command = "chanserv/sop"; }
fantasy { name = "STATUS"; command = "chanserv/status"; }
fantasy { name = "SUSPEND"; command = "chanserv/suspend"; permission = "chanserv/suspend"; }
fantasy { name = "SYNC"; command = "chanserv/sync"; }
fantasy { name = "TOPIC"; command = "chanserv/topic"; }
fantasy { name = "UNBAN"; command = "chanserv/unban"; }
fantasy { name = "UNSUSPEND"; command = "chanserv/unsuspend"; permission = "chanserv/suspend"; }
fantasy { name = "UP"; command = "chanserv/up"; }
fantasy { name = "VOP"; command = "chanserv/vop"; }
/* Use m_rewrite to rewrite the op, deop, etc. fantasy commands (see chanserv.conf). */
fantasy { name = "OWNER"; command = "rewrite"; }
fantasy { name = "DEOWNER"; command = "rewrite"; }
fantasy { name = "PROTECT"; command = "rewrite"; }
fantasy { name = "DEPROTECT"; command = "rewrite"; }
fantasy { name = "OP"; command = "rewrite"; }
fantasy { name = "DEOP"; command = "rewrite"; }
fantasy { name = "HALFOP"; command = "rewrite"; }
fantasy { name = "DEHALFOP"; command = "rewrite"; }
fantasy { name = "VOICE"; command = "rewrite"; }
fantasy { name = "DEVOICE"; command = "rewrite"; }
+946 -341
View File
File diff suppressed because it is too large Load Diff
+45
View File
@@ -0,0 +1,45 @@
/*
* Example configuration file for Chanstats.
* Make sure BotServ, ChanServ and NickServ are running.
*/
module { name = "m_chanstats" }
chanstats
{
/*
* The name of this engine.
* This must match with the name of an SQL engine block.
*/
engine = "mysql/main"
/*
* An optional prefix to prepended to the name of each created table.
* Do not use the same prefix for other programs.
*/
prefix = "anope_"
smileyshappy = ":) :-) ;) ;-) :D :-D :P :-P"
smileyssad = ":( :-( ;( ;-("
smileysother = ":/ :-/"
/*
* Enable Chanstats for newly registered nicks / channels.
* Set it to 0 to disable it.
*/
NSDefChanstats = 1
CSDefChanstats = 1
}
command { service = "ChanServ"; name = "SET CHANSTATS"; command = "chanserv/set/chanstats"; }
command { service = "NickServ"; name = "SET CHANSTATS"; command = "nickserv/set/chanstats"; }
command { service = "NickServ"; name = "SASET CHANSTATS"; command = "nickserv/saset/chanstats"; }
module { name = "cs_fantasy_stats" }
command { service = "ChanServ"; name = "STATS"; command = "chanserv/stats"; }
command { service = "ChanServ"; name = "GSTATS"; command = "chanserv/gstats"; }
module { name = "cs_fantasy_top" }
command { service = "ChanServ"; name = "TOP"; command = "chanserv/top"; }
command { service = "ChanServ"; name = "TOP10"; command = "chanserv/top10"; }
command { service = "ChanServ"; name = "GTOP"; command = "chanserv/gtop"; }
command { service = "ChanServ"; name = "GTOP10"; command = "chanserv/gtop10"; }
+290 -139
View File
@@ -1,7 +1,7 @@
/*
* Example configuration file for Services. After making the appropriate
* changes to this file, place it in the Services data directory (as
* specified in the "configure" script, default /home/username/services/data)
* changes to this file, place it in the Services conf directory (as
* specified in the "configure" script, default /home/username/services/conf)
* under the name "services.conf".
*
* The format of this file is fairly simple: three types of comments are supported:
@@ -116,7 +116,7 @@ include
include
{
type = "executable"
name = "/usr/bin/wget -q -O - http://some.miconfigured.network.com/services.conf"
name = "/usr/bin/wget -q -O - http://some.misconfigured.network.com/services.conf"
}
*/
@@ -192,7 +192,7 @@ serverinfo
* the Operating System choose the local address. This directive is optional.
*
* If you don't know what this means or don't need to use it, just leave this
* directives commented out.
* directive commented out.
*/
#localhost = "nowhere."
@@ -205,15 +205,15 @@ serverinfo
/*
* The filename containing the Services process ID. The path is relative to the
* services executable. If not given, defaults to "services.pid".
* services root directory. If not given, defaults to "data/services.pid".
*/
pid = "services.pid"
pid = "data/services.pid"
/*
* The filename containing the Message of the Day. The path is relative to the
* services executable. If not given, defaults to "services.motd".
* services root directory. If not given, defaults to "conf/services.motd".
*/
motd = "services.motd"
motd = "conf/services.motd"
}
/*
@@ -224,9 +224,11 @@ serverinfo
*
* Supported:
* - bahamut
* - hybrid
* - inspircd11
* - inspircd12
* - inspircd20
* - ngircd
* - plexus
* - ratbox
* - unreal
@@ -267,6 +269,10 @@ networkinfo
* but recommended.
*/
hostlen = 64
/* Set this to the maximum allowed channel length on your network.
*/
chanlen = 32
}
/*
@@ -276,25 +282,44 @@ networkinfo
*/
options
{
/*
* On Linux/UNIX systems Anope can setuid and setgid to this user and group
* after starting up. This is useful if Anope has to bind to privileged ports
*/
#user = "anope"
#group = "anope"
/*
* The case mapping used by services. This must be set to a valid locale name
* installed on your machine. Services use this case map to compare, with
* case insensitivity, things such as nick names, channel names, etc.
*
* We provide two special casemaps shipped with Anope, ascii and rfc1459.
*
* This value should be set to what your IRCd uses, which is probably rfc1459,
* however Anope has always used ascii for comparison, so the default is ascii.
*
* Changing this value once set is not recommended.
*/
casemap = "ascii"
/*
* The maximum length of passwords
*/
passlen = 32
/*
* These keys are used to initiate the random number generator. These numbers
* MUST be random as you want your passcodes to be random. Don't give these
* keys to anyone! Keep them private!
* This key is used to initiate the random number generator. This number
* MUST be random as you want your passcodes to be random. Don't give this
* key to anyone! Keep it private!
*
* NOTE: If you don't uncomment these or keep their default values, any talented
* NOTE: If you don't uncomment this or keep the default values, any talented
* programmer would be able to easily "guess" random strings used to mask
* information. Be safe, and come up with three different 7-digit numbers.
* information. Be safe, and come up with a 7-digit number.
*
* These directives are optional, but highly recommended.
* This directive is optional, but highly recommended.
*/
#userkey1 = 9866235
#userkey2 = 8362013
#userkey3 = 2362899
#seed = 9866235
/*
* Allows Services to continue file write operations (i.e. database saving)
@@ -315,8 +340,8 @@ options
* entity (nickname name) with which it is associated. When set, however,
* Services will also check that the password is at least five
* characters long, and in the future will probably check other things
* as well.
*
* as well.
*
* This directive is optional, but recommended.
*/
strictpasswords = yes
@@ -328,7 +353,7 @@ options
* during a single IRC session (subject to badpasstimeout, below), Services
* will issues a /KILL for the user. If not given, Services will ignore
* failed password attempts (though they will be logged in any case).
*
*
* This directive is optional, but recommended.
*/
badpasslimit = 5
@@ -358,7 +383,7 @@ options
expiretimeout = 30m
/*
* Sets the timout period for reading from the uplink.
* Sets the timeout period for reading from the uplink.
*/
readtimeout = 5s
@@ -370,7 +395,7 @@ options
/*
* Sets the (maximum) frequency at which the timeout list is checked. This,
* combined with readtimeout above, determine how accurately timed events,
* combined with readtimeout above, determines how accurately timed events,
* such as nick kills, occur; it also determines how much CPU time Services
* will use doing this. Higher values will cause less accurate timing but
* less CPU usage.
@@ -463,7 +488,7 @@ options
/*
* The number of LOGON/OPER news items to display when a user logs on.
*
*
* This directive is optional, if no set it will default to 3.
*/
#newscount = 3
@@ -479,18 +504,6 @@ options
*/
#ulineservers = "stats.your.network"
/*
* Default modes for mode lock, these are set on newly registered channels.
*/
mlock = "+nrt"
/*
* Modes that will not be allowed to be locked. Oper only modes such as +O
* are always restricted from regular users and are not affected by this.
* Comment out for no restrictions.
*/
nomlock = "z"
/*
* Modes to set on service bots when they join channels, comment this out for no modes
*
@@ -504,10 +517,22 @@ options
retrywait = 60
/*
* If set, Services will hide commands that users doesn't have the privileges to execute
* If set, Services will hide commands that users don't have the privileges to execute
* from HELP output.
*/
hideprivilegedcommands = no
hideprivilegedcommands = yes
/*
* If set, Services do not allow ownership of nick names, only ownership of accounts.
*/
nonicknameownership = no
/* The regex engine to use, as provided by the regex modules.
* Leave commented to disable regex matching.
*
* Note for this to work the regex module providing the regex engine must be loaded.
*/
regexengine = "regex/pcre"
}
/*
@@ -539,7 +564,7 @@ include
/*
* [RECOMMENDED] Global
*
* Includes global.example.conf, which is necessary for Global funcionality.
* Includes global.example.conf, which is necessary for Global functionality.
*
* Remove this block to disable Global.
*/
@@ -552,7 +577,7 @@ include
/*
* [OPTIONAL] HostServ
*
* Includes hostserv.example.conf, which is necessary for HostServ funcionality.
* Includes hostserv.example.conf, which is necessary for HostServ functionality.
*
* Remove this block to disable HostServ.
*/
@@ -565,7 +590,7 @@ include
/*
* [OPTIONAL] MemoServ
*
* Includes memoserv.example.conf, which is necessary for MemoServ funcionality.
* Includes memoserv.example.conf, which is necessary for MemoServ functionality.
*
* Remove this block to disable MemoServ.
*/
@@ -578,7 +603,7 @@ include
/*
* [OPTIONAL] NickServ
*
* Includes memoserv.example.conf, which is necessary for NickServ funcionality.
* Includes memoserv.example.conf, which is necessary for NickServ functionality.
*
* Remove this block to disable NickServ.
*/
@@ -591,7 +616,7 @@ include
/*
* [RECOMMENDED] OperServ
*
* Includes operserv.example.conf, which is necessary for OperServ funcionality.
* Includes operserv.example.conf, which is necessary for OperServ functionality.
*
* Remove this block to disable OperServ.
*/
@@ -602,7 +627,7 @@ include
}
/*
* [RECOMMENDED] Logging Configuration
* [RECOMMENDED] Logging Configuration
*
* This section is used for configuring what is logged and where it is logged to.
* You may have multiple log blocks if you wish. Remember to properly secure any
@@ -617,7 +642,13 @@ log
* - globops
*/
target = "services.log"
/* Log to both services.log and the channel #services */
/* Log to both services.log and the channel #services
*
* Note that some older IRCds, such as Ratbox, require services to be in the
* log channel to be able to message it. To do this, configure service:channels to
* join your logging channel.
*/
#target = "services.log #services"
/*
@@ -634,12 +665,6 @@ log
*/
logage = 7
/*
* Enable to have the core services clients join and stay in the log channel(s) when logging.
* Note: on some IRCds this is not optional, and is enforced on.
*/
inhabitlogchannel = yes
/*
* What types of log messages should be logged by this block. There are nine general categories:
*
@@ -662,13 +687,13 @@ log
* pesudo-serv/commandname (eg, operserv/akill, chanserv/set)
*
* Valid server options are:
* connect, quit, sync
* connect, quit, sync, squit
*
* Valid channel options are:
* create, destroy, join, part, kick, leave, mode
*
* Valid user options are:
* connect, disconnect, quit, nick, ident, host, mode, maxusers
* connect, disconnect, quit, nick, ident, host, mode, maxusers, oper
*
* Rawio and debug are simple yes/no answers, there are no types for them.
*
@@ -691,7 +716,10 @@ log
log
{
target = "globops"
admin = "global/* operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe */forbid nickserv/getpass */drop"
admin = "global/* operserv/global operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe operserv/oline operserv/set operserv/svsnick operserv/svsjoin operserv/svspart nickserv/getpass */drop"
servers = "squit"
users = "oper"
other = "expire/* bados akill/*"
}
/*
@@ -703,57 +731,59 @@ log
* This block is recommended, as without it you will be unable to access most oper commands.
* It replaces the old ServicesRoot directive amongst others.
*
* The command names below are defaults and are configured in commands.conf. If you configure
* The command names below are defaults and are configured in the *serv.conf's. If you configure
* additional commands with permissions, such as commands from third party modules, the permissions
* must be included in the opertype block before the command can be used.
*
* Available privileges:
* botserv/administration - Can perform certain BotServ administrative tasks
* chanserv/access/modify - Can modify channel access and akick lists
* botserv/administration - Can view and assign private BotServ bots
* chanserv/access/modify - Can modify channel access and akick lists, and use /chanserv enforce
* chanserv/auspex - Can see any information with /chanserv info
* chanserv/no-register-limit - May register an unlimited number of channels and nicknames
* chanserv/set - Can modify the settings of any channel (incl. changing of the owner and password!)
* chanserv/set - Can modify the settings of any channel (incl. changing of the owner!)
* memoserv/info - Can see any information with /memoserv info
* memoserv/set-limit - Can set the limit of max stored memos on any user and channel
* memoserv/no-limit - Can send memos through limits and throttles
* nickserv/access - Can modify other users access list
* nickserv/alist - Can see the access list of other users
* nickserv/auspex - Can see any information with /nickserv info
* nickserv/confirm - Can confirm other users nicknames
* nickserv/drop - Can drop other users nicks
*
* Available commands:
* botserv/bot/del botserv/bot/add botserv/bot/change botserv/assign/private
* botserv/botlist botserv/set/private botserv/set/nobot
* botserv/bot/del botserv/bot/add botserv/bot/change botserv/set/private
* botserv/set/nobot
*
* chanserv/access/list chanserv/drop chanserv/getkey chanserv/mode
* chanserv/list chanserv/suspend chanserv/topic chanserv/status
* chanserv/access/list chanserv/drop chanserv/getkey chanserv/invite
* chanserv/list chanserv/suspend chanserv/topic
*
* chanserv/saset/bantype chanserv/saset/description chanserv/saset/email chanserv/saset/entrymsg
* chanserv/saset/founder chanserv/saset/keeptopic chanserv/saset/opnotice chanserv/saset/restricted
* chanserv/saset/bantype chanserv/saset/description chanserv/saset/email
* chanserv/saset/founder chanserv/saset/keeptopic chanserv/saset/restricted
* chanserv/saset/peace chanserv/saset/persist chanserv/saset/private
* chanserv/saset/secure chanserv/saset/securefounder chanserv/saset/secureops
* chanserv/saset/signkick chanserv/saset/successor chanserv/saset/topiclock
* chanserv/saset/url chanserv/saset/noexpire
* chanserv/saset/url chanserv/saset/noexpire chanserv/saset/autoop
*
* memoserv/sendall memoserv/staff
*
* nickserv/getpass nickserv/sendpass nickserv/getemail nickserv/suspend
* nickserv/resetpass
* nickserv/getpass nickserv/getemail nickserv/suspend
* nickserv/resetpass nickserv/release nickserv/list
*
* nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet
* nickserv/saset/icq nickserv/saset/kill nickserv/saset/language nickserv/saset/message
* nickserv/saset/private nickserv/saset/secure nickserv/saset/url nickserv/saset/noexpire
* nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password
* nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message
* nickserv/saset/private nickserv/saset/secure nickserv/saset/url nickserv/saset/noexpire
*
* hostserv/set hostserv/del
* hostserv/set hostserv/del hostserv/list
*
* global/global
*
* operserv/news operserv/stats operserv/kick operserv/exception
* operserv/mode operserv/session operserv/modlist operserv/ignore
* operserv/chankill operserv/akill operserv/sqline operserv/snline
* operserv/szline operserv/oper operserv/config operserv/umode
* operserv/news operserv/stats operserv/kick operserv/exception operserv/seen
* operserv/mode operserv/session operserv/modinfo operserv/ignore operserv/chanlist
* operserv/chankill operserv/akill operserv/sqline operserv/snline operserv/userlist
* operserv/global operserv/oper operserv/config operserv/umode operserv/logsearch
* operserv/modload operserv/jupe operserv/set operserv/noop
* operserv/quit operserv/update operserv/reload operserv/restart
* operserv/shutdown operserv/svsnick operserv/oline operserv/kill
* operserv/shutdown operserv/svs operserv/oline operserv/kill
*
* Firstly, we define 'opertypes' which are named whatever we want ('Network Administrator', etc).
* These can contain commands for oper-only strings (see above) which grants access to that specific command,
@@ -782,7 +812,7 @@ opertype
inherits = "Helper, Another Helper"
/* What commands (see above) this opertype may use */
commands = "chanserv/list chanserv/suspend chanserv/status chanserv/topic memoserv/staff nickserv/sendpass nickserv/resetpass nickserv/suspend operserv/mode operserv/chankill operserv/szline operserv/akill operserv/session operserv/modlist operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline"
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"
/* What privs (see above) this opertype has */
privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auspex nickserv/confirm"
@@ -804,7 +834,7 @@ opertype
inherits = "Services Operator"
commands = "chanserv/access/list chanserv/drop chanserv/getkey chanserv/saset/noexpire memoserv/sendall nickserv/saset/* nickserv/getemail operserv/news operserv/jupe operserv/svsnick operserv/stats operserv/oline operserv/noop operserv/forbid global/*"
commands = "chanserv/access/list chanserv/drop chanserv/getkey chanserv/saset/noexpire memoserv/sendall nickserv/saset/* nickserv/getemail operserv/news operserv/jupe operserv/svs operserv/stats operserv/oline operserv/noop operserv/forbid global/* operserv/global"
privs = "*"
}
@@ -836,11 +866,24 @@ oper
/* The opertype this person will have */
type = "Services Root"
/* An optional password. If defined the user must login using /operserv login first */
/* If set, the user must be an oper on the IRCd to gain their Services
* oper privileges.
*/
require_oper = yes
/* An optional password. If defined the user must login using "/msg OperServ LOGIN" first */
#password = "secret"
/* An optional SSL fingerprint. If defined is required to use this opertype. */
/* An optional SSL fingerprint. If defined, it's required to be able to use this opertype. */
#certfp = "ed3383b3f7d74e89433ddaa4a6e5b2d7"
/* An optional list of user@host masks. If defined the user must be connected from one of them */
#host = "*@*.anope.org ident@*"
/* An optional vHost to set on users who identify for this oper block.
* This will override HostServ vHosts, and may not be available on all IRCds
*/
#vhost = "oper.mynet"
}
/*
@@ -863,6 +906,10 @@ oper
* This section contains settings related to the use of e-mail from Services.
* If the usemail directive is set to yes, unless specified otherwise, all other
* directives are required.
*
* NOTE: Users can find the IP of the machine services is running on by examining
* mail headers. If you do not want your IP known, you should set up a mail relay
* to strip the relevant headers.
*/
mail
{
@@ -894,7 +941,8 @@ mail
sendfrom = "services@localhost.net"
/*
* If set, SENDPASS and RESETPASS will be restricted to IRC operators.
* 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
@@ -924,29 +972,57 @@ mail
* if you are using ESMTP or QMail to send out e-mails.
*/
#dontquoteaddresses = yes
}
/*
* [OPTIONAL] DNS Config
*
* This section is used to configure DNS.
* At this time DNS is only used by a few modules (m_dnsbl)
* and is not required by the core to function.
*/
dns
{
/*
* The nameserver to use for resolving hostnames, must be an IP or a resolver configuration file.
* The below should work fine on all unix like systems. Windows users will have to find their nameservers
* from ipconfig /all and put the IP here
*/
nameserver = "/etc/resolv.conf"
#nameserver = "127.0.0.1"
/*
* How long to wait in seconds before a DNS query has timed out
* The subject and message of emails sent to users when they register accounts.
*/
timeout = 5
registration_subject = "Nickname registration for %n"
registration_message = "Hi,
You have requested to register the nickname %n on %N.
Please type \" /msg NickServ CONFIRM %c \" to complete registration.
If you don't know why this mail was sent to you, please ignore it silently.
%N administrators."
/*
* The subject and message of emails sent to users when they request a new password.
*/
reset_subject = "Reset password request for %n"
reset_message = "Hi,
You have requested to have the password for %n reset.
To reset your password, type \" /msg NickServ CONFIRM %n %c \"
If you don't know why this mail was sent to you, please ignore it silently.
%N administrators."
/*
* The subject and message of emails sent to users when they request a new email address.
*/
emailchange_subject = "Email confirmation"
emailchange_message = "Hi,
You have requested to change your email address to %e.
Please type \" /msg NickServ CONFIRM %c \" to confirm this change.
If you don't know why this mail was sent to you, please ignore it silently.
%N administrators."
/*
* The subject and message of emails sent to users when they receive a new memo.
*/
memo_subject = "New memo"
memo_message = "Hi %n,
You've just received a new memo from %s. This is memo number %d.
Memo text:
%t"
}
/*
@@ -958,11 +1034,32 @@ dns
*/
/*
* db_plain
* [DEPRECATED] db_old
*
* This is the default flatfile database format.
* This is the old binary database format from late Anope 1.7.x, Anope 1.8.x, and
* early Anope 1.9.x. This module only loads these databases, and will NOT save them.
* You should only use this to upgrade old databases to a newer database format by loading
* other database modules in addition to this one, which will be used when saving databases.
*/
module { name = "db_plain" }
#module { name = "db_old" }
db_old
{
/*
* This is the encryption type used by the databases. This must be set correctly or
* your passwords will not work. Valid options are: md5, oldmd5, sha1, and plain.
*/
#hash = "md5"
}
/*
* [DEPRECATED] db_plain
*
* This is the flatfile database format from Anope-1.9.2 to Anope-1.9.5.
* To convert from this format, load both this and db_flatfile. Be sure to name db_flatfile's
* target database to something else. Start Anope then shut down so the new database will be written.
* Then unload this and restart Anope, loading from the new database.
*/
#module { name = "db_plain" }
db_plain
{
/*
@@ -972,39 +1069,86 @@ db_plain
}
/*
* db_mysql and db_mysql_live
* db_flatfile
*
* Enables (live) MySQL support.
*
* The db_mysql_live module is an extension to db_mysql, and should only be used if
* db_mysql is being used. This module pulls data in real time from SQL as it is
* requested by the core as a result of someone executing commands.
*
* This effectively allows you to edit your database and have it be immediately
* reflected back in Anope.
*
* At this time db_mysql_live only supports pulling data in real time from the three
* main tables: anope_cs_info, anope_ns_alias, and anope_ns_core.
*
* db_mysql provides the command operserv/sqlsync, which is used for importing other database
* methods into MySQL.
* This is the default flatfile database format.
*/
#module { name = "db_mysql" }
#module { name = "db_mysql_live" }
module { name = "db_flatfile" }
db_flatfile
{
/*
* The database name db_flatfile should use
*/
database = "anope.db"
/*
* If enabled, services will fork a child process to save databases.
*
* This is only useful with very large databases, with hundreds
* of thousands of objects, that have a noticeable delay from
* writing databases.
*/
fork = no
}
/*
* [REQUIRED] Encryption modules.
* db_sql
*
* This module allows saving and loading databases using one of the SQL engines.
* This module loads the databases once on startup, then incrementally updates
* objects in the database as they are changed within Anope in real time. Changes
* to the SQL tables not done by Anope will have no effect and will be overwritten.
*
*/
#module { name = "db_sql" }
/*
* db_sql_live
*
* This module allows saving and loading databases using one of the SQL engines.
* This module reads and writes to SQL in real time. Changes to the SQL tables
* will be immediately reflected into Anope. This module should not be loaded
* in conjunction with db_sql, except during the initial import of existing
* databases to SQL.
*/
#module { name = "db_sql_live" }
db_sql
{
/*
* The SQL service db_sql(_live) should use, these are configured in modules.conf.
* For MySQL, this should probably be mysql/main.
*/
engine = "sqlite/main"
/*
* An optional prefix to prepended to the name of each created table.
* Do not use the same prefix for other programs.
*/
#prefix = "anope_db_"
}
/*
* [RECOMMENDED] Encryption modules.
*
* The encryption modules are used when dealing with passwords. This determines how
* the passwords are stored in the databases, and does not add any security as
* far as transmitting passwords over the network goes.
*
* Without any encryption modules, passwords will be stored in plain text, allowing
* for passwords to be recovered later but isn't secure therefore is not recommended.
*
* The other encryption modules use one-way encryption, so the passwords can not
*
* Without any encryption modules loaded users will not be able to authenticate unless
* there is another module loaded that provides authentication checking, such as
* m_ldap_authentication or m_sql_authentication.
*
* With enc_none, passwords will be stored in plain text, allowing for passwords
* to be recovered later but it isn't secure and therefore is not recommended.
*
* The other encryption modules use one-way encryption, so the passwords can not
* be recovered later if those are used.
*
* The first encryption module loaded is the primary encryption module. All new passwords are
* encrypted by this module. Old passwords stored in another encryption method are
* automatically re-encrypted by the primary encryption module on next identify.
*
* NOTE: enc_old is Anope's previous (broken) MD5 implementation, if your databases
* were made using that module, continue to use it and do not use enc_md5.
*
@@ -1015,32 +1159,39 @@ db_plain
* that you first try to get everyone's passwords converted to enc_sha256 before
* switching OSes by placing enc_sha256 at the beginning of the list.
*
* The first encryption module loaded is the primary encryption module. All new passwords are
* encrypted by this module. Old passwords stored in another encryption method are
* automatically re-encrypted by the primary encryption module on next identify.
*/
module { name = "enc_md5" }
module { name = "enc_sha256" }
#module { name = "enc_md5" }
#module { name = "enc_sha1" }
#module { name = "enc_sha256" }
/*
* When using enc_none, passwords will be stored without encryption in plain
* text, allowing for passwords to be recovered later. This isn't secure therefore
* is not recommended.
* When using enc_none, passwords will be stored without encryption. This isn't secure
* therefore it is not recommended.
*/
#module { name = "enc_none" }
/*
* enc_old is Anope's previous (broken) MD5 implementation, if your databases
* were made using that module, load it here to allow conversion to the primary
* enc_old is Anope's previous (broken) MD5 implementation used from 1.4.x to 1.7.16.
* If your databases were made using that module, load it here to allow conversion to the primary
* encryption method.
*/
#module { name = "enc_old" }
/* Extra (optional) modules */
/* Extra (optional) modules. */
include
{
type = "file"
name = "modules.example.conf"
type = "file"
name = "modules.example.conf"
}
/*
* Chanstats module.
* Requires a MySQL Database.
*/
#include
#{
# type = "file"
# name = "chanstats.example.conf"
#}
+16 -7
View File
@@ -4,11 +4,12 @@
/*
* First, create the service.
* Note that an easy way to rename this service is to define{} the client name to something else.
*/
service
{
/*
* The name of the Global client
* The name of the Global client.
*/
nick = "Global"
@@ -34,11 +35,20 @@ service
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* Note that setting this option incorrectly could potentially BREAK some, if
* not all, usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
/*
* An optional comma separated list of channels this service should join. Outside
* of log channels this is not very useful, as the service will just idle in the
* specified channels, and will not accept any types of commands.
*
* Prefixes may be given to the channels in the form of mode characters or prefix symbols.
*/
#channels = "@#services,#mychan"
}
/*
@@ -46,7 +56,7 @@ service
*
* Provides essential functionality for Global.
*/
module { name = "gl_main" }
module { name = "global" }
/*
* Configuration for Global provided by gl_main.
@@ -80,7 +90,7 @@ global
globaloncycleup = "Services are now back online - have a nice day"
/*
* If set, Services will hide the IRC operator's nick in a global
* If set, Services will hide the IRC Operator's nick in a global
* message/notice.
*
* This directive is optional.
@@ -99,7 +109,7 @@ global
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
/* Give it a help command. */
command { service = "Global"; name = "HELP"; command = "generic/help"; }
/*
@@ -112,4 +122,3 @@ command { service = "Global"; name = "HELP"; command = "generic/help"; }
module { name = "gl_global" }
command { service = "OperServ"; name = "GLOBAL"; command = "global/global"; permission = "operserv/global"; }
command { service = "Global"; name = "GLOBAL"; command = "global/global"; permission = "global/global"; }
+46 -9
View File
@@ -4,11 +4,12 @@
/*
* First, create the service.
* Note that an easy way to rename this service is to define{} the client name to something else.
*/
service
{
/*
* The name of the HostServ client
* The name of the HostServ client.
*/
nick = "HostServ"
@@ -34,11 +35,20 @@ service
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* Note that setting this option incorrectly could potentially BREAK some, if
* not all, usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
/*
* An optional comma separated list of channels this service should join. Outside
* of log channels this is not very useful, as the service will just idle in the
* specified channels, and will not accept any types of commands.
*
* Prefixes may be given to the channels in the form of mode characters or prefix symbols.
*/
#channels = "@#services,#mychan"
}
/*
@@ -46,7 +56,7 @@ service
*
* Provides essential functionality for HostServ.
*/
module { name = "hs_main" }
module { name = "hostserv" }
/*
* Configuration for HostServ provided by hs_main.
@@ -57,6 +67,34 @@ hostserv
* The name of the client that should be HostServ.
*/
name = "HostServ"
/*
* The characters allowed in a vHost. Changing this is not recommended unless
* you know for sure your IRCd supports whatever characters you are wanting to use.
* Telling services to set a vHost containing characters your IRCd disallows could
* potentially break the IRCd and/or Services. Note these are 1 byte characters, so
* UTF-8 characters will not work.
*
* It is recommended you DON'T change this.
*/
vhost_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-"
/*
* If set to true, allows vHosts to not contain dots (.).
* Newer IRCds generally do not have a problem with this, but the same warning as
* vhost_chars applies.
*
* It is recommended you DON'T change this.
*/
allow_undotted_vhosts = false
/*
* The characters that are not allowed to be at the very beginning or very ending
* of a vHost. The same warning as vhost_chars applies.
*
* It is recommended you DON'T change this.
*/
disallow_start_or_end = ".-"
}
/*
@@ -70,7 +108,7 @@ hostserv
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
/* Give it a help command. */
command { service = "HostServ"; name = "HELP"; command = "generic/help"; }
/*
@@ -78,7 +116,7 @@ command { service = "HostServ"; name = "HELP"; command = "generic/help"; }
*
* Provides the commands hostserv/del and hostserv/delall.
*
* Used for removing users vHosts.
* Used for removing users' vHosts.
*/
module { name = "hs_del" }
command { service = "HostServ"; name = "DEL"; command = "hostserv/del"; permission = "hostserv/del"; }
@@ -129,7 +167,7 @@ command { service = "HostServ"; name = "ON"; command = "hostserv/on"; }
*
* Provides the commands hostserv/request, hostserv/active, hostserv/reject, and hostserv/waiting.
*
* Used to manage vhosts requested by users.
* Used to manage vHosts requested by users.
*/
module { name = "hs_request" }
command { service = "HostServ"; name = "REQUEST"; command = "hostserv/request"; }
@@ -155,9 +193,8 @@ hs_request
*
* Provides the commands hostserv/set and hostserv/setall.
*
* Used for setting users vhosts.
* Used for setting users' vHosts.
*/
module { name = "hs_set" }
command { service = "HostServ"; name = "SET"; command = "hostserv/set"; permission = "hostserv/set"; }
command { service = "HostServ"; name = "SETALL"; command = "hostserv/setall"; permission = "hostserv/set"; }
+19 -10
View File
@@ -4,11 +4,12 @@
/*
* First, create the service.
* Note that an easy way to rename this service is to define{} the client name to something else.
*/
service
{
/*
* The name of the MemoServ client
* The name of the MemoServ client.
*/
nick = "MemoServ"
@@ -34,11 +35,20 @@ service
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* Note that setting this option incorrectly could potentially BREAK some, if
* not all, usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
/*
* An optional comma separated list of channels this service should join. Outside
* of log channels this is not very useful, as the service will just idle in the
* specified channels, and will not accept any types of commands.
*
* Prefixes may be given to the channels in the form of mode characters or prefix symbols.
*/
#channels = "@#services,#mychan"
}
/*
@@ -46,7 +56,7 @@ service
*
* Provides essential functionality for MemoServ.
*/
module { name = "ms_main" }
module { name = "memoserv" }
/*
* Configuration for MemoServ provided by ms_main.
@@ -101,7 +111,7 @@ memoserv
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
/* Give it a help command. */
command { service = "MemoServ"; name = "HELP"; command = "generic/help"; }
/*
@@ -180,7 +190,7 @@ command { service = "MemoServ"; name = "READ"; command = "memoserv/read"; }
* Provides the command memoserv/rsend.
*
* Used to send a memo requiring a receipt be sent back once it is read.
*
*
* Requires configuring memoserv:memoreceipt.
*/
#module { name = "ms_rsend" }
@@ -189,7 +199,7 @@ command { service = "MemoServ"; name = "READ"; command = "memoserv/read"; }
/*
* ms_send
*
* Provides the command memoserv/send
* Provides the command memoserv/send.
*
* Used to send memos.
*/
@@ -197,9 +207,9 @@ module { name = "ms_send" }
command { service = "MemoServ"; name = "SEND"; command = "memoserv/send"; }
/*
* ms_sendlal
* ms_sendall
*
* Provides the command memoserv/sendall
* Provides the command memoserv/sendall.
*
* Used to send a mass memo to every registered user.
*/
@@ -225,4 +235,3 @@ command { service = "MemoServ"; name = "SET"; command = "memoserv/set"; }
*/
module { name = "ms_staff" }
command { service = "MemoServ"; name = "STAFF"; command = "memoserv/staff"; permission = "memoserv/staff"; }
+376 -49
View File
@@ -1,4 +1,3 @@
/*
* [OPTIONAL] Non-Core Modules
*
@@ -10,12 +9,64 @@
/*
* help
*
* Provides commands generic/help
* Provides the command generic/help.
*
* Is a generic help command that can be used with any client.
* This is a generic help command that can be used with any client.
*/
module { name = "help" }
/*
* m_dns
*
* Adds support for the DNS protocol. By itself this module does nothing useful,
* but other modules such as m_dnsbl and os_dns require this.
*/
#module { name = "m_dns" }
dns
{
/*
* The nameserver to use for resolving hostnames, must be an IP or a resolver configuration file.
* The below should work fine on all unix like systems. Windows users will have to find their nameservers
* from ipconfig /all and put the IP here.
*/
nameserver = "/etc/resolv.conf"
#nameserver = "127.0.0.1"
/*
* How long to wait in seconds before a DNS query has timed out.
*/
timeout = 5
/* Only edit below if you are expecting to use os_dns or otherwise answer DNS queries. */
/*
* The IP and port services use to listen for DNS queries.
* Note that ports less than 1024 are privileged on UNIX/Linux systems, and
* require Anope to be started as root. If you do this, it is recommended you
* set options:user and options:group so Anope can change users after binding
* to this port.
*/
ip = "0.0.0.0"
port = 53
/*
* SOA record information.
*/
/* E-mail address of the DNS administrator. */
admin = "admin@example.com"
/* This should be the names of the public facing nameservers serving the records. */
nameservers = "ns1.example.com ns2.example.com"
/* The time slave servers are allowed to cache. This should be reasonably low
* if you want your records to be updated without much delay.
*/
refresh = 3600
}
/*
* m_dnsbl
*
@@ -23,7 +74,7 @@ module { name = "help" }
* is found on the blacklist they will be immediately banned. This is a crucial module
* to prevent bot attacks.
*/
module { name = "m_dnsbl" }
#module { name = "m_dnsbl" }
m_dnsbl
{
/*
@@ -48,10 +99,10 @@ m_dnsbl
}
blacklist
{
/* Name of the blacklist */
/* Name of the blacklist. */
name = "rbl.efnetrbl.org"
/* How long to set the ban for */
/* How long to set the ban for. */
time = 4h
/* Reason for akill.
@@ -65,7 +116,7 @@ blacklist
*/
reason = "You are listed in the efnet RBL, visit http://rbl.efnetrbl.org/?i=%i for info"
/* Replies to ban and their reason. If this is totally ommited all replies get banned */
/* Replies to ban and their reason. If this is totally ommited all replies get banned. */
1 = "Open Proxy"
/* Don't ban for result 2 or 3 */
#2 = "spamtrap666"
@@ -91,6 +142,43 @@ m_helpchan
helpchannel = "#help"
}
/*
* m_httpd
*
* Allows services to serve web pages. By itself, this module does nothing useful.
*
* Note that using this will allow users to get the IP of your services.
* To prevent this we recommend using a reverse proxy or a tunnel.
*/
#module { name = "m_httpd" }
httpd
{
/* Name of this service. */
name = "httpd/main"
/* IP to listen on. */
ip = "0.0.0.0"
/* Port to listen on. */
port = 8080
/* Time before connections to this server are timed out. */
timeout = 30
/* Listen using SSL. Requires m_ssl. */
#ssl = yes
/* If you are using a reverse proxy that sends one of the
* extforward_headers set below, set this to its IP.
* This allows services to obtain the real IP of users by
* reading the forwarded-for HTTP header.
*/
#extforward_ip = "192.168.0.255"
/* The header to look for. These probably work as is. */
extforward_header = "X-Forwarded-For Forwarded-For"
}
/*
* m_ldap
*
@@ -101,6 +189,10 @@ ldap
{
server = "ldap://127.0.0.1"
port = 389
/*
* Admin credentials used for performing searches and adding users.
*/
admin_binddn = "cn=Manager,dc=anope,dc=org"
admin_password = "secret"
}
@@ -115,13 +207,20 @@ ldap
m_ldap_authentication
{
/*
* The distinguished name we should bind to when a user tries to identify.
* The distinguished name used for searching for users's accounts.
*/
binddn = "ou=users,dc=anope,dc=org"
basedn = "ou=users,dc=anope,dc=org"
/*
* The search filter used to look up users's accounts.
* %account is replaced with the user's account.
* %object_class is replaced with the object_class configured below.
*/
search_filter = "(&(uid=%account)(objectClass=%object_class))"
/*
* The object class used by LDAP to store user account information.
* Used for adding new users to LDAP if disable_ns_register is false
* Used for adding new users to LDAP if disable_ns_register is false.
*/
object_class = "anopeUser"
@@ -143,15 +242,15 @@ m_ldap_authentication
password_attribute = "userPassword"
/*
* Enable to have this module disable /nickserv register.
* Enable this to have this module disable "/msg NickServ REGISTER".
*/
disable_ns_register = false
/*
* The reason to give the users who try to /ns register if
* The reason to give the users who try to "/msg NickServ REGISTER" if
* disable_ns_register is enabled.
*/
#disable_reason = "To register on this network visit http://some.misconfigured.site/register"
#disable_reason = "To register on this network, visit http://some.misconfigured.site/register"
}
/*
@@ -197,13 +296,13 @@ m_ldap_oper
/*
* m_mysql
*
* This module allows other modules (db_mysql/db_mysql_live) to use MySQL.
* Be sure you have imported the table schema with mydbgen before
* trying to use MySQL
* This module allows other modules to use MySQL.
*/
#module { name = "m_mysql" }
mysql
{
/* The name of this service. */
name = "mysql/main"
database = "anope"
server = "127.0.0.1"
username = "anope"
@@ -212,21 +311,252 @@ mysql
}
/*
* m_ssl
* m_proxyscan
*
* This module uses SSL to connect to the uplink server(s)
* This module allows you to scan connecting clients for open proxies.
* Note that using this will allow users to get the IP of your services.
*
* Currently the two supported proxy types are HTTP and SOCKS5.
*
* The proxy scanner works by attempting to connect to clients when they
* connect to the network, and if they have a proxy running instruct it to connect
* back to services. If services are able to connect through the proxy to itself
* then it knows it is an insecure proxy, and will ban it.
*/
module { name = "m_ssl" }
#module { name = "m_proxyscan" }
m_proxyscan
{
/*
* The target IP services tells the proxy to connect back to. This must be a publicly
* avaiable IP that remote proxies can connect to.
*/
#target_ip = "127.0.0.1"
/*
* The port services tells the proxy to connect to.
*/
target_port = 7226
/*
* The listen IP services listen on for incoming connections from suspected proxies.
* This probably will be the same as target_ip, but may not be if you are behind a firewall (NAT).
*/
#listen_ip = "127.0.0.1"
/*
* The port services should listen on for incoming connections from suspected proxies.
* This most likely will be the same as target_port.
*/
listen_port = 7226
/*
* An optional notice sent to clients upon connect.
*/
#connect_notice = "We will now scan your host for insecure proxies. If you do not consent to this scan please disconnect immediately."
/*
* Who the notice should be sent from.
*/
#connect_source = "OperServ"
/*
* If set, OperServ will add infected clients to the akill list. Without it, OperServ simply sends
* a timed G/K-line to the IRCd and forgets about it. Can be useful if your akill list is being filled up by bots.
*/
add_to_akill = yes
/*
* How long before connections should be timed out.
*/
timeout = 5
}
/*
* m_statusupdate
*
* This module automatically updates users status on channels when the
* channel's access list is modified.
* A proxyscan block (must have m_proxyscan loaded).
* You may have multiple proxyscan blocks.
*/
module { name = "m_statusupdate" }
proxyscan
{
/* The type of proxy to check for. A comma separated list is allowed. */
type = "HTTP"
/*
/* The ports to check. */
port = "80,8080"
/* How long to set the ban for. */
time = 4h
/*
* The reason to ban the user for.
* %h is replaced with the type of proxy found.
* %i is replaced with the IP of proxy found.
* %p is replaced with the port.
*/
reason = "You have an open proxy running on your host (%t:%i:%p)"
}
/*
* m_sql_authentication
*
* This module allows authenticating users against an external SQL database using a custom
* query.
*/
#module { name = "m_sql_authentication" }
m_sql_authentication
{
/* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
engine = "mysql/main"
/* Query to execute to authenticate. A non empty result from this query is considered a success,
* and the user will be authenticated.
*
* @a@ is replaced with the user's account name
* @p@ is replaced with the user's password
* @n@ is replaced with the user's nickname
* @i@ is replaced with the user's IP
*
* Note that @n@ and @i@ may not always exist in the case of a user identifying outside of the normal
* nickserv/identify command, such as through the web panel.
*
* Furthermore, if a field named email is returned from this query the user's email is
* set to its value.
*
*
* We've included some example queries for some popular website/forum systems.
*
* Drupal 6: "SELECT `mail` AS `email` FROM `users` WHERE `name` = @a@ AND `pass` = MD5(@p@) AND `status` = 1"
* e107 cms: "SELECT `user_email` AS `email` FROM `e107_user` WHERE `user_loginname` = @a@ AND `user_password` = MD5(@p@)"
* SMF Forum: "SELECT `email_address` AS `email` FROM `smf_members` WHERE `member_name` = @a@ AND `passwd` = SHA1(CONCAT(LOWER(@a@), @p@))"
* vBulletin: "SELECT `email` FROM `user` WHERE `username` = @a@ AND `password` = MD5(CONCAT(MD5(@p@), `salt`))"
* IP.Board: "SELECT `email` FROM `ibf_members` WHERE `name` = @a@ AND `members_pass_hash` = MD5(CONCAT(MD5(`members_pass_salt`), MD5(@p@)))"
*/
query = "SELECT `email_addr` AS `email` FROM `my_users` WHERE `username` = @a@ AND `password` = MD5(CONCAT('salt', @p@))"
/*
* Enable this to have this module disable "/msg NickServ REGISTER".
*/
disable_ns_register = false
/*
* The reason to give the users who try to "/msg NickServ REGISTER" if
* disable_ns_register is enabled.
*/
#disable_reason = "To register on this network visit http://some.misconfigured.site/register"
}
/*
* m_sql_oper
*
* This module allows granting users services operator privileges and possibly IRC Operator
* privileges based on an external SQL database using a custom query.
*/
#module { name = "m_sql_oper" }
m_sql_oper
{
/* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
engine = "mysql/main"
/* Query to execute to determine if a user should have operator privileges.
* A field named opertype must be returned in order to link the user to their oper type.
* The oper types must be configured earlier in services.conf.
*
* If a field named modes is returned from this query then those modes are set on the user.
* Without this, only a simple +o is sent.
*
* @a@ is replaced with the user's account name
* @i@ is replaced with the user's IP
*/
query = "SELECT `opertype` FROM `my_users` WHERE `user_name` = @a@"
}
/*
* m_sqlite
*
* This module allows other modules to use SQLite.
*/
#module { name = "m_sqlite" }
sqlite
{
/* The name of this service. */
name = "sqlite/main"
/* The database name, it will be created if it does not exist. */
database = "anope.db"
}
/*
* m_regex_pcre
*
* Provides the regex engine regex/pcre, which uses the Perl Compatible Regular Expressions library.
*/
module { name = "m_regex_pcre" }
/*
* m_regex_posix
*
* Provides the regex engine regex/posix, which uses the POSIX compliant regular expressions.
* This is likely the only regex module you will not need extra libraries for.
*/
#module { name = "m_regex_posix" }
/*
* m_regex_tre
*
* Provides the regex engine regex/tre, which uses the TRE regex library.
*/
#module { name = "m_regex_tre" }
/*
* m_rewrite
*
* Allows rewriting commands sent to/from clients.
*/
module { name = "m_rewrite" }
#command
#{
# service = "ChanServ"; name = "CLEAR"; command = "rewrite"
#
# /* Enable m_rewrite. */
# rewrite = true
#
# /* Source message to match. A $ can be used to match anything. */
# rewrite_source = "CLEAR $ USERS"
#
# /*
# * Message to rewrite the source message to. A $ followed by a number, eg $0, gets
# * replaced by the number-th word from the source_message, starting from 0.
# */
# rewrite_target = "KICK $1 *"
#
# /*
# * The command description. This only shows up in HELP's output.
# * Comment this option to prevent the command from showing in the
# * HELP command.
# */
# rewrite_description = "Clears all users from a channel"
#}
/*
* m_ssl
*
* This module uses SSL to connect to the uplink server(s).
*/
#module { name = "m_ssl" }
ssl
{
/*
* An optional certificate and key for m_ssl to give to the uplink.
*
* You can generate your own certificate and key pair by using:
*
* openssl genrsa -out anope.key 2048
* openssl req -new -x509 -key anope.key -out anope.crt -days 1095
*/
cert = "data/anope.crt"
key = "data/anope.key"
}
/*
* m_xmlrpc
*
* Allows remote applications (websites) to execute queries in real time to retrieve data from Anope.
@@ -235,18 +565,8 @@ module { name = "m_statusupdate" }
#module { name = "m_xmlrpc" }
m_xmlrpc
{
/* IP to listen on */
bindip = "127.0.0.1"
/* Port to listen on */
port = 26673
/* Enable for IPv6 */
ipv6 = no
/* If enabled, requires m_ssl to be loaded */
ssl = no
/* IPs allowed to connect (separate with spaces), this should be secured. We also recommend you firewall this
* with an outside program to increase security.
*/
allowed = "127.0.0.0/24"
/* Web service to use. Requires m_httpd. */
server = "httpd/main"
}
/*
@@ -258,19 +578,26 @@ m_xmlrpc
#module { name = "m_xmlrpc_main" }
/*
* ns_maxemail
* webcpanel
*
* Limits how many times the same email address may be used in Anope
* to register accounts.
* This module creates a web configuration panel that allows users and operators to perform any task
* as they could over IRC. If you are using the default configuration you should be able to access
* this panel by visiting http://127.0.0.1:8080 in your web browser from the machine Anope is running on.
*
* This module requires m_httpd.
*/
module { name = "ns_maxemail" }
ns_maxemail
#module { name = "webcpanel" }
webcpanel
{
/*
* The limit to how many registered nicks can use the same e-mail address. If set to 0 or left
* commented, there will be no limit enforced when registering new accounts or using
* /msg NickServ SET EMAIL.
*/
#maxemails = 1
}
/* Web server to use. */
server = "httpd/main";
/* Template to use. */
template = "default";
/* Page title. */
title = "Anope IRC Services";
/* Whether or not to use https on redirecting URLs. */
ssl = no
}
+163 -170
View File
@@ -4,11 +4,12 @@
/*
* First, create the service.
* Note that an easy way to rename this service is to define{} the client name to something else.
*/
service
{
/*
* The name of the NickServ client
* The name of the NickServ client.
*/
nick = "NickServ"
@@ -34,11 +35,20 @@ service
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* Note that setting this option incorrectly could potentially BREAK some, if
* not all, usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
/*
* An optional comma separated list of channels this service should join. Outside
* of log channels this is not very useful, as the service will just idle in the
* specified channels, and will not accept any types of commands.
*
* Prefixes may be given to the channels in the form of mode characters or prefix symbols.
*/
#channels = "@#services,#mychan"
}
/*
@@ -46,7 +56,7 @@ service
*
* Provides essential functionality for NickServ.
*/
module { name = "ns_main" }
module { name = "nickserv" }
/*
* Configuration for NickServ provided by ns_main.
@@ -60,7 +70,7 @@ nickserv
/*
* Force users to give an e-mail address when they register a nick.
*
*
* This directive is recommended to be enabled, and required if e-mail registration is enabled.
*/
forceemail = yes
@@ -72,9 +82,18 @@ nickserv
confirmemailchanges = no
/*
* Require an e-mail to be sent to the user before they can register their nick.
* Registration confirmation setting. Set to "none" for no registration confirmation,
* "mail" for email confirmation, and "admin" to have services operators manually confirm
* every registration. Set to "disable" to completely disable all registrations.
*/
#emailregistration = yes
registration = "none"
/*
* A message sent to users on connect if they use an unregistered nick.
*
* This directive is optional.
*/
#unregistered_notice = "Your nickname is not registered. To register it, use: /msg NickServ REGISTER password email"
/*
* The default options for newly registered nicks. Note that changing these options
@@ -91,29 +110,31 @@ nickserv
* - hideemail: Hide's the nick's e-mail address from NickServ's INFO command
* - hideusermask: Hide's the nick's last or current user@host from NickServ's INFO command
* - hidequit: Hide's the nick's last quit message
* - memosignon: Notify user if they have a new memo when they sign into the nick
* - memoreceive: Notify user if they have a new memo as soon as it's received
* - 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
* - 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 UsePrivmsg
* to be enabled as well
* - msg: Services messages will be sent as PRIVMSGs instead of NOTICEs, requires
* options:useprivmsg to be enabled as well
*
* This directive is optional, if left blank, the options will default to secure, memosignon, and
* memoreceive. If you really want no defaults, use "none" by itself as the option.
* This directive is optional, if left blank, the options will default to secure, memo_signon, and
* memo_receive. If you really want no defaults, use "none" by itself as the option.
*/
defaults="secure private hideemail hideusermask memosignon memoreceive autoop"
defaults="secure private hideemail hideusermask memo_signon memo_receive autoop"
/*
* A list of languages to load on startup that will be available in /nickserv set language.
* Useful if you translate Anope to your language. (Explained further in docs/LANGUAGE).
* Note that english should not be listed here because it is the base language.
*
* Removing .UTF-8 will instead use the default encoding for the language, eg. iso-8859-1 for western European languages.
*/
languages = "ca_ES de_DE el_GR es_ES fr_FR hu_HU it_IT nl_NL pl_PL pt_PT ru_RU tr_TR"
languages = "ca_ES.UTF-8 de_DE.UTF-8 el_GR.UTF-8 es_ES.UTF-8 fr_FR.UTF-8 hu_HU.UTF-8 it_IT.UTF-8 nl_NL.UTF-8 pl_PL.UTF-8 pt_PT.UTF-8 ru_RU.UTF-8 tr_TR.UTF-8"
/*
* Default language that non- and newly-registered nicks will receive messages in.
* Leave empty to default to English.
*/
#defaultlanguage = "es_ES"
#defaultlanguage = "es_ES.UTF-8"
/*
* The minimum length of time between consecutive uses of NickServ's REGISTER command. This
@@ -129,7 +150,7 @@ nickserv
resenddelay = 90s
/*
* The length of time before a nick registration expires.
* The length of time before a nick's registration expires.
*
* This directive is optional, but recommended. If not set, the default is 21 days.
*/
@@ -138,7 +159,7 @@ nickserv
/*
* The length of time before a suspended nick becomes unsuspended.
*
* This directive is optional. If not set, the default is to never.
* This directive is optional. If not set, the default is never.
*/
#suspendexpire = 90d
@@ -164,7 +185,7 @@ nickserv
/*
* The username (and possibly hostname) used for the fake user created when NickServ collides
* a user. Should be in the user@host format.
* a user.
*/
enforceruser = "enforcer"
enforcerhost = "localhost.net"
@@ -202,8 +223,8 @@ nickserv
guestnickprefix = "Guest"
/*
* Prevents the use of the DROP, FORBID, GETPASS, and SET PASSWORD commands by Services Admins
* on other Services Admins or the Services Root(s).
* Prevents the use of the ACCESS (excluding the LIST subcommand), DROP, FORBID, SUSPEND,
* GETPASS and SET PASSWORD commands by services operators on other services operators.
*
* This directive is optional, but recommended.
*/
@@ -211,7 +232,7 @@ nickserv
/*
* If set, any user wanting to use the privileges of Services Root, Services Admin, or Services
* Operator must have been logged as an IRC Operator with the /oper command.
* Operator must have been logged as an IRC Operator with the /OPER command.
*
* This directive is optional, but recommended.
*/
@@ -237,6 +258,41 @@ nickserv
* The maximum number of channels a user can have on NickServ's AJOIN command.
*/
ajoinmax = 10
/*
* If set, is the length of time NickServ's killquick and kill options wait before
* forcing users off of protected nicknames.
*/
killquick = 20s
kill = 60s
/*
* If set, Services will set these user modes on any user who identifies.
*
* This directive is optional.
*/
#modesonid = "+R"
/*
* If set, Services will svsnick and svsjoin users who use the recover
* command on an identified user to the nick and channels of the recovered user.
*
* This directive is opional.
*/
restoreonrecover = yes
/*
* Some IRCds allow "SASL" authentication to let users identify to Services
* during the IRCd user registration process. If set, Services will allow
* authenticating users through this mechanism.
*/
sasl = yes
/*
* If set, Services will not show netsplits in the last quit message field
* of NickServ's INFO command.
*/
hidenetsplitquit = no
}
/*
@@ -250,7 +306,18 @@ nickserv
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
/* Command group configuration for NickServ.
*
* Commands may optionally be placed into groups to make NickServ's HELP output easier to understand.
* Remove the following groups to use the old behavior of simply listing all NickServ commands from HELP.
*/
command_group
{
name = "nickserv/admin"
description = "Services Operator commands"
}
/* Give it a help command. */
command { service = "NickServ"; name = "HELP"; command = "generic/help"; }
/*
@@ -311,7 +378,7 @@ command { service = "NickServ"; name = "DROP"; command = "nickserv/drop"; }
* Used for getting registered accounts by searching for emails.
*/
module { name = "ns_getemail" }
command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; permission = "nickserv/getemail"; }
command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; permission = "nickserv/getemail"; group = "nickserv/admin"; }
/*
* ns_getpass
@@ -325,16 +392,6 @@ command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"
#module { name = "ns_getpass" }
#command { service = "NickServ"; name = "GETPASS"; command = "nickserv/getpass"; permission = "nickserv/getpass"; }
/*
* ns_ghost
*
* Provides the command nickserv/ghost.
*
* Used for disconnecting "ghost" sessions.
*/
module { name = "ns_ghost" }
command { service = "NickServ"; name = "GHOST"; command = "nickserv/ghost"; }
/*
* ns_group
*
@@ -355,7 +412,7 @@ command { service = "NickServ"; name = "UNGROUP"; command = "nickserv/ungroup";
* Used for identifying to accounts.
*/
module { name = "ns_identify" }
command { service = "NickServ"; name = "ID"; command = "nickserv/identify"; }
command { service = "NickServ"; name = "ID"; command = "nickserv/identify"; hide = true; }
command { service = "NickServ"; name = "IDENTIFY"; command = "nickserv/identify"; }
/*
@@ -376,7 +433,7 @@ command { service = "NickServ"; name = "INFO"; command = "nickserv/info"; }
* Used for retrieving and searching the registered account list.
*/
module { name = "ns_list" }
command { service = "NickServ"; name = "LIST"; command = "nickserv/list"; }
command { service = "NickServ"; name = "LIST"; command = "nickserv/list"; command = "nickserv/admin"; }
/*
* ns_logout
@@ -393,10 +450,13 @@ command { service = "NickServ"; name = "LOGOUT"; command = "nickserv/logout"; }
*
* Provides the command nickserv/recover.
*
* Used for forcing someone on your nick to a guest nick.
* Used for recovering your nick from services or another user.
*/
module { name = "ns_recover" }
command { service = "NickServ"; name = "RECOVER"; command = "nickserv/recover"; }
# Uncomment below to emulate 1.8's behavior of ghost, recover, and release.
#command { service = "NickServ"; name = "GHOST"; command = "nickserv/recover"; }
#command { service = "NickServ"; name = "RELEASE"; command = "nickserv/recover"; }
/*
* ns_register
@@ -410,16 +470,6 @@ command { service = "NickServ"; name = "CONFIRM"; command = "nickserv/confirm";
command { service = "NickServ"; name = "REGISTER"; command = "nickserv/register"; }
command { service = "NickServ"; name = "RESEND"; command = "nickserv/resend"; }
/*
* ns_release
*
* Provides the command nickserv/release.
*
* Used for releasing names held by nickserv/recover.
*/
module { name = "ns_release" }
command { service = "NickServ"; name = "RELEASE"; command = "nickserv/release"; }
/*
* ns_resetpass
*
@@ -430,150 +480,65 @@ command { service = "NickServ"; name = "RELEASE"; command = "nickserv/release";
module { name = "ns_resetpass" }
command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpass"; }
/*
* ns_saset
*
* Provides commands nickserv/saset, nickserv/saset/display, and nickserv/saset/password.
*
* Used as a help wrapper for SASET commands, and used to force change users display name or password.
*/
module { name = "ns_saset" }
command { service = "NickServ"; name = "SASET"; command = "nickserv/saset"; }
command { service = "NickServ"; name = "SASET DISPLAY"; command = "nickserv/saset/display"; }
command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/saset/password"; }
/*
* ns_set
*
* Provides the commands nickserv/set, nickserv/set/display, and nickserv/set/password.
* Provides the commands:
* nickserv/set, nickserv/saset - Dummy help wrappers for the SET and SASET commands.
* nickserv/set/autoop, nickserv/saset/autoop - Determines whether or not modes are automatically set users when joining a channel.
* nickserv/set/display, nickserv/saset/display - Used for setting a users display name.
* nickserv/set/email, nickserv/saset/email - Used for setting a users email address.
* nickserv/set/greet, nickserv/saset/greet - Used for changing a users greet message, which is displayed when they enter channels.
* nicksrev/set/hide, nickserv/saset/hide - Used for configuring which options are publically shown in nickserv/info for users account.
* nickserv/set/kill, nickserv/saset/kill - Used for configuring nickname protection.
* nickserv/set/language, nickserv/saset/language - Used for configuring what language services use.
* nickserv/set/message, nickserv/saset/message - Used to configure how services send messages to you.
* nickserv/set/password, nickserv/saset/password - Used for changing a users greet password.
* nickserv/set/private, nickserv/saset/private - Used for configuring whether or a users account shows up in nickserv/list.
* nickserv/set/secure, nickserv/saset/secure - Used for configuring whether a user can identify by simply being recognized by nickserv/access.
* nickserv/saset/noexpire - Used for configuring noexpire, which prevents nicks from expiring.
*
* Used as a help wrapper for SET commands, and used for users to change their display name or password.
* This is a dummy command to provide a help wrapper for the various SET and SASET commands.
*/
module { name = "ns_set" }
command { service = "NickServ"; name = "SET"; command = "nickserv/set"; }
command { service = "NickServ"; name = "SET DISPLAY"; command = "nickserv/set/display"; }
command { service = "NickServ"; name = "SET PASSWORD"; command = "nickserv/set/password"; }
command { service = "NickServ"; name = "SASET"; command = "nickserv/saset"; permission = "nickserv/saset/"; group = "nickserv/admin"; }
/*
* ns_set_autoop
*
* Provides the commands nickserv/set/autoop and nickserv/saset/autoop.
*
* Used for setting autoop, which determines whether or not modes are automatically set on you when joining a channel.
*/
module { name = "ns_set_autoop" }
command { service = "NickServ"; name = "SET AUTOOP"; command = "nickserv/set/autoop"; }
command { service = "NickServ"; name = "SASET AUTOOP"; command = "nickserv/saset/autoop"; permission = "nickserv/saset/autoop"; }
command { service = "NickServ"; name = "SASET AUTOOP"; command = "nickserv/saset/autoop"; permission = "nickserv/saset/autoop"; group = "nickserv/admin"; }
command { service = "NickServ"; name = "SET DISPLAY"; command = "nickserv/set/display"; }
command { service = "NickServ"; name = "SASET DISPLAY"; command = "nickserv/saset/display"; permission = "nickserv/saset/display"; group = "nickserv/admin"; }
/*
* ns_set_email
*
* Provides the commands nickserv/set/email and nickserv/saset/email.
*
* Used for setting users email addresses.
*/
module { name = "ns_set_email" }
command { service = "NickServ"; name = "SET EMAIL"; command = "nickserv/set/email"; }
command { service = "NickServ"; name = "SASET EMAIL"; command = "nickserv/saset/email"; permission = "nickserv/saset/email"; }
command { service = "NickServ"; name = "SASET EMAIL"; command = "nickserv/saset/email"; permission = "nickserv/saset/email"; group = "nickserv/admin"; }
/*
* ns_set_greet
*
* Provides the commands nickserv/set/greet and nickserv/saset/greet.
*
* Used for changing users greet message, which is displayed when they enter channels.
*/
module { name = "ns_set_greet" }
command { service = "NickServ"; name = "SET GREET"; command = "nickserv/set/greet"; }
command { service = "NickServ"; name = "SASET GREET"; command = "nickserv/saset/greet"; permission = "nickserv/saset/greet"; }
command { service = "NickServ"; name = "SASET GREET"; command = "nickserv/saset/greet"; permission = "nickserv/saset/greet"; group = "nickserv/admin"; }
/*
* ns_set_hide
*
* Provides the commands nickserv/set/hide and nickserv/saset/hide.
*
* Used for configuring which options are publically shown in nickserv/info for your account.
*/
module { name = "ns_set_hide" }
command { service = "NickServ"; name = "SET HIDE"; command = "nickserv/set/hide"; }
command { service = "NickServ"; name = "SASET HIDE"; command = "nickserv/saset/hide"; permission = "nickserv/saset/hide"; }
command { service = "NickServ"; name = "SASET HIDE"; command = "nickserv/saset/hide"; permission = "nickserv/saset/hide"; group = "nickserv/admin"; }
/*
* ns_set_kill
*
* Provides the commands nickserv/set/kill and nickserv/saset/kill.
*
* Used for configuring if and for how long other users are allowed to use your nick.
*/
module { name = "ns_set_kill" }
command { service = "NickServ"; name = "SET KILL"; command = "nickserv/set/kill"; }
command { service = "NickServ"; name = "SASET KILL"; command = "nickserv/saset/kill"; permission = "nickserv/saset/kill"; }
command { service = "NickServ"; name = "SASET KILL"; command = "nickserv/saset/kill"; permission = "nickserv/saset/kill"; group = "nickserv/admin"; }
/*
* ns_set_language
*
* Provides the commands nickserv/set/language and nickserv/saset/language.
*
* Used for configuring what language services use when messaging you.
*/
module { name = "ns_set_language" }
command { service = "NickServ"; name = "SET LANGUAGE"; command = "nickserv/set/language"; }
command { service = "NickServ"; name = "SASET LANGUAGE"; command = "nickserv/saset/language"; permission = "nickserv/saset/language"; }
command { service = "NickServ"; name = "SASET LANGUAGE"; command = "nickserv/saset/language"; permission = "nickserv/saset/language"; group = "nickserv/admin"; }
/*
* ns_set_message
*
* Provides the commands nickserv/set/message and nickserv/saset/message.
*
* Used to configure how services send messages to you.
*/
module { name = "ns_set_message" }
command { service = "NickServ"; name = "SET MESSAGE"; command = "nickserv/set/message"; }
command { service = "NickServ"; name = "SASET MESSAGE"; command = "nickserv/saset/message"; permission = "nickserv/saset/message"; }
command { service = "NickServ"; name = "SASET MESSAGE"; command = "nickserv/saset/message"; permission = "nickserv/saset/message"; group = "nickserv/admin"; }
command { service = "NickServ"; name = "SET PASSWORD"; command = "nickserv/set/password"; }
command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/saset/password"; permission = "nickserv/saset/password"; group = "nickserv/admin"; }
/*
* ns_set_private
*
* Provides the commands nickserv/set/private and nickserv/saset/private.
*
* Used for configuring whether or not your account shows up in nickserv/list.
*/
module { name = "ns_set_private" }
command { service = "NickServ"; name = "SET PRIVATE"; command = "nickserv/set/private"; }
command { service = "NickServ"; name = "SASET PRIVATE"; command = "nickserv/saset/private"; permission = "nickserv/saset/private"; }
command { service = "NickServ"; name = "SASET PRIVATE"; command = "nickserv/saset/private"; permission = "nickserv/saset/private"; group = "nickserv/admin"; }
/*
* ns_set_secure
*
* Provides the commands nickserv/set/secure and nickserv/saset/secure.
*
* Used for configuring whether you can gain access to your nick by simply being recognized by nickserv/access.
*/
module { name = "ns_set_secure" }
command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; }
command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; }
command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; group = "nickserv/admin"; }
/*
* ns_saset_noexpire
*
* Provides the command nickserv/saset/noexpire.
*
* Used for configuring noexpire, which prevents nicks from expiring.
*/
module { name = "ns_saset_noexpire" }
command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire" }
/*
* ns_sendpass
*
* Provides the command nickserv/sendpass.
*
* Used to send users their password via email.
*
* Requires that no encryption is being used.
*/
module { name = "ns_sendpass" }
command { service = "NickServ"; name = "SENDPASS"; command = "nickserv/sendpass"; permission = "nickserv/sendpass"; }
command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire"; group = "nickserv/admin"; }
/*
* ns_set_misc
@@ -581,10 +546,17 @@ command { service = "NickServ"; name = "SENDPASS"; command = "nickserv/sendpass"
* Provides the command nickserv/set/misc.
*
* Allows you to create arbitrary commands to set data, and have that data show up in nickserv/info.
* A field named misc_description may be given for use with help output.
*/
module { name = "ns_set_misc" }
command { service = "NickServ"; name = "SET URL"; command = "nickserv/set/misc"; }
command { service = "NickServ"; name = "SET ICQ"; command = "nickserv/set/misc"; }
command { service = "NickServ"; name = "SET URL"; command = "nickserv/set/misc"; misc_description = _("Associate a URL with your account"); }
command { service = "NickServ"; name = "SASET URL"; command = "nickserv/saset/misc"; misc_description = _("Associate a URL with this account"); permission = "nickserv/saset/url"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET ICQ"; command = "nickserv/set/misc"; misc_description = _("Associate an ICQ account with your account"); }
#command { service = "NickServ"; name = "SASET ICQ"; command = "nickserv/saset/misc"; misc_description = _("Associate an ICQ account with this account"); permission = "nickserv/saset/icq"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET TWITTER"; command = "nickserv/set/misc"; misc_description = _("Associate a Twitter account with your account"); }
#command { service = "NickServ"; name = "SASET TWITTER"; command = "nickserv/saset/misc"; misc_description = _("Associate a Twitter account with this account"); permission = "nickserv/saset/twitter"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET FACEBOOK"; command = "nickserv/set/misc"; misc_description = _("Associate a Facebook URL with your account"); }
#command { service = "NickServ"; name = "SASET FACEBOOK"; command = "nickserv/saset/misc"; misc_description = _("Associate a Facebook URL with this account"); permission = "nickserv/saset/facebook"; group = "nickserv/admin"; }
/*
* ns_status
@@ -601,11 +573,11 @@ command { service = "NickServ"; name = "STATUS"; command = "nickserv/status"; }
*
* Provides the commands nickserv/suspend and nickserv/unsuspend.
*
* Used to suspend and unsuspend nicknames. Suspended nicknames can not be used but their settings are stored.
* Used to suspend and unsuspend nicknames. Suspended nicknames can not be used but their settings are preserved.
*/
module { name = "ns_suspend" }
command { service = "NickServ"; name = "SUSPEND"; command = "nickserv/suspend"; permission = "nickserv/suspend"; }
command { service = "NickServ"; name = "UNSUSPEND"; command = "nickserv/unsuspend"; permission = "nickserv/suspend"; }
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"; }
/*
* ns_update
@@ -617,3 +589,24 @@ command { service = "NickServ"; name = "UNSUSPEND"; command = "nickserv/unsuspen
module { name = "ns_update" }
command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; }
/*
* Extra NickServ related modules.
*/
/*
* ns_maxemail
*
* Limits how many times the same email address may be used in Anope
* to register accounts.
*/
module { name = "ns_maxemail" }
ns_maxemail
{
/*
* The limit to how many registered nicks can use the same e-mail address. If set to 0 or left
* commented, there will be no limit enforced when registering new accounts or using
* /msg NickServ SET EMAIL.
*/
#maxemails = 1
}
+136 -53
View File
@@ -4,11 +4,12 @@
/*
* First, create the service.
* Note that an easy way to rename this service is to define{} the client name to something else.
*/
service
{
/*
* The name of the OperServ client
* The name of the OperServ client.
*/
nick = "OperServ"
@@ -34,11 +35,20 @@ service
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some if
* not all usefulness of the client. We will not support you if this client is
* Note that setting this option incorrectly could potentially BREAK some, if
* not all, usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
/*
* An optional comma separated list of channels this service should join. Outside
* of log channels this is not very useful, as the service will just idle in the
* specified channels, and will not accept any types of commands.
*
* Prefixes may be given to the channels in the form of mode characters or prefix symbols.
*/
#channels = "@#services,#mychan"
}
/*
@@ -46,7 +56,7 @@ service
*
* Provides essential functionality for OperServ.
*/
module { name = "os_main" }
module { name = "operserv" }
/*
* Configuration for OperServ provided by os_main.
@@ -68,13 +78,12 @@ operserv
/*
* These define the default expiration times for, respectively, AKILLs, CHANKILLs, SNLINEs,
* SQLINEs, and SZLINEs.
* and SQLINEs.
*/
autokillexpiry = 30d
chankillexpiry = 30d
snlineexpiry = 30d
sqlineexpiry = 30d
szlineexpiry = 30d
/*
* If set, this option will make Services send an AKILL command immediately after it has been
@@ -101,22 +110,6 @@ operserv
*/
#killonsqline = yes
/*
* Defines what actions should trigger notifications. The list must be separated by spaces.
*
* The notifications are:
* - oper: A user has become an IRC operator
* - bados: A non-IRCop attempts to use OperServ
* - akillexpire: An AKILL has expired
* - snlineexpire: An SNLINE has expired
* - sqlineexpire: An SQLINE has expired
* - szlineexpire: An SZLINE has expired
* - exceptionexpire: A session exception has expired
*
* This directive is optional, if left blank, there will be no notifications.
*/
notifications = "oper"
/*
* Enables session limiting. Session limiting prevents users from connecting more than a certain
* number of times from the same host at the same time - thus preventing most types of cloning.
@@ -125,8 +118,7 @@ operserv
* should be noted that session limiting, along with a large exception list, can degrade Services'
* performance.
*
* See the source and comments in sessions.c and the online help for more information about
* session limiting.
* See the online help for more information about session limiting.
*
* This directive is optional.
*/
@@ -162,7 +154,7 @@ operserv
*
* This directive is optional, if not set, nothing will be sent.
*/
sessionlimitexceeded = "The session limit for your host %s has been exceeded."
sessionlimitexceeded = "The session limit for your IP %s has been exceeded."
/*
* Same as above, but should be used to provide a website address where users can find out more
@@ -191,6 +183,13 @@ operserv
*/
sessionautokillexpiry = 30m
/*
* Sets the CIDR value used to determine which IP addresses represent the same person.
* By default this would limit 3 connections per IPv4 IP and 3 connections per IPv6 IP.
*/
session_ipv4_cidr = 32
session_ipv6_cidr = 128
/*
* Adds the nickname of the IRC Operator issuing an AKILL to the kill reason.
*
@@ -198,6 +197,12 @@ operserv
*/
addakiller = yes
/*
* Adds akill IDs to akills. Akill IDs are given to users in their ban reason and can be used to easily view,
* modify, or remove an akill from the ID.
*/
akillids = yes
/*
* If set, only IRC Operators will be permitted to use OperServ, regardless of module-based command
* access restrictions.
@@ -218,7 +223,7 @@ operserv
* Sane defaults are provided below that do not need to be edited unless you wish to change the default behavior.
*/
/* Give it a help command */
/* Give it a help command. */
command { service = "OperServ"; name = "HELP"; command = "generic/help"; }
/*
@@ -236,7 +241,7 @@ command { service = "OperServ"; name = "AKILL"; command = "operserv/akill"; perm
*
* Provides the command operserv/chankill.
*
* Used to akill uses from an entire channel.
* Used to akill users from an entire channel.
*/
module { name = "os_chankill" }
command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"; permission = "operserv/chankill"; }
@@ -299,7 +304,7 @@ defcon
* the mode setting selected, Services will set the reverse on all channels, e.g. if this setting
* is +RN when DefCon is used, all channels will be set to +RN, when DefCon is removed, all
* channels will be set to -RN. You don't want to set this to +k for example, because when DefCon
* is removed all channels with -k.
* is removed, all channels are set -k, removing the key from previously keyed channels.
*
* Note 2: MLOCKed modes will not be lost.
*/
@@ -345,19 +350,68 @@ defcon
* Defines the reason to use when clients are KILLed or AKILLed from the network while the proper
* DefCon operation is in effect.
*/
#akillreason = "This network is currently not accepting connections, please try again later"
#akillreason = "This network is currently not accepting connections, please try again later."
}
/*
* os_list
* os_dns
*
* Provides the commands operserv/chanlist and operserv/userlist.
* Provides the command operserv/dns.
*
* Used to list and search the channels and users currently on the network.
* This module requires that m_dns is loaded.
*
* This module allows controlling a DNS zone. This is useful for
* controlling what servers users are placed on for load balancing,
* and to automatically remove split servers.
*
* To use this module you must set a nameserver record for services
* so that DNS queries go to services.
*
* Alternatively, you may use a slave DNS server to hide service's IP,
* provide query caching, and provide better fault tolerance.
*
* To do this using BIND, configure similar to:
*
* options { max-refresh-time 60; };
* zone "irc.example.com" IN {
* type slave;
* masters { 127.0.0.1 port 5353; };
* };
*
* Where 127.0.0.1:5353 is the IP and port services are listening on.
* We recommend you externally firewall both UDP and TCP to the port
* Anope is listening on.
*
* Finally set a NS record for irc.example.com. to BIND or services.
*/
module { name = "os_list" }
command { service = "OperServ"; name = "CHANLIST"; command = "operserv/chanlist"; }
command { service = "OperServ"; name = "USERLIST"; command = "operserv/userlist"; }
#module { name = "os_dns" }
#command { service = "OperServ"; name = "DNS"; command = "operserv/dns"; permission = "operserv/dns"; }
os_dns
{
/* TTL for records. This should be very low if your records change often. */
ttl = 1m
/* If a server drops this many users the server is automatically removed from the DNS zone.
* This directive is optional.
*/
user_drop_mark = 50
/* The time used for user_drop_mark. */
user_drop_time = 1m
/* When a server is removed from the zone for dropping users, it is readded after this time.
* This directive is optional.
*/
user_drop_readd_time = 5m
/* If set, when a server splits, it is automatically removed from the zone. */
remove_split_servers = yes
/* If set, when a server connects to the network, it will be automatically added to
* the zone if it is a known server.
*/
readd_connected_servers = no
}
/*
* os_config
@@ -419,15 +473,44 @@ command { service = "OperServ"; name = "KICK"; command = "operserv/kick"; permis
module { name = "os_kill" }
command { service = "OperServ"; name = "KILL"; command = "operserv/kill"; permission = "operserv/kill"; }
/*
* os_list
*
* Provides the commands operserv/chanlist and operserv/userlist.
*
* Used to list and search the channels and users currently on the network.
*/
module { name = "os_list" }
command { service = "OperServ"; name = "CHANLIST"; command = "operserv/chanlist"; permission = "operserv/chanlist"; }
command { service = "OperServ"; name = "USERLIST"; command = "operserv/userlist"; permission = "operserv/userlist"; }
/*
* os_login
*
* Provides the command operserv/login.
* Provides the commands operserv/login and operserv/logout.
*
* Used to login to OperServ, only required if your oper block requires this.
*/
module { name = "os_login" }
command { service = "OperServ"; name = "LOGIN"; command = "operserv/login"; }
command { service = "OperServ"; name = "LOGOUT"; command = "operserv/logout"; }
/*
* os_logsearch
*
* Provides the command operserv/logsearch.
*
* Used to search services log files.
*/
module { name = "os_logsearch" }
command { service = "OperServ"; name = "LOGSEARCH"; command = "operserv/logsearch"; permission = "operserv/logsearch"; }
logsearch
{
/* The log file name to search. There should be a log{} block configured to log
* to a file of this name.
*/
name = "services.log"
}
/*
* os_mode
@@ -437,8 +520,8 @@ command { service = "OperServ"; name = "LOGIN"; command = "operserv/login"; }
* Used to change user and channel modes.
*/
module { name = "os_mode" }
command { service = "OperServ"; name = "MODE"; command = "operserv/mode"; permission = "operserv/mode"; }
command { service = "OperServ"; name = "UMODE"; command = "operserv/umode"; permission = "operserv/umode"; }
command { service = "OperServ"; name = "MODE"; command = "operserv/mode"; permission = "operserv/mode"; }
/*
* os_modinfo
@@ -448,8 +531,8 @@ command { service = "OperServ"; name = "UMODE"; command = "operserv/umode"; perm
* Used to show information about loaded modules.
*/
module { name = "os_modinfo" }
command { service = "OperServ"; name = "MODINFO"; command = "operserv/modinfo"; }
command { service = "OperServ"; name = "MODLIST"; command = "operserv/modlist"; permission = "operserv/modlist"; }
command { service = "OperServ"; name = "MODINFO"; command = "operserv/modinfo"; permission = "operserv/modinfo"; }
command { service = "OperServ"; name = "MODLIST"; command = "operserv/modlist"; permission = "operserv/modinfo"; }
/*
* os_module
@@ -498,8 +581,8 @@ command { service = "OperServ"; name = "OLINE"; command = "operserv/oline"; perm
/*
* os_oper
*
* Provides the command opersev/oper.
*
* Provides the command operserv/oper.
*
* Used to configure opers and show information about opertypes.
*/
@@ -509,7 +592,7 @@ command { service = "OperServ"; name = "OPER"; command = "operserv/oper"; permis
/*
* os_reload
*
* Provides the command operserv/relad.
* Provides the command operserv/reload.
*
* Used to reload the services.conf configuration file.
*/
@@ -532,7 +615,7 @@ command { service = "OperServ"; name = "SESSION"; command = "operserv/session";
*
* Provides the command operserv/set.
*
* Used to set various settinsg such as superadmin, debug mode, etc.
* Used to set various settings such as superadmin, debug mode, etc.
*/
module { name = "os_set" }
command { service = "OperServ"; name = "SET"; command = "operserv/set"; permission = "operserv/set"; }
@@ -560,34 +643,34 @@ module { name = "os_stats" }
command { service = "OperServ"; name = "STATS"; command = "operserv/stats"; permission = "operserv/stats"; }
/*
* os_svsnick
*
* Provides the operserv/svsnick command.
* os_svs
*
* Used to force change user's nicks.
* Provides the commands operserv/svsnick, operserv/svsjoin, and operserv/svspart.
*
* Used to force users to change nicks, join and part channels.
*/
module { name = "os_svsnick" }
command { service = "OperServ"; name = "SVSNICK"; command = "operserv/svsnick"; permission = "operserv/svsnick"; }
module { name = "os_svs" }
command { service = "OperServ"; name = "SVSNICK"; command = "operserv/svsnick"; permission = "operserv/svs"; }
command { service = "OperServ"; name = "SVSJOIN"; command = "operserv/svsjoin"; permission = "operserv/svs"; }
command { service = "OperServ"; name = "SVSPART"; command = "operserv/svspart"; permission = "operserv/svs"; }
/*
* os_sxline
*
* Provides the operserv/snline, operserv/sqline, and operserv/szline commands.
* Provides the operserv/snline and operserv/sqline commands.
*
* Used to ban different things such as realnames, nicknames, and IPs.
*/
module { name = "os_sxline" }
command { service = "OperServ"; name = "SNLINE"; command = "operserv/snline"; permission = "operserv/snline"; }
command { service = "OperServ"; name = "SQLINE"; command = "operserv/sqline"; permission = "operserv/sqline"; }
command { service = "OperServ"; name = "SZLINE"; command = "operserv/szline"; permission = "operserv/szline"; }
/*
* os_update
*
* Provides the opersev/update command.
* Provides the operserv/update command.
*
* Use to immediately update the databases.
*/
module { name = "os_update" }
command { service = "OperServ"; name = "UPDATE"; command = "operserv/update"; permission = "operserv/update"; }
-426
View File
@@ -1,426 +0,0 @@
-- phpMyAdmin SQL Dump
-- version 3.3.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 07, 2011 at 03:53 PM
-- Server version: 5.1.50
-- PHP Version: 5.3.6-pl0-gentoo
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `anope`
--
-- --------------------------------------------------------
--
-- Table structure for table `anope_bs_badwords`
--
CREATE TABLE IF NOT EXISTS `anope_bs_badwords` (
`channel` varchar(255) NOT NULL DEFAULT '',
`word` varchar(255) NOT NULL,
`type` varchar(50) NOT NULL,
UNIQUE KEY `channel` (`channel`,`word`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_bs_core`
--
CREATE TABLE IF NOT EXISTS `anope_bs_core` (
`nick` varchar(255) NOT NULL DEFAULT '',
`user` varchar(255) NOT NULL DEFAULT '',
`host` text NOT NULL,
`rname` text NOT NULL,
`flags` text NOT NULL,
`created` int(10) unsigned NOT NULL DEFAULT '0',
`chancount` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`nick`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_bs_info_metadata`
--
CREATE TABLE IF NOT EXISTS `anope_bs_info_metadata` (
`botname` varchar(255) NOT NULL DEFAULT '',
`name` varchar(255) NOT NULL DEFAULT '',
`value` text NOT NULL,
KEY `FK_anope_bs_info_metadata_botname` (`botname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_cs_access`
--
CREATE TABLE IF NOT EXISTS `anope_cs_access` (
`provider` varchar(255) NOT NULL DEFAULT '',
`data` varchar(255) NOT NULL DEFAULT '',
`mask` varchar(255) NOT NULL DEFAULT '',
`channel` varchar(255) NOT NULL DEFAULT '',
`last_seen` int(10) unsigned NOT NULL DEFAULT '0',
`creator` varchar(255) NOT NULL DEFAULT '',
`created` int(11) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`mask`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_cs_akick`
--
CREATE TABLE IF NOT EXISTS `anope_cs_akick` (
`channel` varchar(255) NOT NULL DEFAULT '',
`flags` varchar(255) NOT NULL DEFAULT '',
`mask` varchar(255) NOT NULL DEFAULT '',
`reason` text NOT NULL,
`creator` varchar(255) NOT NULL DEFAULT '',
`created` int(10) unsigned NOT NULL DEFAULT '0',
`last_used` int(10) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`mask`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_cs_info`
--
CREATE TABLE IF NOT EXISTS `anope_cs_info` (
`name` varchar(255) NOT NULL DEFAULT '',
`founder` text NOT NULL,
`successor` text NOT NULL,
`descr` text NOT NULL,
`time_registered` int(10) unsigned NOT NULL DEFAULT '0',
`last_used` int(10) unsigned NOT NULL DEFAULT '0',
`last_topic` text NOT NULL,
`last_topic_setter` text NOT NULL,
`last_topic_time` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
`bantype` smallint(6) NOT NULL DEFAULT '0',
`memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
`botnick` varchar(255) NOT NULL DEFAULT '',
`botflags` text NOT NULL,
`capsmin` smallint(6) NOT NULL DEFAULT '0',
`capspercent` smallint(6) NOT NULL DEFAULT '0',
`floodlines` smallint(6) NOT NULL DEFAULT '0',
`floodsecs` smallint(6) NOT NULL DEFAULT '0',
`repeattimes` smallint(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_cs_info_metadata`
--
CREATE TABLE IF NOT EXISTS `anope_cs_info_metadata` (
`channel` varchar(255) NOT NULL DEFAULT '',
`name` varchar(255) NOT NULL DEFAULT '',
`value` text NOT NULL,
KEY `FK_anope_cs_info_metadata_channel` (`channel`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_cs_levels`
--
CREATE TABLE IF NOT EXISTS `anope_cs_levels` (
`channel` varchar(255) NOT NULL DEFAULT '',
`position` int(11) NOT NULL DEFAULT '0',
`level` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`position`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_cs_mlock`
--
CREATE TABLE IF NOT EXISTS `anope_cs_mlock` (
`channel` varchar(255) NOT NULL,
`mode` varchar(127) NOT NULL,
`status` int(11) NOT NULL,
`setter` varchar(255) NOT NULL,
`created` int(11) NOT NULL,
`param` varchar(255) NOT NULL,
UNIQUE KEY `entry` (`channel`,`mode`,`status`,`setter`,`param`),
KEY `FK_anope_cs_mlock` (`channel`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_cs_ttb`
--
CREATE TABLE IF NOT EXISTS `anope_cs_ttb` (
`channel` varchar(255) NOT NULL DEFAULT '',
`ttb_id` int(11) NOT NULL DEFAULT '0',
`value` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `channel` (`channel`,`ttb_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_extra`
--
CREATE TABLE IF NOT EXISTS `anope_extra` (
`data` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_hs_core`
--
CREATE TABLE IF NOT EXISTS `anope_hs_core` (
`nick` varchar(255) NOT NULL,
`vident` varchar(64) NOT NULL,
`vhost` varchar(255) NOT NULL,
`creator` varchar(255) NOT NULL,
`time` int(11) NOT NULL,
KEY `FK_anope_hs_core_nick` (`nick`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_info`
--
CREATE TABLE IF NOT EXISTS `anope_info` (
`version` int(11) DEFAULT NULL,
`date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_ms_info`
--
CREATE TABLE IF NOT EXISTS `anope_ms_info` (
`receiver` varchar(255) NOT NULL,
`flags` int(11) NOT NULL DEFAULT '0',
`time` int(10) unsigned NOT NULL DEFAULT '0',
`sender` text NOT NULL,
`text` blob NOT NULL,
`serv` enum('NICK','CHAN') NOT NULL DEFAULT 'NICK',
KEY `FK_anope_ms_info_receiver` (`receiver`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_ns_access`
--
CREATE TABLE IF NOT EXISTS `anope_ns_access` (
`display` varchar(255) NOT NULL DEFAULT '',
`access` varchar(160) NOT NULL,
KEY `FK_anope_ns_access_display` (`display`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_ns_alias`
--
CREATE TABLE IF NOT EXISTS `anope_ns_alias` (
`nick` varchar(255) NOT NULL DEFAULT '',
`last_quit` text NOT NULL,
`last_realname` text NOT NULL,
`last_usermask` text NOT NULL,
`last_realhost` text NOT NULL,
`time_registered` int(10) unsigned NOT NULL DEFAULT '0',
`last_seen` int(10) unsigned NOT NULL DEFAULT '0',
`flags` text NOT NULL,
`display` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`nick`),
KEY `FK_anope_ns_alias_display` (`display`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_ns_alias_metadata`
--
CREATE TABLE IF NOT EXISTS `anope_ns_alias_metadata` (
`nick` varchar(255) NOT NULL DEFAULT '',
`name` varchar(255) NOT NULL DEFAULT '',
`value` text NOT NULL,
KEY `FK_anope_ns_alias_metadata_nick` (`nick`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_ns_core`
--
CREATE TABLE IF NOT EXISTS `anope_ns_core` (
`display` varchar(255) NOT NULL DEFAULT '',
`pass` text NOT NULL,
`email` text NOT NULL,
`greet` text NOT NULL,
`flags` text NOT NULL,
`language` varchar(5) NOT NULL DEFAULT '',
`memomax` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`display`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_ns_core_metadata`
--
CREATE TABLE IF NOT EXISTS `anope_ns_core_metadata` (
`nick` varchar(255) NOT NULL DEFAULT '',
`name` varchar(255) NOT NULL DEFAULT '',
`value` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_os_core`
--
CREATE TABLE IF NOT EXISTS `anope_os_core` (
`maxusercnt` int(11) NOT NULL DEFAULT '0',
`maxusertime` int(10) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_os_exceptions`
--
CREATE TABLE IF NOT EXISTS `anope_os_exceptions` (
`mask` varchar(255) NOT NULL,
`slimit` int(11) NOT NULL DEFAULT '0',
`who` text NOT NULL,
`reason` text NOT NULL,
`time` int(10) unsigned NOT NULL DEFAULT '0',
`expires` int(10) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `anope_os_xlines`
--
CREATE TABLE IF NOT EXISTS `anope_os_xlines` (
`type` varchar(1) NOT NULL,
`mask` varchar(255) NOT NULL,
`xby` text NOT NULL,
`reason` text NOT NULL,
`seton` int(10) unsigned NOT NULL DEFAULT '0',
`expire` int(10) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `anope_bs_badwords`
--
ALTER TABLE `anope_bs_badwords`
ADD CONSTRAINT `FK_anope_bs_badwords_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_bs_info_metadata`
--
ALTER TABLE `anope_bs_info_metadata`
ADD CONSTRAINT `FK_anope_bs_info_metadata_botname` FOREIGN KEY (`botname`) REFERENCES `anope_bs_core` (`nick`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_cs_access`
--
ALTER TABLE `anope_cs_access`
ADD CONSTRAINT `FK_anope_cs_access_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_cs_akick`
--
ALTER TABLE `anope_cs_akick`
ADD CONSTRAINT `FK_anope_cs_akick_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_cs_info_metadata`
--
ALTER TABLE `anope_cs_info_metadata`
ADD CONSTRAINT `FK_anope_cs_info_metadata_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_cs_levels`
--
ALTER TABLE `anope_cs_levels`
ADD CONSTRAINT `FK_anope_cs_levels_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_cs_mlock`
--
ALTER TABLE `anope_cs_mlock`
ADD CONSTRAINT `FK_anope_cs_mlock_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_cs_ttb`
--
ALTER TABLE `anope_cs_ttb`
ADD CONSTRAINT `FK_anope_cs_ttb_channel` FOREIGN KEY (`channel`) REFERENCES `anope_cs_info` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_hs_core`
--
ALTER TABLE `anope_hs_core`
ADD CONSTRAINT `FK_anope_hs_core_nick` FOREIGN KEY (`nick`) REFERENCES `anope_ns_alias` (`nick`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_ms_info`
--
ALTER TABLE `anope_ms_info`
ADD CONSTRAINT `FK_anope_ms_info_receiver` FOREIGN KEY (`receiver`) REFERENCES `anope_ns_alias` (`nick`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_ns_access`
--
ALTER TABLE `anope_ns_access`
ADD CONSTRAINT `FK_anope_ns_access_display` FOREIGN KEY (`display`) REFERENCES `anope_ns_core` (`display`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_ns_alias`
--
ALTER TABLE `anope_ns_alias`
ADD CONSTRAINT `FK_anope_ns_alias_display` FOREIGN KEY (`display`) REFERENCES `anope_ns_core` (`display`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `anope_ns_alias_metadata`
--
ALTER TABLE `anope_ns_alias_metadata`
ADD CONSTRAINT `FK_anope_ns_alias_metadata_nick` FOREIGN KEY (`nick`) REFERENCES `anope_ns_alias` (`nick`) ON DELETE CASCADE ON UPDATE CASCADE;
+289 -1
View File
@@ -1,3 +1,291 @@
Revision 271d723 - Sun, 2 Sep 2012 08:31:11 -0400 - Update Changes
Revision a0c4575 - Sun, 2 Sep 2012 08:31:04 -0400 - Regenerate language files
Revision 1af64a9 - Sun, 2 Sep 2012 08:30:54 -0400 - Fix Windows
Revision e3d5140 - Sat, 1 Sep 2012 18:54:51 -0400 - Added a web panel module + a default template
Revision f81d011 - Tue, 28 Aug 2012 00:39:50 -0400 - Actually set xline's manager...
Revision fde4289 - Thu, 9 Aug 2012 23:28:02 -0400 - Fixed db_old loading encrypted passwords from 1.8
Revision f7bf2fa - Wed, 8 Aug 2012 17:09:34 -0400 - Put motd in conf/ not data/ and fixed the default values in the config
Revision b894a56 - Wed, 8 Aug 2012 04:28:33 -0400 - Update pid and motd file paths
Revision 48022c3 - Wed, 18 Jul 2012 16:52:14 -0400 - Warn about really big integer values in the config
Revision 28aa981 - Sun, 1 Jul 2012 23:50:38 -0400 - Actually the core can't handle empty realnames, just ignore them
Revision 2b8a09b - Sun, 1 Jul 2012 22:26:05 -0400 - Remove some unused code in inspircd20 protocol module & allow /chghost/ident/naming services clients
Revision a12788e - Sun, 1 Jul 2012 22:26:05 -0400 - Don't crash on empty setnames on inspircd1.2
Revision 9b5f6d3 - Sun, 1 Jul 2012 22:26:05 -0400 - Remove ExtensibleString everywhere
Revision af24dc6 - Tue, 26 Jun 2012 16:21:24 +0100 - Removed old set xop references and cleared up some other stuff.
Revision f27560c - Tue, 26 Jun 2012 02:01:01 +0100 - Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Revision 4b309b5 - Mon, 25 Jun 2012 20:51:08 -0400 - Fixed accidentally recursion in User::SendMessage from last commit
Revision d8a99d6 - Fri, 22 Jun 2012 21:26:33 +0100 - Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Revision 2dec8e7 - Mon, 18 Jun 2012 05:04:30 -0400 - Allow userless command sources
Revision ba53c7e - Sun, 17 Jun 2012 22:23:22 +0100 - Updated MODULES somewhat
Revision 873d428 - Mon, 11 Jun 2012 15:44:48 -0400 - Split up bs_set
Revision 3626fb2 - Wed, 6 Jun 2012 15:16:46 -0400 - Fixed fd leak in win32/pipe.cpp
Revision a661098 - Mon, 4 Jun 2012 05:45:13 +0100 - Some more fantasy character help output
Revision a4bf5ce - Mon, 4 Jun 2012 04:50:35 +0100 - minor help output changes, including some confusion in fantasy chars
Revision 437944d - Fri, 1 Jun 2012 04:43:26 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision db37b1c - Fri, 1 Jun 2012 07:37:34 +0200 - updated chanstats
Revision 1e49e9b - Sat, 26 May 2012 02:36:02 -0400 - This should actually be LOG_TERMINAL, quitmsg isn't logged to terminal on shutdown
Revision 2cbfbc9 - Sat, 26 May 2012 02:15:48 -0400 - Some access level fixes from Robby to more closely match the historic levels, and some code cleanup
Revision 38d5f20 - Thu, 24 May 2012 21:54:15 -0400 - Added a ./Config option for using precompiled headers
Revision 70fb590 - Wed, 23 May 2012 19:35:56 -0400 - Add support for inspircd2.0+s mlock, improved on Unreal's, and made server side mlock usage configurable
Revision bf7d1a5 - Wed, 23 May 2012 15:09:41 -0400 - Fixed some problems found by Robby
Revision 1f73e27 - Sun, 20 May 2012 04:14:26 -0400 - Updated help messages for ns_list, cs_list, cs_entrymsg, and cs_info. Also fixed logging for cs_entrymsg.
Revision 699087b - Sun, 20 May 2012 03:57:22 -0400 - Fixed cs_entrymsg loading entries from the database
Revision ccd2908 - Thu, 17 May 2012 03:57:19 -0400 - reinterpret_cast off of a virtual base does Bad Things
Revision a883362 - Thu, 17 May 2012 02:03:22 -0400 - Fixed not always calling operator bool() in dynamic_reference, which would mess up service references and do weird things
Revision ef88385 - Tue, 15 May 2012 17:19:50 -0400 - m_ldap_authentication: Removed the dependency on a specific binddn in favour of searching the tree for matching criteria and using the returned DN
Revision 90b0283 - Tue, 15 May 2012 04:27:36 -0400 - Grab the DN for every LDAP query and send it in the result
Revision 0a8d46b - Mon, 14 May 2012 22:30:03 -0400 - Fixed parsing FMODE on inspircd 1.1
Revision a84226e - Fri, 11 May 2012 00:50:58 -0400 - Do not show help for set message if useprivmsg is disabled
Revision 9370b06 - Thu, 10 May 2012 17:53:53 -0400 - Fixed crash on access del + valgrind errors
Revision d5ffae0 - Wed, 9 May 2012 03:37:37 -0400 - Made ssl cert and keyfiles configurable
Revision f895997 - Wed, 9 May 2012 03:11:57 +0100 - fixed paste error (failed awesomeness) in last commit.
Revision a81b3aa - Wed, 9 May 2012 01:23:34 +0100 - Fixed saving backups
Revision 820e4ed - Tue, 8 May 2012 18:04:49 -0400 - Fixed some 100% cpu bugs with the new SQL stuff, and fixed sqlite+db_sql_live
Revision 25586f3 - Tue, 8 May 2012 02:01:44 -0400 - Allow services operators to release other user's nicks, and allow services operators to view the access list of other operators
Revision b7149fc - Sun, 6 May 2012 21:44:11 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 675b113 - Sun, 6 May 2012 21:43:50 -0400 - Split up db/conf/lib/locale install directories, and allow alternate ones to be specified at runtime
Revision c797987 - Sat, 5 May 2012 09:35:18 +0200 - Readding missing valid nick check to ns register/group removed in os_forbid commit
Revision eb0e07d - Fri, 4 May 2012 16:03:02 -0400 - Use Unreal's MLOCK command if supported
Revision 1b5805e - Sun, 29 Apr 2012 20:39:33 -0400 - Set quitmsg on ERROR
Revision 42e652c - Sun, 29 Apr 2012 19:24:37 -0400 - Pull table schemas from SQL on startup so we can alter the schemas if we need to, fixed sqlite to work again
Revision 62818ab - Sun, 29 Apr 2012 15:43:51 -0400 - Added options:casemap to chose how case insensitive strings are compared, using ascii, rfc1459, or a locale installed on the system
Revision 4d9a96e - Fri, 27 Apr 2012 17:06:16 -0400 - Fixes to db_sql
Revision e490a54 - Fri, 27 Apr 2012 16:05:49 -0400 - Process defines even before includes, fixes defining{} pseudoclient names to something else in their respective configurations
Revision 5068483 - Fri, 27 Apr 2012 15:38:50 -0400 - Add db_sql:prefix allow prefixing all anope tables similarly, and changed db_sql to update the databases incrementally instead of one big flush
Revision 83ee20f - Wed, 25 Apr 2012 19:02:09 -0400 - Clarify access denied messages caused by NSSecureAdmins
Revision b08aa4e - Wed, 25 Apr 2012 18:49:53 -0400 - Check for os_sesion to exist before having defcon try and place session bans
Revision 1081ecd - Wed, 25 Apr 2012 14:29:50 -0400 - Fixed non-debug build
Revision 2370c16 - Tue, 24 Apr 2012 16:02:07 -0400 - Fixed build from the previous merge
Revision 3d84dc9 - Mon, 23 Apr 2012 05:17:02 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 573e49a - Mon, 23 Apr 2012 05:08:26 -0400 - Reworked live SQL support yet again
Revision 63c639e - Mon, 23 Apr 2012 05:07:06 -0400 - Fixed hashm checking in db_old and loading 1.9.1 databases
Revision fc00406 - Sun, 22 Apr 2012 02:57:17 -0400 - Fixed ./services --version etc not getting printed when stdout is a file/pipe/not a tty
Revision b752c3a - Fri, 13 Apr 2012 18:33:22 +0200 - fixed a bug in chanstats
Revision 7372b45 - Sun, 8 Apr 2012 19:29:56 +0200 - fixed a compile error in m_sqlite
Revision deb5196 - Sun, 8 Apr 2012 12:43:34 +0200 - Added Chanstats. It uses a new, improved database format and is not compatible with current phpdenora or magirc installations.
Revision 9e1fda2 - Sun, 8 Apr 2012 12:30:48 +0200 - Modified the SQL API to allow unescaped parameters (useful for passing row names and NULL values)
Revision 9d249ef - Fri, 6 Apr 2012 14:41:28 -0400 - Fixed unpacking questions from dns packets
Revision e03b73e - Fri, 6 Apr 2012 15:36:49 +0200 - Revert changes made to line endings.
Revision 6b473f2 - Fri, 6 Apr 2012 15:12:22 +0200 - Revert last commit cause guess what, I screwed things up
Revision 05bb80c - Fri, 6 Apr 2012 14:35:34 +0200 - Fixed mail function causing some MTAs to sent blank messages
Revision e6edc65 - Sun, 1 Apr 2012 20:50:46 +0200 - updated the german language file
Revision cf3124c - Sun, 1 Apr 2012 20:50:04 +0200 - fixed some typos
Revision 12a6a27 - Tue, 27 Mar 2012 19:14:55 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 31a0e67 - Tue, 27 Mar 2012 19:01:29 -0400 - Fixed unpacking multiple names from dns packets when one has multiple compression pointers. Currently this will just fail at unpacking the later name due to offsets being invalid. Also cleaned up the existing code and made unpacking error messages more helpful.
Revision 8d0b4a1 - Thu, 22 Mar 2012 07:30:38 +0100 - added a missing error message when a module file does not exist. this fixes bug #1401. also moved some debug messages to debug level 2
Revision 1b0ebca - Wed, 21 Mar 2012 22:20:18 +0100 - fixed bug #1399
Revision 0d100ff - Wed, 21 Mar 2012 20:25:25 +0100 - fixed ns_ajoin
Revision 88fd1da - Tue, 13 Mar 2012 21:07:10 -0400 - Fixed typos
Revision a069347 - Tue, 13 Mar 2012 19:26:11 -0400 - Actually check if the nicks arent registered, oops
Revision a26f4b9 - Tue, 13 Mar 2012 17:45:07 -0400 - Bug #1389 - readd RNG seed in the config and start DNS query ids off on a random number
Revision 053d6a2 - Tue, 13 Mar 2012 17:18:11 -0400 - Add a nickserv:unregistered_notice config option to send a message to unregistered users on connect. Suggested by Cronus.
Revision beae477 - Tue, 13 Mar 2012 16:58:14 -0400 - Bug #1382 - Save maxusercount and maxusertime
Revision cff91a5 - Sun, 11 Mar 2012 21:21:47 -0400 - Made gch files depend on the header they were generated from
Revision 92ed5d7 - Sun, 11 Mar 2012 16:44:44 -0400 - Fixed having multiple uplink blocks work right if the first uplink fails on startup
Revision 7800375 - Sun, 11 Mar 2012 05:20:28 -0400 - Bug #1384 - Fixed spacing of connection log message if users have no vhost - patch from cbiedl
Revision ab25815 - Mon, 5 Mar 2012 20:15:56 -0500 - Fixed backup databases having their names collide due to not separating month and day, #1383
Revision 8e01043 - Mon, 5 Mar 2012 14:29:48 -0500 - Fixed bs_kick syntax error
Revision b7a6d51 - Sun, 4 Mar 2012 10:18:25 +0100 - fixed the --dir commandline parameter
Revision 4ed844f - Fri, 2 Mar 2012 17:05:59 -0500 - Escape all column names when building sql queries
Revision 020467d - Mon, 27 Feb 2012 00:16:15 -0500 - Fixed db_old loading noexpire
Revision 141b87b - Sun, 26 Feb 2012 23:28:02 -0500 - Changed the OnChanDrop event to be called right before channels are dropped, not after
Revision a5b9e23 - Sun, 26 Feb 2012 23:23:15 -0500 - Added chanserv:require config option to set which modes must be on all registered channels. Prevents the core from always enforcing +r on every channel, even if chanserv is not loaded.
Revision a78790e - Sun, 26 Feb 2012 20:18:22 -0500 - Fixed vhost check on identify
Revision 07226fe - Sun, 26 Feb 2012 19:49:02 -0500 - Track plexus umode and cmode +C and renamed UMODE_NO_CTCP to match up with the names of other modes.
Revision e730138 - Sat, 25 Feb 2012 22:45:51 -0500 - Fixed missing #include in init.cpp
Revision 2bc3bd3 - Sat, 25 Feb 2012 00:06:02 -0500 - Do not send kills after sending XLines because it causes us to internally remove the user and then recieve a quit from the user (who is now nonexistant) once the IRCd processes the XLine
Revision 83456f6 - Fri, 24 Feb 2012 23:25:29 -0500 - Fixed akill setter and ids showing in akill reasons
Revision 601dc41 - Fri, 24 Feb 2012 14:54:44 -0500 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 2337b77 - Fri, 24 Feb 2012 14:53:34 -0500 - Fixed calculating bots channel count of assigned channels and fixed the order of saving memos (among other things)
Revision fde40de - Fri, 24 Feb 2012 01:50:21 +0000 - Tell users to use NickServ for registering nicks, not chanserv...
Revision ba32aad - Thu, 23 Feb 2012 02:32:49 +0000 - Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Revision 24811e5 - Wed, 22 Feb 2012 20:55:59 -0500 - Added a configuration option to make all nick registrations require admin verification
Revision f01aab5 - Thu, 23 Feb 2012 00:04:36 +0000 - Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Revision 3850b07 - Wed, 22 Feb 2012 18:12:02 -0500 - Added regex support for many commands, such as akill, sqline, snline, all of the */list commands, etc.
Revision 81e50dd - Wed, 22 Feb 2012 16:25:20 -0500 - Fixed db_old loading memo owners
Revision bd31fbb - Wed, 22 Feb 2012 14:41:36 -0500 - Also fixed m_proxyscan to handle users with invalid ips
Revision 0006606 - Tue, 21 Feb 2012 20:50:14 -0500 - Fixed m_dnsbl handling users with spoofs/other non ips
Revision 826de43 - Wed, 22 Feb 2012 00:28:58 +0000 - Fixed some trivial formatting
Revision b84e080 - Sun, 19 Feb 2012 20:54:55 -0500 - Made our message sources actual clients/servers, and put in a few more default messages for very standard things (KICK etc)
Revision 0ba58d7 - Sat, 18 Feb 2012 18:07:34 -0500 - Fixed some events
Revision 1536c5c - Sat, 18 Feb 2012 17:21:55 -0500 - Add users hostmask to access lists not nick when access add is used on a non registered user
Revision f2ce9cd - Sat, 18 Feb 2012 15:47:16 -0500 - Made mode lock del check status of the mode lock before removing it
Revision ee5cd84 - Sat, 18 Feb 2012 15:04:26 -0500 - Use C++11's explicit override feature if available
Revision 41e8d27 - Thu, 16 Feb 2012 16:02:17 -0500 - Fixed FreeBSD build
Revision e1f5fc6 - Wed, 15 Feb 2012 00:06:25 -0500 - Remove revision numbers as they're only ever set by Config reading git since we've switched off of SVN. Instead just use the hash for the current head when building. Also recheck the hash on every make not just Config.
Revision db59f1a - Tue, 14 Feb 2012 19:03:09 -0500 - Fixed detecting when to set +r and fixed crash on shutdown introduced by the last commit
Revision a9772cd - Tue, 14 Feb 2012 15:13:27 -0500 - Clean up and reorganize our header files
Revision 086790d - Mon, 13 Feb 2012 00:10:45 -0500 - Removed our RNG and just use the systems, it's not very widely used. Also made DNS query ids not random as they don't need to be.
Revision 1bc8e2a - Wed, 8 Feb 2012 18:00:24 -0500 - Removed operserv:notifications in favor of log blocks, as well as some other notifiications
Revision 089c85b - Sat, 4 Feb 2012 17:28:38 -0500 - Fixed WallBadOS
Revision 01194e3 - Sat, 4 Feb 2012 13:12:11 -0500 - Bump for 1.9.7-git
Revision f082530 - Fri, 3 Feb 2012 15:19:09 -0500 - Anope 1.9.6 Release
Revision b906656 - Fri, 3 Feb 2012 15:18:27 -0500 - Update version.log
Revision 378ae4c - Fri, 3 Feb 2012 15:18:06 -0500 - Regenerate language files
Revision ce2a0f7 - Tue, 31 Jan 2012 16:19:47 -0500 - Fixed a memory leak in m_ldap
Revision be5ba49 - Tue, 31 Jan 2012 15:44:04 -0500 - Not sure what I was thinking here
Revision b4f27da - Tue, 31 Jan 2012 15:35:51 -0500 - Bug #1365 - Fixed nickserv/confirm syntax for services opers
Revision d09a302 - Thu, 26 Jan 2012 17:04:59 -0500 - Also refuse to load memoserv modules if memoserv isn't loaded
Revision 0f90927 - Wed, 25 Jan 2012 16:13:38 -0500 - Added two common warning messages on Windows to ignore
Revision 52eaa7d - Wed, 25 Jan 2012 15:48:07 -0500 - Windows
Revision e88e37c - Tue, 24 Jan 2012 18:28:37 -0500 - Add some checks in ms_* to make sure memoserv really exists
Revision f10f49d - Tue, 24 Jan 2012 16:42:21 -0500 - Added missing expires column in /os akill view
Revision d06cdaa - Tue, 24 Jan 2012 16:35:54 -0500 - Fixed os_ignore to check against users real IPs, not to match against opers, and check for expired ignores on /os ignore list
Revision fc20bd7 - Tue, 24 Jan 2012 16:03:44 -0500 - Add tracking for Unreal's usermode +I
Revision b3d9412 - Sun, 22 Jan 2012 17:49:23 +0100 - added a french INSTALL file, thanks to MacLeod for translating
Revision 98feb1b - Sat, 21 Jan 2012 00:50:48 -0500 - Cleaned up bs_kick and fixed amsg kicker
Revision 94c302b - Fri, 20 Jan 2012 20:50:36 +0000 - Fixed param check from last commit
Revision cdb6bb8 - Fri, 20 Jan 2012 17:50:09 +0000 - Updated DEFCON and fixed Defcons disabling of the removed mlock command
Revision a851f84 - Fri, 20 Jan 2012 15:03:49 +0000 - Corrected some incorrect English
Revision a270a13 - Sun, 15 Jan 2012 02:59:09 -0500 - Fixed crash from last commit
Revision 964d63c - Sun, 15 Jan 2012 01:47:31 -0500 - Improve on db_sql_live_read
Revision f38faed - Sat, 14 Jan 2012 15:58:51 +0000 - Fixed an incorrect crash-causing response when an invalid option is specified in botservs kickers
Revision c462a69 - Fri, 13 Jan 2012 15:37:17 -0500 - Only match users nicks against access list entries if the entry is a mask... accidentally removed from an earlier fix for #1368
Revision 14a2c9c - Wed, 11 Jan 2012 19:04:40 -0500 - Fixed loading db_sql_live_read's configuration values on startup
Revision a52ed70 - Tue, 10 Jan 2012 17:58:56 -0500 - Don't ever attempt to process CTCPs as regular messages
Revision 7c03e60 - Tue, 10 Jan 2012 17:53:48 -0500 - Removed this "valid" ip check in cidr::cidr, is wrong for IPv6 and ::pton checks this anyway using inet_pton. Also fixed a comment Robby broke in chanserv.conf
Revision 1e9d88a - Tue, 10 Jan 2012 17:06:08 -0500 - Add support for Unreals extban ~a:
Revision 815e140 - Sun, 8 Jan 2012 19:42:48 -0500 - Fixed loading akill reasons
Revision f824557 - Sun, 8 Jan 2012 18:14:07 -0500 - Fixed topic lock on inspircd
Revision 830c5ca - Sat, 7 Jan 2012 16:21:31 -0500 - Cleanup of cs_tban
Revision 9e71394 - Sat, 7 Jan 2012 04:10:30 -0500 - Cleaned up a lot of log messages, help replies, fixed cs_tban, and other small fixes
Revision dd64eac - Sat, 7 Jan 2012 03:44:43 -0500 - Fixed users not being able to delete their own access with /cs access when using numbers, and clean up cs_xop slightly
Revision 4204ece - Mon, 2 Jan 2012 21:28:24 -0500 - Updated Copyright to 2012
Revision 60a5cc1 - Sat, 31 Dec 2011 03:04:44 -0500 - Bug #1369 - Fixed os_svsnick to allow changing the case of a users' nick
Revision 20aa4e8 - Sat, 31 Dec 2011 01:33:32 -0500 - Bug #1368 - check all members of a users gruop against the access list
Revision f1b05ac - Wed, 28 Dec 2011 12:49:04 -0500 - Fixed this back now unreal sends 0 for non logged in users
Revision a4bf770 - Wed, 28 Dec 2011 04:31:44 -0500 - Added ESVID support to unreal32 Also fixes a crash due to unreal's ESVID change when users connect.
Revision 150831c - Tue, 27 Dec 2011 23:11:14 -0500 - Made capab management a bit simplier
Revision 1a4157b - Fri, 23 Dec 2011 12:29:30 -0500 - Add DT_ALLOW_EMPTY config flag, allow fantasychars to be empty
Revision 3bcb285 - Thu, 22 Dec 2011 03:46:35 -0500 - Somehow these two modules got mixed up..
Revision 704dbe2 - Tue, 20 Dec 2011 18:38:37 -0500 - Updated /bs info output and note db_sql can truncate entire databases
Revision bbddf50 - Mon, 19 Dec 2011 17:13:38 -0500 - Fixed botserv kickers
Revision e5851ad - Mon, 19 Dec 2011 16:07:28 -0500 - Fixed saving databases with MySQL when shut down by SIGINT
Revision 03119f2 - Mon, 19 Dec 2011 15:41:14 -0500 - Made m_dnsbl ban IPs not hostnames
Revision 45fc3ce - Mon, 19 Dec 2011 15:37:15 -0500 - Fixed formatting of many lists and INFO outputs
Revision d320c73 - Sat, 17 Dec 2011 10:30:13 +0000 - Fixed entry messages not displaying.
Revision ca8ce89 - Sat, 17 Dec 2011 02:06:53 +0000 - Fixed a slight error in email registration/resend and some minor typos.
Revision c88a751 - Thu, 15 Dec 2011 02:29:13 -0500 - Add privilege ranks to determine how powerful privileges are
Revision 9ea030d - Thu, 15 Dec 2011 01:14:13 -0500 - Fixed access comparators
Revision ad14c81 - Mon, 12 Dec 2011 15:37:08 -0500 - Update channel last used times when founders use the channel, too
Revision 255a8da - Mon, 12 Dec 2011 15:26:59 -0500 - Added oper:require_oper configuration option
Revision 4211dcf - Sun, 11 Dec 2011 17:03:33 -0500 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 3c5337f - Sun, 11 Dec 2011 17:01:56 -0500 - Fixed translating messages with varargs sent directly to users, too
Revision d2f788c - Sun, 11 Dec 2011 05:17:19 +0000 - Added K to vhost_chars...
Revision fa54d5a - Thu, 8 Dec 2011 17:29:17 -0500 - Fixed a memory leak in m_sqlite
Revision aeefe16 - Mon, 5 Dec 2011 11:52:40 -0500 - Bug #1364 - fixed crash in /cs kick
Revision c80e784 - Sat, 3 Dec 2011 19:17:41 -0500 - Attempt to fix issue with modules having their link libraries in the wrong order.
Revision 620c08b - Fri, 25 Nov 2011 23:12:23 +0000 - Fixed some more errors in sql live-write, hopefully the last.
Revision 23a9270 - Fri, 25 Nov 2011 23:10:26 +0000 - Fixed a crash in ns saset when using mysql-write module
Revision cef3eb7 - Fri, 25 Nov 2011 00:44:31 -0500 - Remove send_cmd and replace it with a stringstream
Revision 12d0a73 - Mon, 21 Nov 2011 16:24:45 -0500 - Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Revision 0dd85f7 - Mon, 21 Nov 2011 16:17:17 -0500 - Fixed not translating messages using varargs
Revision 51d6e8e - Sun, 20 Nov 2011 18:41:46 -0500 - CMake handles strings and lists differently, so this should hopefully finally fix the linking issue.
Revision 3f14882 - Sun, 20 Nov 2011 18:34:13 -0500 - Apparently pstdint.h was NOT included way back with commit 377a7a9 to use something similar to stdint.h
Revision 5a17b06 - Sun, 20 Nov 2011 18:32:47 -0500 - Really fix linking in libraries (even if gettext isn't found on *nix), and a minor nitpick about the leading spaces on LINK_LIBS.
Revision bf8e4ac - Sun, 20 Nov 2011 16:09:59 -0500 - Attempt to fix where link libraries are set when compiling to fix failed builds on systems that require -ldl.
Revision 781ed11 - Sun, 20 Nov 2011 15:31:01 -0500 - Allow services operators to modify other users access list
Revision 6f8f749 - Fri, 18 Nov 2011 16:20:17 -0500 - Allow kicking and banning by mask
Revision c43cdf4 - Fri, 18 Nov 2011 11:22:01 -0500 - Added operserv/logout
Revision 8374211 - Fri, 18 Nov 2011 00:36:54 -0500 - Allow having multiple fantasy characters
Revision 69dfc72 - Thu, 17 Nov 2011 12:46:18 -0500 - Fixed storing mode locks
Revision 5281282 - Wed, 16 Nov 2011 16:22:58 -0500 - Fixed compile error
Revision 503eb42 - Tue, 15 Nov 2011 16:30:31 -0500 - Made looking up a level for a nonexistant privilege debugg log a warning, not abort
Revision 38d90c7 - Tue, 15 Nov 2011 16:27:32 -0500 - Fixed loading ssl certs for users
Revision 1356498 - Tue, 15 Nov 2011 16:22:02 -0500 - Prevent locking mode Z on unrealircd
Revision 9ed203c - Tue, 15 Nov 2011 16:16:38 -0500 - Fixed crash on shutdown & a compiler warning
Revision b5ff856 - Tue, 8 Nov 2011 17:29:16 -0500 - Windows
Revision 97b9055 - Sat, 5 Nov 2011 15:05:15 -0400 - Remove xlines from the IRCd aswell as from our list when the clear command is used, and fixed adding timed Zlines to inspircd
Revision 5f0b933 - Sat, 5 Nov 2011 00:11:49 -0400 - Set proper expirys on ZLines if the IRCd supports it
Revision b3194a1 - Fri, 4 Nov 2011 19:39:27 -0400 - Updated Changes
Revision d01f4ea - Fri, 4 Nov 2011 18:04:12 -0400 - Allow /os userlist to match host and ip too
Revision a42cafb - Fri, 4 Nov 2011 17:55:14 -0400 - Store flags for memos, fixed the expiring very soon message, fixed /os session view when a session exception is added at a lower limit than th default
Revision 066e5b3 - Fri, 4 Nov 2011 02:28:21 -0400 - Delete all tables before flushing not just ones we know about
Revision 09dba47 - Thu, 3 Nov 2011 18:59:51 -0400 - Added an assignment operator for Serializable because some STL containers use it which causes iterators to become invalidated
Revision ca33ac6 - Thu, 3 Nov 2011 02:28:29 -0400 - Bug #1354 - Allow mode chars to be used for channel prefixs in services.conf
Revision 302989b - Tue, 1 Nov 2011 01:11:26 -0400 - Clarify the message when users try to lock modes they don't have access to lock
Revision 22b7d9f - Tue, 1 Nov 2011 00:15:28 -0400 - Added a copy constructor to dynamic_reference to allow references to reference other references correctly
Revision 9dd71c4 - Sat, 29 Oct 2011 21:16:50 -0400 - Fixed the signal/fork/wait mess hopefully once and for all. fork() did not copy kqueue descriptors on freebsd which caused problems
Revision 655c1cc - Thu, 27 Oct 2011 18:21:49 -0400 - Fix a few warnings that only showed up with gcc 3.4.6 here (sadly, there is one on every file about anonymous variadic macros that I can't get rid of).
Revision d9333e0 - Thu, 27 Oct 2011 18:01:56 -0400 - Clear flags before rebuilding them from the databases. Fixes bug #1351 where default flags would always be set when unserializing objects.
Revision 39ac438 - Thu, 27 Oct 2011 15:09:31 -0400 - Ignore sigchld/usr2 sent to the child process after fork
Revision 0761a4a - Thu, 27 Oct 2011 14:46:20 -0400 - Bug #1350 + other related fixes
Revision 66ca256 - Thu, 27 Oct 2011 13:50:32 -0400 - Fixed loading exceptions in db_plain
Revision 961bb6e - Thu, 27 Oct 2011 00:13:00 +0100 - Fixed some typos/errors in the example configs comments.
Revision b14f5ea - Wed, 26 Oct 2011 16:52:00 -0400 - Fixed accidentally clearing botmodes when joins are sent
Revision bf66336 - Wed, 26 Oct 2011 15:29:45 -0400 - Bug #1347, fixed incorrect param parsing in cs_set_misc
Revision c79a575 - Wed, 26 Oct 2011 15:17:05 -0400 - Bug #1348 - Fixed /cs entrymsg list
Revision 8334128 - Wed, 26 Oct 2011 14:31:58 -0400 - Removed the old unordered_map code
Revision 7c62de1 - Mon, 24 Oct 2011 16:37:29 -0400 - Merge branch '1.9' of anope.git.sf.net:/gitroot/anope/anope into 1.9
Revision 377a7a9 - Mon, 24 Oct 2011 16:32:29 -0400 - Fixed bug #1349 (m_sqlite compiles without error under FreeBSD), as well as use C99's stdint.h (or cstdint if available) to get (u)intX_t types instead of our stupid typedefs. pstdint.h included in case there is no cstdint or stdint.h available.
Revision ccf29c0 - Mon, 24 Oct 2011 13:19:51 -0400 - Fixed the capab parser to parse capab tokens prefixed with :. Fixes not detecting quitstorm support on ratbox
Revision d0513d6 - Sat, 22 Oct 2011 16:11:26 -0400 - A few minor fixups
Revision f4a0bdd - Sat, 22 Oct 2011 12:45:55 -0400 - Added our own eventfd test for openvz machines which have eventfd but can not be used
Revision 3e2ac36 - Sat, 22 Oct 2011 11:35:31 -0400 - Bug #1343 - don't allow recovering and ghosting enforcers
Revision c8b3809 - Sat, 22 Oct 2011 11:21:21 -0400 - Added akill ids
Revision ad2ef75 - Sat, 22 Oct 2011 11:20:50 -0400 - Fixed a race condition with installing signal handlers and forking
Revision 6ce9010 - Fri, 21 Oct 2011 18:01:51 -0400 - Fixed extracting multiple words from our serializable stringstream
Revision d0afc8c - Fri, 21 Oct 2011 00:21:34 -0400 - Added m_rewrite
Revision 230b3bc - Thu, 20 Oct 2011 13:38:37 -0400 - Only fork if we are at term
Revision 1cfb630 - Thu, 20 Oct 2011 11:54:56 -0400 - Fixed a crash in clearusers
Revision d16f962 - Wed, 19 Oct 2011 12:59:16 -0400 - Bug #1342 - fixed tracking chmodes in bahamuts sjoin
Revision fc16746 - Tue, 18 Oct 2011 12:18:18 -0400 - Prevent chankill from akilling my clients
Revision eb5b5f9 - Tue, 18 Oct 2011 12:06:51 -0400 - Fixed compile errors on release build
Revision faea452 - Tue, 18 Oct 2011 01:48:05 -0400 - Reorder some stuff in Init & the ts6 proto mods to fix weirdness from bots being introduced by 3rd party modules
Revision 2c614d5 - Sat, 15 Oct 2011 02:08:52 -0400 - Fixed up anoperc to work with the newer startup method
Revision 89b4be6 - Sat, 15 Oct 2011 00:54:32 -0400 - Fixed crash on /os oper del
Revision 28ca0e1 - Fri, 14 Oct 2011 22:07:13 -0400 - Fork earlier in startup to prevent it messing up threads, if there are any
Revision 2504af7 - Fri, 14 Oct 2011 12:53:28 -0400 - Fixed os_forbid adds reason if no expiry is given
Revision ddc3c2f - Fri, 14 Oct 2011 12:20:07 -0400 - Added options:nonicknameownership config option
Revision 53275c3 - Tue, 11 Oct 2011 02:50:37 -0400 - Don't add new levels to existing channels default, screws with stuff when the config is reloaded
Revision f3f6727 - Tue, 11 Oct 2011 00:09:26 -0400 - Bug #1337
Revision 4681e3a - Mon, 10 Oct 2011 17:19:06 -0400 - Allow chanserv/suspend to take an expiry time
Revision 80f4f31 - Mon, 10 Oct 2011 15:04:23 -0400 - Put serialized_items on the heap to prevent weird crashes on shutdown from the list being destructed before members in it
Revision 9f3d735 - Mon, 10 Oct 2011 14:16:59 -0400 - Allow nickserv/suspend to take an expiry time
Revision 0e012f7 - Sun, 9 Oct 2011 21:29:34 -0400 - Check for being at terminal before forking
Revision 9f85033 - Sun, 9 Oct 2011 02:52:13 -0400 - Give more verbose messages on startup
Revision af273e3 - Sun, 25 Sep 2011 15:34:56 -0400 - Store flags for objects, also fixes bug #1333
Revision 1f3e96f - Sun, 25 Sep 2011 14:42:09 -0400 - Made channel privileges case insensitive
Revision e7ba639 - Sun, 25 Sep 2011 14:38:21 -0400 - Remove opnotice from example configs
Revision 1f2399d - Sun, 25 Sep 2011 04:19:15 -0400 - Added a new database format and sqlite support. Also moved db-convert to a module.
Revision 43201ea - Mon, 19 Sep 2011 18:35:40 -0400 - Fixed /os reload doing weird things to service channels, and allow setting modes by clients on burst
Revision 7dce64e - Mon, 19 Sep 2011 13:14:20 -0400 - Fixed missing _ in cs_appendtopic
Revision 1184eb5 - Mon, 19 Sep 2011 13:12:52 -0400 - Allow OnPreHelp to stop processing
Revision 4c2a492 - Mon, 19 Sep 2011 12:36:52 -0400 - Call fantasy events even if the commands for them don't exist
Revision be77a7e - Mon, 19 Sep 2011 12:29:54 -0400 - Bug #1334 - fixed crash on /os oper info
Revision 934723f - Mon, 19 Sep 2011 12:14:02 -0400 - LOG_COMMAND must now always give a valid command
Revision f07295c - Fri, 16 Sep 2011 14:07:33 -0400 - Bug #1332 - Fixed ValidateUser to not require secure off to disable nickserv kill
Revision 26c1d67 - Sat, 10 Sep 2011 16:27:10 -0400 - Fixed compile errors & warnings from 1.9.6 to 1.9 merge
Revision 3d5889c - Sat, 10 Sep 2011 16:08:58 -0400 - Updated channel flag names to remove LOGCHAN
Revision 213c1c4 - Sat, 10 Sep 2011 02:42:18 -0400 - Changed msgmerge to not use -E.. it will escape all of some languages and mess up poedit etc. Keep it in xgettext for the bold/underline characters.
Revision 63cb8ca - Sat, 10 Sep 2011 02:06:31 -0400 - Moved signal/thread/mode checking to use signal pipes
Revision dc5d1fa - Sat, 10 Sep 2011 02:06:31 -0400 - Made ChanServ privileges configurable
Revision 563d158 - Sat, 10 Sep 2011 02:06:31 -0400 - Allow Config to install cmake
Revision 1478b5b - Sat, 10 Sep 2011 02:06:29 -0400 - Added chanserv/log
Revision 19e0b87 - Sat, 10 Sep 2011 02:05:56 -0400 - Removed /bs set msg
Revision 17ea4ed - Sat, 10 Sep 2011 02:05:03 -0400 - Fixed service_reference to work correctly with external classes
Revision feaef7c - Sat, 10 Sep 2011 02:05:03 -0400 - Allow services to register or unregister themselves
Revision c6d3fbd - Sat, 10 Sep 2011 02:05:02 -0400 - Added kqueue
Revision 700a585 - Sat, 10 Sep 2011 02:05:00 -0400 - Allow modules to add their own channel levels
Revision 62752db - Sat, 10 Sep 2011 01:58:39 -0400 - Rewrote mlock saving/loading code to not use this silly extensible hack
Revision f025d1b - Sat, 10 Sep 2011 01:58:38 -0400 - Made service_reference type safe
Revision 8c4417c - Sat, 10 Sep 2011 01:58:38 -0400 - Removed opnotice
Revision d4db2b8 - Sat, 10 Sep 2011 01:58:38 -0400 - Made the IsValidHost checks configurable
Revision bb8e04c - Sat, 10 Sep 2011 01:58:35 -0400 - Added oper:host and oper:vhost
Revision b504791 - Sat, 10 Sep 2011 01:55:37 -0400 - Cleaned up the dns engine, and fixed sometimes parsing multiple answer queries incorrectly
Revision d5749c1 - Sat, 10 Sep 2011 01:55:37 -0400 - Fixed eventfd pipeengine to not add the same socket twice
Revision f54ab5e - Sat, 10 Sep 2011 01:55:29 -0400 - Squash merge of 1.9 to 1.9.6
Revision 1e45019 - Sat, 10 Sep 2011 01:55:11 -0400 - Added m_proxyscan
Revision 2eb708e - Sat, 10 Sep 2011 01:55:09 -0400 - Cleaned up some of the socket code, cleaned up the pipe engines, added support for binary sockets, and cleaned up the asynch connect/accept code
Revision 4fcb371 - Sat, 10 Sep 2011 01:52:59 -0400 - Track what "level" channel status modes are, which allows us to have chanserv/mode determine if a status mode can be set by users better
Revision 6401d93 - Sat, 10 Sep 2011 01:52:59 -0400 - Added chanserv/up and chanserv/down
Revision 8a9a39c - Sat, 10 Sep 2011 01:52:59 -0400 - Renamed the core pseudoclient modules to match their names
Revision 13e8b26 - Sat, 10 Sep 2011 01:52:59 -0400 - Made email messages sent by services configurable
Revision 8a6d657 - Sat, 10 Sep 2011 01:52:46 -0400 - Removed log:inhabitlogchannel and replaced it with service:channels
Revision 4a7ba7e - Sat, 10 Sep 2011 00:58:35 -0400 - Removed SZLine. Instead, have AKILL determine whether or not a ZLINE should be set.
Revision 2b5d9f3 - Sat, 10 Sep 2011 00:54:29 -0400 - Bump for 1.9.6 git
Revision 3a502f2 - Fri, 9 Sep 2011 23:28:58 -0400 - Anope 1.9.5 Release
Revision b6dad37 - Fri, 9 Sep 2011 23:28:37 -0400 - Update version.log
Revision 3cbad7f - Fri, 9 Sep 2011 23:27:15 -0400 - Regenerate language files
Revision b80a0a8 - Fri, 9 Sep 2011 22:27:51 -0400 - Updated Greek language file
Revision f844b0a - Fri, 9 Sep 2011 19:18:43 -0400 - Changed User::IsRecognized check to default to secure
@@ -782,7 +1070,7 @@ Revision 0d2d7e9 - Sun, 20 Jun 2010 20:05:23 -0400 - Fixed Windows build
Revision 63d7bee - Sun, 20 Jun 2010 18:51:03 -0400 - Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Revision 381c9c8 - Sun, 20 Jun 2010 18:42:58 -0400 - The first of a few "CBX OCDing over code style" commits, focusing on include/* and src/* but not src/core/* or src/modules/*.
Revision e8a1570 - Sun, 20 Jun 2010 14:04:17 -0400 - Added m_helpchan to replace the cores helpchannel functionality
Revision 968e4d0 - Sun, 20 Jun 2010 13:11:31 -0400 - Fixed the name of cs_forbid in chanserv:modules so it really loads
Revision 968e4d0b - Sun, 20 Jun 2010 13:11:31 -0400 - Fixed the name of cs_forbid in chanserv:modules so it really loads
Revision 7b7e2a6 - Sat, 19 Jun 2010 21:22:48 -0400 - Updated TODO
Revision 448eadd - Sat, 19 Jun 2010 20:53:53 -0400 - Made db-converter add all of the core clients when converting a 1.8 database
Revision 68b54f3 - Sat, 19 Jun 2010 13:39:12 -0400 - Made db-converter only write mlock params if there really is one, fixes some problems with converting mlock for certain databases
+1 -1
View File
@@ -9,7 +9,7 @@ if(WIN32)
endif(IN_SOURCE)
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
install(FILES ${DOCS}
DESTINATION docs
DESTINATION ${DOC_DIR}
)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/README.txt")
endif(WIN32)
+260 -252
View File
@@ -1,339 +1,347 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
Preamble
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the entire
whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years,
to give any third party, for a charge no more than your cost of
physically performing source distribution, a complete machine-readable
copy of the corresponding source code, to be distributed under the terms
of Sections 1 and 2 above on a medium customarily used for software
interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is allowed
only for noncommercial distribution and only if you received the program
in object code or executable form with such an offer, in accord with
Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent license
would not permit royalty-free redistribution of the Program by all those
who receive copies directly or indirectly through you, then the only way
you could satisfy both it and this License would be to refrain entirely
from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is implemented
by public license practices. Many people have made generous contributions
to the wide range of software distributed through that system in reliance
on consistent application of that system; it is up to the author/donor to
decide if he or she is willing to distribute software through any other
system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
This section is intended to make thoroughly clear what is believed to be
a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
How to Apply These Terms to Your New Programs
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make
it free software which everyone can redistribute and change under
these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
<one line to give the program's name and an idea of what it does.>
Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'. This is free software, and you are welcome
to redistribute it under certain conditions; type `show c'
for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+41
View File
@@ -1,3 +1,44 @@
Anope Version 1.9.8
--------------------
A Ability to configure fantasy commands in the config
A Add SVSJOIN and SVSPART commands
F Fix "leave" channel log level from not logging
F Fix users able to "resend" their registration mail with registration set to admin only
F Fix build on OpenBSD
F Fix not logging debug logs to the logfile when debug mode is enabled
F Fix defcon timeout timer
F Fix crash in os_forbid with expiring entries
F Fix several issues with db_sql_live
Anope Version 1.9.7
--------------------
A Added ability for using regex as patterns for various commands
A Extended ability of operserv/akill to also match against nick and realname
A Added chanserv:require configuration option
A Added nickserv:unregistered_notice and nickserv:registration configuration option
A Added options:casemap configuration option
A Added a web panel
A db_sql_live now allows all tables to be "live", not just a select few
Anope Version 1.9.6
--------------------
A Added ability to configure emails sent by services
A Added chanserv/up and chanserv/down
A Added m_proxyscan
A Added more configurability for what vhosts are valid
A Added chanserv/log
A Added ability to configure ChanServ privileges
A Added a new database format
A Added SQLite support
A Added more verbose messages on startup
A Added ability for chanserv/suspend and nickserv/suspend to take an expiry time
A Added no nickname ownership config option
A Added m_rewrite
A Added akill IDs
F Fixed crash in clearusers
F Fixed crash in /os oper info
F Fixed eventfd Config check to work properly on OpenVZ
Anope Version 1.9.5
--------------------
A Extended LDAP support
+30
View File
@@ -1,3 +1,33 @@
Anope Version 1.9.8
-------------------
networkinfo:chanlen added
options:user and options:group added
nickserv:modesonid added to set modes on everyone who identifies
nickserv:kill and nickserv:killquick added to configure NickServ's kill timeout
nickserv:restoreonrecover added to try to restore a user's session after a ghost
command:group added
fantasy block added
dns block has been moved to modules.conf as a part of m_dns
Anope Version 1.9.7
-------------------
operserv:notifications removed in favor of log{} blocks
options:regexengine added
options:casemap added
chanserv:require added
nickserv:registration added, emailregistration removed.
nickserv:unregistered_notice added
Anope Version 1.9.6
-------------------
service:channels added to join services to channels
mail block modified to allow configuring of email messages
oper:host and oper:vhost added
oper:require_oper added
options:nonicknameownership added
operserv:akillids added
nickserv/access oper privilege added
Anope Version 1.9.5
-------------------
Don't even try it, get a new config and start over.
+9 -12
View File
@@ -31,10 +31,11 @@ Anope DefCon
The DefCon system is part of Anope's core,
The DefCon system has to be configured on your services.conf file to
be enabled. The defcon module will not unload unless all non-optional
directives are set. Look for the defcon block
section on your services.conf file for more information.
The DefCon system has to be configured on your operserv.conf file to
be enabled. Defcon will be disabled if "defaultlevel" in the defcon
block is left commented, or set to 0. Look for the defcon block
on your operserv.conf file for more information on enabling and
configuring it.
Make sure you restart Anope after changing the DefCon configuration
directives.
@@ -45,7 +46,7 @@ Anope DefCon
No new channel registrations
No New Nick Registrations
No MLOCK changes
No Mode Lock changes
Force Chan Mode
Use Reduced Session Limit
KILL any new clients trying to connect
@@ -55,7 +56,7 @@ Anope DefCon
No new memos sent to block MemoServ attacks
Information regarding how to enable this for specific defcon levels can
be found in services.conf
be found in operserv.conf
4) Usage
@@ -70,22 +71,18 @@ Anope DefCon
/msg OperServ DEFCON 4
*** Global -- from OperServ: dengel Changed the DEFCON level to 4
-OperServ- Services are now at DEFCON 4
-OperServ- * No new channel registrations
-OperServ- * No new nick registrations
-OperServ- * No MLOCK changes
-OperServ- * No mode lock changes
-OperServ- * Use the reduced session limit of 5
-Global- The Defcon Level is now at Level: 4
-Global- The Defcon Level is now at: 4
Restore normal readiness:
/msg OperServ DEFCON 5
*** Global -- from OperServ: dengel Changed the DEFCON level to 5
-OperServ- Services are now at DEFCON 5
-Global- Services are now back to normal, sorry for any inconvenience
+209
View File
@@ -0,0 +1,209 @@
Installation et instructions d'anope
------------------------------------
1) Instalation d'anope
2) Mise à jour d'anope
3) Configuration de l'ircd
4) Mise en route de anope
5) Mise en place d'un fichier crontab
Note: Vous devrez également lire les fichiers README et FAQ !
1) Installation de anope
Note importante: il n'est pas recommandé d'utiliser (et même d'installer)
Anope en tant que root.
Utilisez un utilisateur non privilégié,
La première chose que vous devez faire est d'obtenir le package Anope (si ce n'est déjà fait).
Vous pouvez le trouver ici http://www.anope.org/
Anope peut être installer de deux façons.
1. La méthode recommandée est d'utiliser CMake.
Vous pouvez vérifier si CMake est déjà installé sur votre système en utilisant la
commande: cmake --version ( sur votre vps ou dedier etre loggué en root )
Si c'est installé, vous aurez une ligne qui dit quelque chose qui ressemble à
«version 2.6 cmake-patch 1".
Si la version est inférieure à 2,4 ou si vous obtenez une erreur disant que la commande n'a pas été trouvé,
vous ne serez pas en mesure d'utiliser CMake,
sauf si vous installez vous-même dans votre répertoire home. CMake
vous pouvez le téléchargé ici > http://www.cmake.org/cmake/resources/software.html
Si vous n'arrivez pas à installer (soit en raison du manque d'espace
ou de restrictions par votre fournisseur d'hébergement),
vous pouvez encore utiliser le script de configuration fournis.
Cette option n'est pas recommandée et finira par être retiré, mais il est fourni pour la compatibilité de ces
manque de CMake.
Ensuite, décompressez le package dans votre répertoire home, et allez dans le répértoire
qui viens d'être crée.
Maintenant, tapez ./Config pour lancer le script de configuration. Il va vous poser
quelques questions, et compiler Anope sur votre système.
Si vous ne savez pas repondre à une question, utilisez la valeur par défaut.
Vous pouvez maintenant taper make pour compiler Anope. S'il ya des erreurs dans la
Makefile, * essayez d'utiliser * gmake au lieu. Si cela ne fonctionne toujours pas, vous (ou
votre fournisseur ) doit installer GNU make. Vous pouvez
le Trouvez sur ftp://prep.ai.mit.edu/pub/gnu/.
Maintenant, tapez make install (ou gmake install; voir ci-dessus). Cela permet d'installer
tous les fichiers nécessaires dans les chemins que vous avez spécifié dans la configuration
script, et les permissions du fichier de configuration. Vous devez vous assurer que les données
répertoire ne sont pas accessible par d'autres utilisateurs, que des utilisateurs malveillants peuvent
causer des problèmes sur votre réseau, si les mots de passe ne sont pas cryptés, ou de lire
les mémos de tout utilisateur.
Si vous voyez des erreurs lors de ce processus, s'il vous plaît nous envoyer un mail avec le * complet *
sortie d'erreur, et n'oubliez pas de mentionner votre OS, compilateur et bibliothèque C + +
versions.
Maintenant, allez dans le répertoire de données (par défaut, cd ~/services/data). ouvrer exemple.conf
avec votre éditeur de texte favori. Il contient toute la configuration
directives. Anope va l'utiliser au démarrage. Lisez attentivement les instructions contenues dans
le fichier. l'utilisation des valeurs par defauld n'est pas recomment et anope ne risque pas de fonctionner
Si vous avez besoin d'aide, vous devez vous abonner à la mailing list et par courrier Anope
pour se faire aider par d'autres utilisateurs. Voir le fichier README pour plus de
informations.
2) Mise à jour Anope
Si vous avez un fichier .Diff et que vous voulez patcher les ancienne sources Anope avec,
effectuer les opérations suivantes:
* Copiez le fichier .Diff dans le répertoire racine des sources Anope.
* Type de patch-p1 <file.diff
Notez que la mise à jour anope avec un fichier patch n'est pas recommandé.
Vous devez télécharger une nouvelle source propre, car cela vous donnera les meilleurs résultats..
Pour mettre à jour Anope, suivez simplement les instructions d'installation décrites dans
l'article 1. Il y a cependant quelques règles spécifiques:
* IMPORTANT: Sauvegardez vos anciennes bases de données!
* Si vous mettez à jour vers une nouvelle version majeure, toujours redémarrer avec un
fichier de configuration neuve example.conf.
3) Mise en place du IRCd
Ce Services agit comme un serveur IRC avec des pseudo-clients sur elle. Pour les relier à
votre réseau, vous aurez besoin d'ajouter quelques lignes dans le ircd.conf de leur plate-forme
serveur (comme indiqué dans la directive de configuration RemoteServer).
Pour les échantillons ci-dessous, nous allons prendre services.localhost.net que le nom de la
Services (comme indiqué dans la directive de configuration ServerName). Notez que
présente des échantillons sont faites pour être aussi générique que possible, mais il pourrait y avoir
de petites variations, en fonction de votre IRCd. Pour IRCd aide spécifique aux
de configuration, lire près de la fin de cette section.
Tout d'abord, les lignes C / N, qui permettent aux services de crée un lien. Ils ont également besoin d'un
Y: ligne fonctionne correctement.
Y: 27:180:0:0:4000000
C: 127.0.0.1: mypass: services.localhost.net: 30
N: 127.0.0.1: mypass: services.localhost.net: 30
"mot de pass" est le même mot de passe que vous avez mentionné dans le RemoteServer
directive de configuration. 127.0.0.1 est l'adresse IP à partir de laquelle les services se connecterons
à partir de (reliant en localhost est le moyen le plus efficace pour exécuter les services).
Ensuite, vous avez à mettre en place un U:ligne, qui permettra aux services de changer
modes de canal, de sujets, et bien plus encore, sans être op sur le canal.
U: services.localhost.net: *: *
REMARQUE: si vous avez plus d'un serveur dans votre réseau, cette ligne doit
être ajouté sur tous les autres serveurs, où cela ne risque pas de fonctionner correctement.
Enfin, vous aurez besoin d'ajouter un H:ligne, pour permttre la commande OperServ JUPE
de fonctionner correctement.
H:*::Services.LocalHost.Net
Ne pas oublier de /rehash votre IRCd pour appliquer les modifications.
Une nouvelle tendance dans la configuration ircd hybride, Unreal et Bahamut, qui utilisent une approche plus
«Lisibles» sous forme de configuration. Pour ceux, utiliser quelque chose comme:
link services.localhost.net
{
username *;
hostname localhost;
bind-ip *;
port 6667;
hub *;
password-connect "mypass";
password-receive "mypass";
class servers;
};
Notez que ce bloc de fichiers de configuration de style est diffèrent
sur le IRCd. Consultez le fabricant de lien interactif (le lien est ci-dessous) pour plus
détails sur la configuration exacte utilisée par votre IRCd.
Si vous êtes incapable d'obtenir un lien avec votre IRCd après la lecture de cet article,
vous pouvez essayer le fabricant lien interactif, qui est situé au:
http://anope.org/ilm.php
4) A partir Anope
Allez dans le répertoire où les fichiers binaires ont été installés (par défaut, ce n'est
~/ Services/ bin). Tapez. /Services à lancer Anope.
S'il ya des erreurs de syntaxe dans le fichier de configuration, ils seront
affiche sur l'écran. Corrigez-les jusqu'à ce qu'il n'y à plus d'erreur.
Un démarrage réussi ne générera pas de message.
Donner aux services au moins une minute pour se connecté à votre réseau, comme certains
IRCds sur certains OS peut être très lent pour le processus de liaison. Si rien n'arrive après environ une minute,
il y a probablement un problème de configuration. Essayez
de lancer Anope en mode debug ./services-debug-nofork pour voir toutes les erreurs qu'il
rencontres, et d'essayer de les corriger.
Si vous avez besoin d'aide pour résoudre des erreurs, n'hésitez pas à vous abonner à la Anope
liste de diffusion et de poser là. Voir le fichier README pour plus de détails.
5) Mettre en place un crontab
Une entrée crontab vous permettra de vérifier périodiquement que Anope est
toujours en cours, et redémarrez-le s'il n'est pas.
D'abord renommer le script example.chk qui est dans le chemin de Anope (par défaut,
cela est ~/services/data) pour services.chk et le modifier. Vous aurez besoin de
modifier la partie configuration du fichier. Assurez-vous ensuite que le fichier est
marqué comme exécutable en tapant chmod + x services.chk, et essayer de lancer le
script pour voir si cela fonctionne (Anope ne doit pas être en marche lorsque vous faites cela ;))
Lorsque cela est fait, vous devrez ajouter l'entrée crontab. Type de crontab-e.
Cela va ouvrir l'éditeur de texte par défaut avec le fichier crontab. Entrez le chemin
suivant (avec le chemin correct):
* / 5 * * * * /home/ircd/services/data/services.chk> /dev/nul 2> & 1
Le * / 5 au commencement signifie "vérifier toutes les 5 minutes". Vous pouvez remplacer
le 5 avec un autre numéro si vous voulez (mais moins de 60). Consulter
pages de manuel de votre système pour plus de détails sur la syntaxe de la crontab
fichier. Intéressant pages de manuel sont crontab (5), crontab (1) et cron (8).
Sauvegarder et quitter, et il est installé.
+2 -2
View File
@@ -35,12 +35,12 @@ Anope Mutli Language Support
want translated (messages to the user, etc).
If you want to translate a module someone has made, first generate a .pot file if there isn't one already using
`xgettext -s -d modulename -o modulename.pot --from-code=utf-8 modulename.cpp`.
`xgettext -s -d modulename -o modulename.pot --from-code=utf-8 --keyword --keyword=_ modulename.cpp`.
The .pot file is a template of all of the language strings extracted from the source file.
Next, run msginit on the .pot file with
`msginit -l language -o modulename.language.po -i modulename.pot`.
Translate the new .po file and rerun ./Config; make && make install.
All .po and .pot files should be placed in modules/language/third. Additionally an update script is provided there
All .po and .pot files should be placed in modules/third/language. Additionally an update script is provided there
that will create .pot files and merge any changes to it with existing .po files.
+42 -38
View File
@@ -22,16 +22,16 @@ Anope Modules
1. If modules are supported by your system, they will be configured
automatically when you run ./Config. The modules will be installed
to the modules directory in your data path (by default this will
be ~/services/modules).
be ~/services/data/modules).
Note: you might need to run "make distclean" prior to running ./Config
2. Compile Anope as usual using ./Config. The "make" process will now
compile module support into Anope, and compile the default sample
modules, and any other module located in the modules folder or any
of its sub-directories, eg. modules/extra.
2. Compile Anope as usual. The (g)make process will now compile module
support into Anope, and compile the default sample modules, and/or
any other module located on the modules folder ("src/modules/").
3. Install Anope as usual. The install process will place the compiled
modules in their runtime location, making them available for loading.
3. Install Anope as usual. The "make install" process will place the
compiled modules in their runtime location, making them available
for loading.
4. Start or restart services to make use of the new Anope executable.
Note that you do not need to restart to load new or changed modules,
@@ -42,59 +42,64 @@ Anope Modules
All module manipulation commands are done through OperServ. These are:
MODLOAD Load a module
MODRELOAD Reload a module
MODUNLOAD Un-Load a module
MODLIST List loaded modules
MODINFO Info about a loaded module
These commands available to Service Roots only.
Access to the above commands require the operserv/modload and modlist
permissions. Refer to operserv.example.conf.
You can also load (and pre-load) Modules automatically by loading them
on startup. To do so, edit your services.conf file and change the values
of "ModuleAutoload" and "ModuleDelayedAutoload" to include the modules
you want to load every time Anope starts.
on startup. To do so, edit any one of the configuration files (you may
want to use modules.conf for third-party/extra modules, or a config
file relevant to the *Serv your module operates on, eg. hostserv.conf),
and use the following method to load a module on startup or reload:
module { name="hs_modname" }
4) Usage Example
/msg OperServ modload hs_moo
*** Global -- from OperServ: dengel loaded module hs_moo
-OperServ- Module hs_moo loaded
/msg OperServ modload ns_identify
-OperServ- Module ns_identify loaded
/msg OperServ modinfo hs_moo
-OperServ- Module: hs_moo Version: 1.1 Author: Anope loaded: Mar 21 10:54:37 2004 CLT
-OperServ- Providing command: /msg HostServ moo
/msg OperServ modinfo ns_identify
-OperServ- Module: ns_identify Version: 1.9.7 Author: Anope loaded: Jun 17 18:43:08 2012 BST (2 minutes ago)
-OperServ- Providing service: nickserv/identify
-OperServ- Command ID on NickServ is linked to nickserv/identify
-OperServ- Command IDENTIFY on NickServ is linked to nickserv/identify
/msg HostServ moo
-HostServ- MOO! - This command was loaded via a module!
/msg OperServ modreload ns_identify
-OperServ- Module ns_identify reloaded
/msg OperServ modunload hs_moo
*** Global -- from OperServ: dengel unloaded module hs_moo
-OperServ- Module hs_moo unloaded
/msg OperServ modunload ns_identify
-OperServ- Module ns_identify unloaded
/msg HostServ moo
-HostServ- Unknown command moo. "/msg HostServ HELP" for help.
/msg NickServ IDENTIFY
-NickServ- Unknown command identify. "/msg NickServ HELP" for help.
NOTE: Doing the above, with the command still existing in a config file,
will result in a log message, similar to the following:
<@NickServ> Command IDENTIFY exists on me, but its service nickserv/identify was not found!
* Note that the name of the module file is "hs_moo.c", yet we load
and reference the module as "hs_moo" only. By naming convention
* Note that the name of the module source file is "ns_identify.cpp", yet we
load and reference the module as "ns_identify" only. By naming convention
modules have an abbreviated service name they attach to (hs_ for
HostServ, cs_ for ChanServ, etc) followed by a descriptive keyword.
5) More Modules
Anope ships with three sample modules that only illustrates some of the
implemented module capabilities. They don't really do much or anything
useful.
You can download more useful modules from http://modules.anope.org/. Just
grab the module file (usually with a .c extension). Place the module
file in your modules (src/modules) folder; the same folder that contains
both hs_moo.c and catserv.c module files.
grab the module file (usually with a .cpp extension). Place the module
file in your modules (anope-1.9.x/modules/third) folder; although any of
the other folders within the modules directory will work.
The new modules need to be compiled and installed before you can make
use of them:
1. Make sure you're in the main source directory. (usually anope-1.X.XX/)
2. Run `make modules` to compile any new or changed modules.
3. Run `make install` to install the modules.
2. Run ./Config to find and configure modules, then `cd build`.
3. Run `make` to compile Anope, and any modules.
4. Run `make install` to copy the compiled binaries to the ~/services/
directory.
You can now use /msg OperServ MODLOAD to load the new modules.
@@ -115,7 +120,6 @@ Anope Modules
* http://wiki.anope.org/
8) Modules Repository
You can find modules at http://modules.anope.org
+10 -2
View File
@@ -1,7 +1,7 @@
Anope -- a set of IRC services for IRC networks
-----------------------------------------------
Anope is 2003-2011 Anope Team <team@anope.org>.
Anope is 2003-2013 Anope Team <team@anope.org>.
Based on Epona 2000-2002 PegSoft <epona@pegsoft.net>.
Based on Services 1996-1999 Andrew Church <achurch@achurch.org>.
@@ -116,6 +116,12 @@ Table of Contents
* Christopher N. <saka@epiknet.org> (fr.l)
* Yusuf Kurekci <ysfm.20@gmail.com> (tr.l)
Anope Web panel:
* Thomas Edwards <thomas.edwards@ilkotech.co.uk>
* Luke Thompson <luke.thompson@ilkotech.co.uk>
* Matthew M. <mcm@they-got.us>
2) Presentation
Anope is a set of Services for IRC networks that allows users to manage
@@ -165,10 +171,12 @@ Table of Contents
Anope currently works with:
* Bahamut 1.4.27 or later (including 1.8)
* Hybrid 8.0 or later
* InspIRCd 1.1, 1.2, or 2.0
* ngIRCd 19.2 or later
* Plexus 3 or later
* Ratbox 2.0.6 or later
* UnrealIRCd 3.2 or later
* Plexus 3 or later
Anope could also work with some of the daemons derived by the ones listed
above, but there's no support for them if they work or don't work.
-36
View File
@@ -1,36 +0,0 @@
Legend:
x = done
? = unsure
+ = in progress
1.9.5
-----
[+] More LDAP
[x] Rewrite silly forbid system
[x] Fix the modules language system to work without needing its own functions..
[x] Rewrite commands system
[x] Rewrite access system
[x] NS INFO: separate field for last seen realhost, shown to SRA only
[x] Configurable bot usermodes
Future
------
[ ] NS IDENTIFY changes
[?] Last failed identify? Maybe more useful for sopers only, so users don't get unnecessarily worried
[?] Last successful login time/ip? perhaps both of these should be a new nick setting
[ ] NS SUSPEND: show suspender and reason, probably to sopers only (see CS SUSPEND)
[ ] Allow channel founders to change the fantasy trigger for their channel.
[+] CIDR Akills, session exceptions, etc
[?] Language charset stuff, including collation (1.9.1? phoenix?)
[?] a way for a module to queue itself (or even another module) for unloading
[+] Useful/common "third party" modules to core distro
[x] NS AJOIN
[x] CS ENTRYMSG
[?] Don't allow soper accounts to expire
[?] Reason for CS SET RESTRICTED
[ ] Unique IDs on each AKILL/blah so that networks may use them as ticket IDs
[ ] HS ACTIVATE -ALL (rob sez this all needs reviewing)
[ ] No nickname ownership?
[ ] More commands need to be split up such as /bs bot, /ms set, /bs kick, /bs set, /os set? etc.
[ ] Customize email messages
+2 -3
View File
@@ -16,9 +16,8 @@ Anope Bundled Tools
sendmailpath = "/home/anope/services/bin/anopesmtp 127.0.0.1"
If the SMTP client doesn't send mail, or if there's an other problem with
it, you can compile it in debug mode. To do this, open anopesmtp.cpp, and look
for "smtp_debug" near the top. Change this from 0 to 1 and recompile
the code. This should generate a log file of what happened when it tried
it, you can enable debug mode by passing the --debug flag after the server
address. This should generate a log file of what happened when it tried
to connect to the SMTP server.
Credits:
+4 -25
View File
@@ -25,37 +25,16 @@ Anope for Windows
(NOTE: When installing, tell CMake to add itself to the PATH.)
If you have Visual C++ 10 (2010) skip ahead to step 2, else you
need to download the following free components from Microsoft. Once
downloaded, install these packages.
If you have Visual C++ 10 or 11 (2010/2012) skip ahead to step 2, else you
need to download and install the following free component from Microsoft.
* Microsoft Visual C++ 2010 Express Edition:
http://www.microsoft.com/express/vc/
or
then download and install:
* Microsoft Windows 2008 SDK:
http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en
(NOTE: Although they say for Windows Server 2003 or 2008, they do infact work on all supported
versions of Windows. When installing the 2003 SDK, you should select the Custom option, and only select
to have the Microsoft Windows Core SDK installed. When installing the 2008 SDK, you should select the
Custom option, and only select to have the Developer Tools installed, but also expand that and deselect
the Visual C++ Compilers as well as the Mobile Tools. Doing this will decrease the install time as well
as the space used by the SDK.)
http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express
2) Unpack the Anope tarball with your favorite uncompression program
(WinZip or WinRAR, etc).
3) (Note before this step: If you fall under one of the situations at the end of Step 1 where it says that the
SDK will not work out of the box, do not bring up the Visual C++ Command Prompt by using the link in
the Windows Start Menu. Instead, edit vsvars32.bat in the directory where you unpacked the source code
in step 2, so the first line that says "@SET VSINSTALLDIR=<whatever>" has the directory where you installed
Visual C++ Express to, if different from the default. Save the file and then run it instead.)
Bring up the Visual C++ Command Prompt; This will launch a
3) Bring up the Visual C++ Command Prompt; This will launch a
DOS Command Prompt like window, which will set the environment
properties needed to make Anope.
+2 -2
View File
@@ -17,9 +17,9 @@ channel - Takes one parameter, a channel name, and returns real time information
user - Takes one parameter, a user name, and returns real time information regarding that user.
XMLRPC was designed to be used with db_mysql, and will not return any information that can be pulled from the SQL
XMLRPC was designed to be used with db_sql, and will not return any information that can be pulled from the SQL
database, such as accounts and registered channel information. It is instead used for pulling realtime data such
as users and channels currently onlive. For examples on how to use these calls in PHP, see xmlrpc.php in docs/XMLRPC.
as users and channels currently online. For examples on how to use these calls in PHP, see xmlrpc.php in docs/XMLRPC.
Also note that the parameter named "id" is reserved for query ID. If you pass a query to Anope containing a value for id. it will
be stored by Anope and the same id will be passed back in the result.
+10 -21
View File
@@ -1,33 +1,18 @@
<?php
/* XMLRPC Functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
*/
class AnopeXMLRPC
{
private $Host, $Bind, $Port;
private $Host;
private $Socket;
function __construct($Host, $Port, $Bind = NULL)
function __construct($Host)
{
$this->Host = $Host;
$this->Port = $Port;
$this->Bind = $Bind;
$this->Socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($Bind && socket_bind($this->Socket, $this->Bind) == false)
$his->Socket = false;
if (socket_connect($this->Socket, $this->Host, $this->Port) == false)
$this->Socket = false;
}
function __destruct()
{
@socket_close($this->Socket);
}
/** Run an XMLRPC command. Name should be a query name and params an array of parameters, eg:
@@ -40,10 +25,12 @@ class AnopeXMLRPC
function RunXMLRPC($name, $params)
{
$xmlquery = xmlrpc_encode_request($name, $params);
socket_write($this->Socket, $xmlquery);
$context = stream_context_create(array("http" => array(
"method" => "POST",
"header" => "Content-Type: text/xml",
"content" => $xmlquery)));
$inbuf = socket_read($this->Socket, 4096);
$inbuf = substr($inbuf, strpos($inbuf, "\r\n\r\n") + 4);
$inbuf = file_get_contents($this->Host, false, $context);
$response = xmlrpc_decode($inbuf);
if (isset($response[0]))
@@ -98,4 +85,6 @@ class AnopeXMLRPC
}
}
$anopexmlrpc = new AnopeXMLRPC("http://127.0.0.1:8080/xmlrpc");
?>
+25 -10
View File
@@ -7,7 +7,7 @@ get_target_property(version_BINARY version LOCATION)
# Modify version.h from the above executable, with dependencies to version.cpp
# and all of the source files in the main build
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_build
COMMAND ${version_BINARY} ${Anope_SOURCE_DIR}/src/version.sh ${CMAKE_CURRENT_BINARY_DIR}/version.h
COMMAND ${version_BINARY} ${Anope_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/version.h
DEPENDS version ${SRC_SRCS}
)
# Add version to list of files for CPack to ignore
@@ -18,13 +18,27 @@ if(NOT WIN32)
endif(NOT WIN32)
set(PCH_SOURCES_GCH "")
if(CMAKE_COMPILER_IS_GNUCXX)
string(REPLACE " " ";" PCH_CXXFLAGS ${CXXFLAGS})
file(GLOB INCLUDE_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
remove_item_from_list(INCLUDE_SRCS "version.h")
if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
string(REPLACE " " ";" PCH_CXXFLAGS "${CXXFLAGS} ${CMAKE_CXX_FLAGS}")
file(GLOB PCH_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
sort_list(PCH_SOURCES)
set(PCH_SOURCES "module.h;modules.h;services.h")
foreach(PCH_SOURCE ${PCH_SOURCES})
find_includes(${PCH_SOURCE} INCLUDES)
set(INCLUDES_LIST)
append_to_list(INCLUDES_LIST ${PCH_SOURCE})
foreach(INCLUDE ${INCLUDES})
# Extract the filename from the #include line
extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE)
if(QUOTE_TYPE STREQUAL "quotes")
find_in_list(PCH_SOURCES "${FILENAME}" FOUND)
if(NOT FOUND EQUAL -1)
append_to_list(INCLUDES_LIST ${FILENAME})
endif(NOT FOUND EQUAL -1)
endif(QUOTE_TYPE STREQUAL "quotes")
endforeach(INCLUDE)
set(PCH_EXTRAFLAGS "")
if(DEBUG_BUILD)
set(PCH_EXTRAFLAGS "-g")
@@ -33,16 +47,17 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC)
endif(PCH_SOURCE STREQUAL "module.h")
if(GETTEXT_INCLUDE)
set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}")
set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}")
endif(GETTEXT_INCLUDE)
set(PCH_SOURCES_GCH "${PCH_SOURCES_GCH};${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
COMMAND ${CMAKE_CXX_COMPILER} ARGS ${PCH_CXXFLAGS} ${PCH_EXTRAFLAGS} ${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
DEPENDS ${INCLUDE_SRCS} VERBATIM
COMMAND ${CMAKE_CXX_COMPILER} ARGS ${PCH_CXXFLAGS} ${PCH_EXTRAFLAGS}
${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} -I${Anope_SOURCE_DIR}/modules/pseudoclients ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
DEPENDS ${INCLUDES_LIST} VERBATIM
)
endforeach(PCH_SOURCE ${PCH_SOURCES})
endif(CMAKE_COMPILER_IS_GNUCXX)
endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
# Add a custom target to the above file
add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH})
+121 -55
View File
@@ -1,62 +1,84 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef ACCESS_H
#define ACCESS_H
enum ChannelAccess
#include "services.h"
#include "anope.h"
#include "serialize.h"
#include "service.h"
enum
{
CA_ACCESS_LIST,
CA_NOKICK,
CA_FANTASIA,
CA_GREET,
CA_AUTOVOICE,
CA_VOICEME,
CA_VOICE,
CA_INFO,
CA_SAY,
CA_AUTOHALFOP,
CA_HALFOPME,
CA_HALFOP,
CA_KICK,
CA_SIGNKICK,
CA_BAN,
CA_TOPIC,
CA_MODE,
CA_GETKEY,
CA_INVITE,
CA_UNBAN,
CA_AUTOOP,
CA_OPDEOPME,
CA_OPDEOP,
CA_AUTOPROTECT,
CA_AKICK,
CA_BADWORDS,
CA_ASSIGN,
CA_MEMO,
CA_ACCESS_CHANGE,
CA_PROTECTME,
CA_PROTECT,
CA_SET,
CA_AUTOOWNER,
CA_OWNERME,
CA_OWNER,
CA_FOUNDER,
CA_SIZE
ACCESS_INVALID = -10000,
ACCESS_FOUNDER = 10001
};
class ChanAccess;
/* A privilege, probably configured using a privilege{} block. Most
* commands require specific privileges to be executed. The AccessProvider
* backing each ChanAccess determines whether that ChanAccess has a given
* privilege.
*/
struct CoreExport Privilege
{
Anope::string name;
Anope::string desc;
/* Rank relative to other privileges */
int rank;
Privilege(const Anope::string &name, const Anope::string &desc, int rank);
bool operator==(const Privilege &other) const;
};
class CoreExport PrivilegeManager
{
static std::vector<Privilege> Privileges;
public:
static void AddPrivilege(Privilege p);
static void RemovePrivilege(Privilege &p);
static Privilege *FindPrivilege(const Anope::string &name);
static std::vector<Privilege> &GetPrivileges();
static void ClearPrivileges();
};
/* A provider of access. Only used for creating ChanAccesses, as
* they contain pure virtual functions.
*/
class CoreExport AccessProvider : public Service
{
public:
AccessProvider(Module *o, const Anope::string &n);
AccessProvider(Module *owner, const Anope::string &name);
virtual ~AccessProvider();
/** Creates a new ChanAccess entry using this provider.
* @return The new entry
*/
virtual ChanAccess *Create() = 0;
private:
static std::list<AccessProvider *> Providers;
public:
static const std::list<AccessProvider *>& GetProviders();
};
class CoreExport ChanAccess
/* Represents one entry of an access list on a channel. */
class CoreExport ChanAccess : public Serializable
{
public:
/* The provider that created this access entry */
AccessProvider *provider;
ChannelInfo *ci;
/* Channel this access entry is on */
Serialize::Reference<ChannelInfo> ci;
Anope::string mask;
Anope::string creator;
time_t last_seen;
@@ -64,26 +86,70 @@ class CoreExport ChanAccess
ChanAccess(AccessProvider *p);
virtual ~ChanAccess();
virtual bool Matches(User *u, NickCore *nc) = 0;
virtual bool HasPriv(ChannelAccess priv) = 0;
virtual Anope::string Serialize() = 0;
virtual void Unserialize(const Anope::string &data) = 0;
bool operator>(ChanAccess &other);
bool operator<(ChanAccess &other);
bool operator>=(ChanAccess &other);
bool operator<=(ChanAccess &other);
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Check if this access entry matches the given user or account
* @param u The user
* @param nc The account
*/
virtual bool Matches(const User *u, const NickCore *nc) const;
/** Check if this access entry has the given privilege.
* @param name The privilege name
*/
virtual bool HasPriv(const Anope::string &name) const = 0;
/** Serialize the access given by this access entry into a human
* readable form. chanserv/access will return a number, chanserv/xop
* will be AOP, SOP, etc.
*/
virtual Anope::string AccessSerialize() const = 0;
/** Unserialize this access entry from the given data. This data
* will be fetched from AccessSerialize.
*/
virtual void AccessUnserialize(const Anope::string &data) = 0;
/* Comparison operators to other Access entries */
bool operator>(const ChanAccess &other) const;
bool operator<(const ChanAccess &other) const;
bool operator>=(const ChanAccess &other) const;
bool operator<=(const ChanAccess &other) const;
};
/* A group of access entries. This is used commonly, for example with ChannelInfo::AccessFor,
* to show what access a user has on a channel because users can match multiple access entries.
*/
class CoreExport AccessGroup : public std::vector<ChanAccess *>
{
public:
ChannelInfo *ci;
NickCore *nc;
bool SuperAdmin, Founder;
/* Channel these access entries are on */
const ChannelInfo *ci;
/* Account these entries affect, if any */
const NickCore *nc;
/* super_admin always gets all privs. founder is a special case where ci->founder == nc */
bool super_admin, founder;
AccessGroup();
bool HasPriv(ChannelAccess priv) const;
ChanAccess *Highest() const;
/** Check if this access group has a certain privilege. Eg, it
* will check every ChanAccess entry of this group for any that
* has the given privilege.
* @param priv The privilege
* @return true if any entry has the given privilege
*/
bool HasPriv(const Anope::string &priv) const;
/** Get the "highest" access entry from this group of entries.
* The highest entry is determined by the entry that has the privilege
* with the highest rank (see Privilege::rank).
* @return The "highest" entry
*/
const ChanAccess *Highest() const;
/* Comparison operators to other AccessGroups */
bool operator>(const AccessGroup &other) const;
bool operator<(const AccessGroup &other) const;
bool operator>=(const AccessGroup &other) const;
+223 -173
View File
@@ -1,122 +1,69 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include "extensible.h"
#include "serialize.h"
#include "anope.h"
#include "memo.h"
#include "base.h"
class NickAlias;
class NickCore;
typedef Anope::hash_map<NickAlias *> nickalias_map;
typedef Anope::hash_map<NickCore *> nickcore_map;
typedef Anope::insensitive_map<NickAlias *> nickalias_map;
typedef Anope::insensitive_map<NickCore *> nickcore_map;
extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
extern CoreExport Serialize::Checker<nickcore_map> NickCoreList;
extern CoreExport nickalias_map NickAliasList;
extern CoreExport nickcore_map NickCoreList;
/* NickServ nickname structures. */
/** Flags set on NickAliases
/* A registered nickname.
* It matters that Base is here before Extensible (it is inherited by Serializable)
*
* Possible flags:
* NO_EXPIRE - Nick never expires
* HELD - This nick is being held after a kill by an enforcer client
* or is being SVSHeld.
* COLLIDED - We are taking over this nick, either by SVSNICK or KILL
* and are waiting for the confirmation of either of these actions to
* proceed. This is checked in NickAlias::OnCancel
*
*/
enum NickNameFlag
class CoreExport NickAlias : public Serializable, public Extensible
{
NS_BEGIN,
Anope::string vhost_ident, vhost_host, vhost_creator;
time_t vhost_created;
/* Nick never expires */
NS_NO_EXPIRE,
/* This nick is being held after a kill by an enforcer client
* or is being SVSHeld. Used by ns_release to determin if something
* should be allowed to be released
*/
NS_HELD,
/* We are taking over this nick, either by SVSNICK or KILL.
* We are waiting for the confirmation of either of these actions to
* proceed. This is checked in NickAlias::OnCancel
*/
NS_COLLIDED,
NS_END
};
const Anope::string NickNameFlagStrings[] = {
"BEGIN", "NO_EXPIRE", "HELD", "COLLIDED", ""
};
/** Flags set on NickCores
*/
enum NickCoreFlag
{
NI_BEGIN,
/* Kill others who take this nick */
NI_KILLPROTECT,
/* Dont recognize unless IDENTIFIED */
NI_SECURE,
/* Use PRIVMSG instead of NOTICE */
NI_MSG,
/* Don't allow user to change memo limit */
NI_MEMO_HARDMAX,
/* Notify of memos at signon and un-away */
NI_MEMO_SIGNON,
/* Notify of new memos when sent */
NI_MEMO_RECEIVE,
/* Don't show in LIST to non-servadmins */
NI_PRIVATE,
/* Don't show email in INFO */
NI_HIDE_EMAIL,
/* Don't show last seen address in INFO */
NI_HIDE_MASK,
/* Don't show last quit message in INFO */
NI_HIDE_QUIT,
/* Kill in 20 seconds instead of in 60 */
NI_KILL_QUICK,
/* Kill immediatly */
NI_KILL_IMMED,
/* User gets email on memo */
NI_MEMO_MAIL,
/* Don't show services access status */
NI_HIDE_STATUS,
/* Nickname is suspended */
NI_SUSPENDED,
/* Autoop nickname in channels */
NI_AUTOOP,
/* This nickcore is forbidden, which means the nickalias for it is aswell */
NI_FORBIDDEN,
/* If set means the nick core does not have their email addrses confirmed.
*/
NI_UNCONFIRMED,
NI_END
};
const Anope::string NickCoreFlagStrings[] = {
"BEGIN", "KILLPROTECT", "SECURE", "MSG", "MEMO_HARDMAX", "MEMO_SIGNON", "MEMO_RECEIVE",
"PRIVATE", "HIDE_EMAIL", "HIDE_MASK", "HIDE_QUIT", "KILL_QUICK", "KILL_IMMED",
"MEMO_MAIL", "HIDE_STATUS", "SUSPENDED", "AUTOOP", "FORBIDDEN", "UNCONFIRMED", ""
};
class NickCore;
class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_END>
{
public:
/** Default constructor
Anope::string nick;
Anope::string last_quit;
Anope::string last_realname;
/* Last usermask this nick was seen on, eg user@host */
Anope::string last_usermask;
/* Last uncloaked usermask, requires nickserv/auspex to see */
Anope::string last_realhost;
time_t time_registered;
time_t last_seen;
/* Account this nick is tied to. Multiple nicks can be tied to a single account. */
Serialize::Reference<NickCore> nc;
/** Constructor
* @param nickname The nick
* @param nickcore The nickcofe for this nick
* @param nickcore The nickcore for this nick
*/
NickAlias(const Anope::string &nickname, NickCore *nickcore);
/** Default destructor
*/
~NickAlias();
Anope::string nick; /* Nickname */
Anope::string last_quit; /* Last quit message */
Anope::string last_realname; /* Last realname */
Anope::string last_usermask; /* Last usermask */
Anope::string last_realhost; /* Last uncloaked usermask, requires nickserv/auspex to see */
time_t time_registered; /* When the nick was registered */
time_t last_seen; /* When it was seen online for the last time */
NickCore *nc; /* I'm an alias of this */
HostInfo hostinfo;
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Release a nick
* See the comment in users.cpp
@@ -129,37 +76,126 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_EN
* @param u The user
*/
void OnCancel(User *u);
/** Set a vhost for the user
* @param ident The ident
* @param host The host
* @param creator Who created the vhost
* @param time When the vhost was craated
*/
void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime);
/** Remove a users vhost
**/
void RemoveVhost();
/** Check if the user has a vhost
* @return true or false
*/
bool HasVhost() const;
/** Retrieve the vhost ident
* @return the ident
*/
const Anope::string &GetVhostIdent() const;
/** Retrieve the vhost host
* @return the host
*/
const Anope::string &GetVhostHost() const;
/** Retrieve the vhost creator
* @return the creator
*/
const Anope::string &GetVhostCreator() const;
/** Retrieve when the vhost was created
* @return the time it was created
*/
time_t GetVhostCreated() const;
/** Finds a registered nick
* @param nick The nick to lookup
* @return the nick, if found
*/
static NickAlias *Find(const Anope::string &nick);
};
class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END>
/* A registered account. Each account must have a NickAlias with the same nick as the
* account's display.
* It matters that Base is here before Extensible (it is inherited by Serializable)
*
* Possible flags:
* KILLPROTECT - Kill other users who try to take this nick
* SECURE - Don't recognize unless identified
* MSG - Use PRIVMSG instead of notice
* MEMO_HARDMAX - Don't allow user to change memo limit
* MEMO_SIGNON - Notify of memos at signon and unaway
* MEMO_RECEIEVE - Notify of new memos when sent
* PRIVATE - Don't show in LIST to non-servadmins
* HIDE_EMAIL - Don't show email in INFO
* HIDE_MASK - Don't show last seen address in INFO
* HIDE_QUIT - Don't show last quit message in INFO
* KILL_QUICK - Kill quicker
* KILL_IMMED - Kill immediately
* MEMO_MAIL - User gets email on memo
* HIDE_STATUS - Don't show services access status
* SUSPEND - Nickname is suspended
* AUTOOP - Autoop nickname in channels
* UNCONFIRMED - Account has not had email address confirmed
* STATS - ChanStats is enabled for this user
*/
class CoreExport NickCore : public Serializable, public Extensible
{
/* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */
Serialize::Checker<std::map<ChannelInfo *, int> > chanaccess;
public:
/** Default constructor
* @param display The display nick
*/
NickCore(const Anope::string &nickdisplay);
/** Default destructor
*/
~NickCore();
std::list<User *> Users;
Anope::string display; /* How the nick is displayed */
Anope::string pass; /* Password of the nicks */
Anope::string email; /* E-mail associated to the nick */
Anope::string greet; /* Greet associated to the nick */
Anope::string language; /* Language name */
std::vector<Anope::string> access; /* Access list, vector of strings */
std::vector<Anope::string> cert; /* ssl certificate list, vector of strings */
/* Name of the account. Find(display)->nc == this. */
Anope::string display;
/* User password in form of hashm:data */
Anope::string pass;
Anope::string email;
/* Greet associated with the account, sometimes sent when the user joins a channel */
Anope::string greet;
/* Locale name of the language of the user. Empty means default language */
Anope::string language;
/* Access list, contains user@host masks of users who get certain privileges based
* on if NI_SECURE is set and what (if any) kill protection is enabled. */
std::vector<Anope::string> access;
/* SSL certificate list. Users who have a matching certificate may be automatically logged in */
std::vector<Anope::string> cert;
MemoInfo memos;
uint16 channelcount; /* Number of channels currently registered */
/* Nicknames registered that are grouped to this account.
* for n in aliases, n->nc == this.
*/
Serialize::Checker<std::vector<NickAlias *> > aliases;
/* Set if this user is a services operattor. o->ot must exist. */
Oper *o;
/* Unsaved data */
time_t lastmail; /* Last time this nick record got a mail */
std::list<NickAlias *> aliases; /* List of aliases */
/* Number of channels registered by this account */
uint16_t channelcount;
/* Last time an email was sent to this user */
time_t lastmail;
/* Users online now logged into this account */
std::list<User *> users;
/** Constructor
* @param display The display nick
*/
NickCore(const Anope::string &nickdisplay);
~NickCore();
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Changes the display for this account
* @param na The new display, must be grouped to this account.
*/
void SetDisplay(const NickAlias *na);
/** Checks whether this account is a services oper or not.
* @return True if this account is a services oper, false otherwise.
@@ -206,6 +242,14 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END
*/
void ClearAccess();
/** Is the given user on this accounts access list?
*
* @param u The user
*
* @return true if the user is on the access list
*/
bool IsOnAccess(const User *u) const;
/** Add an entry to the nick's certificate list
*
* @param entry The fingerprint to add to the cert list
@@ -230,7 +274,7 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END
*
* Search for an fingerprint within the cert list.
*/
bool FindCert(const Anope::string &entry);
bool FindCert(const Anope::string &entry) const;
/** Erase a fingerprint from the nick's certificate list
*
@@ -246,67 +290,73 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END
*/
void ClearCert();
/** Finds an account
* @param nick The account name to find
* @return The account, if it exists
*/
static NickCore* Find(const Anope::string &nick);
void AddChannelReference(ChannelInfo *ci);
void RemoveChannelReference(ChannelInfo *ci);
void GetChannelReferences(std::deque<ChannelInfo *> &queue);
};
/** Timer for colliding nicks to force people off of nicknames
/* A request to check if an account/password is valid. These can exist for
* extended periods of time due to some authentication modules take.
*/
class CoreExport NickServCollide : public Timer
class CoreExport IdentifyRequest
{
dynamic_reference<User> u;
Anope::string nick;
/* Owner of this request, used to cleanup requests if a module is unloaded
* while a reqyest us pending */
Module *owner;
Anope::string account;
Anope::string password;
std::set<Module *> holds;
bool dispatched;
bool success;
static std::set<IdentifyRequest *> Requests;
protected:
IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass);
virtual ~IdentifyRequest();
public:
/** Default constructor
* @param nick The nick we're colliding
* @param delay How long to delay before kicking the user off the nick
/* One of these is called when the request goes through */
virtual void OnSuccess() = 0;
virtual void OnFail() = 0;
const Anope::string &GetAccount() const { return account; }
const Anope::string &GetPassword() const { return password; }
/* Holds this request. When a request is held it must be Released later
* for the request to complete. Multiple modules may hold a request at any time,
* but the request is not complete until every module has released it. If you do not
* require holding this (eg, your password check is done in this thread and immediately)
* then you don't need to hold the request before Successing it.
* @param m The module holding this request
*/
NickServCollide(User *user, time_t delay);
void Hold(Module *m);
/** Default destructor
/** Releases a held request
* @param m The module releaseing the hold
*/
virtual ~NickServCollide();
void Release(Module *m);
/** Called when the delay is up
* @param t The current time
/** Called by modules when this IdentifyRequest has successeded successfully.
* If this request is behind held it must still be Released after calling this.
* @param m The module confirming authentication
*/
void Tick(time_t t);
};
void Success(Module *m);
/** Timers for removing HELD status from nicks.
*/
class NickServHeld : public Timer
{
dynamic_reference<NickAlias> na;
Anope::string nick;
public:
NickServHeld(NickAlias *n, long t);
~NickServHeld();
void Tick(time_t);
};
/** Timers for releasing nicks to be available for use
*/
class CoreExport NickServRelease : public User, public Timer
{
Anope::string nick;
public:
/** Default constructor
* @param na The nick
* @param delay The delay before the nick is released
/** Used to either finalize this request or marks
* it as dispatched and begins waiting for the module(s)
* that have holds to finish.
*/
NickServRelease(NickAlias *na, time_t delay);
void Dispatch();
/** Default destructor
*/
virtual ~NickServRelease();
/** Called when the delay is up
* @param t The current time
*/
void Tick(time_t t);
static void ModuleUnload(Module *m);
};
#endif // ACCOUNT_H
+383 -147
View File
@@ -1,39 +1,35 @@
/*
* (C) 2003-2011 Anope Team
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef ANOPE_H
#define ANOPE_H
#include <string>
#include <vector>
#include <set>
#include "hashcomp.h"
#include <signal.h>
class Message;
#include "hashcomp.h"
namespace Anope
{
template<typename T> class map : public std::map<string, T> { };
template<typename T> class insensitive_map : public std::map<string, T, std::less<ci::string> > { };
/**
* A wrapper string class around all the other string classes, this class will
* allow us to only require one type of string everywhere that can be converted
* at any time to a specific type of string.
*/
class string
class CoreExport string
{
private:
/**
* The actual string is stored in an std::string as it can be converted to
* ci::string, irc::string, or a C-style string at any time.
* ci::string, or a C-style string at any time.
*/
std::string _string;
public:
@@ -54,10 +50,10 @@ namespace Anope
string(char chr) : _string() { _string = chr; }
string(size_type n, char chr) : _string(n, chr) { }
string(const char *_str) : _string(_str) { }
string(const char *_str, size_type n) : _string(_str, n) { }
string(const std::string &_str) : _string(_str) { }
string(const ci::string &_str) : _string(_str.c_str()) { }
string(const irc::string &_str) : _string(_str.c_str()) { }
string(const string &_str, size_type pos = 0, size_type n = npos) : _string(_str._string, pos, n) { }
string(const string &_str, size_type pos, size_type n = npos) : _string(_str._string, pos, n) { }
template <class InputIterator> string(InputIterator first, InputIterator last) : _string(first, last) { }
/**
@@ -66,8 +62,6 @@ namespace Anope
inline string &operator=(char chr) { this->_string = chr; return *this; }
inline string &operator=(const char *_str) { this->_string = _str; return *this; }
inline string &operator=(const std::string &_str) { this->_string = _str; return *this; }
inline string &operator=(const ci::string &_str) { this->_string = _str.c_str(); return *this; }
inline string &operator=(const irc::string &_str) { this->_string = _str.c_str(); return *this; }
inline string &operator=(const string &_str) { if (this != &_str) this->_string = _str._string; return *this; }
/**
@@ -75,35 +69,21 @@ namespace Anope
*/
inline bool operator==(const char *_str) const { return this->_string == _str; }
inline bool operator==(const std::string &_str) const { return this->_string == _str; }
inline bool operator==(const ci::string &_str) const { return ci::string(this->_string.c_str()) == _str; }
inline bool operator==(const irc::string &_str) const { return irc::string(this->_string.c_str()) == _str; }
inline bool operator==(const string &_str) const { return this->_string == _str._string; }
inline bool equals_cs(const char *_str) const { return this->_string == _str; }
inline bool equals_cs(const std::string &_str) const { return this->_string == _str; }
inline bool equals_cs(const ci::string &_str) const { return this->_string == _str.c_str(); }
inline bool equals_cs(const irc::string &_str) const { return this->_string == _str.c_str(); }
inline bool equals_cs(const string &_str) const { return this->_string == _str._string; }
inline bool equals_ci(const char *_str) const { return ci::string(this->_string.c_str()) == _str; }
inline bool equals_ci(const std::string &_str) const { return ci::string(this->_string.c_str()) == _str.c_str(); }
inline bool equals_ci(const ci::string &_str) const { return _str == this->_string.c_str(); }
inline bool equals_ci(const irc::string &_str) const { return ci::string(this->_string.c_str()) == _str.c_str(); }
inline bool equals_ci(const string &_str) const { return ci::string(this->_string.c_str()) == _str._string.c_str(); }
inline bool equals_irc(const char *_str) const { return irc::string(this->_string.c_str()) == _str; }
inline bool equals_irc(const std::string &_str) const { return irc::string(this->_string.c_str()) == _str.c_str(); }
inline bool equals_irc(const ci::string &_str) const { return irc::string(this->_string.c_str()) == _str.c_str(); }
inline bool equals_irc(const irc::string &_str) const { return _str == this->_string.c_str(); }
inline bool equals_irc(const string &_str) const { return irc::string(this->_string.c_str()) == _str._string.c_str(); }
/**
* Inequality operators, exact opposites of the above.
*/
inline bool operator!=(const char *_str) const { return !operator==(_str); }
inline bool operator!=(const std::string &_str) const { return !operator==(_str); }
inline bool operator!=(const ci::string &_str) const { return !operator==(_str); }
inline bool operator!=(const irc::string &_str) const { return !operator==(_str); }
inline bool operator!=(const string &_str) const { return !operator==(_str); }
/**
@@ -112,8 +92,6 @@ namespace Anope
inline string &operator+=(char chr) { this->_string += chr; return *this; }
inline string &operator+=(const char *_str) { this->_string += _str; return *this; }
inline string &operator+=(const std::string &_str) { this->_string += _str; return *this; }
inline string &operator+=(const ci::string &_str) { this->_string += _str.c_str(); return *this; }
inline string &operator+=(const irc::string &_str) { this->_string += _str.c_str(); return *this; }
inline string &operator+=(const string &_str) { if (this != &_str) this->_string += _str._string; return *this; }
/**
@@ -122,15 +100,11 @@ namespace Anope
inline const string operator+(char chr) const { return string(*this) += chr; }
inline const string operator+(const char *_str) const { return string(*this) += _str; }
inline const string operator+(const std::string &_str) const { return string(*this) += _str; }
inline const string operator+(const ci::string &_str) const { return string(*this) += _str; }
inline const string operator+(const irc::string &_str) const { return string(*this) += _str; }
inline const string operator+(const string &_str) const { return string(*this) += _str; }
friend const string operator+(char chr, const string &str);
friend const string operator+(const char *_str, const string &str);
friend const string operator+(const std::string &_str, const string &str);
friend const string operator+(const ci::string &_str, const string &str);
friend const string operator+(const irc::string &_str, const string &str);
/**
* Less-than operator.
@@ -144,7 +118,6 @@ namespace Anope
inline std::string &str() { return this->_string; }
inline const std::string &str() const { return this->_string; }
inline ci::string ci_str() const { return ci::string(this->_string.c_str()); }
inline irc::string irc_str() const { return irc::string(this->_string.c_str()); }
/**
* Returns if the string is empty or not.
@@ -167,6 +140,9 @@ namespace Anope
*/
inline void push_back(char c) { return this->_string.push_back(c); }
inline string& append(const string &s) { this->_string.append(s.str()); return *this; }
inline string& append(const char *s, size_t n) { this->_string.append(s, n); return *this; }
/**
* Resizes the string content to n characters.
*/
@@ -182,12 +158,26 @@ namespace Anope
/**
* Trim leading and trailing white spaces from the string.
*/
inline void trim()
inline string& ltrim()
{
while (!this->_string.empty() && isspace(this->_string[0]))
this->_string.erase(this->_string.begin());
return *this;
}
inline string& rtrim()
{
while (!this->_string.empty() && isspace(this->_string[this->_string.length() - 1]))
this->_string.erase(this->_string.length() - 1);
return *this;
}
inline string& trim()
{
this->ltrim();
this->rtrim();
return *this;
}
/**
@@ -258,6 +248,28 @@ namespace Anope
return new_string;
}
/**
* Get the string in lowercase.
*/
inline string lower() const
{
Anope::string new_string = *this;
for (size_type i = 0; i < new_string.length(); ++i)
new_string[i] = std::tolower(new_string[i], Anope::casemap);
return new_string;
}
/**
* Get the string in uppercase.
*/
inline string upper() const
{
Anope::string new_string = *this;
for (size_type i = 0; i < new_string.length(); ++i)
new_string[i] = std::toupper(new_string[i], Anope::casemap);
return new_string;
}
/**
* Get a substring of the string.
*/
@@ -285,59 +297,135 @@ namespace Anope
* Stream insertion operator, must be friend because they cannot be inside the class.
*/
friend std::ostream &operator<<(std::ostream &os, const string &_str);
};
/** Hash an Anope::string for unorderd_map, passed as the third template arg to unordered_map
*/
struct hash
{
/* VS 2008 specific code */
enum { bucket_size = 4, min_buckets = 8 };
bool operator()(const string &s1, const string &s2) const;
/* End of 2008 specific code */
/** Hash an Anope::string for unordered_map
* @param s The string
* @return A hash value for the string
*/
bool operator()(const string &s) const;
friend std::istream &operator>>(std::istream &is, string &_str);
};
inline std::ostream &operator<<(std::ostream &os, const string &_str) { return os << _str._string; }
/* This is not standard to make operator>> behave like operator<< in that it will allow extracting a whole line, not just one word */
inline std::istream &operator>>(std::istream &is, string &_str) { return std::getline(is, _str._string); }
inline const string operator+(char chr, const string &str) { string tmp(chr); tmp += str; return tmp; }
inline const string operator+(const char *_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
inline const string operator+(const std::string &_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
inline const string operator+(const ci::string &_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
inline const string operator+(const irc::string &_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
struct hash_ci
{
inline size_t operator()(const string &s) const
{
return std::tr1::hash<std::string>()(s.lower().str());
}
};
struct hash_cs
{
inline size_t operator()(const string &s) const
{
return std::tr1::hash<std::string>()(s.str());
}
};
struct compare
{
inline bool operator()(const string &s1, const string &s2) const
{
return s1.equals_ci(s2);
}
};
template<typename T> class map : public std::map<string, T, ci::less> { };
template<typename T> class hash_map : public std::tr1::unordered_map<string, T, hash_ci, compare> { };
static const char *const compiled = __TIME__ " " __DATE__;
/** The time Anope started.
*/
extern CoreExport time_t StartTime;
/** The value to return from main()
*/
extern int ReturnValue;
extern sig_atomic_t Signal;
extern CoreExport bool Quitting;
extern CoreExport bool Restarting;
extern CoreExport Anope::string QuitReason;
/** The current system time, which is pretty close to being accurate.
* Use this unless you need very specific time checks
*/
extern CoreExport time_t CurTime;
/** The debug level we are running at.
*/
extern CoreExport int Debug;
/** Other comand line options.
*/
extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug;
/** The root of the services installation. Usually ~/services
*/
extern CoreExport Anope::string ServicesDir;
/** Services binary name (eg services)
*/
extern CoreExport Anope::string ServicesBin;
/** Various directory paths. These can be set at runtime by command line args
*/
extern CoreExport Anope::string ConfigDir;
extern CoreExport Anope::string DataDir;
extern CoreExport Anope::string ModuleDir;
extern CoreExport Anope::string LocaleDir;
extern CoreExport Anope::string LogDir;
/** The uplink we are currently connected to
*/
extern CoreExport int CurrentUplink;
/** Various methods to determine the Anope version running
*/
extern CoreExport string Version();
extern CoreExport string VersionShort();
extern CoreExport string VersionBuildString();
extern CoreExport int VersionMajor();
extern CoreExport int VersionMinor();
extern CoreExport int VersionPatch();
extern CoreExport int VersionBuild();
/** Determines if we are still attached to the terminal, and can print
* messages to the user via stderr/stdout.
* @return true if still attached
*/
extern bool AtTerm();
/** Used to "fork" the process and go into the background during initial startup
* while we are AtTerm(). The actual fork is not done here, but earlier, and this
* simply notifys the parent via kill() to exit().
*/
extern void Fork();
/** Does something with the signal in Anope::Signal
*/
extern void HandleSignal();
/** One of the first functions called, does general initialization such as reading
* command line args, loading the configuration, doing the initial fork() if necessary,
* initializating language support, loading modules, and loading databases.
* @throws CoreException if something bad went wrong
*/
extern void Init(int ac, char **av);
/** Calls the save database event
*/
extern CoreExport void SaveDatabases();
/** Check whether two strings match.
* @param str The string to check against the pattern (e.g. foobar)
* @param mask The pattern to check (e.g. foo*bar)
* @param case_sensitive Whether or not the match is case sensitive, default false.
* @param use_regex Whether or not to try regex. case_sensitive is not used in regex.
*/
extern CoreExport bool Match(const Anope::string &str, const Anope::string &mask, bool case_sensitive = false);
/** Find a message in the message table
* @param name The name of the message were looking for
* @return NULL if we cant find it, or a pointer to the Message if we can
*/
extern CoreExport std::vector<Message *> FindMessage(const string &name);
extern CoreExport bool Match(const string &str, const string &mask, bool case_sensitive = false, bool use_regex = false);
/** Converts a string to hex
* @param the data to be converted
@@ -350,20 +438,34 @@ namespace Anope
* @param src The data to be converted
* @param dest The destination string
*/
extern CoreExport void Unhex(const Anope::string &src, Anope::string &dest);
extern CoreExport void Unhex(const Anope::string &src, char *dest);
extern CoreExport void Unhex(const string &src, string &dest);
extern CoreExport void Unhex(const string &src, char *dest, size_t sz);
/** Base 64 encode a string
* @param src The string to encode
* @param target Where the encoded string is placed
*/
extern CoreExport void B64Encode(const Anope::string &src, Anope::string &target);
extern CoreExport void B64Encode(const string &src, string &target);
/** Base 64 decode a string
* @param src The base64 encoded string
* @param target The plain text result
*/
extern CoreExport void B64Decode(const Anope::string &src, Anope::string &target);
extern CoreExport void B64Decode(const string &src, string &target);
/** Encrypts what is in 'src' to 'dest'
* @param src The source string to encrypt
* @param dest The destination where the encrypted string is placed
*/
extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest);
/** Decrypts what is in 'src' to 'dest'.
* @param src The source string to decrypt
* @param dest The destination where the decrypted string is placed
* @return true if decryption was successful. This is usually not the case
* as most encryption methods we use are one way.
*/
extern CoreExport bool Decrypt(const Anope::string &src, Anope::string &dest);
/** Returns a sequence of data formatted as the format argument specifies.
** After the format parameter, the function expects at least as many
@@ -382,7 +484,56 @@ namespace Anope
/** Return the last error, uses errno/GetLastError() to determine this
* @return An error message
*/
extern CoreExport const Anope::string LastError();
extern CoreExport const string LastError();
/** Determines if a path is a file
*/
extern CoreExport bool IsFile(const Anope::string &file);
/** Converts a string into seconds
* @param s The string, eg 3d
* @return The time represented by the string, eg 259,200
*/
extern CoreExport time_t DoTime(const Anope::string &s);
/** Retrieves a human readable string representing the time in seconds
* @param seconds The time on seconds, eg 60
* @param nc The account to use langauge settings for to translate this string, if applicable
* @return A human readable string, eg "1 minute"
*/
extern CoreExport Anope::string Duration(time_t seconds, const NickCore *nc = NULL);
/** Generates a human readable string of type "expires in ..."
* @param expires time in seconds
* @param nc The account to use langauge settings for to translate this string, if applicable
* @return A human readable string, eg "expires in 5 days"
*/
extern CoreExport Anope::string Expires(time_t seconds, const NickCore *nc = NULL);
/** Converts a time in seconds (epoch) to a human readable format.
* @param t The time
* @param nc The account to use langauge settings for to translate this string, if applicable
* @param short_output If true, the output is just a date (eg, "Apr 12 20:18:22 2009 MSD"), else it includes the date and how long ago/from now that date is, (eg "Apr 12 20:18:22 2009 MSD (1313 days, 9 hours, 32 minutes ago)"
*/
extern CoreExport Anope::string strftime(time_t t, const NickCore *nc = NULL, bool short_output = false);
/** Normalize buffer, stripping control characters and colors
* @param A string to be parsed for control and color codes
* @return A string stripped of control and color codes
*/
extern CoreExport Anope::string NormalizeBuffer(const Anope::string &);
/** Main processing routine. Parses the message and takes the appropriate action.
* @param Raw message from the uplink
*/
extern void Process(const Anope::string &);
/** Does a blocking dns query and returns the first IP.
* @param host host to look up
* @param type inet addr type
* @return the IP if it was found, else the host
*/
extern Anope::string Resolve(const Anope::string &host, int type);
}
/** sepstream allows for splitting token seperated lists.
@@ -409,23 +560,52 @@ class CoreExport sepstream
/** Create a sepstream and fill it with the provided data
*/
sepstream(const Anope::string &source, char seperator);
virtual ~sepstream() { }
/** Fetch the next token from the stream
* @param token The next token from the stream is placed here
* @return True if tokens still remain, false if there are none left
*/
virtual bool GetToken(Anope::string &token);
bool GetToken(Anope::string &token);
/** Gets token number 'num' from the stream
* @param token The token is placed here
* @param num The token number to featch
* @return True if the token was able to be detched
*/
bool GetToken(Anope::string &token, int num);
/** Gets every token from this stream
* @param token Tokens are pushed back here
*/
template<typename T> void GetTokens(T& token)
{
token.clear();
Anope::string t;
while (this->GetToken(t))
token.push_back(t);
}
/** Gets token number 'num' from the stream and all remaining tokens.
* @param token The token is placed here
* @param num The token number to featch
* @return True if the token was able to be detched
*/
bool GetTokenRemainder(Anope::string &token, int num);
/** Determines the number of tokens in this stream.
* @return The number of tokens in this stream
*/
int NumTokens();
/** Fetch the entire remaining stream, without tokenizing
* @return The remaining part of the stream
*/
virtual const Anope::string GetRemaining();
const Anope::string GetRemaining();
/** Returns true if the end of the stream has been reached
* @return True if the end of the stream has been reached, otherwise false
*/
virtual bool StreamEnd();
bool StreamEnd();
};
/** A derived form of sepstream, which seperates on commas
@@ -448,90 +628,146 @@ class spacesepstream : public sepstream
spacesepstream(const Anope::string &source) : sepstream(source, ' ') { }
};
/** The base class that most classes in Anope inherit from
/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
* When a module whishes to abort, e.g. within a constructor, it should throw an exception using ModuleException or
* a class derived from ModuleException. If a module throws an exception during its constructor, the module will not
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/
class dynamic_reference_base;
class CoreExport Base
{
/* References to this base class */
std::set<dynamic_reference_base *> References;
public:
Base();
virtual ~Base();
void AddReference(dynamic_reference_base *r);
void DelReference(dynamic_reference_base *r);
};
class dynamic_reference_base : public Base
class CoreException : public std::exception
{
protected:
bool invalid;
/** Holds the error message to be displayed
*/
Anope::string err;
/** Source of the exception
*/
Anope::string source;
public:
dynamic_reference_base() : invalid(false) { }
virtual ~dynamic_reference_base() { }
inline void Invalidate() { this->invalid = true; }
/** Default constructor, just uses the error mesage 'Core threw an exception'.
*/
CoreException() : err("Core threw an exception"), source("The core") { }
/** This constructor can be used to specify an error message before throwing.
*/
CoreException(const Anope::string &message) : err(message), source("The core") { }
/** This constructor can be used to specify an error message before throwing,
* and to specify the source of the exception.
*/
CoreException(const Anope::string &message, const Anope::string &src) : err(message), source(src) { }
/** This destructor solves world hunger, cancels the world debt, and causes the world to end.
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
virtual ~CoreException() throw() { }
/** Returns the reason for the exception.
* The module should probably put something informative here as the user will see this upon failure.
*/
virtual const Anope::string &GetReason() const
{
return err;
}
virtual const Anope::string &GetSource() const
{
return source;
}
};
template<typename T>
class dynamic_reference : public dynamic_reference_base
class ModuleException : public CoreException
{
protected:
T *ref;
public:
dynamic_reference(T *obj) : ref(obj)
{
if (ref)
ref->AddReference(this);
}
/** Default constructor, just uses the error mesage 'Module threw an exception'.
*/
ModuleException() : CoreException("Module threw an exception", "A Module") { }
virtual ~dynamic_reference()
{
if (this->invalid)
{
this->invalid = false;
this->ref = NULL;
}
else if (this->operator bool())
ref->DelReference(this);
}
virtual operator bool()
{
if (this->invalid)
{
this->invalid = false;
this->ref = NULL;
}
return this->ref != NULL;
}
virtual inline operator T*()
{
if (this->operator bool())
return this->ref;
return NULL;
}
virtual inline T *operator->()
{
if (this->operator bool())
return this->ref;
return NULL;
}
virtual inline void operator=(T *newref)
{
if (this->invalid)
{
this->invalid = false;
this->ref = NULL;
}
else if (this->operator bool())
this->ref->DelReference(this);
this->ref = newref;
if (this->operator bool())
this->ref->AddReference(this);
}
/** This constructor can be used to specify an error message before throwing.
*/
ModuleException(const Anope::string &message) : CoreException(message, "A Module") { }
/** This destructor solves world hunger, cancels the world debt, and causes the world to end.
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
virtual ~ModuleException() throw() { }
};
class ConvertException : public CoreException
{
public:
ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~ConvertException() throw() { }
};
/** Convert something to a string
*/
template<typename T> inline Anope::string stringify(const T &x)
{
std::ostringstream stream;
if (!(stream << x))
throw ConvertException("Stringify fail");
return stream.str();
}
template<typename T> inline void convert(const Anope::string &s, T &x, Anope::string &leftover, bool failIfLeftoverChars = true)
{
leftover.clear();
std::istringstream i(s.str());
char c;
bool res = i >> x;
if (!res)
throw ConvertException("Convert fail");
if (failIfLeftoverChars)
{
if (i.get(c))
throw ConvertException("Convert fail");
}
else
{
std::string left;
getline(i, left);
leftover = left;
}
}
template<typename T> inline void convert(const Anope::string &s, T &x, bool failIfLeftoverChars = true)
{
Anope::string Unused;
convert(s, x, Unused, failIfLeftoverChars);
}
template<typename T> inline T convertTo(const Anope::string &s, Anope::string &leftover, bool failIfLeftoverChars = true)
{
T x;
convert(s, x, leftover, failIfLeftoverChars);
return x;
}
template<typename T> inline T convertTo(const Anope::string &s, bool failIfLeftoverChars = true)
{
T x;
convert(s, x, failIfLeftoverChars);
return x;
}
/** Casts to be used instead of dynamic_cast, this uses dynamic_cast
* for debug builds and static_cast on releass builds
* to speed up the program because dynamic_cast relies on RTTI.
*/
#ifdef DEBUG_BUILD
# include <typeinfo>
#endif
template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
{
#ifdef DEBUG_BUILD
T ret = dynamic_cast<T>(ptr);
if (ptr != NULL && ret == NULL)
throw CoreException(Anope::string("anope_dynamic_static_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail");
return ret;
#else
return static_cast<T>(ptr);
#endif
}
#endif // ANOPE_H
+145
View File
@@ -0,0 +1,145 @@
/*
*
* Copyright (C) 2008-2011 Adam <Adam@anope.org>
* Copyright (C) 2008-2013 Anope Team <team@anope.org>
*
* Please read COPYING and README for further details.
*
*/
#ifndef BASE_H
#define BASE_H
#include "services.h"
/** The base class that most classes in Anope inherit from
*/
class CoreExport Base
{
/* References to this base class */
std::set<ReferenceBase *> *references;
public:
Base();
virtual ~Base();
/** Adds a reference to this object. Eg, when a Reference
* is created referring to this object this is called. It is used to
* cleanup references when this object is destructed.
*/
void AddReference(ReferenceBase *r);
void DelReference(ReferenceBase *r);
};
class ReferenceBase
{
protected:
bool invalid;
public:
ReferenceBase() : invalid(false) { }
ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { }
virtual ~ReferenceBase() { }
inline void Invalidate() { this->invalid = true; }
};
/** Used to hold pointers to objects that may be deleted. A Reference will
* no longer be valid once the object it refers is destructed.
*/
template<typename T>
class Reference : public ReferenceBase
{
protected:
T *ref;
public:
Reference() : ref(NULL)
{
}
Reference(T *obj) : ref(obj)
{
if (ref)
ref->AddReference(this);
}
Reference(const Reference<T> &other) : ReferenceBase(other), ref(other.ref)
{
if (operator bool())
ref->AddReference(this);
}
virtual ~Reference()
{
if (operator bool())
ref->DelReference(this);
}
inline Reference<T>& operator=(const Reference<T> &other)
{
if (this != &other)
{
if (*this)
this->ref->DelReference(this);
this->ref = other.ref;
this->invalid = other.invalid;
if (*this)
this->ref->AddReference(this);
}
return *this;
}
/* We explicitly call operator bool here in several places to prevent other
* operators, such operator T*, from being called instead, which will mess
* with any class inheriting from this that overloads this operator.
*/
virtual operator bool()
{
if (!this->invalid)
return this->ref != NULL;
return false;
}
inline operator T*()
{
if (operator bool())
return this->ref;
return NULL;
}
inline T* operator->()
{
if (operator bool())
return this->ref;
return NULL;
}
inline T* operator*()
{
if (operator bool())
return this->ref;
return NULL;
}
/** Note that we can't have an operator< that returns this->ref < other.ref
* because this function is used to sort objects in containers (such as set
* or map), and if the references themselves can change if the object they
* refer to is invalidated or changed, then this screws with the order that
* the objects would be in the container without properly adjusting the
* container, resulting in weird stuff.
*
* As such, we don't allow storing references in containers that require
* operator<, because they would not be able to compare what the references
* actually referred to.
*/
inline bool operator==(const Reference<T> &other)
{
if (!this->invalid)
return this->ref == other;
return false;
}
};
#endif // BASE_H
+44 -30
View File
@@ -1,47 +1,44 @@
/*
*
* Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
* Copyright (C) 2008-2013 Anope Team <team@anope.org>
*
* Please read COPYING and README for further details.
*
*/
#ifndef BOTS_H
#define BOTS_H
class BotInfo;
#include "users.h"
#include "anope.h"
#include "serialize.h"
#include "commands.h"
extern CoreExport Anope::insensitive_map<BotInfo *> BotListByNick;
extern CoreExport Anope::map<BotInfo *> BotListByUID;
typedef Anope::insensitive_map<BotInfo *> botinfo_map;
/** Flags settable on a bot
*/
enum BotFlag
{
BI_BEGIN,
typedef Anope::map<BotInfo *> botinfo_map;
/* This bot is a core bot. NickServ, ChanServ, etc */
BI_CORE,
/* This bot can only be assigned by IRCops */
BI_PRIVATE,
/* This bot is defined in the config */
BI_CONF,
extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
BI_END
};
static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "CONF", "" };
class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
/* A service bot (NickServ, ChanServ, a BotServ bot, etc). */
class CoreExport BotInfo : public User, public Serializable
{
public:
uint32 chancount;
time_t created; /* Birth date ;) */
time_t lastmsg; /* Last time we said something */
typedef Anope::insensitive_map<CommandInfo> command_map;
command_map commands; /* Commands, actual name to service name */
Anope::string botmodes; /* Modes the bot should have as configured in service:modes */
bool introduced; /* Whether or not this bot is introduced */
time_t created;
/* Last time this bot said something (via privmsg) */
time_t lastmsg;
/* Map of actual command names -> service name/permission required */
CommandInfo::map commands;
/* Modes the bot should have as configured in service:modes */
Anope::string botmodes;
/* Channels the bot should be in as configured in service:channels */
std::vector<Anope::string> botchannels;
/* Whether or not this bot is introduced to the network */
bool introduced;
/* Bot can only be assigned by irc ops */
bool oper_only;
/* Bot is defined in the configuration file */
bool conf;
/** Create a new bot.
* @param nick The nickname to assign to the bot.
@@ -56,6 +53,9 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
*/
virtual ~BotInfo();
void Serialize(Serialize::Data &data) const;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
void GenerateUID();
/** Change the nickname for the bot.
@@ -80,6 +80,10 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
*/
void UnAssign(User *u, ChannelInfo *ci);
/** Get the number of channels this bot is assigned to
*/
unsigned GetChannelCount() const;
/** Join this bot to a channel
* @param c The channel
* @param status The status the bot should have on the channel
@@ -108,14 +112,24 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
* @param cname The command name
* @param sname The service name
* @param permission Permission required to execute the command, if any
* @return The commandinfo for the newly created command
*/
void SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
CommandInfo& SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
/** Get command info for a command
* @param cname The command name
* @return A struct containing service name and permission
*/
CommandInfo *GetCommand(const Anope::string &cname);
/** Find a bot by nick
* @param nick The nick
* @param nick_only True to only look by nick, and not by UID
* @return The bot, if it exists
*/
static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
};
extern CoreExport BotInfo *BotServ, *ChanServ, *Global, *HostServ, *MemoServ, *NickServ, *OperServ;
#endif // BOTS_H
+134 -74
View File
@@ -1,28 +1,35 @@
/* Channel support
*
* (C) 2008-2011 Anope Team
* (C) 2008-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
*/
#ifndef CHANNELS_H
#define CHANNELS_H
typedef Anope::insensitive_map<Channel *> channel_map;
#include "anope.h"
#include "extensible.h"
#include "modes.h"
#include "serialize.h"
typedef Anope::hash_map<Channel *> channel_map;
extern CoreExport channel_map ChannelList;
struct UserContainer : public Extensible
/* A user container, there is one of these per user per channel. */
struct ChanUserContainer : public Extensible
{
User *user;
ChannelStatus *Status;
Channel *chan;
/* Status the user has in the channel */
ChannelStatus status;
UserContainer(User *u) : user(u) { }
virtual ~UserContainer() { }
ChanUserContainer(User *u, Channel *c) : user(u), chan(c) { }
};
typedef std::list<UserContainer *> CUserList;
enum ChannelFlag
{
/* ChanServ is currently holding the channel */
@@ -30,50 +37,59 @@ enum ChannelFlag
/* Channel still exists when emptied */
CH_PERSIST,
/* If set the channel is syncing users (channel was just created) and it should not be deleted */
CH_SYNCING,
/* Is a services log channel */
CH_LOGCHAN
CH_SYNCING
};
const Anope::string ChannelFlagString[] = { "CH_INABIT", "CH_PERSIST", "CH_SYNCING", "CH_LOGCHAN", "" };
class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
class CoreExport Channel : public Base, public Extensible
{
public:
typedef std::multimap<ChannelModeName, Anope::string> ModeList;
typedef std::multimap<Anope::string, Anope::string> ModeList;
private:
/** A map of channel modes with their parameters set on this channel
*/
ModeList modes;
public:
/** Default constructor
/* Channel name */
Anope::string name;
/* Set if this channel is registered. ci->c == this. Contains information relevant to the registered channel */
Serialize::Reference<ChannelInfo> ci;
/* When the channel was created */
time_t creation_time;
std::set<ChannelFlag> flags;
/* Users in the channel */
typedef std::list<ChanUserContainer *> ChanUserList;
ChanUserList users;
/* Current topic of the channel */
Anope::string topic;
/* Who set the topic */
Anope::string topic_setter;
/* The timestamp associated with the topic. Not necessarually anywhere close to Anope::CurTime.
* This is the time the topic was *originally set*. When we restore the topic we want to change the TS back
* to this, but we can only do this on certain IRCds.
*/
time_t topic_ts;
/* The actual time the topic was set, probably close to Anope::CurTime */
time_t topic_time;
time_t server_modetime; /* Time of last server MODE */
time_t chanserv_modetime; /* Time of last check_modes() */
int16_t server_modecount; /* Number of server MODEs this second */
int16_t chanserv_modecount; /* Number of check_mode()'s this sec */
int16_t bouncy_modes; /* Did we fail to set modes here? */
/** Constructor
* @param name The channel name
* @param ts The time the channel was created
*/
Channel(const Anope::string &nname, time_t ts = Anope::CurTime);
/** Default destructor
/** Destructor
*/
~Channel();
Anope::string name; /* Channel name */
ChannelInfo *ci; /* Corresponding ChannelInfo */
time_t creation_time; /* When channel was created */
/* List of users in the channel */
CUserList users;
Anope::string topic; /* Current topic of the channel */
Anope::string topic_setter; /* Who set the topic */
time_t topic_time; /* When the topic was set*/
time_t server_modetime; /* Time of last server MODE */
time_t chanserv_modetime; /* Time of last check_modes() */
int16 server_modecount; /* Number of server MODEs this second */
int16 chanserv_modecount; /* Number of check_mode()'s this sec */
int16 bouncy_modes; /* Did we fail to set modes here? */
/** Call if we need to unset all modes and clear all user status (internally).
* Only useful if we get a SJOIN with a TS older than what we have here
*/
@@ -83,10 +99,15 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
*/
void Sync();
/** Check if a channels modes are correct.
*/
void CheckModes();
/** Join a user internally to the channel
* @param u The user
* @return The UserContainer for the user
*/
void JoinUser(User *u);
ChanUserContainer* JoinUser(User *u);
/** Remove a user internally from the channel
* @param u The user
@@ -97,111 +118,114 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
* @param u The user
* @return A user container if found, else NULL
*/
UserContainer *FindUser(User *u);
ChanUserContainer *FindUser(const User *u) const;
/** Check if a user has a status on a channel
* @param u The user
* @param cms The status mode, or NULL to represent no status
* @return true or false
*/
bool HasUserStatus(User *u, ChannelModeStatus *cms) const;
bool HasUserStatus(const User *u, ChannelModeStatus *cms) const;
/** Check if a user has a status on a channel
* Use the overloaded function for ChannelModeStatus* to check for no status
* @param u The user
* @param Name The Mode name, eg CMODE_OP, CMODE_VOICE
* @param name The mode name, eg CMODE_OP, CMODE_VOICE
* @return true or false
*/
bool HasUserStatus(User *u, ChannelModeName Name) const;
bool HasUserStatus(const User *u, const Anope::string &name) const;
/** See if a channel has a mode
* @param Name The mode name
* @param name The mode name
* @return The number of modes set
* @param param The optional mode param
*/
size_t HasMode(ChannelModeName Name, const Anope::string &param = "");
/** Get a list of modes on a channel
* @param Name A mode name to get the list of
* @return a pair of iterators for the beginning and end of the list
*/
std::pair<ModeList::iterator, ModeList::iterator> GetModeList(ChannelModeName Name);
size_t HasMode(const Anope::string &name, const Anope::string &param = "");
/** Set a mode internally on a channel, this is not sent out to the IRCd
* @param setter The setter
* @param cm The mode
* @param param The param
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
void SetModeInternal(ChannelMode *cm, const Anope::string &param = "", bool EnforceMLock = true);
void SetModeInternal(MessageSource &source, ChannelMode *cm, const Anope::string &param = "", bool enforce_mlock = true);
/** Remove a mode internally on a channel, this is not sent out to the IRCd
* @param setter The Setter
* @param cm The mode
* @param param The param
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
void RemoveModeInternal(ChannelMode *cm, const Anope::string &param = "", bool EnforceMLock = true);
void RemoveModeInternal(MessageSource &source, ChannelMode *cm, const Anope::string &param = "", bool enforce_mlock = true);
/** Set a mode on a channel
* @param bi The client setting the modes
* @param cm The mode
* @param param Optional param arg for the mode
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
void SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param = "", bool EnforceMLock = true);
void SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param = "", bool enforce_mlock = true);
/**
* Set a mode on a channel
* @param bi The client setting the modes
* @param Name The mode name
* @param name The mode name
* @param param Optional param arg for the mode
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
void SetMode(BotInfo *bi, ChannelModeName Name, const Anope::string &param = "", bool EnforceMLock = true);
void SetMode(BotInfo *bi, const Anope::string &name, const Anope::string &param = "", bool enforce_mlock = true);
/** Remove a mode from a channel
* @param bi The client setting the modes
* @param cm The mode
* @param param Optional param arg for the mode
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
void RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param = "", bool EnforceMLock = true);
void RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param = "", bool enforce_mlock = true);
/**
* Remove a mode from a channel
* @param bi The client setting the modes
* @param Name The mode name
* @param name The mode name
* @param param Optional param arg for the mode
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
*/
void RemoveMode(BotInfo *bi, ChannelModeName Name, const Anope::string &param = "", bool EnforceMLock = true);
void RemoveMode(BotInfo *bi, const Anope::string &name, const Anope::string &param = "", bool enforce_mlock = true);
/** Get a param from the channel
* @param Name The mode
* @param Target a string to put the param into
* @return true on success
/** Get a modes parameter for the channel
* @param name The mode
* @param target a string to put the param into
* @return true if the parameter was fetched, false if on error (mode not set) etc.
*/
bool GetParam(ChannelModeName Name, Anope::string &Target) const;
bool GetParam(const Anope::string &name, Anope::string &target) const;
/** Set a string of modes on the channel
* @param bi The client setting the modes
* @param EnforceMLock Should mlock be enforced on this mode change
* @param enforce_mlock Should mlock be enforced on this mode change
* @param cmodes The modes to set
*/
void SetModes(BotInfo *bi, bool EnforceMLock, const char *cmodes, ...);
void SetModes(BotInfo *bi, bool enforce_mlock, const char *cmodes, ...);
/** Set a string of modes internally on a channel
* @param setter the setter (if it is a user)
* @param source The setter
* @param mode the modes
* @param EnforceMLock true to enforce mlock
* @param enforce_mlock true to enforce mlock
*/
void SetModesInternal(User *setter, const Anope::string &mode, bool EnforceMLock = true);
void SetModesInternal(MessageSource &source, const Anope::string &mode, time_t ts = 0, bool enforce_mlock = true);
/** Does the given user match the given list? (CMODE_BAN, CMODE_EXCEPT, etc, a list mode)
* @param u The user
* @param list The mode of the list to check (eg CMODE_BAN)
* @return true if the user matches the list
*/
bool MatchesList(User *u, const Anope::string &list);
/** Kick a user from a channel internally
* @param source The sender of the kick
* @param nick The nick being kicked
* @param reason The reason for the kick
*/
void KickInternal(const Anope::string &source, const Anope::string &nick, const Anope::string &reason);
void KickInternal(MessageSource &source, const Anope::string &nick, const Anope::string &reason);
/** Kick a user from the channel
* @param bi The sender, can be NULL for the service bot for this channel
@@ -211,6 +235,17 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
*/
bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...);
/** Get all modes set on this channel, excluding status modes.
* @return a map of modes and their optional parameters.
*/
const ModeList &GetModes() const;
/** Get a list of modes on a channel
* @param name A mode name to get the list of
* @return a pair of iterators for the beginning and end of the list
*/
std::pair<ModeList::iterator, ModeList::iterator> GetModeList(const Anope::string &name);
/** Get a string of the modes set on this channel
* @param complete Include mode parameters
* @param plus If set to false (with complete), mode parameters will not be given for modes requring no parameters to be unset
@@ -219,7 +254,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
Anope::string GetModes(bool complete, bool plus);
/** Update the topic of the channel internally, and reset it if topiclock etc says to
* @param user THe user setting the new topic
* @param user The user setting the new topic
* @param newtopic The new topic
* @param ts The time the new topic is being set
*/
@@ -231,6 +266,31 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
* @param ts The time when the new topic is being set
*/
void ChangeTopic(const Anope::string &user, const Anope::string &newtopic, time_t ts = Anope::CurTime);
/** Hold the channel open using ChanServ
*/
void Hold();
/** Set the correct modes, or remove the ones granted without permission,
* for the specified user.
* @param user The user to give/remove modes to/from
* @param give_modes if true modes may be given to the user
* @param check_noop if true, CI_NOAUTOOP is checked before giving modes
*/
void SetCorrectModes(User *u, bool give_mode, bool check_noop);
/** Unbans a user from this channel.
* @param u The user 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(const User *u, bool full = false);
/** Finds a channel
* @param name The channel to find
* @return The channel, if found
*/
static Channel* Find(const Anope::string &name);
};
#endif // CHANNELS_H
+68 -26
View File
@@ -1,6 +1,6 @@
/* Declarations for command data.
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -12,70 +12,102 @@
#ifndef COMMAND_H
#define COMMAND_H
#include "services.h"
#include "service.h"
#include "anope.h"
#include "channels.h"
class Module;
class BotInfo;
class Command;
enum CommandFlag
struct CommandGroup
{
CFLAG_ALLOW_UNREGISTERED,
CFLAG_STRIP_CHANNEL
};
const Anope::string CommandFlagStrings[] = {
"CFLAG_ALLOW_UNREGISTERED",
"CFLAG_STRIP_CHANNEL",
""
Anope::string name, description;
};
/* Used in BotInfo::commands */
struct CommandInfo
{
typedef Anope::map<CommandInfo> map;
CommandInfo() : hide(false), prepend_channel(false) { }
/* Service name of the command */
Anope::string name;
/* Permission required to execute the command */
Anope::string permission;
/* Group this command is in */
Anope::string group;
/* whether or not to hide this command in help output */
bool hide;
/* Only used with fantasy */
bool prepend_channel;
};
/* Where the replies from commands go to. User inheits from this and is the normal
* source of a CommandReply
*/
struct CoreExport CommandReply
{
virtual ~CommandReply() { }
virtual void SendMessage(const BotInfo *source, const Anope::string &msg) = 0;
};
/* The source for a command */
struct CoreExport CommandSource
class CoreExport CommandSource
{
/* User executing the command */
/* The nick executing the command */
Anope::string nick;
/* User executing the command, may be NULL */
User *u;
public:
/* The account executing the command */
Reference<NickCore> nc;
/* Where the reply should go */
CommandReply *reply;
/* Channel the command was executed on (fantasy) */
Channel *c;
Reference<Channel> c;
/* The service this command is on */
BotInfo *owner;
/* The service the reply should come from, *not* necessarily the service the command is on */
BotInfo *service;
Reference<BotInfo> service;
/* The actual name of the command being executed */
Anope::string command;
/* The permission of the command being executed */
Anope::string permission;
std::list<Anope::string> reply;
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi);
const Anope::string &GetNick() const;
User *GetUser();
NickCore *GetAccount();
AccessGroup AccessFor(ChannelInfo *ci);
bool IsFounder(ChannelInfo *ci);
void Reply(const char *message, ...);
void Reply(const Anope::string &message);
void DoReply();
bool HasCommand(const Anope::string &cmd);
bool HasPriv(const Anope::string &cmd);
bool IsServicesOper();
bool IsOper();
};
/** Every services command is a class, inheriting from Command.
*/
class CoreExport Command : public Service, public Flags<CommandFlag>
class CoreExport Command : public Service
{
Anope::string desc;
std::vector<Anope::string> syntax;
/* Allow unregistered users to use this command */
bool allow_unregistered;
/* Command requires that a user is executing it */
bool require_user;
public:
/* Maximum paramaters accepted by this command */
size_t MaxParams;
size_t max_params;
/* Minimum parameters required to use this command */
size_t MinParams;
size_t min_params;
/* Module which owns us */
Module *module;
protected:
/** Create a new command.
* @param owner The owner of the command
* @param sname The command name
@@ -85,6 +117,7 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
*/
Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
public:
virtual ~Command();
protected:
@@ -94,7 +127,14 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
void SetSyntax(const Anope::string &s);
void SendSyntax(CommandSource &);
void SendSyntax(CommandSource &, const Anope::string &syntax);
void AllowUnregistered(bool b);
void RequireUser(bool b);
public:
bool AllowUnregistered() const;
bool RequireUser() const;
/** Get the command description
* @return The commands description
*/
@@ -125,4 +165,6 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand);
};
extern CoreExport void RunCommand(CommandSource &source, const Anope::string &message);
#endif // COMMANDS_H
+107 -60
View File
@@ -1,14 +1,21 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef CONFIG_H
#define CONFIG_H
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
#include <deque>
#include "anope.h"
#include "account.h"
#include "regchannel.h"
#include "users.h"
/** A configuration key and value pair
*/
@@ -23,7 +30,6 @@ typedef std::vector<KeyVal> KeyValList;
typedef std::multimap<Anope::string, KeyValList> ConfigDataHash;
// Required forward definitions
class ServerConfig;
/** Types of data in the core config
*/
@@ -41,7 +47,8 @@ enum ConfigDataType
DT_TIME, // Time value
DT_NORELOAD = 32, // Item can't be reloaded after startup
DT_ALLOW_WILD = 64, // Allow wildcards/CIDR in DT_IPADDRESS
DT_ALLOW_NEWLINE = 128 // New line characters allowed in DT_STRING
DT_ALLOW_NEWLINE = 128, // New line characters allowed in DT_STRING
DT_ALLOW_EMPTY = 256 // Allow empty value
};
/** Holds a config value, either string, integer or boolean.
@@ -199,23 +206,6 @@ typedef bool (*MultiValidator)(ServerConfig *, const Anope::string &, const Anop
*/
typedef bool (*MultiNotify)(ServerConfig *, const Anope::string &);
bool ValidateNotEmpty(ServerConfig *, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateNotZero(ServerConfig *, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateEmailReg(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidatePort(ServerConfig *, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateGuestPrefix(ServerConfig *conf, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateBantype(ServerConfig *, const Anope::string &, const Anope::string &, ValueItem &data);
bool ValidateChanServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateMemoServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateBotServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateHostServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateLimitSessions(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateOperServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateGlobal(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateNickLen(ServerConfig *, const Anope::string &, const Anope::string &, ValueItem &data);
bool ValidateMail(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
bool ValidateGlobalOnCycle(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data);
/** Represents a configuration file
*/
class ConfigurationFile
@@ -340,6 +330,29 @@ class CoreExport ServerConfig
void ValidateIP(const Anope::string &p, const Anope::string &, const Anope::string &, bool) const;
void ValidateNoSpaces(const Anope::string &, const Anope::string &, const Anope::string &) const;
struct Uplink
{
Anope::string host;
unsigned port;
Anope::string password;
bool ipv6;
Uplink(const Anope::string &_host, int _port, const Anope::string &_password, bool _ipv6) : host(_host), port(_port), password(_password), ipv6(_ipv6) { }
bool operator==(const Uplink &other) const
{
if (this->host != other.host)
return false;
if (this->port != other.port)
return false;
if (this->password != other.password)
return false;
if (this->ipv6 != other.ipv6)
return false;
return true;
}
inline bool operator!=(const Uplink &other) const { return !(*this == other); }
};
/** Below here is a list of variables which contain the config files values
*/
/* Host to bind to */
@@ -360,6 +373,15 @@ class CoreExport ServerConfig
unsigned UserLen;
/* Max lenght of hostnames */
unsigned HostLen;
/* Max length of channel names */
unsigned ChanLen;
/* User and group to run as */
Anope::string User;
Anope::string Group;
/* Casemapping to use */
Anope::string CaseMap;
/* Max length of passwords */
unsigned PassLen;
@@ -415,14 +437,24 @@ class CoreExport ServerConfig
Anope::string MLock;
/* Unmlockable modes */
Anope::string NoMLock;
/* Modes that are required to be on registered channels */
Anope::string CSRequire;
/* Use server side mlock */
bool UseServerSideMLock;
/* Use server side topic lock */
bool UseServerSideTopicLock;
/* The max length for reasons (cs_kick, cs_ban, etc) */
unsigned CSReasonMax;
/* Default botmodes on channels, defaults to ao */
Anope::string BotModes;
/* THe actual modes */
ChannelStatus BotModeList;
/* How long to wait between connection attempts */
int RetryWait;
/* If services should hide unprivileged commands */
bool HidePrivilegedCommands;
/* If set, nicks cant be owned/everything is entirely account based */
bool NoNicknameOwnership;
/* Regex engine to use */
Anope::string RegexEngine;
/* A vector of our logfile options */
std::vector<LogInfo *> LogInfos;
@@ -439,11 +471,11 @@ class CoreExport ServerConfig
time_t MailDelay;
/* Don't quote the To: address */
bool DontQuoteAddresses;
/* Nameserver to use for resolving hostnames */
Anope::string NameServer;
/* TIme before a DNS query is considered dead */
time_t DNSTimeout;
/* Mail messages to send */
Anope::string MailRegistrationSubject, MailRegistrationMessage;
Anope::string MailResetSubject, MailResetMessage;
Anope::string MailEmailchangeSubject, MailEmailchangeMessage;
Anope::string MailMemoSubject, MailMemoMessage;
/* Prefix of guest nicks when a user gets forced off of a nick */
Anope::string NSGuestNickPrefix;
@@ -452,7 +484,7 @@ class CoreExport ServerConfig
/* Don't allow nicks to use /ns group to regroup nicks */
bool NSNoGroupChange;
/* Default flags for newly registered nicks */
Flags<NickCoreFlag, NI_END> NSDefFlags;
std::set<Anope::string> NSDefFlags;
/* All languages Anope is aware about */
Anope::string Languages;
/* Default language used by services */
@@ -488,8 +520,10 @@ class CoreExport ServerConfig
bool NSSecureAdmins;
/* Services opers must be /operd on the ircd aswell */
bool NSStrictPrivileges;
/* Use email to verify new users registering */
bool NSEmailReg;
/* Type of confirmation to use, or to disable registration completely */
Anope::string NSRegistration;
/* A message sent to unregistered users on connect */
Anope::string NSUnregisteredNotice;
/* Core NickServ modules */
Anope::string NickCoreModules;
/* Set the proper channel modes on users when they identify */
@@ -498,11 +532,22 @@ class CoreExport ServerConfig
bool NSAddAccessOnReg;
/* Maximum number of channels on AJoin */
unsigned AJoinMax;
/* Kill & killquick delays before force changing off users */
time_t NSKillQuick;
time_t NSKill;
/* Modes set on a user when they identify */
Anope::string NSModesOnID;
/* Restore nick/channels on recover */
bool NSRestoreOnRecover;
/* Whether or not to use SASL */
bool NSSASL;
/* If set, hides netsplits in the last_quit field of nicks */
bool NSHideNetSplitQuit;
/* Core ChanServ modules */
Anope::string ChanCoreModules;
/* Default flags for newly registered channels */
Flags<ChannelInfoFlag, CI_END> CSDefFlags;
std::set<Anope::string> CSDefFlags;
/* Max number of channels a user can own */
unsigned CSMaxReg;
/* Time before a channel expires */
@@ -535,10 +580,17 @@ class CoreExport ServerConfig
/* Who can use memos reciepts */
unsigned MSMemoReceipt;
/* Valid chars allowed in vhosts */
Anope::string VhostChars;
/* Allow undotted vhosts? */
bool VhostUndotted;
/* Chars disallowed at the beginning or end of vhosts */
Anope::string VhostDisallowBE;
/* Core BotServ modules */
Anope::string BotCoreModules;
/* Default BotServ flags */
Flags<BotServFlag> BSDefFlags;
std::set<Anope::string> BSDefFlags;
/* How long before botserv forgets a user. This is used for flood kickers etc */
time_t BSKeepData;
/* Min number of users to have in the channel before the service bot joins */
@@ -576,30 +628,16 @@ class CoreExport ServerConfig
time_t SNLineExpiry;
/* Default expiry time for SQLines */
time_t SQLineExpiry;
/* Default expiry time for SZLine */
time_t SZLineExpiry;
/* Actually akill the user when the akill is added */
bool AkillOnAdd;
/* Kill users on SNLine */
bool KillonSNline;
/* Kill users on SQline */
bool KillonSQline;
/* Send a WALLOPS/GLOBOPS when a user opers */
bool WallOper;
/* Send a WALLOPS/GLOBOPS when a nonoper tries to use OperServ */
bool WallBadOS;
/* Send a WALLOPS/GLOBOPS when an akill expires */
bool WallAkillExpire;
/* Send a WALLOPS/GLOBOPS when SNLines expire */
bool WallSNLineExpire;
/* Send a WALLOPS/GLOBOPS when SQLines expire */
bool WallSQLineExpire;
/* Send a WALLOPS/GLOBOPS when SZLines expire */
bool WallSZLineExpire;
/* Send a WALLOPS/GLOBOPS when exceptions expire */
bool WallExceptionExpire;
/* Add the akillers nick to the akill reason */
bool AddAkiller;
/* Add akill ids to akill reason */
bool AkillIds;
/* Limit sessions */
bool LimitSessions;
@@ -613,6 +651,9 @@ class CoreExport ServerConfig
unsigned MaxSessionLimit;
/* How long session akills should last */
time_t SessionAutoKillExpiry;
/* Number of bits to use when comparing session IPs */
unsigned SessionIPv4CIDR;
unsigned SessionIPv6CIDR;
/* Reason to use for session kills */
Anope::string SessionLimitExceeded;
/* Optional second reason */
@@ -623,10 +664,8 @@ class CoreExport ServerConfig
/* List of modules to autoload */
std::list<Anope::string> ModulesAutoLoad;
/* User keys to use for generating random hashes for pass codes etc */
unsigned long UserKey1;
unsigned long UserKey2;
unsigned long UserKey3;
/* Seed to use for RNG */
unsigned long Seed;
/* Numeric */
Anope::string Numeric;
@@ -637,6 +676,11 @@ class CoreExport ServerConfig
std::list<OperType *> MyOperTypes;
/* List of pairs of opers and their opertype from the config */
std::vector<Oper *> Opers;
/* Map of fantasy commands */
CommandInfo::map Fantasy;
std::vector<CommandGroup> CommandGroups;
};
/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
@@ -668,7 +712,7 @@ class ConfigException : public CoreException
#define CONF_FILE_NOT_FOUND 0x000200
/** Allows reading of values from configuration files
* This class allows a module to read from either the main configuration file (inspircd.conf) or from
* This class allows a module to read from either the main configuration file (services.conf) or from
* a module-specified configuration file. It may either be instantiated with one parameter or none.
* Constructing the class using one parameter allows you to specify a path to your own configuration
* file, otherwise, inspircd.conf is read.
@@ -763,4 +807,7 @@ class CoreExport ConfigReader
int EnumerateValues(const Anope::string &, int);
};
extern ConfigurationFile ServicesConf;
extern CoreExport ServerConfig *Config;
#endif // CONFIG_H
+56
View File
@@ -0,0 +1,56 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
class AccessGroup;
class AutoKick;
namespace Anope { class String; }
class BotInfo;
class CallBack;
class ChanAccess;
class Channel;
class ChannelInfo;
class ChannelStatus;
class ClientSocket;
class Command;
class CommandSource;
class ConnectionSocket;
namespace DNS { class Packet; }
class Entry;
class IdentifyRequest;
class InfoFormatter;
class IRCDProto;
class ListenSocket;
class Log;
class LogInfo;
class Memo;
class MessageSource;
class Module;
class NickAlias;
class NickCore;
class OperType;
class ReferenceBase;
class Regex;
class Serializable;
class Server;
class ServerConfig;
class Socket;
class Thread;
class User;
class XLine;
class XLineManager;
struct BadWord;
struct Exception;
struct MemoInfo;
struct ModeLock;
struct Oper;
-191
View File
@@ -1,191 +0,0 @@
#ifndef DNS_H
#define DNS_H
/** Valid query types
*/
enum QueryType
{
/* Nothing */
DNS_QUERY_NONE,
/* A simple A lookup */
DNS_QUERY_A = 1,
/* A CNAME lookup */
DNS_QUERY_CNAME = 5,
/* Reverse DNS lookup */
DNS_QUERY_PTR = 12,
/* IPv6 AAAA lookup */
DNS_QUERY_AAAA = 28
};
/** Flags that can be AND'd into DNSPacket::flags to receive certain values
*/
enum QueryFlags
{
DNS_QUERYFLAGS_QR = 0x8000,
DNS_QUERYFLAGS_OPCODE = 0x7800,
DNS_QUERYFLAGS_AA = 0x400,
DBS_QUERYFLAGS_TC = 0x200,
DNS_QUERYFLAGS_RD = 0x100,
DNS_QUERYFLAGS_RA = 0x80,
DNS_QUERYFLAGS_Z = 0x70,
DNS_QUERYFLAGS_RCODE = 0xF
};
enum DNSError
{
DNS_ERROR_NONE,
DNS_ERROR_UNKNOWN,
DNS_ERROR_UNLOADED,
DNS_ERROR_TIMEOUT,
DNS_ERROR_NOT_AN_ANSWER,
DNS_ERROR_NONSTANDARD_QUERY,
DNS_ERROR_FORMAT_ERROR,
DNS_ERROR_SERVER_FAILURE,
DNS_ERROR_DOMAIN_NOT_FOUND,
DNS_ERROR_NOT_IMPLEMENTED,
DNS_ERROR_REFUSED,
DNS_ERROR_NO_RECORDS,
DNS_ERROR_INVALIDTYPE
};
class DNSRequestTimeout; // Forward declarations
struct DNSRecord;
class Module;
/** The request
*/
class CoreExport DNSRequest
{
/* Timeout timer for this request */
DNSRequestTimeout *timeout;
/* Use result cache if available */
bool use_cache;
public:
/* Request id */
unsigned short id;
/* Creator of this request */
Module *creator;
/* Address we're looking up */
Anope::string address;
/* QueryType, A, AAAA, PTR etc */
QueryType QT;
DNSRequest(const Anope::string &addr, QueryType qt, bool cache = false, Module *c = NULL);
virtual ~DNSRequest();
void Process();
virtual void OnLookupComplete(const DNSRecord *r) = 0;
virtual void OnError(const DNSRecord *r);
};
/** A full packet sent to the nameserver, may contain multiple queries
*/
struct DNSPacket
{
/* Our 16-bit id for this header */
unsigned short id;
/* Flags on the query */
unsigned short flags;
/* Number of queries */
unsigned short qdcount;
/* Number of resource records in answer */
unsigned short ancount;
/* Number of NS resource records in authority records section */
unsigned short nscount;
/* Number of resource records in the additional records section */
unsigned short arcount;
/* How many of the bytes of the payload are in use */
unsigned short payload_count;
/* The queries, at most can be 512 bytes */
unsigned char payload[512];
inline DNSPacket();
bool AddQuestion(const Anope::string &address, QueryType qt);
inline void FillPacket(const unsigned char *input, const size_t length);
inline void FillBuffer(unsigned char *buffer);
};
struct CoreExport DNSRecord
{
/* Name of the initial lookup */
Anope::string name;
/* Result of the lookup */
Anope::string result;
/* Type of query this was */
QueryType type;
/* Error, if there was one */
DNSError error;
/* Record class, should always be 1 */
unsigned short record_class;
/* Time to live */
time_t ttl;
/* Record length */
unsigned short rdlength;
/* When this record was created in our cache */
time_t created;
inline DNSRecord(const Anope::string &n);
operator bool() const;
};
/** DNS manager, manages the connection and all requests
*/
class CoreExport DNSManager : public Timer, public Socket
{
std::multimap<Anope::string, DNSRecord *> cache;
sockaddrs addrs;
public:
std::deque<DNSPacket *> packets;
std::map<short, DNSRequest *> requests;
static const int DNSPort = 53;
DNSManager(const Anope::string &nameserver, int port);
~DNSManager();
bool ProcessRead();
bool ProcessWrite();
void AddCache(DNSRecord *rr);
bool CheckCache(DNSRequest *request);
void Tick(time_t now);
void Cleanup(Module *mod);
/** Does a BLOCKING DNS query and returns the first IP.
* Only use this if you know what you are doing. Unless you specifically
* need a blocking query use the DNSRequest system
*/
static DNSRecord BlockingQuery(const Anope::string &mask, QueryType qt);
};
/** A DNS timeout, one is made for every DNS request to detect timeouts
*/
class DNSRequestTimeout : public Timer
{
DNSRequest *request;
public:
bool done;
DNSRequestTimeout(DNSRequest *r, time_t timeout);
~DNSRequestTimeout();
void Tick(time_t);
};
extern DNSManager *DNSEngine;
#endif // DNS_H
+55 -158
View File
@@ -1,82 +1,64 @@
/*
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
*/
#ifndef EXTENSIBLE_H
#define EXTENSIBLE_H
#include "hashcomp.h"
#include "anope.h"
#include "serialize.h"
/** Dummy base class we use to cast everything to/from
/* All items added to Extensible must inherit from this.
*/
class ExtensibleItemBase
class CoreExport ExtensibleItem
{
public:
ExtensibleItemBase() { }
virtual ~ExtensibleItemBase() { }
virtual ~ExtensibleItem() { }
virtual const Anope::string *Serialize() { return NULL; }
};
/** Class used to represent an extensible item that doesn't hold a pointer
/** Common class used to Extensible::Extend as it inherits from both ExtensibleItem
* and whatever basic object you're trying to store.
* Eg, obj->Extend(key, new ExtensibleItemClass<Anope::string>(value));
*/
template<typename T> class ExtensibleItemRegular : public ExtensibleItemBase
template<typename T> struct CoreExport ExtensibleItemClass : T, ExtensibleItem
{
protected:
T Item;
public:
ExtensibleItemRegular(T item) : Item(item) { }
virtual ~ExtensibleItemRegular() { }
T &GetItem() { return Item; }
ExtensibleItemClass(const T& t) : T(t) { }
};
/** Class used to represent an extensible item that holds a pointer
/* Used to attach metadata to this object that is automatically saved
* when the object is saved (assuming the object's Serialize method
* correcly calls Extensible::ExtensibleSerialize).
*/
template<typename T> class ExtensibleItemPointer : public ExtensibleItemBase
struct CoreExport ExtensibleMetadata : ExtensibleItemClass<Anope::string>
{
protected:
T *Item;
ExtensibleMetadata(const Anope::string &t) : ExtensibleItemClass<Anope::string>(t) { }
public:
ExtensibleItemPointer(T *item) : Item(item) { }
virtual ~ExtensibleItemPointer() { delete Item; }
T *GetItem() { return Item; }
const Anope::string *Serialize() anope_override { return this; }
};
/** Class used to represent an extensible item that holds a pointer to an arrray
*/
template<typename T> class ExtensibleItemPointerArray : public ExtensibleItemBase
{
protected:
T *Item;
public:
ExtensibleItemPointerArray(T *item) : Item(item) { }
virtual ~ExtensibleItemPointerArray() { delete [] Item; }
T *GetItem() { return Item; }
};
class CoreExport Extensible : public Base
/* Used to attach arbitrary objects to this object using unique keys */
class CoreExport Extensible
{
private:
typedef std::map<Anope::string, ExtensibleItemBase *> extensible_map;
extensible_map Extension_Items;
typedef std::map<Anope::string, ExtensibleItem *> extensible_map;
extensible_map *extension_items;
public:
/** Default constructor, does nothing
/** Default constructor
*/
Extensible() { }
Extensible();
/** Default destructor, deletes all of the extensible items in this object
/** Destructor, deletes all of the extensible items in this object
* then clears the map
*/
virtual ~Extensible()
{
for (extensible_map::iterator it = Extension_Items.begin(), it_end = Extension_Items.end(); it != it_end; ++it)
delete it->second;
Extension_Items.clear();
}
virtual ~Extensible();
/** Extend an Extensible class.
*
@@ -84,32 +66,11 @@ class CoreExport Extensible : public Base
* @param p This parameter is a pointer to an ExtensibleItem or ExtensibleItemBase derived class
*
* You must provide a key to store the data as via the parameter 'key'.
* The data will be inserted into the map. If the data already exists, you may not insert it
* twice, Extensible::Extend will return false in this case.
*
* @return Returns true on success, false if otherwise
* The data will be inserted into the map. If the data already exists, it will be overwritten.
*/
void Extend(const Anope::string &key, ExtensibleItemBase *p)
{
this->Shrink(key);
this->Extension_Items.insert(std::make_pair(key, p));
}
void Extend(const Anope::string &key, ExtensibleItem *p = NULL);
/** Extend an Extensible class.
*
* @param key The key parameter is an arbitary string which identifies the extension data
*
* You must provide a key to store the data as via the parameter 'key', this single-parameter
* version takes no 'data' parameter, this is used purely for boolean values.
* The key will be inserted into the map with a NULL 'data' pointer. If the key already exists
* then you may not insert it twice, Extensible::Extend will return false in this case.
*
* @return Returns true on success, false if otherwise
*/
void Extend(const Anope::string &key)
{
this->Extend(key, new ExtensibleItemPointer<char *>(NULL));
}
void ExtendMetadata(const Anope::string &key, const Anope::string &value = "");
/** Shrink an Extensible class.
*
@@ -119,105 +80,41 @@ class CoreExport Extensible : public Base
* you provide a nonexistent key (case is important) then the function will return false.
* @return Returns true on success.
*/
bool Shrink(const Anope::string &key)
{
extensible_map::iterator it = this->Extension_Items.find(key);
if (it != this->Extension_Items.end())
{
delete it->second;
/* map::size_type map::erase( const key_type& key );
* returns the number of elements removed, std::map
* is single-associative so this should only be 0 or 1
*/
return this->Extension_Items.erase(key);
}
return false;
}
/** Get an extension item that is not a pointer.
*
* @param key The key parameter is an arbitary string which identifies the extension data
* @param p If you provide a non-existent key, this value will be 0. Otherwise a copy to the item you requested will be placed in this templated parameter.
* @return Returns true if the item was found and false if it was nor, regardless of wether 'p' is NULL. This allows you to store NULL values in Extensible.
*/
template<typename T> bool GetExtRegular(const Anope::string &key, T &p)
{
extensible_map::iterator it = this->Extension_Items.find(key);
if (it != this->Extension_Items.end())
{
p = debug_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
return true;
}
return false;
}
/** Get an extension item that is a pointer.
*
* @param key The key parameter is an arbitary string which identifies the extension data
* * @param p If you provide a non-existent key, this value will be NULL. Otherwise a pointer to the item you requested will be placed in this templated parameter.
* @return Returns true if the item was found and false if it was nor, regardless of wether 'p' is NULL. This allows you to store NULL values in Extensible.
*/
template<typename T> bool GetExtPointer(const Anope::string &key, T *&p)
{
extensible_map::iterator it = this->Extension_Items.find(key);
if (it != this->Extension_Items.end())
{
p = debug_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
return true;
}
p = NULL;
return false;
}
/** Get an extension item that is a pointer to an array
*
* @param key The key parameter is an arbitary string which identifies the extension data
* @param p If you provide a non-existent key, this value will be NULL. Otherwise a pointer to the item you requested will be placed in this templated parameter.
* @return Returns true if the item was found and false if it was nor, regardless of wether 'p' is NULL. This allows you to store NULL values in Extensible.
*/
template<typename T> bool GetExtArray(const Anope::string &key, T *&p)
{
extensible_map::iterator it = this->Extension_Items.find(key);
if (it != this->Extension_Items.end())
{
p = debug_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
return true;
}
p = NULL;
return false;
}
bool Shrink(const Anope::string &key);
/** Get an extension item.
*
* @param key The key parameter is an arbitary string which identifies the extension data
* @return Returns true if the item was found and false if it was not.
*
* This single-parameter version only checks if the key exists, it does nothing with
* the 'data' field and is probably only useful in conjunction with the single-parameter
* version of Extend().
* @return The item found
*/
bool GetExt(const Anope::string &key)
template<typename T> T GetExt(const Anope::string &key) const
{
return this->Extension_Items.find(key) != this->Extension_Items.end();
if (this->extension_items)
{
extensible_map::const_iterator it = this->extension_items->find(key);
if (it != this->extension_items->end())
return anope_dynamic_static_cast<T>(it->second);
}
return NULL;
}
/** Check if an extension item exists.
*
* @param key The key parameter is an arbitary string which identifies the extension data
* @return True if the item was found.
*/
bool HasExt(const Anope::string &key) const;
/** Get a list of all extension items names.
* @param list A deque of strings to receive the list
* @return This function writes a list of all extension items stored
* in this object by name into the given deque and returns void.
*/
void GetExtList(std::deque<Anope::string> &list)
{
for (extensible_map::iterator it = Extension_Items.begin(), it_end = Extension_Items.end(); it != it_end; ++it)
list.push_back(it->first);
}
void GetExtList(std::deque<Anope::string> &list) const;
void ExtensibleSerialize(Serialize::Data &data) const;
void ExtensibleUnserialize(Serialize::Data &data);
};
#endif // EXTENSIBLE_H
-224
View File
@@ -1,224 +0,0 @@
/* Prototypes and external variable declarations.
*
* (C) 2003-2011 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
#ifndef EXTERN_H
#define EXTERN_H
#define E extern CoreExport
#define EI extern DllExport
#include "hashcomp.h"
/* IRC Variables */
E IRCDVar *ircd;
E IRCDProto *ircdproto;
E IRCdMessage *ircdmessage;
/**** actions.c ****/
E bool bad_password(User *u);
E void common_unban(ChannelInfo *ci, User *u, bool full = false);
/**** botserv.c ****/
E BotInfo *findbot(const Anope::string &nick);
E void bot_raw_ban(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason);
E void bot_raw_kick(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason);
/**** channels.c ****/
E Channel *findchan(const Anope::string &chan);
E User *nc_on_chan(Channel *c, const NickCore *nc);
E void do_cmode(const Anope::string &source, const Anope::string &channel, const Anope::string &modes, const Anope::string &ts);
E void do_join(const Anope::string &source, const Anope::string &channels, const Anope::string &ts);
E void do_kick(const Anope::string &source, const Anope::string &channel, const Anope::string &users, const Anope::string &reason);
E void do_part(const Anope::string &source, const Anope::string &channels, const Anope::string &reason);
E void chan_set_correct_modes(User *user, Channel *c, int give_modes);
/**** chanserv.c ****/
E void check_modes(Channel *c);
E ChannelInfo *cs_findchan(const Anope::string &chan);
E bool IsFounder(User *user, ChannelInfo *ci);
E void update_cs_lastseen(User *user, ChannelInfo *ci);
E int get_idealban(ChannelInfo *ci, User *u, Anope::string &ret);
/**** config.c ****/
E ConfigurationFile services_conf;
E ServerConfig *Config;
/**** encrypt.c ****/
E void enc_encrypt(const Anope::string &src, Anope::string &dest);
E bool enc_decrypt(const Anope::string &src, Anope::string &dest);
/**** hostserv.c ****/
/**** init.c ****/
E void introduce_user(const Anope::string &user);
E bool GetCommandLineArgument(const Anope::string &name, char shortname = 0);
E bool GetCommandLineArgument(const Anope::string &name, char shortname, Anope::string &param);
E void Init(int ac, char **av);
/**** ircd.c ****/
E void pmodule_ircd_proto(IRCDProto *);
E void pmodule_ircd_var(IRCDVar *ircdvar);
E void pmodule_ircd_message(IRCdMessage *message);
/**** language.cpp ****/
E std::vector<Anope::string> languages;
E std::vector<Anope::string> domains;
E void InitLanguages();
E const char *translate(const char *string);
E const char *translate(User *u, const char *string);
E const char *translate(NickCore *nc, const char *string);
E const char *anope_gettext(const char *lang, const char *string);
/**** main.c ****/
E Anope::string services_dir;
E Anope::string services_bin;
E int debug;
E bool readonly;
E bool nofork;
E bool nothird;
E bool noexpire;
E bool protocoldebug;
E bool quitting;
E bool restarting;
E Anope::string quitmsg;
E time_t start_time;
E ConnectionSocket *UplinkSock;
E int CurrentUplink;
E void save_databases();
E void sighandler(int signum);
/**** messages.cpp ****/
E void init_core_messages();
E bool OnStats(const Anope::string &source, const std::vector<Anope::string> &);
E bool OnTime(const Anope::string &source, const std::vector<Anope::string> &);
E bool OnVersion(const Anope::string &source, const std::vector<Anope::string> &);
E bool On436(const Anope::string &, const std::vector<Anope::string> &);
E bool OnAway(const Anope::string &, const std::vector<Anope::string> &);
E bool OnJoin(const Anope::string &, const std::vector<Anope::string> &);
E bool OnKick(const Anope::string &, const std::vector<Anope::string> &);
E bool OnKill(const Anope::string &, const std::vector<Anope::string> &);
E bool OnMode(const Anope::string &, const std::vector<Anope::string> &);
E bool OnNick(const Anope::string &, const std::vector<Anope::string> &);
E bool OnUID(const Anope::string &, const std::vector<Anope::string> &);
E bool OnPart(const Anope::string &, const std::vector<Anope::string> &);
E bool OnPing(const Anope::string &, const std::vector<Anope::string> &);
E bool OnPrivmsg(const Anope::string &, const std::vector<Anope::string> &);
E bool OnQuit(const Anope::string &, const std::vector<Anope::string> &);
E bool OnServer(const Anope::string &, const std::vector<Anope::string> &);
E bool OnSQuit(const Anope::string &, const std::vector<Anope::string> &);
E bool OnTopic(const Anope::string &, const std::vector<Anope::string> &);
E bool OnWhois(const Anope::string &, const std::vector<Anope::string> &);
E bool OnCapab(const Anope::string &, const std::vector<Anope::string> &);
E bool OnSJoin(const Anope::string &, const std::vector<Anope::string> &);
E bool OnError(const Anope::string &, const std::vector<Anope::string> &);
/**** misc.c ****/
E bool IsFile(const Anope::string &filename);
E int toupper(char);
E int tolower(char);
E time_t dotime(const Anope::string &s);
E Anope::string duration(const time_t &seconds, NickCore *nc = NULL);
E Anope::string expire_left(NickCore *nc, time_t expires);
E Anope::string do_strftime(const time_t &t, NickCore *nc = NULL, bool short_output = false);
E bool doValidHost(const Anope::string &host, int type);
E bool isValidHost(const Anope::string &host, int type);
E bool isvalidchar(char c);
E Anope::string myStrGetToken(const Anope::string &str, char dilim, int token_number);
E Anope::string myStrGetTokenRemainder(const Anope::string &str, char dilim, int token_number);
E int myNumToken(const Anope::string &str, char dilim);
E bool nickIsServices(const Anope::string &nick, bool bot);
E void add_entropy_userkeys();
E void rand_init();
E unsigned char getrandom8();
E uint16 getrandom16();
E uint32 getrandom32();
E std::list<Anope::string> BuildStringList(const Anope::string &, char = ' ');
E std::vector<Anope::string> BuildStringVector(const Anope::string &, char = ' ');
E bool str_is_wildcard(const Anope::string &str);
E bool str_is_pure_wildcard(const Anope::string &str);
E Anope::string normalizeBuffer(const Anope::string &);
/**** modes.cpp ****/
/* Number of generic modes we support */
E unsigned GenericChannelModes, GenericUserModes;
E std::multimap<ChannelModeName, ModeLock> def_mode_locks;
E void SetDefaultMLock(ServerConfig *config);
/**** nickserv.c ****/
E void change_core_display(NickCore *nc);
E void change_core_display(NickCore *nc, const Anope::string &newdisplay);
E NickAlias *findnick(const Anope::string &nick);
E NickCore *findcore(const Anope::string &nick);
E bool is_on_access(const User *u, const NickCore *nc);
/**** process.c ****/
E void process(const Anope::string &buf);
/**** send.c ****/
E void send_cmd(const Anope::string &source, const char *fmt, ...) FORMAT(printf, 2, 3);
E void notice_server(const Anope::string &source, const Server *s, const char *fmt, ...) FORMAT(printf, 3, 4);
/**** sockets.cpp ****/
E int32 TotalRead;
E int32 TotalWritten;
E SocketIO normalSocketIO;
/**** users.c ****/
E int32 opcnt;
E uint32 maxusercnt, usercnt;
E time_t maxusertime;
E User *finduser(const Anope::string &nick);
E User *do_nick(const Anope::string &source, const Anope::string &nick, const Anope::string &username, const Anope::string &host, const Anope::string &server, const Anope::string &realname, time_t ts, const Anope::string &ip, const Anope::string &vhost, const Anope::string &uid, const Anope::string &modes);
E void do_umode(const Anope::string &user, const Anope::string &modes);
E void do_kill(User *user, const Anope::string &reason);
E bool matches_list(Channel *c, User *user, ChannelModeName mode);
E Anope::string create_mask(User *u);
#endif /* EXTERN_H */
+50 -361
View File
@@ -1,192 +1,79 @@
/*
*
* Copyright (C) 2002-2011 InspIRCd Development Team
* Copyright (C) 2009-2011 Anope Team <team@anope.org>
* Copyright (C) 2009-2013 Anope Team <team@anope.org>
*
* Please read COPYING and README for further details.
*
* These classes have been copied from InspIRCd and modified
* for use in Anope.
*
*
*/
#ifndef HASHCOMP_H
#define HASHCOMP_H
#ifdef _WIN32
# ifdef MODULE_COMPILE
# define CoreExport __declspec(dllimport)
# define DllExport __declspec(dllexport)
# else
# define CoreExport __declspec(dllexport)
# define DllExport __declspec(dllimport)
# endif
#include <string>
#include <locale>
#ifndef _WIN32
#include <tr1/unordered_map>
#else
# define CoreExport
# define DllExport
#include <unordered_map>
#endif
#include <string>
#include "services.h"
namespace Anope
{
class string;
}
#ifndef _WIN32
# if defined(__GNUC__) && __GNUC__ >= 4
/* GCC4+ has deprecated hash_map and uses tr1. But of course, uses a different include to MSVC. */
# include <tr1/unordered_map>
# define unordered_map_namespace std::tr1
# else /* GCC ver < 4 */
# include <ext/hash_map>
/* Oddball linux namespace for hash_map */
# define unordered_map_namespace __gnu_cxx
# define unordered_map hash_map
# endif
#else
# if _MSC_VER >= 1600
/* MSVC 2010+ has tr1. Though MSVC and GCC use different includes! */
# include <unordered_map>
# define unordered_map_namespace std::tr1
# else
# include <hash_map>
# define unordered_map_namespace
template<typename Key, typename Type, typename Compare, typename Unused = void>
class unordered_map : public stdext::hash_map<Key, Type, Compare>
{
public:
unordered_map() : hash_map() { }
};
# endif
#endif
/* Casemap in use by Anope. ci::string's comparation functions use this (and thus Anope::string) */
extern std::locale casemap;
/*******************************************************
* This file contains classes and templates that deal
* with the comparison and hashing of 'irc strings'.
* An 'irc string' is a string which compares in a
* case insensitive manner, and as per RFC 1459 will
* treat [ identical to {, ] identical to }, and \
* as identical to |.
*
* Our hashing functions are designed to accept
* std::string and compare/hash them as type irc::string
* by converting them internally. This makes them
* backwards compatible with other code which is not
* aware of irc::string.
*******************************************************/
/** A mapping of uppercase to lowercase, including scandinavian
* 'oddities' as specified by RFC1459, e.g. { -> [, and | -> \
*/
unsigned const char rfc_case_insensitive_map[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 0-19 */
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, /* 20-39 */
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, /* 40-59 */
60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, /* 60-79 */
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 94, 95, 96, 97, 98, 99, /* 80-99 */
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, /* 100-119 */
120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, /* 120-139 */
140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, /* 140-159 */
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, /* 160-179 */
180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, /* 180-199 */
200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, /* 200-219 */
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, /* 220-239 */
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 /* 240-255 */
};
/** Case insensitive map, ASCII rules.
* That is;
* [ != {, but A == a.
*/
unsigned const char ascii_case_insensitive_map[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 0-19 */
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, /* 20-39 */
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, /* 40-59 */
60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, /* 60-79 */
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, /* 80-99 */
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, /* 100-119 */
120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, /* 120-139 */
140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, /* 140-159 */
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, /* 160-179 */
180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, /* 180-199 */
200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, /* 200-219 */
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, /* 220-239 */
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 /* 240-255 */
};
/** The irc namespace contains a number of helper classes.
*/
namespace irc
{
/** The irc_char_traits class is used for RFC-style comparison of strings.
* This class is used to implement irc::string, a case-insensitive, RFC-
* comparing string class.
*/
struct irc_char_traits : std::char_traits<char>
/* ASCII case insensitive ctype. */
template<typename char_type>
class ascii_ctype : public std::ctype<char_type>
{
/** Check if two chars match.
* @param c1st First character
* @param c2nd Second character
* @return true if the characters are equal
*/
static bool eq(char c1st, char c2nd);
public:
char_type do_toupper(char_type c) const anope_override
{
if (c >= 'a' && c <= 'z')
return c - 32;
else
return c;
}
/** Check if two chars do NOT match.
* @param c1st First character
* @param c2nd Second character
* @return true if the characters are unequal
*/
static bool ne(char c1st, char c2nd);
/** Check if one char is less than another.
* @param c1st First character
* @param c2nd Second character
* @return true if c1st is less than c2nd
*/
static bool lt(char c1st, char c2nd);
/** Compare two strings of size n.
* @param str1 First string
* @param str2 Second string
* @param n Length to compare to
* @return similar to strcmp, zero for equal, less than zero for str1
* being less and greater than zero for str1 being greater than str2.
*/
static int compare(const char *str1, const char *str2, size_t n);
/** Find a char within a string up to position n.
* @param s1 String to find in
* @param n Position to search up to
* @param c Character to search for
* @return Pointer to the first occurance of c in s1
*/
static const char *find(const char *s1, int n, char c);
char_type do_tolower(char_type c) const anope_override
{
if (c >= 'A' && c <= 'Z')
return c + 32;
else
return c;
}
};
/** This typedef declares irc::string based upon irc_char_traits.
*/
typedef std::basic_string<char, irc_char_traits, std::allocator<char> > string;
/** Used to hash irc::strings for unordered_map
*/
struct CoreExport hash
/* rfc1459 case insensitive ctype, { = [, } = ], and | = \ */
template<typename char_type>
class rfc1459_ctype : public ascii_ctype<char_type>
{
/* VS 2008 specific code */
enum { bucket_size = 4, min_buckets = 8 };
bool operator()(const Anope::string &s1, const Anope::string &s2) const;
/* End VS 2008 specific code */
public:
char_type do_toupper(char_type c) const anope_override
{
if (c == '{' || c == '}' || c == '|')
return c - 32;
else
return ascii_ctype<char_type>::do_toupper(c);
}
/** Hash an irc::string for unordered_map
* @param s The string
* @return A hash value for the string
*/
size_t operator()(const irc::string &s) const;
size_t operator()(const Anope::string &s) const;
char_type do_tolower(char_type c) const anope_override
{
if (c == '[' || c == ']' || c == '\\')
return c + 32;
else
return ascii_ctype<char_type>::do_tolower(c);
}
};
}
/** The ci namespace contains a number of helper classes.
/** The ci namespace contains a number of helper classes relevant to case insensitive strings.
*/
namespace ci
{
@@ -239,60 +126,8 @@ namespace ci
*/
typedef std::basic_string<char, ci_char_traits, std::allocator<char> > string;
/** Used to hash ci::strings for unordered_map
*/
struct CoreExport hash
struct CoreExport less
{
/* VS 2008 specific code */
enum { bucket_size = 4, min_buckets = 8 };
bool operator()(const Anope::string &s1, const Anope::string &s2) const;
/* End VS 2008 specific code */
/** Hash a ci::string for unordered_map
* @param s The string
* @return A hash value for the string
*/
size_t operator()(const ci::string &s) const;
size_t operator()(const Anope::string &s) const;
};
}
namespace std
{
/** An overload for std::equal_to<ci::string> that uses Anope::string, passed for the fourth temmplate
* argument for unordered_map
*/
template<> struct CoreExport equal_to<ci::string>
{
public:
/** Compare two Anope::strings as ci::strings
* @paarm s1 The first string
* @param s2 The second string
* @return true if they are equal
*/
bool operator()(const Anope::string &s1, const Anope::string &s2) const;
};
/** An overload for std::equal_to<irc::string> that uses Anope::string, passed for the fourth template
* argument for unorderd_map
*/
template<> struct CoreExport equal_to<irc::string>
{
public:
/** Compare two Anope::strings as irc::strings
* @param s1 The first string
* @param s2 The second string
* @return true if they are equal
*/
bool operator()(const Anope::string &s1, const Anope::string &s2) const;
};
/** An overload for std::less<ci::string> that uses Anope::string, passed for the third template argument
* to std::map and std::multimap
*/
template<> struct CoreExport less<ci::string>
{
public:
/** Compare two Anope::strings as ci::strings and find which one is less
* @param s1 The first string
* @param s2 The second string
@@ -300,64 +135,6 @@ namespace std
*/
bool operator()(const Anope::string &s1, const Anope::string &s2) const;
};
/** An overload for std;:less<irc::string> that uses Anope::string, passed for the third tempalte argument
* to std::map and std::multimap
*/
template<> struct CoreExport less<irc::string>
{
public:
/** Compare two Anope::strings as irc::strings and find which one is less
* @param s1 The first string
* @param s2 The second string
* @return true if s1 < s2, else false
*/
bool operator()(const Anope::string &s1, const Anope::string &s2) const;
};
}
/* Define operators for using >> and << with irc::string to an ostream on an istream. */
/* This was endless fun. No. Really. */
/* It was also the first core change Ommeh made, if anyone cares */
/** Operator >> for irc::string
*/
inline std::istream &operator>>(std::istream &is, irc::string &str)
{
std::string tmp;
is >> tmp;
str = tmp.c_str();
return is;
}
/** Operator >> for ci::string
*/
inline std::istream &operator>>(std::istream &is, ci::string &str)
{
std::string tmp;
is >> tmp;
str = tmp.c_str();
return is;
}
/* Define operators for + and == with irc::string to std::string for easy assignment
* and comparison
*
* Operator +
*/
inline std::string operator+(std::string &leftval, irc::string &rightval)
{
return leftval + std::string(rightval.c_str());
}
/* Define operators for + and == with irc::string to std::string for easy assignment
* and comparison
*
* Operator +
*/
inline irc::string operator+(irc::string &leftval, std::string &rightval)
{
return leftval + irc::string(rightval.c_str());
}
/* Define operators for + and == with ci::string to std::string for easy assignment
@@ -380,46 +157,6 @@ inline ci::string operator+(ci::string &leftval, std::string &rightval)
return leftval + ci::string(rightval.c_str());
}
/* Define operators for + and == with irc::string to ci::string for easy assignment
* and comparison
*
* Operator +
*/
inline irc::string operator+(irc::string &leftval, ci::string &rightval)
{
return leftval + irc::string(rightval.c_str());
}
/* Define operators for + and == with irc::string to ci::string for easy assignment
* and comparison
*
* Operator +
*/
inline ci::string operator+(ci::string &leftval, irc::string &rightval)
{
return leftval + ci::string(rightval.c_str());
}
/* Define operators for + and == with irc::string to std::string for easy assignment
* and comparison
*
* Operator ==
*/
inline bool operator==(const std::string &leftval, const irc::string &rightval)
{
return leftval.c_str() == rightval;
}
/* Define operators for + and == with irc::string to std::string for easy assignment
* and comparison
*
* Operator ==
*/
inline bool operator==(const irc::string &leftval, const std::string &rightval)
{
return leftval == rightval.c_str();
}
/* Define operators for + and == with ci::string to std::string for easy assignment
* and comparison
*
@@ -440,40 +177,6 @@ inline bool operator==(const ci::string &leftval, const std::string &rightval)
return leftval == rightval.c_str();
}
/* Define operators for + and == with irc::string to ci::string for easy assignment
* and comparison
*
* Operator ==
*/
inline bool operator==(const ci::string &leftval, const irc::string &rightval)
{
return leftval.c_str() == rightval;
}
/* Define operators for + and == with irc::string to ci::string for easy assignment
* and comparison
*
* Operator ==
*/
inline bool operator==(const irc::string &leftval, const ci::string &rightval)
{
return leftval == rightval.c_str();
}
/* Define operators != for irc::string to std::string for easy comparison
*/
inline bool operator!=(const irc::string &leftval, const std::string &rightval)
{
return !(leftval == rightval.c_str());
}
/* Define operators != for std::string to irc::string for easy comparison
*/
inline bool operator!=(const std::string &leftval, const irc::string &rightval)
{
return !(leftval.c_str() == rightval);
}
/* Define operators != for ci::string to std::string for easy comparison
*/
inline bool operator!=(const ci::string &leftval, const std::string &rightval)
@@ -481,25 +184,11 @@ inline bool operator!=(const ci::string &leftval, const std::string &rightval)
return !(leftval == rightval.c_str());
}
/* Define operators != for ci::string to irc::string for easy comparison
/* Define operators != for std::string to ci::string for easy comparison
*/
inline bool operator!=(const std::string &leftval, const ci::string &rightval)
{
return !(leftval.c_str() == rightval);
}
/* Define operators != for irc::string to ci::string for easy comparison
*/
inline bool operator!=(const irc::string &leftval, const ci::string &rightval)
{
return !(leftval == rightval.c_str());
}
/* Define operators != for irc::string to ci::string for easy comparison
*/
inline bool operator!=(const ci::string &leftval, const irc::string &rightval)
{
return !(leftval.c_str() == rightval);
}
#endif // HASHCOMP_H
+60 -17
View File
@@ -1,11 +1,69 @@
/* Commonly used language strings
/*
*
* (C) 2008-2011 Anope Team
* (C) 2008-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
*/
#include "anope.h"
namespace Language
{
/* Languages we support as configured in services.conf. They are
* added to this list if we detect a language exists in the correct
* location for each language.
*/
extern CoreExport std::vector<Anope::string> Languages;
/* Domains to search when looking for translations other than the
* default "anope domain. This is used by modules who add their own
* language files (and thus domains) to Anope. If a module is loaded
* and we detect a language file exists for at least one of the supported
* languages for the module, then we add the module's domain (its name)
* here.
*
* When strings are translated they are checked against all domains.
*/
extern std::vector<Anope::string> Domains;
/** Initialize the language system. Finds valid language files and
* populates the Languages list.
*/
extern void InitLanguages();
/** Translates a string to the default language.
* @param string A string to translate
* @return The translated string if found, else the original string.
*/
extern CoreExport const char *Translate(const char *string);
/** Translates a string to the language of the given user.
* @param u The user to transate the string for
* @param string A string to translate
* @return The translated string if found, else the original string.
*/
extern CoreExport const char *Translate(User *u, const char *string);
/** Translates a string to the language of the given account.
* @param nc The account to translate the string for
* @param string A string to translate
* @return The translated string if count, else the original string
*/
extern CoreExport const char *Translate(const NickCore *nc, const char *string);
/** Translatesa string to the given language.
* @param lang The language to trnalsate to
* @param string The string to translate
* @return The translated string if found, else the original string.
*/
extern CoreExport const char *Translate(const char *lang, const char *string);
} // namespace Language
/* Commonly used language strings */
#define MORE_INFO _("\002%s%s HELP %s\002 for more information.")
#define BAD_USERHOST_MASK _("Mask must be in the form \037user\037@\037host\037.")
#define BAD_EXPIRY_TIME _("Invalid expiry time.")
@@ -30,7 +88,6 @@
#define NO_REASON _("No reason")
#define UNKNOWN _("<unknown>")
#define NO_EXPIRE _("does not expire")
#define END_OF_ANY_LIST _("End of \002%s\002 list.")
#define LIST_INCORRECT_RANGE _("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")
#define UNKNOWN_OPTION _("Unknown option \002%s\002.\n" \
"Type %s%s HELP %s for more information.")
@@ -47,7 +104,6 @@
#define NICK_SET_UNKNOWN_OPTION _("Unknown SET option \002%s%s\002.")
#define NICK_SET_DISPLAY_CHANGED _("The new display is now \002%s\002.")
#define NICK_LIST_SYNTAX _("LIST \037pattern\037")
#define LIST_HEADER _("List of entries matching \002%s\002:")
#define NICK_RECOVERED _("User claiming your nick has been killed.\n" \
"\002%s%s RELEASE %s\002 to get it back before %s timeout.")
#define NICK_REQUESTED _("This nick has already been requested, please check your e-mail address for the pass code")
@@ -62,16 +118,8 @@
#define CHAN_SETTING_UNSET _("%s for %s unset.")
#define CHAN_SET_MLOCK_DEPRECATED _("MLOCK is deprecated. Use \002%s%s HELP MODE\002 instead.")
#define CHAN_ACCESS_LEVEL_RANGE _("Access level must be between %d and %d inclusive.")
#define CHAN_ACCESS_LIST_HEADER _("Access list for %s:\n" \
" Num Lev Mask")
#define CHAN_ACCESS_VIEW_AXS_FORMAT _(" %3d %4d %s\n" \
" by %s on %s, last seen %s")
#define CHAN_AKICK_VIEW_FORMAT _("%3d %s (by %s on %s)\n" \
" %s")
#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_LIST_ENTRY _("%3d %s\n" \
" Added by %s on %s")
#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" \
@@ -86,11 +134,6 @@
#define BOT_NOT_ASSIGNED _("You must assign a bot to the channel before using this command.")
#define BOT_NOT_ON_CHANNEL _("Bot is not on channel \002%s\002.")
#define BOT_ASSIGN_READONLY _("Sorry, bot assignment is temporarily disabled.")
#define ENABLED _("Enabled")
#define DISABLED _("Disabled")
#define OPER_LIST_FORMAT _(" %3d %-32s %s")
#define OPER_VIEW_FORMAT _("%3d %s (by %s on %s; %s)\n" \
" %s")
#define HOST_SET_ERROR _("A vhost must be in the format of a valid hostmask.")
#define HOST_SET_IDENT_ERROR _("A vhost ident must be in the format of a valid ident")
#define HOST_SET_TOOLONG _("Error! The vhost is too long, please use a host shorter than %d characters.")
+93
View File
@@ -0,0 +1,93 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef LISTS_H
#define LISTS_H
#include "services.h"
#include "anope.h"
/** A class to process numbered lists (passed to most DEL/LIST/VIEW commands).
* The function HandleNumber is called for every number in the list. Note that
* if descending is true it gets called in descending order. This is so deleting
* the index passed to the function from an array will not cause the other indexes
* passed to the function to be incorrect. This keeps us from having to have an
* 'in use' flag on everything.
*/
class CoreExport NumberList
{
private:
bool is_valid;
std::set<unsigned> numbers;
bool desc;
public:
/** Processes a numbered list
* @param list The list
* @param descending True to make HandleNumber get called with numbers in descending order
*/
NumberList(const Anope::string &list, bool descending);
/** Destructor, does nothing
*/
virtual ~NumberList();
/** Should be called after the constructors are done running. This calls the callbacks.
*/
void Process();
/** Called with a number from the list
* @param number The number
*/
virtual void HandleNumber(unsigned number);
/** Called when there is an error with the numbered list
* Return false to immediatly stop processing the list and return
* This is all done before we start calling HandleNumber, so no numbers will have been processed yet
* @param list The list
* @return false to stop processing
*/
virtual bool InvalidRange(const Anope::string &list);
};
/** This class handles formatting LIST/VIEW replies.
*/
class CoreExport ListFormatter
{
public:
typedef std::map<Anope::string, Anope::string> ListEntry;
private:
std::vector<Anope::string> columns;
std::vector<ListEntry> entries;
public:
ListFormatter &AddColumn(const Anope::string &name);
void AddEntry(const ListEntry &entry);
bool IsEmpty() const;
void Process(std::vector<Anope::string> &);
};
/** This class handles formatting INFO replies
*/
class CoreExport InfoFormatter
{
NickCore *nc;
std::vector<std::pair<Anope::string, Anope::string> > replies;
unsigned longest;
public:
InfoFormatter(NickCore *nc);
void Process(std::vector<Anope::string> &);
Anope::string &operator[](const Anope::string &key);
};
#endif // LISTS_H
+69 -29
View File
@@ -1,14 +1,35 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef LOGGER_H
#define LOGGER_H
#include "anope.h"
#include "defs.h"
enum LogType
{
/* Used whenever an administrator uses an administrative comand */
LOG_ADMIN,
/* Used whenever an administrator overides something, such as adding
* access to a channel where they don't have permission to.
*/
LOG_OVERRIDE,
/* Any other command usage */
LOG_COMMAND,
LOG_SERVER,
LOG_CHANNEL,
LOG_USER,
LOG_MODULE,
LOG_NORMAL,
LOG_TERMINAL,
LOG_RAWIO,
@@ -21,44 +42,62 @@ enum LogType
struct LogFile
{
Anope::string filename;
public:
std::ofstream stream;
LogFile(const Anope::string &name);
Anope::string GetName() const;
};
class Command;
/* Represents a single log message */
class CoreExport Log
{
public:
BotInfo *bi;
LogType Type;
Anope::string Category;
std::list<Anope::string> Sources;
/* Bot that should log this message */
const BotInfo *bi;
/* For commands, the user executing the command */
Anope::string nick;
/* For commands, the user executing the command, but might not always exist */
const User *u;
/* For commands, the account executing teh command, but will not always exist */
const NickCore *nc;
/* For commands, the command being executed */
Command *c;
/* Used for LOG_CHANNEL */
Channel *chan;
/* For commands, the channel the command was executed on, will not always exist */
const ChannelInfo *ci;
/* For LOG_SERVER */
Server *s;
/* For LOG_MODULE */
Module *m;
LogType type;
Anope::string category;
std::list<Anope::string> sources;
std::stringstream buf;
Log(LogType type = LOG_NORMAL, const Anope::string &category = "", BotInfo *bi = NULL);
Log(LogType type = LOG_NORMAL, const Anope::string &category = "", const BotInfo *bi = NULL);
/* LOG_COMMAND/OVERRIDE/ADMIN */
Log(LogType type, User *u, Command *c, ChannelInfo *ci = NULL);
Log(LogType type, CommandSource &source, Command *c, const ChannelInfo *ci = NULL);
/* LOG_CHANNEL */
Log(User *u, Channel *c, const Anope::string &category = "");
Log(const User *u, Channel *c, const Anope::string &category = "");
/* LOG_USER */
explicit Log(User *u, const Anope::string &category = "");
explicit Log(const User *u, const Anope::string &category = "", const BotInfo *bi = NULL);
/* LOG_SERVER */
Log(Server *s, const Anope::string &category = "");
explicit Log(Server *s, const Anope::string &category = "", const BotInfo *bi = NULL);
Log(BotInfo *b, const Anope::string &category = "");
explicit Log(const BotInfo *b, const Anope::string &category = "");
Log(Module *m, const Anope::string &category = "");
~Log();
Anope::string BuildPrefix() const;
template<typename T> Log &operator<<(T val)
{
this->buf << val;
@@ -66,25 +105,25 @@ class CoreExport Log
}
};
/* Configured in the configuration file, actually does the message logging */
class CoreExport LogInfo
{
public:
std::list<Anope::string> Targets;
std::map<Anope::string, LogFile *> Logfiles;
std::list<Anope::string> Sources;
int LogAge;
bool Inhabit;
std::list<Anope::string> Admin;
std::list<Anope::string> Override;
std::list<Anope::string> Commands;
std::list<Anope::string> Servers;
std::list<Anope::string> Users;
std::list<Anope::string> Channels;
std::list<Anope::string> Normal;
bool RawIO;
bool Debug;
std::list<Anope::string> targets;
std::map<Anope::string, LogFile *> logfiles;
std::list<Anope::string> sources;
int log_age;
std::list<Anope::string> admin;
std::list<Anope::string> override;
std::list<Anope::string> commands;
std::list<Anope::string> servers;
std::list<Anope::string> users;
std::list<Anope::string> channels;
std::list<Anope::string> normal;
bool raw_io;
bool debug;
LogInfo(int logage, bool inhabit, bool rawio, bool debug);
LogInfo(int logage, bool rawio, bool debug);
~LogInfo();
@@ -92,6 +131,7 @@ class CoreExport LogInfo
bool HasType(LogType ltype, const Anope::string &type) const;
/* Logs the message l if configured to */
void ProcessMessage(const Log *l);
};
+47 -17
View File
@@ -1,28 +1,58 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifndef MAIL_H
#define MAIL_H
#include "anope.h"
#include "threadengine.h"
#include "serialize.h"
extern CoreExport bool Mail(User *u, NickCore *nc, BotInfo *service, const Anope::string &subject, const Anope::string &message);
extern CoreExport bool Mail(NickCore *nc, const Anope::string &subject, const Anope::string &message);
extern CoreExport bool MailValidate(const Anope::string &email);
class MailThread : public Thread
namespace Mail
{
private:
Anope::string MailTo;
Anope::string Addr;
Anope::string Subject;
Anope::string Message;
bool DontQuoteAddresses;
extern CoreExport bool Send(User *from, NickCore *to, const BotInfo *service, const Anope::string &subject, const Anope::string &message);
extern CoreExport bool Send(NickCore *to, const Anope::string &subject, const Anope::string &message);
extern CoreExport bool Validate(const Anope::string &email);
bool Success;
public:
MailThread(const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
/* A email message being sent */
class Message : public Thread
{
private:
Anope::string sendmail_path;
Anope::string send_from;
Anope::string mail_to;
Anope::string addr;
Anope::string subject;
Anope::string message;
bool dont_quote_addresses;
~MailThread();
bool success;
public:
/** Construct this message. Once constructed call Thread::Start to launch the mail sending.
* @param sf Config->SendFrom
* @param mailto Name of person being mailed (u->nick, nc->display, etc)
* @param addr Destination address to mail
* @param subject Message subject
* @param message The actual message
*/
Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
void Run();
};
~Message();
/* Called from within the thread to actually send the mail */
void Run() anope_override;
};
} // namespace Mail
#endif // MAIL_H
+55
View File
@@ -0,0 +1,55 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef MEMO_H
#define MEMO_H
#include "anope.h"
#include "serialize.h"
class CoreExport Memo : public Serializable
{
public:
bool unread;
bool receipt;
Memo();
~Memo();
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
Anope::string owner;
/* When it was sent */
time_t time;
Anope::string sender;
Anope::string text;
};
/* Memo info structures. Since both nicknames and channels can have memos,
* we encapsulate memo data in a MemoInfo to make it easier to handle.
*/
struct CoreExport MemoInfo
{
int16_t memomax;
Serialize::Checker<std::vector<Memo *> > memos;
std::vector<Anope::string> ignores;
MemoInfo();
Memo *GetMemo(unsigned index) const;
unsigned GetIndex(Memo *m) const;
void Del(unsigned index);
bool HasIgnore(User *u);
static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan);
};
#endif // MEMO_H
+161
View File
@@ -0,0 +1,161 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#include "protocol.h"
/* Common IRCD messages.
* Protocol modules may chose to include some, none, or all of these handlers
* as they see fit.
*/
namespace Message
{
struct CoreExport Away : IRCDMessage
{
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Capab : IRCDMessage
{
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Error : IRCDMessage
{
Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Join : IRCDMessage
{
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
typedef std::pair<ChannelStatus, User *> SJoinUser;
/** Handle a SJOIN.
* @param source The source of the SJOIN
* @param chan The channel the users are joining to
* @param ts The TS for the channel
* @param modes The modes sent with the SJOIN, if any
* @param users The users and their status, if any
*/
static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users);
};
struct CoreExport Kick : IRCDMessage
{
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Kill : IRCDMessage
{
Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Mode : IRCDMessage
{
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport MOTD : IRCDMessage
{
MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Part : IRCDMessage
{
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Ping : IRCDMessage
{
Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Privmsg : IRCDMessage
{
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Quit : IRCDMessage
{
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport SQuit : IRCDMessage
{
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Stats : IRCDMessage
{
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Time : IRCDMessage
{
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Topic : IRCDMessage
{
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Version : IRCDMessage
{
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Whois : IRCDMessage
{
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
} // namespace Message
+167 -213
View File
@@ -1,7 +1,7 @@
/* Mode support
*
* Copyright (C) 2008-2011 Adam <Adam@anope.org>
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
* Copyright (C) 2008-2013 Anope Team <team@anope.org>
*
* Please read COPYING and README for further details.
*/
@@ -9,80 +9,8 @@
#ifndef MODES_H
#define MODES_H
/** All of the valid user mode names
*/
enum UserModeName
{
UMODE_BEGIN,
UMODE_SERV_ADMIN, UMODE_BOT, UMODE_CO_ADMIN, UMODE_FILTER, UMODE_HIDEOPER, UMODE_NETADMIN,
UMODE_REGPRIV, UMODE_PROTECTED, UMODE_NO_CTCP, UMODE_WEBTV, UMODE_WEBIRC, UMODE_WHOIS, UMODE_ADMIN, UMODE_DEAF,
UMODE_GLOBOPS, UMODE_HELPOP, UMODE_INVIS, UMODE_OPER, UMODE_PRIV, UMODE_GOD, UMODE_REGISTERED,
UMODE_SNOMASK, UMODE_VHOST, UMODE_WALLOPS, UMODE_CLOAK, UMODE_SSL, UMODE_SOFTCALLERID, UMODE_CALLERID,
UMODE_COMMONCHANS, UMODE_HIDDEN, UMODE_STRIPCOLOR, UMODE_INVISIBLE_OPER, UMODE_RESTRICTED,
UMODE_END
};
const Anope::string UserModeNameStrings[] = {
"UMODE_BEGIN",
"UMODE_SERV_ADMIN", "UMODE_BOT", "UMODE_CO_ADMIN", "UMODE_FILTER", "UMODE_HIDEOPER", "UMODE_NETADMIN",
"UMODE_REGPRIV", "UMODE_PROTECTED", "UMODE_NO_CTCP", "UMODE_WEBTV", "UMODE_WEBIRC", "UMODE_WHOIS", "UMODE_ADMIN", "UMODE_DEAF",
"UMODE_GLOBOPS", "UMODE_HELPOP", "UMODE_INVIS", "UMODE_OPER", "UMODE_PRIV", "UMODE_GOD", "UMODE_REGISTERED",
"UMODE_SNOMASK", "UMODE_VHOST", "UMODE_WALLOPS", "UMODE_CLOAK", "UMODE_SSL", "UMODE_SOFTCALLERID", "UMODE_CALLERID",
"UMODE_COMMONCHANS", "UMODE_HIDDEN", "UMODE_STRIPCOLOR", "UMODE_INVISIBLE_OPER", "UMODE_RESTRICTED"
""
};
/** All of the valid channel mode names
*/
enum ChannelModeName
{
CMODE_BEGIN,
/* Channel modes */
CMODE_BLOCKCOLOR, CMODE_FLOOD, CMODE_INVITE, CMODE_KEY, CMODE_LIMIT, CMODE_MODERATED, CMODE_NOEXTERNAL,
CMODE_PRIVATE, CMODE_REGISTERED, CMODE_SECRET, CMODE_TOPIC, CMODE_AUDITORIUM, CMODE_SSL, CMODE_ADMINONLY,
CMODE_NOCTCP, CMODE_FILTER, CMODE_NOKNOCK, CMODE_REDIRECT, CMODE_REGMODERATED, CMODE_NONICK, CMODE_OPERONLY,
CMODE_NOKICK, CMODE_REGISTEREDONLY, CMODE_STRIPCOLOR, CMODE_NONOTICE, CMODE_NOINVITE, CMODE_ALLINVITE,
CMODE_BLOCKCAPS, CMODE_PERM, CMODE_NICKFLOOD, CMODE_JOINFLOOD, CMODE_DELAYEDJOIN, CMODE_NOREJOIN,
CMODE_BANDWIDTH,
/* b/e/I */
CMODE_BAN, CMODE_EXCEPT,
CMODE_INVITEOVERRIDE,
/* v/h/o/a/q */
CMODE_VOICE, CMODE_HALFOP, CMODE_OP,
CMODE_PROTECT, CMODE_OWNER,
CMODE_END
};
const Anope::string ChannelModeNameStrings[] = {
"CMODE_BEGIN",
/* Channel modes */
"CMODE_BLOCKCOLOR", "CMODE_FLOOD", "CMODE_INVITE", "CMODE_KEY", "CMODE_LIMIT", "CMODE_MODERATED", "CMODE_NOEXTERNAL",
"CMODE_PRIVATE", "CMODE_REGISTERED", "CMODE_SECRET", "CMODE_TOPIC", "CMODE_AUDITORIUM", "CMODE_SSL", "CMODE_ADMINONLY",
"CMODE_NOCTCP", "CMODE_FILTER", "CMODE_NOKNOCK", "CMODE_REDIRECT", "CMODE_REGMODERATED", "CMODE_NONICK", "CMODE_OPERONLY",
"CMODE_NOKICK", "CMODE_REGISTEREDONLY", "CMODE_STRIPCOLOR", "CMODE_NONOTICE", "CMODE_NOINVITE", "CMODE_ALLINVITE",
"CMODE_BLOCKCAPS", "CMODE_PERM", "CMODE_NICKFLOOD", "CMODE_JOINFLOOD", "CMODE_DELAYEDJOIN", "CMODE_NOREJOIN",
"CMODE_BANDWIDTH",
/* b/e/I */
"CMODE_BAN", "CMODE_EXCEPT",
"CMODE_INVITEOVERRIDE",
/* v/h/o/a/q */
"CMODE_VOICE", "CMODE_HALFOP", "CMODE_OP",
"CMODE_PROTECT", "CMODE_OWNER",
""
};
#include "anope.h"
#include "base.h"
/** The different types of modes
*/
@@ -102,9 +30,7 @@ enum ModeType
*/
enum ModeClass
{
/* Channel mode */
MC_CHANNEL,
/* User mode */
MC_USER
};
@@ -113,22 +39,22 @@ enum ModeClass
class CoreExport Mode : public Base
{
public:
/* Class of mode this is */
ModeClass Class;
/* Mode char for this */
char ModeChar;
/* Type of mode this is */
ModeType Type;
/* Mode name */
Anope::string name;
/* Class of mode this is (user/channel) */
ModeClass mclass;
/* Mode char for this, eg 'b' */
char mchar;
/* Type of mode this is, eg MODE_LIST */
ModeType type;
/** Default constructor
* @param mClass The type of mode this is
* @param modeChar The mode char
/** constructor
* @param mname The mode name
* @param mclass The type of mode this is
* @param mc The mode char
* @param type The mode type
*/
Mode(ModeClass mClass, char modeChar, ModeType type);
/** Default destructor
*/
Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type);
virtual ~Mode();
};
@@ -137,32 +63,22 @@ class CoreExport Mode : public Base
class CoreExport UserMode : public Mode
{
public:
/* Mode name */
UserModeName Name;
/** Default constructor
* @param nName The mode name
* @param modeChar The mode char
*/
UserMode(UserModeName mName, char modeChar);
/** Default destructor
/** constructor
* @param name The mode name
* @param mc The mode char
*/
UserMode(const Anope::string &name, char mc);
virtual ~UserMode();
/** Returns the mode name as a string
*/
const Anope::string NameAsString();
};
class CoreExport UserModeParam : public UserMode
{
public:
/** Default constructor
* @param mName The mode name
* @param modeChar The mode char
/** constructor
* @param name The mode name
* @param mc The mode char
*/
UserModeParam(UserModeName mName, char modeChar);
UserModeParam(const Anope::string &name, char mc);
/** Check if the param is valid
* @param value The param
@@ -176,17 +92,11 @@ class CoreExport UserModeParam : public UserMode
class CoreExport ChannelMode : public Mode
{
public:
/* Mode name */
ChannelModeName Name;
/** Default constructor
* @param mName The mode name
* @param modeChar The mode char
*/
ChannelMode(ChannelModeName mName, char modeChar);
/** Default destructor
/** constructor
* @param name The mode name
* @param mc The mode char
*/
ChannelMode(const Anope::string &name, char mc);
virtual ~ChannelMode();
/** Can a user set this mode, used for mlock
@@ -194,10 +104,6 @@ class CoreExport ChannelMode : public Mode
* @param u The user, or NULL
*/
virtual bool CanSet(User *u) const;
/** Returns the mode name as a string
*/
const Anope::string NameAsString();
};
@@ -206,13 +112,13 @@ class CoreExport ChannelMode : public Mode
class CoreExport ChannelModeList : public ChannelMode
{
public:
/** Default constructor
* @param mName The mode name
* @param modeChar The mode char
/** constructor
* @param name The mode name
* @param mc The mode char
*/
ChannelModeList(ChannelModeName mName, char modeChar);
ChannelModeList(const Anope::string &name, char mc);
/** Default destructor
/** destructor
*/
virtual ~ChannelModeList();
@@ -228,7 +134,7 @@ class CoreExport ChannelModeList : public ChannelMode
* @param e The entry to match against
* @return true on match
*/
virtual bool Matches(User *u, const Entry *e) { return false; }
virtual bool Matches(const User *u, const Entry *e) { return false; }
/** Called when a mask is added to a channel
* @param chan The channel
@@ -248,19 +154,19 @@ class CoreExport ChannelModeList : public ChannelMode
class CoreExport ChannelModeParam : public ChannelMode
{
public:
/** Default constructor
* @param mName The mode name
* @param modeChar The mode char
* @param MinusArg true if this mode sends no arg when unsetting
/** constructor
* @param name The mode name
* @param mc The mode char
* @param minus_no_arg true if this mode sends no arg when unsetting
*/
ChannelModeParam(ChannelModeName mName, char modeChar, bool MinusArg = false);
ChannelModeParam(const Anope::string &name, char mc, bool minus_no_arg = false);
/** Default destructor
/** destructor
*/
virtual ~ChannelModeParam();
/* Should we send an arg when unsetting this mode? */
bool MinusNoArg;
bool minus_no_arg;
/** Is the param valid
* @param value The param
@@ -276,27 +182,41 @@ class CoreExport ChannelModeStatus : public ChannelMode
public:
/* The symbol, eg @ % + */
char Symbol;
/** Default constructor
* @param mName The mode name
* @param modeChar The mode char
* @param mSymbol The symbol for the mode, eg @ % +
/* The "level" of the mode, used to compare with other modes.
* Used so we know op > halfop > voice etc.
*/
ChannelModeStatus(ChannelModeName mName, char modeChar, char mSymbol);
short level;
/** Default destructor
/** constructor
* @param name The mode name
* @param mc The mode char
* @param mSymbol The symbol for the mode, eg @ %
* @param mlevel A level for the mode, which is usually determined by the PREFIX capab
*/
ChannelModeStatus(const Anope::string &name, char mc, char mSymbol, short mlevel = 0);
/** destructor
*/
virtual ~ChannelModeStatus();
};
/* The status a user has on a channel (+v, +h, +o) etc */
class CoreExport ChannelStatus
{
public:
std::set<Anope::string> modes;
Anope::string BuildCharPrefixList() const;
Anope::string BuildModePrefixList() const;
};
/** Channel mode +k (key)
*/
class CoreExport ChannelModeKey : public ChannelModeParam
{
public:
ChannelModeKey(char modeChar) : ChannelModeParam(CMODE_KEY, modeChar) { }
ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { }
bool IsValid(const Anope::string &value) const;
bool IsValid(const Anope::string &value) const anope_override;
};
/** This class is used for channel mode +A (Admin only)
@@ -305,10 +225,10 @@ class CoreExport ChannelModeKey : public ChannelModeParam
class CoreExport ChannelModeAdmin : public ChannelMode
{
public:
ChannelModeAdmin(char modeChar) : ChannelMode(CMODE_ADMINONLY, modeChar) { }
ChannelModeAdmin(char mc) : ChannelMode("ADMINONLY", mc) { }
/* Opers only */
bool CanSet(User *u) const;
bool CanSet(User *u) const anope_override;
};
/** This class is used for channel mode +O (Opers only)
@@ -317,10 +237,10 @@ class CoreExport ChannelModeAdmin : public ChannelMode
class CoreExport ChannelModeOper : public ChannelMode
{
public:
ChannelModeOper(char modeChar) : ChannelMode(CMODE_OPERONLY, modeChar) { }
ChannelModeOper(char mc) : ChannelMode("OPERONLY", mc) { }
/* Opers only */
bool CanSet(User *u) const;
bool CanSet(User *u) const anope_override;
};
/** This class is used for channel mode +r (registered channel)
@@ -329,55 +249,42 @@ class CoreExport ChannelModeOper : public ChannelMode
class CoreExport ChannelModeRegistered : public ChannelMode
{
public:
ChannelModeRegistered(char modeChar) : ChannelMode(CMODE_REGISTERED, modeChar) { }
ChannelModeRegistered(char mc) : ChannelMode("REGISTERED", mc) { }
/* No one mlocks +r */
bool CanSet(User *u) const;
};
enum StackerType
{
ST_CHANNEL,
ST_USER
bool CanSet(User *u) const anope_override;
};
class StackerInfo
{
public:
/* Modes to be added */
std::list<std::pair<Base *, Anope::string> > AddModes;
std::list<std::pair<Mode *, Anope::string> > AddModes;
/* Modes to be deleted */
std::list<std::pair<Base *, Anope::string> > DelModes;
/* The type of object this stacker info is for */
StackerType Type;
std::list<std::pair<Mode *, Anope::string> > DelModes;
/* Bot this is sent from */
BotInfo *bi;
const BotInfo *bi;
/** Add a mode to this object
* @param mode The mode
* @param Set true if setting, false if unsetting
* @param Param The param for the mode
* @param set true if setting, false if unsetting
* @param param The param for the mode
*/
void AddMode(Mode *mode, bool Set, const Anope::string &Param);
void AddMode(Mode *mode, bool set, const Anope::string &param);
};
/** This is mode manager
/** This is the mode manager
* It contains functions for adding modes to Anope so Anope can track them
* and do things such as MLOCK.
* This also contains a mode stacker that will combine multiple modes and set
* them on a channel all at once
* them on a channel or user at once
*/
class CoreExport ModeManager
{
protected:
/* List of pairs of user/channels and their stacker info */
static std::list<std::pair<Base *, StackerInfo *> > StackerObjects;
/** Get the stacker info for an item, if one doesnt exist it is created
* @param Item The user/channel etc
* @return The stacker info
*/
static StackerInfo *GetInfo(Base *Item);
static std::map<User *, StackerInfo *> UserStackerObjects;
static std::map<Channel *, StackerInfo *> ChannelStackerObjects;
/** Build a list of mode strings to send to the IRCd from the mode stacker
* @param info The stacker info for a channel or user
@@ -385,21 +292,20 @@ class CoreExport ModeManager
*/
static std::list<Anope::string> BuildModeStrings(StackerInfo *info);
/** Really add a mode to the stacker, internal use only
* @param bi The client to set the modes from
* @param Object The object, user/channel
* @param mode The mode
* @param Set Adding or removing?
* @param Param A param, if there is one
* @param Type The type this is, user or channel
*/
static void StackerAddInternal(BotInfo *bi, Base *Object, Mode *mode, bool Set, const Anope::string &Param, StackerType Type);
public:
/* List of all modes Anope knows about */
static std::vector<ChannelMode *> ChannelModes;
static std::vector<UserMode *> UserModes;
/* Number of generic channel and user modes we are tracking */
static unsigned GenericChannelModes;
static unsigned GenericUserModes;
/* Default channel mode lock */
static std::list<std::pair<Anope::string, Anope::string> > ModeLockOn;
static std::list<Anope::string> ModeLockOff;
/* Default modes bots have on channels */
static ChannelStatus DefaultBotModes;
/** Add a user mode to Anope
* @param um A UserMode or UserMode derived class
* @return true on success, false on error
@@ -412,74 +318,122 @@ class CoreExport ModeManager
*/
static bool AddChannelMode(ChannelMode *cm);
/** Find a channel mode
* @param Mode The mode
* @return The mode class
/** Remove a user mode from Anope
* @param um A UserMode to remove
*/
static ChannelMode *FindChannelModeByChar(char Mode);
static void RemoveUserMode(UserMode *um);
/** Find a user mode
* @param Mode The mode
* @return The mode class
/** Remove a channel mode from Anope
* @param um A ChanneMode to remove
*/
static UserMode *FindUserModeByChar(char Mode);
static void RemoveChannelMode(ChannelMode *cm);
/** Find a channel mode
* @param Mode The modename
* @param mode The mode
* @return The mode class
*/
static ChannelMode *FindChannelModeByName(ChannelModeName Name);
static ChannelMode *FindChannelModeByChar(char mode);
/** Find a user mode
* @param Mode The modename
* @param mode The mode
* @return The mode class
*/
static UserMode *FindUserModeByName(UserModeName Name);
static UserMode *FindUserModeByChar(char mode);
/** Find channel mode by string
* @param name The mode name
* @return The mode
/** Find a channel mode
* @param name The modename
* @return The mode class
*/
static ChannelMode *FindChannelModeByString(const Anope::string &name);
static ChannelMode *FindChannelModeByName(const Anope::string &name);
/** Find user mode by string
* @param name The mode name
* @return The mode
/** Find a user mode
* @param name The modename
* @return The mode class
*/
static UserMode *FindUserModeByString(const Anope::string &name);
static UserMode *FindUserModeByName(const Anope::string &name);
/** Gets the channel mode char for a symbol (eg + returns v)
* @param Value The symbol
* @param symbol The symbol
* @return The char
*/
static char GetStatusChar(char Value);
static char GetStatusChar(char symbol);
/** Add a mode to the stacker to be set on a channel
* @param bi The client to set the modes from
* @param c The channel
* @param cm The channel mode
* @param Set true for setting, false for removing
* @param Param The param, if there is one
* @param set true for setting, false for removing
* @param param The param, if there is one
*/
static void StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool Set, const Anope::string &Param = "");
static void StackerAdd(const BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string &param = "");
/** Add a mode to the stacker to be set on a user
* @param bi The client to set the modes from
* @param u The user
* @param um The user mode
* @param Set true for setting, false for removing
* @param set true for setting, false for removing
* @param param The param, if there is one
*/
static void StackerAdd(BotInfo *bi, User *u, UserMode *um, bool Set, const Anope::string &Param = "");
static void StackerAdd(const BotInfo *bi, User *u, UserMode *um, bool set, const Anope::string &param = "");
/** Process all of the modes in the stacker and send them to the IRCd to be set on channels/users
*/
static void ProcessModes();
/** Delete a user or channel from the stacker
* @param b The user/channel
/** Delete a user, channel, or mode from the stacker
*/
static void StackerDel(Base *b);
static void StackerDel(User *u);
static void StackerDel(Channel *c);
static void StackerDel(Mode *m);
/** Updates the default mode locks and default bot modes
* @param config The configuration to read from. This is often called
* during a config reload.
*/
static void UpdateDefaultMLock(ServerConfig *config);
};
/** Entry flags
*/
enum EntryType
{
ENTRYTYPE_CIDR,
ENTRYTYPE_NICK_WILD,
ENTRYTYPE_NICK,
ENTRYTYPE_USER_WILD,
ENTRYTYPE_USER,
ENTRYTYPE_HOST_WILD,
ENTRYTYPE_HOST
};
/** Represents a mask set on a channel (b/e/I)
*/
class CoreExport Entry
{
Anope::string name;
public:
std::set<EntryType> types;
unsigned char cidr_len;
Anope::string mask;
Anope::string nick, user, host;
/** Constructor
* @param mode What mode this host is for, can be empty for unknown/no mode
* @param host A full nick!ident@host/cidr mask
*/
Entry(const Anope::string &mode, const Anope::string &host);
/** Get the banned mask for this entry
* @return The mask
*/
const Anope::string GetMask();
/** Check if this entry matches a user
* @param u The user
* @param full True to match against a users real host and IP
* @return true on match
*/
bool Matches(const User *u, bool full = false) const;
};
#endif // MODES_H
+48 -3
View File
@@ -1,9 +1,54 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
#ifndef MODULE_H
#define MODULE_H
#include "services.h"
#include "modules.h"
#include "oper.h"
/* Just include everything for now */
#include "access.h"
#include "account.h"
#include "anope.h"
#include "base.h"
#include "bots.h"
#include "channels.h"
#include "commands.h"
#include "config.h"
#include "extensible.h"
#include "hashcomp.h"
#include "language.h"
#include "lists.h"
#include "logger.h"
#include "mail.h"
#include "memo.h"
#include "messages.h"
#include "modes.h"
#include "modules.h"
#include "opertype.h"
#include "protocol.h"
#include "regexpr.h"
#include "regchannel.h"
#include "serialize.h"
#include "servers.h"
#include "service.h"
#include "services.h"
#include "socketengine.h"
#include "sockets.h"
#include "threadengine.h"
#include "timers.h"
#include "uplink.h"
#include "users.h"
#include "xline.h"
#include "global.h"
#include "memoserv.h"
#include "nickserv.h"
#endif // MODULE_H
+219 -348
View File
@@ -1,53 +1,58 @@
/* Modular support
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#include "serialize.h"
#ifndef MODULES_H
#define MODULES_H
#include <time.h>
#include "services.h"
#include <stdio.h>
#include "base.h"
#include "modes.h"
#include "timers.h"
#include "hashcomp.h"
#include "logger.h"
#include "extensible.h"
/* Cross OS compatibility macros */
/** This definition is used as shorthand for the various classes
* and functions needed to make a module loadable by the OS.
* It defines the class factory and external AnopeInit and AnopeFini functions.
*/
#ifdef _WIN32
typedef HMODULE ano_module_t;
# define dlopen(file, unused) LoadLibrary(file)
# define dlsym(file, symbol) (HMODULE)GetProcAddress(file, symbol)
# define dlclose(file) FreeLibrary(file) ? 0 : 1
# define ano_modclearerr() SetLastError(0)
# define ano_moderr() (Anope::LastError().empty() ? NULL : Anope::LastError().c_str())
# define MODULE_INIT(x) \
extern "C" DllExport Module *AnopeInit(const Anope::string &, const Anope::string &); \
extern "C" Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \
{ \
return new x(modname, creator); \
} \
BOOLEAN WINAPI DllMain(HINSTANCE, DWORD, LPVOID) \
{ \
return TRUE; \
} \
extern "C" DllExport void AnopeFini(x *); \
extern "C" void AnopeFini(x *m) \
{ \
delete m; \
}
#else
typedef void * ano_module_t;
/* We call dlerror() here because it clears the module error after being
* called. This previously read 'errno = 0', but that didn't work on
* all POSIX-compliant architectures. This way the error is guaranteed
* to be cleared, POSIX-wise. -GD
*/
# define ano_modclearerr() dlerror()
# define ano_moderr() dlerror()
# define MODULE_INIT(x) \
extern "C" DllExport Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \
{ \
return new x(modname, creator); \
} \
extern "C" DllExport void AnopeFini(x *m) \
{ \
delete m; \
}
#endif
/** Possible return types from events.
*/
enum EventReturn
{
EVENT_STOP,
EVENT_CONTINUE,
EVENT_ALLOW
};
/**
* This #define allows us to call a method in all
* loaded modules in a readable simple way, e.g.:
@@ -56,8 +61,8 @@ enum EventReturn
#define FOREACH_MOD(y, x) \
if (true) \
{ \
std::vector<Module*>::iterator safei; \
for (std::vector<Module*>::iterator _i = ModuleManager::EventHandlers[y].begin(); _i != ModuleManager::EventHandlers[y].end(); ) \
std::vector<Module *>::iterator safei; \
for (std::vector<Module *>::iterator _i = ModuleManager::EventHandlers[y].begin(); _i != ModuleManager::EventHandlers[y].end(); ) \
{ \
safei = _i; \
++safei; \
@@ -83,9 +88,9 @@ else \
#define FOREACH_RESULT(y, x) \
if (true) \
{ \
std::vector<Module*>::iterator safei; \
std::vector<Module *>::iterator safei; \
MOD_RESULT = EVENT_CONTINUE; \
for (std::vector<Module*>::iterator _i = ModuleManager::EventHandlers[y].begin(); _i != ModuleManager::EventHandlers[y].end(); ) \
for (std::vector<Module *>::iterator _i = ModuleManager::EventHandlers[y].begin(); _i != ModuleManager::EventHandlers[y].end(); ) \
{ \
safei = _i; \
++safei; \
@@ -107,24 +112,14 @@ if (true) \
else \
static_cast<void>(0)
#ifndef _WIN32
# include <dlfcn.h>
/* Define these for systems without them */
# ifndef RTLD_NOW
# define RTLD_NOW 0
# endif
# ifndef RTLD_LAZY
# define RTLD_LAZY RTLD_NOW
# endif
# ifndef RTLD_GLOBAL
# define RTLD_GLOBAL 0
# endif
# ifndef RTLD_LOCAL
# define RTLD_LOCAL 0
# endif
#endif
class Message;
/** Possible return types from events.
*/
enum EventReturn
{
EVENT_STOP,
EVENT_CONTINUE,
EVENT_ALLOW
};
enum ModuleReturn
{
@@ -146,29 +141,23 @@ enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFOR
/* Module types, in the order in which they are unloaded. The order these are in is IMPORTANT */
enum ModType { MT_BEGIN, THIRD, SUPPORTED, CORE, DATABASE, ENCRYPTION, PROTOCOL, MT_END };
typedef std::multimap<Anope::string, Message *> message_map;
extern CoreExport message_map MessageMap;
class Module;
extern CoreExport std::list<Module *> Modules;
class Version
/** Returned by Module::GetVersion, used to see what version of Anope
* a module is compiled against.
*/
class ModuleVersion
{
private:
int Major;
int Minor;
int Build;
int version_major;
int version_minor;
int version_patch;
public:
/** Constructor
* @param vMajor The major version numbber
* @param vMinor The minor version numbber
* @param vBuild The build version numbber
* @param major The major version numbber
* @param minor The minor version numbber
* @param patch The patch version numbber
*/
Version(int vMajor, int vMinor, int vBuild);
/** Destructor
*/
virtual ~Version();
ModuleVersion(int major, int minor, int patch);
/** Get the major version of Anope this was built against
* @return The major version
@@ -180,15 +169,12 @@ class Version
*/
int GetMinor() const;
/** Get the build version this was built against
* @return The build version
/** Get the patch version this was built against
* @return The patch version
*/
int GetBuild() const;
int GetPatch() const;
};
class CallBack;
class XLineManager;
struct CommandSource;
/** Every module in Anope is actually a class.
*/
@@ -211,11 +197,11 @@ class CoreExport Module : public Extensible
/** Callbacks used in this module
*/
std::list<CallBack *> CallBacks;
std::list<CallBack *> callbacks;
/** Handle for this module, obtained from dlopen()
*/
ano_module_t handle;
void *handle;
/** Time this module was created
*/
@@ -268,7 +254,11 @@ class CoreExport Module : public Extensible
* compiled against
* @return The version
*/
Version GetVersion() const;
ModuleVersion GetVersion() const;
/* Everything below here are events. Modules must ModuleManager::Attach to these events
* before they will be called.
*/
/** Called when the ircd notifies that a user has been kicked from a channel.
* @param c The channel the user has been kicked from.
@@ -276,7 +266,7 @@ class CoreExport Module : public Extensible
* @param source The nick of the sender.
* @param kickmsg The reason for the kick.
*/
virtual void OnUserKicked(Channel *c, User *target, const Anope::string &source, const Anope::string &kickmsg) { }
virtual void OnUserKicked(Channel *c, User *target, MessageSource &source, const Anope::string &kickmsg) { }
/** Called when Services' configuration has been loaded.
*/
@@ -301,7 +291,7 @@ class CoreExport Module : public Extensible
* @param u The connecting user.
* @param exempt set to true/is true if the user should be excepted from bans etc
*/
virtual void OnUserConnect(dynamic_reference<User> &u, bool &exempt) { }
virtual void OnUserConnect(User *u, bool &exempt) { }
/** Called when a new server connects to the network.
* @param s The server that has connected to the network
@@ -317,8 +307,9 @@ class CoreExport Module : public Extensible
/** Called when someone uses the generic/help command
* @param source Command source
* @param params Params
* @return EVENT_STOP to stop processing
*/
virtual void OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) { }
virtual EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called when someone uses the generic/help command
* @param source Command source
@@ -341,11 +332,6 @@ class CoreExport Module : public Extensible
*/
virtual void OnPostCommand(CommandSource &source, Command *command, const std::vector<Anope::string> &params) { }
/** Called after the core has finished loading the databases, but before
* we connect to the server
*/
virtual void OnPostLoadDatabases() { }
/** Called when the databases are saved
* @return EVENT_CONTINUE to let other modules continue saving, EVENT_STOP to stop
*/
@@ -363,20 +349,22 @@ class CoreExport Module : public Extensible
virtual EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) { return EVENT_CONTINUE; }
/** Called on fantasy command
* @param command The command
* @param u The user using the command
* @param source The source of the command
* @param c The command
* @param ci The channel it's being used in
* @param params The params
* @return EVENT_STOP to halt processing and not run the command, EVENT_ALLOW to allow the command to be executed
*/
virtual void OnBotFantasy(const Anope::string &command, User *u, ChannelInfo *ci, const Anope::string &params) { }
virtual EventReturn OnBotFantasy(CommandSource &source, Command *c, ChannelInfo *ci, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called on fantasy command without access
* @param command The command
* @param u The user using the command
* @param source The source of the command
* @param c The command
* @param ci The channel it's being used in
* @param params The params
* @return EVENT_STOP to halt processing and not run the command, EVENT_ALLOW to allow the command to be executed
*/
virtual void OnBotNoFantasyAccess(const Anope::string &command, User *u, ChannelInfo *ci, const Anope::string &params) { }
virtual EventReturn OnBotNoFantasyAccess(CommandSource &source, Command *c, ChannelInfo *ci, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called after a bot joins a channel
* @param c The channel
@@ -395,18 +383,13 @@ class CoreExport Module : public Extensible
* @param ci The channel
* @param bw The badword
*/
virtual void OnBadWordAdd(ChannelInfo *ci, BadWord *bw) { }
virtual void OnBadWordAdd(ChannelInfo *ci, const BadWord *bw) { }
/** Called before a badword is deleted from a channel
* @param ci The channel
* @param bw The badword
*/
virtual void OnBadWordDel(ChannelInfo *ci, BadWord *bw) { }
/** Called in findbot()
* @param nick The nick being looked up
*/
virtual void OnFindBot(const Anope::string &nick) { }
virtual void OnBadWordDel(ChannelInfo *ci, const BadWord *bw) { }
/** Called before a bot kicks a user
* @param bi The bot sending the kick
@@ -453,15 +436,16 @@ class CoreExport Module : public Extensible
/** Called when a new topic is set
* @param c The channel
* @param setter The user who set the new topic
* @param topic The new topic
*/
virtual void OnTopicUpdated(Channel *c, const Anope::string &topic) { }
virtual void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) { }
/** Called before a channel expires
* @param ci The channel
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
* @param expire Set to true to allow the chan to expire
*/
virtual EventReturn OnPreChanExpire(ChannelInfo *ci) { return EVENT_CONTINUE; }
virtual void OnPreChanExpire(ChannelInfo *ci, bool &expire) { }
/** Called before a channel expires
* @param ci The channel
@@ -484,73 +468,6 @@ class CoreExport Module : public Extensible
*/
virtual void OnServerDisconnect() { }
/** Called when the flatfile dbs are being written
* @param Write A callback to the function used to insert a line into the database
*/
virtual void OnDatabaseWrite(void (*Write)(const Anope::string &)) { }
/** Called when a line is read from the database
* @param params The params from the database
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
*/
virtual EventReturn OnDatabaseRead(const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called when nickcore metadata is read from the database
* @param nc The nickcore
* @param key The metadata key
* @param params The params from the database
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
*/
virtual EventReturn OnDatabaseReadMetadata(NickCore *nc, const Anope::string &key, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called when nickcore metadata is read from the database
* @param na The nickalias
* @param key The metadata key
* @param params The params from the database
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
*/
virtual EventReturn OnDatabaseReadMetadata(NickAlias *na, const Anope::string &key, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called when botinfo metadata is read from the database
* @param bi The botinfo
* @param key The metadata key
* @param params The params from the database
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
*/
virtual EventReturn OnDatabaseReadMetadata(BotInfo *bi, const Anope::string &key, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called when chaninfo metadata is read from the database
* @param ci The chaninfo
* @param key The metadata key
* @param params The params from the database
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to stop processing
*/
virtual EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, const std::vector<Anope::string> &params) { return EVENT_CONTINUE; }
/** Called when we are writing metadata for a nickcore
* @param WriteMetata A callback function used to insert the metadata
* @param nc The nickcore
*/
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const Anope::string &, const Anope::string &), NickCore *nc) { }
/** Called when we are wrting metadata for a nickalias
* @param WriteMetata A callback function used to insert the metadata
* @param na The nick alias
*/
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const Anope::string &, const Anope::string &), NickAlias *na) { }
/** Called when we are writing metadata for a botinfo
* @param WriteMetata A callback function used to insert the metadata
* @param bi The botinfo
*/
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const Anope::string &, const Anope::string &), BotInfo *bi) { }
/** Called when are are writing metadata for a channelinfo
* @param WriteMetata A callback function used to insert the metadata
* @param bi The channelinfo
*/
virtual void OnDatabaseWriteMetadata(void (*WriteMetadata)(const Anope::string &, const Anope::string &), ChannelInfo *ci) { }
/** Called when services restart
*/
virtual void OnRestart() { }
@@ -561,9 +478,9 @@ class CoreExport Module : public Extensible
/** Called before a nick expires
* @param na The nick
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
* @param expire Set to true to allow the nick to expire
*/
virtual EventReturn OnPreNickExpire(NickAlias *na) { return EVENT_CONTINUE; }
virtual void OnPreNickExpire(NickAlias *na, bool &expire) { }
/** Called when a nick drops
* @param na The nick
@@ -582,25 +499,25 @@ class CoreExport Module : public Extensible
virtual EventReturn OnExceptionAdd(Exception *ex) { return EVENT_CONTINUE; }
/** Called before an exception is deleted
* @param u The user who is deleting it
* @param source The source deleting it
* @param ex The exceotion
*/
virtual void OnExceptionDel(User *u, Exception *ex) { }
virtual void OnExceptionDel(CommandSource &source, Exception *ex) { }
/** Called before a XLine is added
* @param u The user adding the XLine
* @param source The source of the XLine
* @param x The XLine
* @param xlm The xline manager it was added to
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnAddXLine(User *u, XLine *x, XLineManager *xlm) { return EVENT_CONTINUE; }
virtual EventReturn OnAddXLine(CommandSource &source, const XLine *x, XLineManager *xlm) { return EVENT_CONTINUE; }
/** Called before a XLine is deleted
* @param u The user deleting the XLine
* @param x The XLine, can be NULL for all XLines
* @param source The source of the XLine
* @param x The XLine
* @param xlm The xline manager it was deleted from
*/
virtual void OnDelXLine(User *u, XLine *x, XLineManager *xlm) { }
virtual void OnDelXLine(CommandSource &source, const XLine *x, XLineManager *xlm) { }
/** Called when a user is checked for whether they are a services oper
* @param u The user
@@ -619,10 +536,12 @@ class CoreExport Module : public Extensible
*/
virtual void OnUserQuit(User *u, const Anope::string &msg) { }
/** Called when a user disconnects
/** Called when a user disconnects, before and after being internally removed from
* all lists (channels, user list, etc)
* @param u The user
*/
virtual void OnUserLogoff(User *u) { }
virtual void OnPreUserLogoff(User *u) { }
virtual void OnPostUserLogoff(User *u) { }
/** Called when a new bot is made
* @param bi The bot
@@ -641,41 +560,36 @@ class CoreExport Module : public Extensible
/** Called when access is deleted from a channel
* @param ci The channel
* @param u The user who removed the access
* @param source The source of the command
* @param access The access entry being removed
*/
virtual void OnAccessDel(ChannelInfo *ci, User *u, ChanAccess *access) { }
virtual void OnAccessDel(ChannelInfo *ci, CommandSource &source, ChanAccess *access) { }
/** Called when access is added
* @param ci The channel
* @param u The user who added the access
* @param source The source of the command
* @param access The access changed
*/
virtual void OnAccessAdd(ChannelInfo *ci, User *u, ChanAccess *access) { }
virtual void OnAccessAdd(ChannelInfo *ci, CommandSource &source, ChanAccess *access) { }
/** Called when the access list is cleared
* @param ci The channel
* @param u The user who cleared the access
*/
virtual void OnAccessClear(ChannelInfo *ci, User *u) { }
virtual void OnAccessClear(ChannelInfo *ci, CommandSource &source) { }
/** Called when a level for a channel is changed
* @param u The user changing the level
* @param source The source of the command
* @param ci The channel the level was changed on
* @param pos The level position, can be -1 for resetting levels
* @param priv The privilege changed
* @param what The new level
*/
virtual void OnLevelChange(User *u, ChannelInfo *ci, int pos, int what) { }
virtual void OnLevelChange(CommandSource &source, ChannelInfo *ci, const Anope::string &priv, int16_t what) { }
/** Called when a channel is dropped
* @param chname The channel name
*/
virtual void OnChanDrop(const Anope::string &chname) { }
/** Called when a channel is forbidden
/** Called right before a channel is dropped
* @param ci The channel
*/
virtual void OnChanForbidden(ChannelInfo *ci) { }
virtual void OnChanDrop(ChannelInfo *ci) { }
/** Called when a channel is registered
* @param ci The channel
@@ -713,58 +627,56 @@ class CoreExport Module : public Extensible
virtual void OnChannelDelete(Channel *c) { }
/** Called after adding an akick to a channel
* @param u The user adding the akick
* @param source The source of the command
* @param ci The channel
* @param ak The akick
*/
virtual void OnAkickAdd(User *u, ChannelInfo *ci, AutoKick *ak) { }
virtual void OnAkickAdd(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) { }
/** Called before removing an akick from a channel
* @param u The user removing the akick
* @param source The source of the command
* @param ci The channel
* @param ak The akick
*/
virtual void OnAkickDel(User *u, ChannelInfo *ci, AutoKick *ak) { }
virtual void OnAkickDel(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) { }
/** Called after a user join a channel when we decide whether to kick them or not
* @param u The user
* @param ci The channel
* @param kick Set to true to kick
* @return EVENT_ALLOW to stop processing immediatly
* @param mask The mask to ban, if any
* @param reason The reason for the kick
* @return EVENT_STOP to prevent the user from joining by kicking/banning the user
*/
virtual EventReturn OnCheckKick(User *u, ChannelInfo *ci, bool &kick) { return EVENT_CONTINUE; }
virtual EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) { return EVENT_CONTINUE; }
/** Called when a user requests info for a channel
* @param source The user requesting info
* @param ci The channel the user is requesting info for
* @param ShowHidden true if we should show the user everything
* @param info Data to show the user requesting information
* @param show_hidden true if we should show the user everything
*/
virtual void OnChanInfo(CommandSource &source, ChannelInfo *ci, bool ShowHidden) { }
/** Called on cs_findchan()
* @param chname The name being looked up
*/
virtual void OnFindChan(const Anope::string &chname) { }
virtual void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) { }
/** Checks if access has the channel privilege 'priv'.
* @param access THe access struct
* @param priv The privilege being checked for
* @return EVENT_ALLOW for yes, EVENT_STOP to stop all processing
*/
virtual EventReturn OnCheckPriv(ChanAccess *access, ChannelAccess priv) { return EVENT_CONTINUE; }
virtual EventReturn OnCheckPriv(ChanAccess *access, const Anope::string &priv) { return EVENT_CONTINUE; }
/** Check whether an access group has a privilege
* @param group The group
* @param priv The privilege
* @return MOD_ALLOW to allow, MOD_STOP to stop
*/
virtual EventReturn OnGroupCheckPriv(const AccessGroup *group, ChannelAccess priv) { return EVENT_CONTINUE; }
virtual EventReturn OnGroupCheckPriv(const AccessGroup *group, const Anope::string &priv) { return EVENT_CONTINUE; }
/** Called when a nick is dropped
* @param u The user dropping the nick
* @param source The source of the command
* @param na The nick
*/
virtual void OnNickDrop(User *u, NickAlias *na) { }
virtual void OnNickDrop(CommandSource &source, NickAlias *na) { }
/** Called when a nick is forbidden
* @param na The nick alias of the forbidden nick
@@ -855,31 +767,16 @@ class CoreExport Module : public Extensible
/** Called when a user requests info for a nick
* @param source The user requesting info
* @param na The nick the user is requesting info from
* @param ShowHidden true if we should show the user everything
* @param info Data to show the user requesting information
* @param show_hidden true if we should show the user everything
*/
virtual void OnNickInfo(CommandSource &source, NickAlias *na, bool ShowHidden) { }
virtual void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) { }
/** Called in findnick()
* Useful to modify the na returned by findnick()
* @param nick The nick being looked up
/** Check whether a username and password is correct
* @param u The user trying to identify, if applicable.
* @param req The login request
*/
virtual void OnFindNick(const Anope::string &nick) { }
/** Called in findcore()
* Useful to modify the nc returned by findcore()
* @param nick The nick being looked up
*/
virtual void OnFindCore(const Anope::string &nick) { }
/** Check whether a users password is correct.
* @param u The user
* @param command The command the user is doing
* @param params Command params
* @param account The account the password should be checked against
* @param password The password
* @return EVENT_ALLOW to allow the password, EVENT_STOP to stop processing completely
*/
virtual EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) { return EVENT_CONTINUE; }
virtual void OnCheckAuthentication(User *u, IdentifyRequest *req) { }
/** Called when a user does /ns update
* @param u The user
@@ -919,45 +816,45 @@ class CoreExport Module : public Extensible
* @param nc The nickcore of the memo being deleted
* @param mi The memo info
* @param m The memo
* @param number What memo number is being deleted, can be 0 for all memos
*/
virtual void OnMemoDel(const NickCore *nc, MemoInfo *mi, Memo *m) { }
virtual void OnMemoDel(NickCore *nc, MemoInfo *mi, const Memo *m) { }
/** Called when a memo is deleted
* @param ci The channel of the memo being deleted
* @param mi The memo info
* @param m The memo
* @param number What memo number is being deleted, can be 0 for all memos
*/
virtual void OnMemoDel(ChannelInfo *ci, MemoInfo *mi, Memo *m) { }
virtual void OnMemoDel(ChannelInfo *ci, MemoInfo *mi, const Memo *m) { }
/** Called when a mode is set on a channel
* @param c The channel
* @param Name The mode name
* @param setter The user or server that is setting the mode
* @param mname The mode name
* @param param The mode param, if there is one
* @return EVENT_STOP to make mlock/secureops etc checks not happen
*/
virtual EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name, const Anope::string &param) { return EVENT_CONTINUE; }
virtual EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, const Anope::string &mname, const Anope::string &param) { return EVENT_CONTINUE; }
/** Called when a mode is unset on a channel
* @param c The channel
* @param Name The mode name
* @param setter The user or server that is unsetting the mode
* @param mname The mode name
* @param param The mode param, if there is one
* @return EVENT_STOP to make mlock/secureops etc checks not happen
*/
virtual EventReturn OnChannelModeUnset(Channel *c, ChannelModeName Name, const Anope::string &param) { return EVENT_CONTINUE; }
virtual EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, const Anope::string &mname, const Anope::string &param) { return EVENT_CONTINUE; }
/** Called when a mode is set on a user
* @param u The user
* @param Name The mode name
* @param mname The mode name
*/
virtual void OnUserModeSet(User *u, UserModeName Name) { }
virtual void OnUserModeSet(User *u, const Anope::string &mname) { }
/** Called when a mode is unset from a user
* @param u The user
* @param Name The mode name
* @param mname The mode name
*/
virtual void OnUserModeUnset(User *u, UserModeName Name) { }
virtual void OnUserModeUnset(User *u, const Anope::string &mname) { }
/** Called when a channel mode is introducted into Anope
* @param cm The mode
@@ -978,10 +875,10 @@ class CoreExport Module : public Extensible
/** Called when a mode is about to be unlocked
* @param ci The channel the mode is being unlocked from
* @param mode The mode being unlocked
* @param lock The mode lock
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
*/
virtual EventReturn OnUnMLock(ChannelInfo *ci, ChannelMode *mode, const Anope::string &param) { return EVENT_CONTINUE; }
virtual EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) { return EVENT_CONTINUE; }
/** Called after a module is loaded
* @param u The user loading the module, can be NULL
@@ -1019,6 +916,56 @@ class CoreExport Module : public Extensible
* @param msg The message
*/
virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg) { }
/** Called when a message is logged
* @param l The log message
*/
virtual void OnLog(Log *l) { }
/** Called when a DNS request (question) is recieved.
* @param req The dns request
* @param reply The reply that will be sent
*/
virtual void OnDnsRequest(DNS::Packet &req, DNS::Packet *reply) { }
/** Called when a channels modes are being checked to see if they are allowed,
* mostly to ensure mlock/+r are set.
* @param c The channel
* @return EVENT_STOP to stop checking modes
*/
virtual EventReturn OnCheckModes(Channel *c) { return EVENT_CONTINUE; }
virtual void OnSerializeCheck(Serialize::Type *) { }
virtual void OnSerializableConstruct(Serializable *) { }
virtual void OnSerializableDestruct(Serializable *) { }
virtual void OnSerializableUpdate(Serializable *) { }
virtual void OnSerializeTypeCreate(Serialize::Type *) { }
/** Called when a chanserv/set command is used
* @param source The source of the command
* @param cmd The command
* @param ci The channel the command was used on
* @param setting The setting passed to the command. Probably ON/OFF.
* @return EVENT_ALLOW to bypass access checks, EVENT_STOP to halt immediately.
*/
virtual EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) { return EVENT_CONTINUE; }
/** Called when a nickserv/set command is used.
* @param source The source of the command
* @param cmd The command
* @param nc The nickcore being modifed
* @param setting The setting passed to the command. Probably ON/OFF.
* @return EVENT_STOP to halt immediately
*/
virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickCore *nc, const Anope::string &setting) { return EVENT_CONTINUE; }
/** Called whenever a message is received from the uplink
* @param source The source of the message
* @param command The command being executed
* @param params Parameters
* @return EVENT_STOP to prevent the protocol module from processing this message
*/
virtual EventReturn OnMessage(MessageSource &source, Anope::string &command, std::vector<Anope::string> &param) { return EVENT_CONTINUE; }
};
/** Implementation-specific flags which may be set in ModuleManager::Attach()
@@ -1028,22 +975,19 @@ enum Implementation
I_BEGIN,
/* NickServ */
I_OnPreNickExpire, I_OnNickExpire, I_OnNickForbidden, I_OnNickGroup, I_OnNickLogout, I_OnNickIdentify, I_OnNickDrop,
I_OnNickRegister, I_OnNickSuspended, I_OnNickUnsuspended,
I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay,
I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess,
I_OnNickClearCert, I_OnNickAddCert, I_OnNickEraseCert,
I_OnNickInfo, I_OnFindNick, I_OnFindCore, I_OnCheckAuthentication,
I_OnNickUpdate,
I_OnNickRegister, I_OnNickSuspended, I_OnNickUnsuspended, I_OnDelNick, I_OnDelCore, I_OnChangeCoreDisplay,
I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess, I_OnNickClearCert, I_OnNickAddCert, I_OnNickEraseCert,
I_OnNickInfo, I_OnCheckAuthentication, I_OnNickUpdate, I_OnSetNickOption,
/* ChanServ */
I_OnChanForbidden, I_OnChanSuspend, I_OnChanDrop, I_OnPreChanExpire, I_OnChanExpire, I_OnAccessAdd,
I_OnChanSuspend, I_OnChanDrop, I_OnPreChanExpire, I_OnChanExpire, I_OnAccessAdd,
I_OnAccessDel, I_OnAccessClear, I_OnLevelChange, I_OnChanRegistered, I_OnChanUnsuspend, I_OnCreateChan, I_OnDelChan, I_OnChannelCreate,
I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick,
I_OnChanInfo, I_OnFindChan, I_OnCheckPriv, I_OnGroupCheckPriv,
I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick, I_OnCheckModes,
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnSetChannelOption,
/* BotServ */
I_OnBotJoin, I_OnBotKick, I_OnBotCreate, I_OnBotChange, I_OnBotDelete, I_OnBotAssign, I_OnBotUnAssign,
I_OnUserKicked, I_OnBotFantasy, I_OnBotNoFantasyAccess, I_OnBotBan, I_OnBadWordAdd, I_OnBadWordDel, I_OnFindBot,
I_OnUserKicked, I_OnBotFantasy, I_OnBotNoFantasyAccess, I_OnBotBan, I_OnBadWordAdd, I_OnBadWordDel,
/* HostServ */
I_OnSetVhost, I_OnDeleteVhost,
@@ -1052,7 +996,7 @@ enum Implementation
I_OnMemoSend, I_OnMemoDel,
/* Users */
I_OnUserConnect, I_OnUserNickChange, I_OnUserQuit, I_OnUserLogoff, I_OnPreJoinChannel,
I_OnUserConnect, I_OnUserNickChange, I_OnUserQuit, I_OnPreUserLogoff, I_OnPostUserLogoff, I_OnPreJoinChannel,
I_OnJoinChannel, I_OnPrePartChannel, I_OnPartChannel, I_OnLeaveChannel, I_OnFingerprint, I_OnUserAway,
/* OperServ */
@@ -1060,8 +1004,7 @@ enum Implementation
I_OnAddXLine, I_OnDelXLine, I_IsServicesOper,
/* Database */
I_OnPostLoadDatabases, I_OnSaveDatabase, I_OnLoadDatabase,
I_OnDatabaseWrite, I_OnDatabaseRead, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata,
I_OnSaveDatabase, I_OnLoadDatabase,
/* Modules */
I_OnModuleLoad, I_OnModuleUnload,
@@ -1072,21 +1015,22 @@ enum Implementation
I_OnServerQuit, I_OnTopicUpdated,
I_OnEncrypt, I_OnDecrypt,
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnPrivmsg,
I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnPrivmsg, I_OnLog, I_OnDnsRequest,
I_OnMessage,
I_OnSerializeCheck, I_OnSerializableConstruct, I_OnSerializableDestruct, I_OnSerializableUpdate, I_OnSerializeTypeCreate,
I_END
};
class Service;
/** Used to manage modules.
*/
class CoreExport ModuleManager
{
private:
/** A map of service providers
*/
static std::map<Anope::string, Service *> ServiceProviders;
public:
/** List of all modules loaded in Anope
*/
static std::list<Module *> Modules;
/** Event handler hooks.
* This needs to be public to be used by FOREACH_MOD and friends.
*/
@@ -1096,11 +1040,6 @@ class CoreExport ModuleManager
*/
static void CleanupRuntimeDirectory();
/** Load up a list of modules.
* @param module_list The list of modules to load
**/
static void LoadModuleList(std::list<Anope::string> &ModList);
/** Loads a given module.
* @param m the module to load
* @param u the user who loaded it, NULL for auto-load
@@ -1132,9 +1071,8 @@ class CoreExport ModuleManager
* @param major The major version
* @param minor The minor vesion
* @param patch The patch version
* @param build The build version
*/
static void RequireVersion(int major, int minor, int patch, int build);
static void RequireVersion(int major, int minor, int patch);
/** Change the priority of one event in a module.
* Each module event has a list of modules which are attached to that event type. If you wish to be called before or after other specific modules, you may use this
@@ -1197,29 +1135,6 @@ class CoreExport ModuleManager
*/
static void UnloadAll();
/** Register a service
* @param s The service
* @return true if it was successfully registeed, else false (service name colision)
*/
static bool RegisterService(Service *s);
/** Unregister a service
* @param s The service
* @return true if it was unregistered successfully
*/
static bool UnregisterService(Service *s);
/** Get a service
* @param name The service name
* @return The services, or NULL
*/
static Service *GetService(const Anope::string &name);
/** Get the existing service key names
* @return The keys
*/
static std::vector<Anope::string> GetServiceKeys();
private:
/** Call the module_delete function to safely delete the module
* @param m the module to delete
@@ -1228,61 +1143,17 @@ class CoreExport ModuleManager
static ModuleReturn DeleteModule(Module *m);
};
/** Class used for callbacks within modules
/** Class used for callbacks within modules. These are identical to Timers hwoever
* they will be cleaned up automatically when a module is unloaded, and Timers will not.
*/
class CallBack : public Timer
class CoreExport CallBack : public Timer
{
private:
Module *m;
public:
CallBack(Module *mod, long time_from_now, time_t now = Anope::CurTime, bool repeating = false) : Timer(time_from_now, now, repeating), m(mod)
{
m->CallBacks.push_back(this);
}
CallBack(Module *mod, long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
virtual ~CallBack()
{
std::list<CallBack *>::iterator it = std::find(m->CallBacks.begin(), m->CallBacks.end(), this);
if (it != m->CallBacks.end())
m->CallBacks.erase(it);
}
};
template<typename T>
class service_reference : public dynamic_reference<T>
{
Anope::string name;
public:
service_reference(const Anope::string &n) : dynamic_reference<T>(static_cast<T *>(ModuleManager::GetService(n))), name(n)
{
}
operator bool()
{
if (this->invalid)
{
this->invalid = false;
this->ref = NULL;
}
if (!this->ref)
{
this->ref = static_cast<T *>(ModuleManager::GetService(this->name));
if (this->ref)
this->ref->AddReference(this);
}
return this->ref;
}
};
class CoreExport Message
{
public:
Anope::string name;
bool (*func)(const Anope::string &source, const std::vector<Anope::string> &params);
Message(const Anope::string &n, bool (*f)(const Anope::string &, const std::vector<Anope::string> &));
~Message();
virtual ~CallBack();
};
#endif // MODULES_H
+19 -7
View File
@@ -1,27 +1,39 @@
/*
* Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
* Copyright (C) 2008-2013 Anope Team <team@anope.org>
*
* Please read COPYING and README for further details.
*
*/
#ifndef OPERTYPE_H
#define OPERTYPE_H
#include "hashcomp.h"
class OperType;
#include "services.h"
#include "account.h"
/* A services operator. Usually made by the configuration file, but not always.
* NickAlias::Find(name)->nc->o == this
*/
struct CoreExport Oper
{
/* The oper's nick */
Anope::string name;
/* The type of operator this operator is */
OperType *ot;
/* Whether the user must be an IRC operator (umode +o) to be considered a services operator */
bool require_oper;
Anope::string password;
Anope::string certfp;
OperType *ot;
/* True if this operator is set in the config */
bool config;
/* Hosts allowed to use this operator block */
std::vector<Anope::string> hosts;
Anope::string vhost;
Oper(const Anope::string &n, const Anope::string &p, const Anope::string &c, OperType *o) :
name(n), password(p), certfp(c), ot(o), config(false) { }
Oper(const Anope::string &n, OperType *o) : name(n), ot(o), require_oper(false), config(false) { }
virtual ~Oper() { }
/** Find an oper block by name
* @param name The name
+266
View File
@@ -0,0 +1,266 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef PROTOCOL_H
#define PROTOCOL_H
#include "services.h"
#include "anope.h"
#include "service.h"
/* Encapsultes the IRCd protocol we are speaking. */
class CoreExport IRCDProto : public Service
{
Anope::string proto_name;
protected:
IRCDProto(Module *creator, const Anope::string &proto_name);
public:
virtual ~IRCDProto();
virtual void SendSVSKillInternal(const BotInfo *, User *, const Anope::string &);
virtual void SendModeInternal(const BotInfo *, const Channel *, const Anope::string &);
virtual void SendModeInternal(const BotInfo *, const User *, const Anope::string &) = 0;
virtual void SendKickInternal(const BotInfo *, const Channel *, const User *, const Anope::string &);
virtual void SendMessageInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendNoticeInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &msg);
virtual void SendPrivmsgInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendQuitInternal(const User *u, const Anope::string &buf);
virtual void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf);
virtual void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf);
virtual void SendCTCPInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf);
const Anope::string &GetProtocolName();
/* Modes used by default by our clients */
Anope::string DefaultPseudoclientModes;
/* Can we force change a users's nick? */
bool CanSVSNick;
/* Can we force join or part users? */
bool CanSVSJoin;
/* Can we set vhosts/vidents on users? */
bool CanSetVHost, CanSetVIdent;
/* Can we ban specific gecos from being used? */
bool CanSNLine;
/* Can we ban specific nicknames from being used? */
bool CanSQLine;
/* Can we ban sepcific channel names from being used? */
bool CanSQLineChannel;
/* Can we ban by IP? */
bool CanSZLine;
/* Can we place temporary holds on specific nicknames? */
bool CanSVSHold;
/* See os_oline */
bool CanSVSO;
/* See ns_cert */
bool CanCertFP;
/* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */
bool RequiresID;
/* The maximum number of modes we are allowed to set with one MODE command */
unsigned MaxModes;
/** 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
* @param mode Whether to turn NOOP on or off
*/
virtual void SendSVSNOOP(const Server *s, bool mode) { }
/** Sets the topic on a channel
* @param bi The bot to set the topic from
* @param c The channel to set the topic on. The topic being set is Channel::topic
*/
virtual void SendTopic(BotInfo *, Channel *);
/** Sets a vhost on a user.
* @param u The user
* @param vident The ident to set
* @param vhost The vhost to set
*/
virtual void SendVhost(User *u, const Anope::string &vident, const Anope::string &vhost) { }
virtual void SendVhostDel(User *) { }
/** Sets an akill. This is a recursive function that can be called multiple times
* for the same xline, but for different users, if the xline is not one that can be
* enforced by the IRCd, such as a nick/user/host/realname combination ban.
* @param u The user affected by the akill, if known
* @param x The akill
*/
virtual void SendAkill(User *, XLine *) = 0;
virtual void SendAkillDel(const XLine *) = 0;
/* Realname ban */
virtual void SendSGLine(User *, const XLine *) { }
virtual void SendSGLineDel(const XLine *) { }
/* IP ban */
virtual void SendSZLine(User *u, const XLine *) { }
virtual void SendSZLineDel(const XLine *) { }
/* Nick ban (and sometimes channel) */
virtual void SendSQLine(User *, const XLine *x) { }
virtual void SendSQLineDel(const XLine *x) { }
/** Kills a user
* @param source The client used to kill the user, if any
* @param user The user to be killed
* @param fmt Kill reason
*/
virtual void SendSVSKill(const BotInfo *source, User *user, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const Channel *dest, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const User *u, const char *fmt, ...);
/** Introduces a client to the rest of the network
* @param u The client to introduce
*/
virtual void SendClientIntroduction(const User *u) = 0;
virtual void SendKick(const BotInfo *bi, const Channel *chan, const User *user, const char *fmt, ...);
/* Sends a message using SendPrivmsg or SendNotice, depending on the default message method. */
virtual void SendMessage(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendNotice(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendPrivmsg(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendAction(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendCTCP(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) = 0;
virtual void SendGlobalPrivmsg(const BotInfo *bi, const Server *desc, const Anope::string &msg) = 0;
virtual void SendQuit(const User *u, const char *fmt, ...);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
/** Joins one of our users to a channel.
* @param u The user to join
* @param c The channel to join the user to
* @param status The status to set on the user after joining. This may or may not already internally
* be set on the user. This may include the modes in the join, but will usually place them on the mode
* stacker to be set "soon".
*/
virtual void SendJoin(const User *u, Channel *c, const ChannelStatus *status) = 0;
virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...);
/** Force joins a user that isn't ours to a channel.
* @param bi The source of the message
* @param u The user to join
* @param chan The channel to join the user to
* @param param Channel key?
*/
virtual void SendSVSJoin(const BotInfo *bi, const User *u, const Anope::string &chan, const Anope::string &param) { }
/** Force parts a user that isn't ours from a channel.
* @param bi The source of the message
* @param u The user to part
* @param chan The channel to part the user from
* @param param part reason, some IRCds don't support this
*/
virtual void SendSVSPart(const BotInfo *bi, const User *u, const Anope::string &chan, const Anope::string &param) { }
virtual void SendInvite(const BotInfo *bi, const Channel *c, const User *u);
virtual void SendGlobops(const BotInfo *source, const char *fmt, ...);
/** Sets oper flags on a user, currently only supported by Unreal
*/
virtual void SendSVSO(const BotInfo *, const Anope::string &, const Anope::string &) { }
/** Sends a nick change of one of our clients.
*/
virtual void SendNickChange(const User *u, const Anope::string &newnick);
/** Forces a nick change of a user that isn't ours (SVSNICK)
*/
virtual void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when);
/** Used to introduce ourselves to our uplink. Usually will SendServer(Me) and any other
* initial handshake requirements.
*/
virtual void SendConnect() = 0;
/** Called right before we begin our burst, after we have handshaked successfully with the uplink/
* At this point none of our servesr, users, or channels exist on the uplink
*/
virtual void SendBOB() { }
virtual void SendEOB() { }
virtual void SendSVSHold(const Anope::string &) { }
virtual void SendSVSHoldDel(const Anope::string &) { }
virtual void SendSWhois(const BotInfo *bi, const Anope::string &, const Anope::string &) { }
/** Introduces a server to the uplink
*/
virtual void SendServer(const Server *) = 0;
virtual void SendSquit(Server *, const Anope::string &message);
virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...);
virtual void SendLogin(User *u) = 0;
virtual void SendLogout(User *u) = 0;
/** Send a channel creation message to the uplink.
* On most TS6 IRCds this is a SJOIN with no nick
*/
virtual void SendChannel(Channel *c) { }
/** Make the user an IRC operator
* Normally this is a simple +o, though some IRCds require us to send the oper type
*/
virtual void SendOper(User *u);
virtual bool IsNickValid(const Anope::string &);
virtual bool IsChannelValid(const Anope::string &);
virtual bool IsIdentValid(const Anope::string &);
virtual bool IsHostValid(const Anope::string &);
};
class CoreExport MessageSource
{
Anope::string source;
User *u;
Server *s;
public:
MessageSource(const Anope::string &);
MessageSource(User *u);
MessageSource(Server *s);
const Anope::string GetName();
const Anope::string &GetSource();
User *GetUser();
Server *GetServer();
};
enum IRCDMessageFlag
{
IRCDMESSAGE_SOFT_LIMIT,
IRCDMESSAGE_REQUIRE_SERVER,
IRCDMESSAGE_REQUIRE_USER
};
class CoreExport IRCDMessage : public Service
{
Anope::string name;
unsigned param_count;
std::set<IRCDMessageFlag> flags;
public:
IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0);
unsigned GetParamCount() const;
virtual void Run(MessageSource &, const std::vector<Anope::string> &params) = 0;
void SetFlag(IRCDMessageFlag f) { flags.insert(f); }
bool HasFlag(IRCDMessageFlag f) const { return flags.count(f); }
};
extern CoreExport IRCDProto *IRCD;
#endif // PROTOCOL_H
+800
View File
@@ -0,0 +1,800 @@
/* A portable stdint.h
****************************************************************************
* BSD License:
****************************************************************************
*
* Copyright (c) 2005-2011 Paul Hsieh
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************
*
* Version 0.1.12
*
* The ANSI C standard committee, for the C99 standard, specified the
* inclusion of a new standard include file called stdint.h. This is
* a very useful and long desired include file which contains several
* very precise definitions for integer scalar types that is
* critically important for making portable several classes of
* applications including cryptography, hashing, variable length
* integer libraries and so on. But for most developers its likely
* useful just for programming sanity.
*
* The problem is that most compiler vendors have decided not to
* implement the C99 standard, and the next C++ language standard
* (which has a lot more mindshare these days) will be a long time in
* coming and its unknown whether or not it will include stdint.h or
* how much adoption it will have. Either way, it will be a long time
* before all compilers come with a stdint.h and it also does nothing
* for the extremely large number of compilers available today which
* do not include this file, or anything comparable to it.
*
* So that's what this file is all about. Its an attempt to build a
* single universal include file that works on as many platforms as
* possible to deliver what stdint.h is supposed to. A few things
* that should be noted about this file:
*
* 1) It is not guaranteed to be portable and/or present an identical
* interface on all platforms. The extreme variability of the
* ANSI C standard makes this an impossibility right from the
* very get go. Its really only meant to be useful for the vast
* majority of platforms that possess the capability of
* implementing usefully and precisely defined, standard sized
* integer scalars. Systems which are not intrinsically 2s
* complement may produce invalid constants.
*
* 2) There is an unavoidable use of non-reserved symbols.
*
* 3) Other standard include files are invoked.
*
* 4) This file may come in conflict with future platforms that do
* include stdint.h. The hope is that one or the other can be
* used with no real difference.
*
* 5) In the current verison, if your platform can't represent
* int32_t, int16_t and int8_t, it just dumps out with a compiler
* error.
*
* 6) 64 bit integers may or may not be defined. Test for their
* presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
* Note that this is different from the C99 specification which
* requires the existence of 64 bit support in the compiler. If
* this is not defined for your platform, yet it is capable of
* dealing with 64 bits then it is because this file has not yet
* been extended to cover all of your system's capabilities.
*
* 7) (u)intptr_t may or may not be defined. Test for its presence
* with the test: #ifdef PTRDIFF_MAX. If this is not defined
* for your platform, then it is because this file has not yet
* been extended to cover all of your system's capabilities, not
* because its optional.
*
* 8) The following might not been defined even if your platform is
* capable of defining it:
*
* WCHAR_MIN
* WCHAR_MAX
* (u)int64_t
* PTRDIFF_MIN
* PTRDIFF_MAX
* (u)intptr_t
*
* 9) The following have not been defined:
*
* WINT_MIN
* WINT_MAX
*
* 10) The criteria for defining (u)int_least(*)_t isn't clear,
* except for systems which don't have a type that precisely
* defined 8, 16, or 32 bit types (which this include file does
* not support anyways). Default definitions have been given.
*
* 11) The criteria for defining (u)int_fast(*)_t isn't something I
* would trust to any particular compiler vendor or the ANSI C
* committee. It is well known that "compatible systems" are
* commonly created that have very different performance
* characteristics from the systems they are compatible with,
* especially those whose vendors make both the compiler and the
* system. Default definitions have been given, but its strongly
* recommended that users never use these definitions for any
* reason (they do *NOT* deliver any serious guarantee of
* improved performance -- not in this file, nor any vendor's
* stdint.h).
*
* 12) The following macros:
*
* PRINTF_INTMAX_MODIFIER
* PRINTF_INT64_MODIFIER
* PRINTF_INT32_MODIFIER
* PRINTF_INT16_MODIFIER
* PRINTF_LEAST64_MODIFIER
* PRINTF_LEAST32_MODIFIER
* PRINTF_LEAST16_MODIFIER
* PRINTF_INTPTR_MODIFIER
*
* are strings which have been defined as the modifiers required
* for the "d", "u" and "x" printf formats to correctly output
* (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
* (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
* PRINTF_INTPTR_MODIFIER is not defined for some systems which
* provide their own stdint.h. PRINTF_INT64_MODIFIER is not
* defined if INT64_MAX is not defined. These are an extension
* beyond what C99 specifies must be in stdint.h.
*
* In addition, the following macros are defined:
*
* PRINTF_INTMAX_HEX_WIDTH
* PRINTF_INT64_HEX_WIDTH
* PRINTF_INT32_HEX_WIDTH
* PRINTF_INT16_HEX_WIDTH
* PRINTF_INT8_HEX_WIDTH
* PRINTF_INTMAX_DEC_WIDTH
* PRINTF_INT64_DEC_WIDTH
* PRINTF_INT32_DEC_WIDTH
* PRINTF_INT16_DEC_WIDTH
* PRINTF_INT8_DEC_WIDTH
*
* Which specifies the maximum number of characters required to
* print the number of that type in either hexadecimal or decimal.
* These are an extension beyond what C99 specifies must be in
* stdint.h.
*
* Compilers tested (all with 0 warnings at their highest respective
* settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
* bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
* .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
*
* This file should be considered a work in progress. Suggestions for
* improvements, especially those which increase coverage are strongly
* encouraged.
*
* Acknowledgements
*
* The following people have made significant contributions to the
* development and testing of this file:
*
* Chris Howie
* John Steele Scott
* Dave Thorup
* John Dill
*
*/
#include <stddef.h>
#include <limits.h>
#include <signal.h>
/*
* For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
* do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
*/
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
#include <stdint.h>
#define _PSTDINT_H_INCLUDED
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
# endif
# ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
# endif
# ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
# endif
# ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
# endif
# ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
# endif
# ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "20"
# endif
# ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
# endif
# ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
# endif
# ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
# endif
/*
* Something really weird is going on with Open Watcom. Just pull some of
* these duplicated definitions from Open Watcom's stdint.h file for now.
*/
# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
# if !defined (INT64_C)
# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
# endif
# if !defined (UINT64_C)
# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
# endif
# if !defined (INT32_C)
# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
# endif
# if !defined (UINT32_C)
# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
# endif
# if !defined (INT16_C)
# define INT16_C(x) (x)
# endif
# if !defined (UINT16_C)
# define UINT16_C(x) (x)
# endif
# if !defined (INT8_C)
# define INT8_C(x) (x)
# endif
# if !defined (UINT8_C)
# define UINT8_C(x) (x)
# endif
# if !defined (UINT64_MAX)
# define UINT64_MAX 18446744073709551615ULL
# endif
# if !defined (INT64_MAX)
# define INT64_MAX 9223372036854775807LL
# endif
# if !defined (UINT32_MAX)
# define UINT32_MAX 4294967295UL
# endif
# if !defined (INT32_MAX)
# define INT32_MAX 2147483647L
# endif
# if !defined (INTMAX_MAX)
# define INTMAX_MAX INT64_MAX
# endif
# if !defined (INTMAX_MIN)
# define INTMAX_MIN INT64_MIN
# endif
# endif
#endif
#ifndef _PSTDINT_H_INCLUDED
#define _PSTDINT_H_INCLUDED
#ifndef SIZE_MAX
# define SIZE_MAX (~(size_t)0)
#endif
/*
* Deduce the type assignments from limits.h under the assumption that
* integer sizes in bits are powers of 2, and follow the ANSI
* definitions.
*/
#ifndef UINT8_MAX
# define UINT8_MAX 0xff
#endif
#ifndef uint8_t
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
typedef unsigned char uint8_t;
# define UINT8_C(v) ((uint8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef INT8_MAX
# define INT8_MAX 0x7f
#endif
#ifndef INT8_MIN
# define INT8_MIN INT8_C(0x80)
#endif
#ifndef int8_t
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
typedef signed char int8_t;
# define INT8_C(v) ((int8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef UINT16_MAX
# define UINT16_MAX 0xffff
#endif
#ifndef uint16_t
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
typedef unsigned int uint16_t;
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
# define UINT16_C(v) ((uint16_t) (v))
#elif (USHRT_MAX == UINT16_MAX)
typedef unsigned short uint16_t;
# define UINT16_C(v) ((uint16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT16_MAX
# define INT16_MAX 0x7fff
#endif
#ifndef INT16_MIN
# define INT16_MIN INT16_C(0x8000)
#endif
#ifndef int16_t
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
typedef signed int int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
#elif (SHRT_MAX == INT16_MAX)
typedef signed short int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef UINT32_MAX
# define UINT32_MAX (0xffffffffUL)
#endif
#ifndef uint32_t
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
typedef unsigned long uint32_t;
# define UINT32_C(v) v ## UL
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (UINT_MAX == UINT32_MAX)
typedef unsigned int uint32_t;
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
# define UINT32_C(v) v ## U
#elif (USHRT_MAX == UINT32_MAX)
typedef unsigned short uint32_t;
# define UINT32_C(v) ((unsigned short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT32_MAX
# define INT32_MAX (0x7fffffffL)
#endif
#ifndef INT32_MIN
# define INT32_MIN INT32_C(0x80000000)
#endif
#ifndef int32_t
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
typedef signed long int32_t;
# define INT32_C(v) v ## L
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (INT_MAX == INT32_MAX)
typedef signed int int32_t;
# define INT32_C(v) v
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#elif (SHRT_MAX == INT32_MAX)
typedef signed short int32_t;
# define INT32_C(v) ((short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
/*
* The macro stdint_int64_defined is temporarily used to record
* whether or not 64 integer support is available. It must be
* defined for any 64 integer extensions for new platforms that are
* added.
*/
#undef stdint_int64_defined
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# endif
#endif
#if !defined (stdint_int64_defined)
# if defined(__GNUC__)
# define stdint_int64_defined
__extension__ typedef long long int64_t;
__extension__ typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
# define stdint_int64_defined
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
# define UINT64_C(v) v ## UI64
# define INT64_C(v) v ## I64
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "I64"
# endif
# endif
#endif
#if !defined (LONG_LONG_MAX) && defined (INT64_C)
# define LONG_LONG_MAX INT64_C (9223372036854775807)
#endif
#ifndef ULONG_LONG_MAX
# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
#endif
#if !defined (INT64_MAX) && defined (INT64_C)
# define INT64_MAX INT64_C (9223372036854775807)
#endif
#if !defined (INT64_MIN) && defined (INT64_C)
# define INT64_MIN INT64_C (-9223372036854775808)
#endif
#if !defined (UINT64_MAX) && defined (INT64_C)
# define UINT64_MAX UINT64_C (18446744073709551615)
#endif
/*
* Width of hexadecimal for number field.
*/
#ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
#endif
#ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
#endif
#ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
#endif
#ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
#endif
#ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "20"
#endif
#ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
#endif
#ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
#endif
#ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
#endif
/*
* Ok, lets not worry about 128 bit integers for now. Moore's law says
* we don't need to worry about that until about 2040 at which point
* we'll have bigger things to worry about.
*/
#ifdef stdint_int64_defined
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
# define INTMAX_MAX INT64_MAX
# define INTMAX_MIN INT64_MIN
# define UINTMAX_MAX UINT64_MAX
# define UINTMAX_C(v) UINT64_C(v)
# define INTMAX_C(v) INT64_C(v)
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
# endif
#else
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
# define INTMAX_MAX INT32_MAX
# define UINTMAX_MAX UINT32_MAX
# define UINTMAX_C(v) UINT32_C(v)
# define INTMAX_C(v) INT32_C(v)
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
# endif
#endif
/*
* Because this file currently only supports platforms which have
* precise powers of 2 as bit sizes for the default integers, the
* least definitions are all trivial. Its possible that a future
* version of this file could have different definitions.
*/
#ifndef stdint_least_defined
typedef int8_t int_least8_t;
typedef uint8_t uint_least8_t;
typedef int16_t int_least16_t;
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
# define UINT_LEAST8_MAX UINT8_MAX
# define INT_LEAST8_MAX INT8_MAX
# define UINT_LEAST16_MAX UINT16_MAX
# define INT_LEAST16_MAX INT16_MAX
# define UINT_LEAST32_MAX UINT32_MAX
# define INT_LEAST32_MAX INT32_MAX
# define INT_LEAST8_MIN INT8_MIN
# define INT_LEAST16_MIN INT16_MIN
# define INT_LEAST32_MIN INT32_MIN
# ifdef stdint_int64_defined
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;
# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
# define UINT_LEAST64_MAX UINT64_MAX
# define INT_LEAST64_MAX INT64_MAX
# define INT_LEAST64_MIN INT64_MIN
# endif
#endif
#undef stdint_least_defined
/*
* The ANSI C committee pretending to know or specify anything about
* performance is the epitome of misguided arrogance. The mandate of
* this file is to *ONLY* ever support that absolute minimum
* definition of the fast integer types, for compatibility purposes.
* No extensions, and no attempt to suggest what may or may not be a
* faster integer type will ever be made in this file. Developers are
* warned to stay away from these types when using this or any other
* stdint.h.
*/
typedef int_least8_t int_fast8_t;
typedef uint_least8_t uint_fast8_t;
typedef int_least16_t int_fast16_t;
typedef uint_least16_t uint_fast16_t;
typedef int_least32_t int_fast32_t;
typedef uint_least32_t uint_fast32_t;
#define UINT_FAST8_MAX UINT_LEAST8_MAX
#define INT_FAST8_MAX INT_LEAST8_MAX
#define UINT_FAST16_MAX UINT_LEAST16_MAX
#define INT_FAST16_MAX INT_LEAST16_MAX
#define UINT_FAST32_MAX UINT_LEAST32_MAX
#define INT_FAST32_MAX INT_LEAST32_MAX
#define INT_FAST8_MIN INT_LEAST8_MIN
#define INT_FAST16_MIN INT_LEAST16_MIN
#define INT_FAST32_MIN INT_LEAST32_MIN
#ifdef stdint_int64_defined
typedef int_least64_t int_fast64_t;
typedef uint_least64_t uint_fast64_t;
# define UINT_FAST64_MAX UINT_LEAST64_MAX
# define INT_FAST64_MAX INT_LEAST64_MAX
# define INT_FAST64_MIN INT_LEAST64_MIN
#endif
#undef stdint_int64_defined
/*
* Whatever piecemeal, per compiler thing we can do about the wchar_t
* type limits.
*/
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
# include <wchar.h>
# ifndef WCHAR_MIN
# define WCHAR_MIN 0
# endif
# ifndef WCHAR_MAX
# define WCHAR_MAX ((wchar_t)-1)
# endif
#endif
/*
* Whatever piecemeal, per compiler/platform thing we can do about the
* (u)intptr_t types and limits.
*/
#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
# define STDINT_H_UINTPTR_T_DEFINED
#endif
#ifndef STDINT_H_UINTPTR_T_DEFINED
# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
# define stdint_intptr_bits 64
# elif defined (__WATCOMC__) || defined (__TURBOC__)
# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
# define stdint_intptr_bits 16
# else
# define stdint_intptr_bits 32
# endif
# elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
# define stdint_intptr_bits 32
# elif defined (__INTEL_COMPILER)
/* TODO -- what did Intel do about x86-64? */
# endif
# ifdef stdint_intptr_bits
# define stdint_intptr_glue3_i(a,b,c) a##b##c
# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
# ifndef PRINTF_INTPTR_MODIFIER
# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
# endif
# ifndef PTRDIFF_MAX
# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
# endif
# ifndef PTRDIFF_MIN
# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
# endif
# ifndef UINTPTR_MAX
# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
# endif
# ifndef INTPTR_MAX
# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
# endif
# ifndef INTPTR_MIN
# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
# endif
# ifndef INTPTR_C
# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
# endif
# ifndef UINTPTR_C
# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
# endif
typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
# else
/* TODO -- This following is likely wrong for some platforms, and does
nothing for the definition of uintptr_t. */
typedef ptrdiff_t intptr_t;
# endif
# define STDINT_H_UINTPTR_T_DEFINED
#endif
/*
* Assumes sig_atomic_t is signed and we have a 2s complement machine.
*/
#ifndef SIG_ATOMIC_MAX
# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
#endif
#endif
#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
/*
* Please compile with the maximum warning settings to make sure macros are not
* defined more than once.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define glue3_aux(x,y,z) x ## y ## z
#define glue3(x,y,z) glue3_aux(x,y,z)
#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
#define DECL(us,bits) glue3(DECL,us,) (bits)
#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits)
int main () {
DECL(I,8)
DECL(U,8)
DECL(I,16)
DECL(U,16)
DECL(I,32)
DECL(U,32)
#ifdef INT64_MAX
DECL(I,64)
DECL(U,64)
#endif
intmax_t imax = INTMAX_C(0);
uintmax_t umax = UINTMAX_C(0);
char str0[256], str1[256];
sprintf (str0, "%d %x\n", 0, ~0);
sprintf (str1, "%d %x\n", i8, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
sprintf (str1, "%u %x\n", u8, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
sprintf (str1, "%d %x\n", i16, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
sprintf (str1, "%u %x\n", u16, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);
sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
#ifdef INT64_MAX
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
#endif
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);
TESTUMAX(8);
TESTUMAX(16);
TESTUMAX(32);
#ifdef INT64_MAX
TESTUMAX(64);
#endif
return EXIT_SUCCESS;
}
#endif
+223 -147
View File
@@ -1,116 +1,204 @@
/* Modular support
/*
*
* (C) 2008-2011 Anope Team
* (C) 2008-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
*/
#ifndef REGCHANNEL_H
#define REGCHANNEL_H
typedef Anope::insensitive_map<ChannelInfo *> registered_channel_map;
extern CoreExport registered_channel_map RegisteredChannelList;
#include "memo.h"
#include "modes.h"
#include "extensible.h"
#include "logger.h"
#include "modules.h"
#include "serialize.h"
#include "bots.h"
/** Flags used for the ChannelInfo class
*/
enum ChannelInfoFlag
typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList;
/* Indices for TTB (Times To Ban) */
enum
{
CI_BEGIN,
/* Retain the topic even after the channel is emptied */
CI_KEEPTOPIC,
/* Don't allow non-authorized users to be opped */
CI_SECUREOPS,
/* Hide channel from ChanServ LIST command */
CI_PRIVATE,
/* Topic can only be changed by SET TOPIC */
CI_TOPICLOCK,
/* Only users on the access list may join */
CI_RESTRICTED,
/* Don't allow ChanServ and BotServ commands to do bad things to users with higher access levels */
CI_PEACE,
/* Don't allow any privileges unless a user is IDENTIFIED with NickServ */
CI_SECURE,
/* Channel does not expire */
CI_NO_EXPIRE,
/* Channel memo limit may not be changed */
CI_MEMO_HARDMAX,
/* Send notice to channel on use of OP/DEOP */
CI_OPNOTICE,
/* Stricter control of channel founder status */
CI_SECUREFOUNDER,
/* Sign kicks with the user who did the kick */
CI_SIGNKICK,
/* Sign kicks if level is < than the one defined by the SIGNKIGK level */
CI_SIGNKICK_LEVEL,
/* Channel is suspended */
CI_SUSPENDED,
/* Channel still exists when emptied, this can be caused by setting a perm
* channel mode (+P on InspIRCd) or /cs set #chan persist on.
* This keeps the service bot in the channel regardless if a +P type mode
* is set or not
*/
CI_PERSIST,
CI_END
TTB_BOLDS,
TTB_COLORS,
TTB_REVERSES,
TTB_UNDERLINES,
TTB_BADWORDS,
TTB_CAPS,
TTB_FLOOD,
TTB_REPEAT,
TTB_ITALICS,
TTB_AMSGS,
TTB_SIZE
};
const Anope::string ChannelInfoFlagStrings[] = {
"BEGIN", "KEEPTOPIC", "SECUREOPS", "PRIVATE", "TOPICLOCK", "RESTRICTED",
"PEACE", "SECURE", "NO_EXPIRE", "MEMO_HARDMAX", "OPNOTICE", "SECUREFOUNDER",
"SIGNKICK", "SIGNKICK_LEVEL", "SUSPENDED", "PERSIST", ""
};
/** Flags for auto kick
/** Flags for badwords
*/
enum AutoKickFlag
enum BadWordType
{
/* Is by nick core, not mask */
AK_ISNICK
/* Always kicks if the word is said */
BW_ANY,
/* User must way the entire word */
BW_SINGLE,
/* The word has to start with the badword */
BW_START,
/* The word has to end with the badword */
BW_END
};
const Anope::string AutoKickFlagString[] = { "AK_ISNICK", "" };
/* Structure used to contain bad words. */
struct CoreExport BadWord : Serializable
{
Serialize::Reference<ChannelInfo> ci;
Anope::string word;
BadWordType type;
BadWord();
~BadWord();
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
};
/* AutoKick data. */
class AutoKick : public Flags<AutoKickFlag>
class CoreExport AutoKick : public Serializable
{
public:
AutoKick() : Flags<AutoKickFlag>(AutoKickFlagString) { }
/* Only one of these can be in use */
/* Channel this autokick is on */
Serialize::Reference<ChannelInfo> ci;
Anope::string mask;
NickCore *nc;
Serialize::Reference<NickCore> nc;
Anope::string reason;
Anope::string creator;
time_t addtime;
time_t last_used;
AutoKick();
~AutoKick();
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
};
struct ModeLock
struct CoreExport ModeLock : Serializable
{
public:
Serialize::Reference<ChannelInfo> ci;
bool set;
ChannelModeName name;
Anope::string name;
Anope::string param;
Anope::string setter;
time_t created;
ModeLock(bool s, ChannelModeName n, const Anope::string &p, const Anope::string &se = "", time_t c = Anope::CurTime) : set(s), name(n), param(p), setter(se), created(c) { }
ModeLock(ChannelInfo *ch, bool s, const Anope::string &n, const Anope::string &p, const Anope::string &se = "", time_t c = Anope::CurTime);
~ModeLock();
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
};
class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, CI_END>
struct CoreExport LogSetting : Serializable
{
Serialize::Reference<ChannelInfo> ci;
/* Our service name of the command */
Anope::string service_name;
/* The name of the client the command is on */
Anope::string command_service;
/* Name of the command to the user, can have spaces */
Anope::string command_name;
Anope::string method, extra;
Anope::string creator;
time_t created;
LogSetting() : Serializable("LogSetting") { }
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
};
/* It matters that Base is here before Extensible (it is inherited by Serializable)
*
* Possible flags:
* TOPICLOCK - Topic can only be changed by TOPIC SET
* RESTRICTED - Only users on the access list may join
* PEACE - Don't allow ChanServ and BotServ commands to do bad things to users with higher access levels
* SECURE - Don't allow any privileges
* NO_EXPIRE - Channel does not expire
* MEMO_HARDMAX - Channel memo limit may not be changed
* SECUREFOUNDER - Stricter control of channel founder status
* SIGNKICK - Sign kicks with the user who did the kick
* SIGNKICK_LEVEL - Sign kicks if level is < than the one defined by the SIGNKICK level
* SUSPENDED - Channel is suepended
* PERSIST - Channel still exists when empited (perm channel mode or leaving a botserv bot).
* STATS - Chanstats are enabled
* NOAUTOOP - If set users are not auto given any status on join
*
* BotServ flags:
* BS_DONTKICKOPS - BotServ won't kick ops
* BS_DONTKICKVOICES - BotServ won't kick voices
* BS_FANTASY - BotServ bot accepts fantasy commands
* BS_GREET - BotServ should show greets
* BS_NOBOT - BotServ bots are not allowed to be in this channel
* BS_KICK_BOLDS - BotServ kicks for bolds
* BS_KICK_COLORS - BotServ kicks for colors
* BS_KICK_REVERSES - BotServ kicks for reverses
* BS_KICK_UNDERLINES - BotServ kicks for underlines
* BS_KICK_BADWORD - BotServ kicks for badwords
* BS_KICK_CAPS - BotServ kicks for caps
* BS_KICK_FLOOD - BotServ kicks for flood
* BS_KICK_REPEAT - BotServ kicks for repeating
* BS_KICK_ITALICS - BotServ kicks for italics
* BS_KICK_AMSGS - BotServ kicks for amsgs
*/
class CoreExport ChannelInfo : public Serializable, public Extensible
{
private:
NickCore *founder; /* Channel founder */
std::vector<ChanAccess *> access; /* List of authorized users */
std::vector<AutoKick *> akick; /* List of users to kickban */
std::vector<BadWord *> badwords; /* List of badwords */
Serialize::Reference<NickCore> founder; /* Channel founder */
Serialize::Reference<NickCore> successor; /* Who gets the channel if the founder nick is dropped or expires */
Serialize::Checker<std::vector<ChanAccess *> > access; /* List of authorized users */
Serialize::Checker<std::vector<AutoKick *> > akick; /* List of users to kickban */
Serialize::Checker<std::vector<BadWord *> > badwords; /* List of badwords */
std::map<Anope::string, int16_t> levels;
public:
typedef std::multimap<ChannelModeName, ModeLock> ModeList;
ModeList mode_locks;
friend class ChanAccess;
friend class AutoKick;
friend struct BadWord;
/** Default constructor
typedef std::multimap<Anope::string, ModeLock *> ModeList;
Serialize::Checker<ModeList> mode_locks;
Serialize::Checker<std::vector<LogSetting *> > log_settings;
Anope::string name; /* Channel name */
Anope::string desc;
time_t time_registered;
time_t last_used;
Anope::string last_topic; /* The last topic that was set on this channel */
Anope::string last_topic_setter; /* Setter */
time_t last_topic_time; /* Time */
int16_t bantype;
MemoInfo memos;
Channel *c; /* Pointer to channel, if the channel exists */
/* For BotServ */
Serialize::Reference<BotInfo> bi; /* Bot used on this channel */
int16_t ttb[TTB_SIZE]; /* Times to ban for each kicker */
int16_t capsmin, capspercent; /* For CAPS kicker */
int16_t floodlines, floodsecs; /* For FLOOD kicker */
int16_t repeattimes; /* For REPEAT kicker */
/** Constructor
* @param chname The channel name
*/
ChannelInfo(const Anope::string &chname);
@@ -118,38 +206,12 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** Copy constructor
* @param ci The ChannelInfo to copy settings to
*/
ChannelInfo(ChannelInfo &ci);
ChannelInfo(const ChannelInfo &ci);
/** Default destructor
*/
~ChannelInfo();
Anope::string name; /* Channel name */
NickCore *successor; /* Who gets the channel if the founder nick is dropped or expires */
Anope::string desc;
time_t time_registered;
time_t last_used;
Anope::string last_topic; /* The last topic that was set on this channel */
Anope::string last_topic_setter; /* Setter */
time_t last_topic_time; /* Time */
int16 bantype;
int16 levels[CA_SIZE];
MemoInfo memos;
Channel *c; /* Pointer to channel record (if channel is currently in use) */
/* For BotServ */
BotInfo *bi; /* Bot used on this channel */
Flags<BotServFlag> botflags;
int16 ttb[TTB_SIZE]; /* Times to ban for each kicker */
int16 capsmin, capspercent; /* For CAPS kicker */
int16 floodlines, floodsecs; /* For FLOOD kicker */
int16 repeattimes; /* For REPEAT kicker */
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Change the founder of the channek
* @params nc The new founder
@@ -161,10 +223,13 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*/
NickCore *GetFounder() const;
void SetSuccessor(NickCore *nc);
NickCore *GetSuccessor() const;
/** Find which bot should send mode/topic/etc changes for this channel
* @return The bot
*/
BotInfo *WhoSends();
BotInfo *WhoSends() const;
/** Add an entry to the channel access list
* @param access The entry
@@ -178,13 +243,13 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*
* Retrieves an entry from the access list that matches the given index.
*/
ChanAccess *GetAccess(unsigned index);
ChanAccess *GetAccess(unsigned index) const;
/** Retrieve the access for a user or group in the form of a vector of access entries
* (as multiple entries can affect a single user).
*/
AccessGroup AccessFor(User *u);
AccessGroup AccessFor(NickCore *nc);
AccessGroup AccessFor(const User *u);
AccessGroup AccessFor(const NickCore *nc);
/** Get the size of the accss vector for this channel
* @return The access vector size
@@ -199,14 +264,6 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*/
void EraseAccess(unsigned index);
/** Erase an entry from the channel access list
*
* @param taccess The access to remove
*
* Clears the memory used by the given access entry and removes it from the vector.
*/
void EraseAccess(ChanAccess *taccess);
/** Clear the entire channel access list
*
* Clears the entire access list by deleting every item and then clearing the vector.
@@ -220,7 +277,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
* @param t The time the akick was added, defaults to now
* @param lu The time the akick was last used, defaults to never
*/
AutoKick *AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
AutoKick* AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
/** Add an akick entry to the channel by reason
* @param user The user who added the akick
@@ -229,13 +286,13 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
* @param t The time the akick was added, defaults to now
* @param lu The time the akick was last used, defaults to never
*/
AutoKick *AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
/** Get an entry from the channel akick list
* @param index The index in the akick vector
* @return The akick structure, or NULL if not found
*/
AutoKick *GetAkick(unsigned index);
AutoKick* GetAkick(unsigned index) const;
/** Get the size of the akick vector for this channel
* @return The akick vector size
@@ -256,13 +313,13 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
* @param type The type (SINGLE START END)
* @return The badword
*/
BadWord *AddBadWord(const Anope::string &word, BadWordType type);
BadWord* AddBadWord(const Anope::string &word, BadWordType type);
/** Get a badword structure by index
* @param index The index
* @return The badword
*/
BadWord *GetBadWord(unsigned index);
BadWord* GetBadWord(unsigned index) const;
/** Get how many badwords are on this channel
* @return The number of badwords in the vector
@@ -278,11 +335,6 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*/
void ClearBadWords();
/** Loads MLocked modes from extensible. This is used from database loading because Anope doesn't know what modes exist
* until after it connects to the IRCd.
*/
void LoadMLock();
/** Check if a mode is mlocked
* @param mode The mode
* @param An optional param
@@ -303,10 +355,13 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** Remove a mlock
* @param mode The mode
* @param status True for mlock on, false for mlock off
* @param param The param of the mode, required if it is a list or status mode
* @return true on success, false on failure
*/
bool RemoveMLock(ChannelMode *mode, const Anope::string &param = "");
bool RemoveMLock(ChannelMode *mode, bool status, const Anope::string &param = "");
void RemoveMLock(ModeLock *mlock);
/** Clear all mlocks on the channel
*/
@@ -315,23 +370,23 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** Get all of the mlocks for this channel
* @return The mlocks
*/
const std::multimap<ChannelModeName, ModeLock> &GetMLock() const;
const ModeList &GetMLock() const;
/** Get a list of modes on a channel
* @param Name The mode name to get a list of
* @return a pair of iterators for the beginning and end of the list
*/
std::pair<ModeList::iterator, ModeList::iterator> GetModeList(ChannelModeName Name);
std::pair<ModeList::iterator, ModeList::iterator> GetModeList(const Anope::string &name);
/** Get details for a specific mlock
* @param mname The mode name
* @param An optional param to match with
* @return The MLock, if any
*/
ModeLock *GetMLock(ChannelModeName mname, const Anope::string &param = "");
const ModeLock *GetMLock(const Anope::string &mname, const Anope::string &param = "");
/** Get the current mode locks as a string
* @param complete True to show mlock parameters aswell
* @param complete True to show mlock parameters aswell
* @return A string of mode locks, eg: +nrt
*/
Anope::string GetMLockAsString(bool complete) const;
@@ -347,32 +402,53 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
* the new topic in the ChannelInfo
*/
void CheckTopic();
/** Restore the channel topic, used on channel creation when not syncing with the uplink
* and after uplink sync
*/
void RestoreTopic();
/** Get the level for a privilege
* @param priv The privilege name
* @return the level
* @throws CoreException if priv is not a valid privilege
*/
int16_t GetLevel(const Anope::string &priv) const;
/** Set the level for a privilege
* @param priv The privilege priv
* @param level The new level
*/
void SetLevel(const Anope::string &priv, int16_t level);
/** Remove a privilege from the channel
* @param priv The privilege
*/
void RemoveLevel(const Anope::string &priv);
/** Clear all privileges from the channel
*/
void ClearLevels();
/** Gets a ban mask for the given user based on the bantype
* of the channel.
* @param u The user
* @return A ban mask that affects the user
*/
Anope::string GetIdealBan(User *u) const;
/** Finds a ChannelInfo
* @param name channel name to lookup
* @return the ChannelInfo associated with the channel
*/
static ChannelInfo* Find(const Anope::string &name);
};
/** A timer used to keep the BotServ bot/ChanServ in the channel
* after kicking the last user in a channel
/** Is the user the real founder?
* @param user The user
* @param ci The channel
* @return true or false
*/
class CoreExport ChanServTimer : public Timer
{
private:
dynamic_reference<Channel> c;
public:
/** Default constructor
* @param chan The channel
*/
ChanServTimer(Channel *chan);
/** Called when the delay is up
* @param The current time
*/
void Tick(time_t);
};
extern CoreExport bool IsFounder(const User *user, const ChannelInfo *ci);
#endif // REGCHANNEL_H
+47
View File
@@ -0,0 +1,47 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef REGEXPR_H
#define REGEXPR_H
#include "services.h"
#include "anope.h"
#include "service.h"
class RegexException : public CoreException
{
public:
RegexException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~RegexException() throw() { }
};
class CoreExport Regex
{
Anope::string expression;
protected:
Regex(const Anope::string &expr) : expression(expr) { }
public:
virtual ~Regex() { }
const Anope::string &GetExpression() { return expression; }
virtual bool Matches(const Anope::string &str) = 0;
};
class CoreExport RegexProvider : public Service
{
public:
RegexProvider(Module *o, const Anope::string &n) : Service(o, "Regex", n) { }
virtual Regex *Compile(const Anope::string &) = 0;
};
#endif // REGEXPR_H
+333
View File
@@ -0,0 +1,333 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef SERIALIZE_H
#define SERIALIZE_H
#include <sstream>
#include "anope.h"
#include "base.h"
namespace Serialize
{
class Data
{
public:
enum Type
{
DT_TEXT,
DT_INT
};
virtual ~Data() { }
virtual std::iostream& operator[](const Anope::string &key) = 0;
virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); }
virtual size_t Hash() const { throw CoreException("Not supported"); }
virtual void SetType(const Anope::string &key, Type t) { }
virtual Type GetType(const Anope::string &key) const { return DT_TEXT; }
};
extern void RegisterTypes();
extern void CheckTypes();
class Type;
template<typename T> class Checker;
template<typename T> class Reference;
}
/** A serialziable object. Serializable objects can be serialized into
* abstract data types (Serialize::Data), and then reconstructed or
* updated later at any time.
*/
class CoreExport Serializable : public virtual Base
{
private:
/* A list of every serializable item in Anope.
* Some of these are static and constructed at runtime,
* so this list must be on the heap, as it is not always
* constructed before other objects are if it isn't.
*/
static std::list<Serializable *> *SerializableItems;
/* The type of item this object is */
Serialize::Type *s_type;
private:
/* Iterator into serializable_items */
std::list<Serializable *>::iterator s_iter;
/* The hash of the last serialized form of this object commited to the database */
size_t last_commit;
/* The last time this object was commited to the database */
time_t last_commit_time;
protected:
Serializable(const Anope::string &serialize_type);
Serializable(const Serializable &);
Serializable &operator=(const Serializable &);
public:
virtual ~Serializable();
/* Unique ID (per type, not globally) for this object */
unsigned int id;
/** Marks the object as potentially being updated "soon".
*/
void QueueUpdate();
bool IsCached(Serialize::Data &);
void UpdateCache(Serialize::Data &);
bool IsTSCached();
void UpdateTS();
/** Get the type of serializable object this is
* @return The serializable object type
*/
Serialize::Type* GetSerializableType() const { return this->s_type; }
virtual void Serialize(Serialize::Data &data) const = 0;
static const std::list<Serializable *> &GetItems();
};
/* A serializable type. There should be one of these classes for each type
* of class that inherits from Serialiable. Used for unserializing objects
* of this type, as it requires a function pointer to a static member function.
*/
class CoreExport Serialize::Type
{
typedef Serializable* (*unserialize_func)(Serializable *obj, Serialize::Data &);
static std::vector<Anope::string> TypeOrder;
static std::map<Anope::string, Serialize::Type *> Types;
/* The name of this type, should be a class name */
Anope::string name;
unserialize_func unserialize;
/* Owner of this type. Used for placing objects of this type in separate databases
* based on what module, if any, owns it.
*/
Module *owner;
/* The timesatmp for this type. All objects of this type are as up to date as
* this timestamp. if curtime == timestamp then we have the most up to date
* version of every object of this type.
*/
time_t timestamp;
public:
/* Map of Serializable::id to Serializable objects */
std::map<unsigned int, Serializable *> objects;
/** Creates a new serializable type
* @param n Type name
* @param f Func to unserialize objects
* @param owner Owner of this type. Leave NULL for the core.
*/
Type(const Anope::string &n, unserialize_func f, Module *owner = NULL);
~Type();
/** Gets the name for this type
* @return The name, eg "NickAlias"
*/
const Anope::string &GetName() { return this->name; }
/** Unserialized an object.
* @param obj NULL if this object doesn't yet exist. If this isn't NULL, instead
* update the contents of this object.
* @param data The data to unserialize
* @return The unserialized object. If obj != NULL this should be obj.
*/
Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
/** Check if this object type has any pending changes and update them.
*/
void Check();
/** Gets the timestamp for the object type. That is, the time we know
* all objects of this type are updated at least to.
*/
time_t GetTimestamp() const;
/** Bumps object type timestamp to current time
*/
void UpdateTimestamp();
Module* GetOwner() const { return this->owner; }
static Serialize::Type *Find(const Anope::string &name);
static const std::vector<Anope::string> &GetTypeOrder();
static const std::map<Anope::string, Serialize::Type *>& GetTypes();
};
/** Should be used to hold lists and other objects of a specific type,
* but not a specific object. Used for ensuring that any access to
* this object type is always up to date. These are usually constructed
* at run time, before main is called, so no types are registered. This
* is why there are static Serialize::Type* variables in every function.
*/
template<typename T>
class Serialize::Checker
{
Anope::string name;
T obj;
mutable Serialize::Type *type;
inline void Check() const
{
if (!type)
type = Serialize::Type::Find(this->name);
if (type)
type->Check();
}
public:
Checker(const Anope::string &n) : name(n), type(NULL) { }
inline const T* operator->() const
{
this->Check();
return &this->obj;
}
inline T* operator->()
{
this->Check();
return &this->obj;
}
inline const T& operator*() const
{
this->Check();
return this->obj;
}
inline T& operator*()
{
this->Check();
return this->obj;
}
inline operator const T&() const
{
this->Check();
return this->obj;
}
inline operator T&()
{
this->Check();
return this->obj;
}
};
/** Used to hold references to serializable objects. Reference should always be
* used when holding references to serializable objects for extended periods of time
* to ensure that the object it refers to it always up to date. This also behaves like
* Reference in that it will invalidate itself if the object it refers to is
* destructed.
*/
template<typename T>
class Serialize::Reference : public ReferenceBase
{
protected:
T *ref;
public:
Reference() : ref(NULL)
{
}
Reference(T *obj) : ref(obj)
{
if (obj)
obj->AddReference(this);
}
Reference(const Reference<T> &other) : ReferenceBase(other), ref(other.ref)
{
if (ref && !invalid)
this->ref->AddReference(this);
}
~Reference()
{
if (ref && !invalid)
this->ref->DelReference(this);
}
inline Reference<T>& operator=(const Reference<T> &other)
{
if (this != &other)
{
if (ref && !invalid)
this->ref->DelReference(this);
this->ref = other.ref;
this->invalid = other.invalid;
if (ref && !invalid)
this->ref->AddReference(this);
}
return *this;
}
inline operator bool() const
{
if (!this->invalid)
return this->ref != NULL;
return false;
}
inline operator T*() const
{
if (!this->invalid)
{
if (this->ref)
// This can invalidate me
this->ref->QueueUpdate();
if (!this->invalid)
return this->ref;
}
return NULL;
}
inline T* operator*() const
{
if (!this->invalid)
{
if (this->ref)
// This can invalidate me
this->ref->QueueUpdate();
if (!this->invalid)
return this->ref;
}
return NULL;
}
inline T* operator->() const
{
if (!this->invalid)
{
if (this->ref)
// This can invalidate me
this->ref->QueueUpdate();
if (!this->invalid)
return this->ref;
}
return NULL;
}
};
#endif // SERIALIZE_H
+67 -52
View File
@@ -1,71 +1,66 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef SERVERS_H
#define SERVERS_H
/* Anope */
#include "services.h"
#include "anope.h"
#include "extensible.h"
/* Anope. We are at the top of the server tree, our uplink is
* almost always me->GetLinks()[0]. We never have an uplink. */
extern CoreExport Server *Me;
extern CoreExport void do_server(const Anope::string &source, const Anope::string &servername, unsigned int hops, const Anope::string &descript, const Anope::string &numeric);
extern CoreExport const Anope::string ts6_uid_retrieve();
extern CoreExport const Anope::string ts6_sid_retrieve();
/* Types of capab
*/
enum CapabType
namespace Servers
{
CAPAB_BEGIN,
/* Retrieves the next free TS6 UID or SID */
extern CoreExport const Anope::string TS6_UID_Retrieve();
extern CoreExport const Anope::string TS6_SID_Retrieve();
CAPAB_NOQUIT,
CAPAB_TSMODE,
CAPAB_UNCONNECT,
CAPAB_QS,
/* 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
*/
extern CoreExport Server* GetUplink();
CAPAB_END
};
/* CAPAB stuffs */
struct CapabInfo
{
Anope::string Token;
CapabType Flag;
};
extern CoreExport Flags<CapabType, CAPAB_END> Capab;
extern CoreExport CapabInfo Capab_Info[];
/** Flags set on servers
*/
enum ServerFlag
{
SERVER_NONE,
/* Server is syncing */
SERVER_SYNCING,
/* This server was juped */
SERVER_JUPED
};
const Anope::string ServerFlagStrings[] = { "SERVER_NONE", "SERVER_SYNCING", "SERVER_JUPED", "" };
/* CAPAB/PROTOCTL given by the uplink */
extern CoreExport std::set<Anope::string> Capab;
}
/** Class representing a server
*/
class CoreExport Server : public Flags<ServerFlag>
class CoreExport Server : public Extensible
{
private:
/* Server name */
Anope::string Name;
Anope::string name;
/* Hops between services and server */
unsigned int Hops;
unsigned int hops;
/* Server description */
Anope::string Description;
Anope::string description;
/* Server ID */
Anope::string SID;
Anope::string sid;
/* Links for this server */
std::vector<Server *> Links;
std::vector<Server *> links;
/* Uplink for this server */
Server *UplinkServer;
Server *uplink;
/* Server is syncing */
bool syncing;
/* The server is juped */
bool juped;
/* Reason this server was quit */
Anope::string QReason;
Anope::string quit_reason;
public:
/** Constructor
@@ -74,14 +69,19 @@ class CoreExport Server : public Flags<ServerFlag>
* @param hops Hops from services server
* @param description Server rdescription
* @param sid Server sid/numeric
* @param flag An optional server flag
* @param jupe If the server is juped
*/
Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid, ServerFlag flag = SERVER_NONE);
Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid = "", bool jupe = false);
private:
/** Destructor
*/
~Server();
public:
/* Number of users on the server */
unsigned users;
/** Delete this server with a reason
* @param reason The reason
*/
@@ -112,7 +112,7 @@ class CoreExport Server : public Flags<ServerFlag>
*/
void SetSID(const Anope::string &sid);
/** Get the server numeric/SID
/** Get the server numeric/SID, else the server name
* @return The numeric/SID
*/
const Anope::string &GetSID() const;
@@ -138,20 +138,35 @@ class CoreExport Server : public Flags<ServerFlag>
void DelLink(Server *s);
/** Finish syncing this server and optionally all links to it
* @param SyncLinks True to sync the links for this server too (if any)
* @param sync_links True to sync the links for this server too (if any)
*/
void Sync(bool SyncLinks);
void Sync(bool sync_links);
/** Check if this server is synced
* @return true or false
*/
bool IsSynced() const;
/** Unsync the server. Only used for Me->Unsync()
*/
void Unsync();
/** Check if this server is ULined
* @return true or false
*/
bool IsULined() const;
/** Check if this server is juped (a pseudoserver other than us)
* @return true if this server is a juped server
*/
bool IsJuped() const;
/** Send a message to alll users on this server
* @param source The source of the message
* @param message The message
*/
void Notice(const BotInfo *source, const Anope::string &message);
/** Find a server
* @param name The name or SID/numeric
* @param s The server list to search for this server on, defaults to our Uplink
+175
View File
@@ -0,0 +1,175 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef SERVICE_H
#define SERVICE_H
#include "services.h"
#include "anope.h"
#include "modules.h"
/** Anything that inherits from this class can be referred to
* using ServiceReference. Any interfaces provided by modules,
* such as commands, use this. This is also used for modules
* that publish a service (m_ssl, etc).
*/
class CoreExport Service : public virtual Base
{
static std::map<Anope::string, std::map<Anope::string, Service *> > Services;
static std::map<Anope::string, std::map<Anope::string, Anope::string> > Aliases;
static Service *FindService(const std::map<Anope::string, Service *> &services, const std::map<Anope::string, Anope::string> *aliases, const Anope::string &n)
{
std::map<Anope::string, Service *>::const_iterator it = services.find(n);
if (it != services.end())
return it->second;
if (aliases != NULL)
{
std::map<Anope::string, Anope::string>::const_iterator it2 = aliases->find(n);
if (it2 != aliases->end())
return FindService(services, aliases, it2->second);
}
return NULL;
}
public:
static Service *FindService(const Anope::string &t, const Anope::string &n)
{
std::map<Anope::string, std::map<Anope::string, Service *> >::const_iterator it = Services.find(t);
if (it == Services.end())
return NULL;
std::map<Anope::string, std::map<Anope::string, Anope::string> >::const_iterator it2 = Aliases.find(t);
if (it2 != Aliases.end())
return FindService(it->second, &it2->second, n);
return FindService(it->second, NULL, n);
}
static std::vector<Anope::string> GetServiceKeys(const Anope::string &t)
{
std::vector<Anope::string> keys;
std::map<Anope::string, std::map<Anope::string, Service *> >::iterator it = Services.find(t);
if (it != Services.end())
for (std::map<Anope::string, Service *>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2)
keys.push_back(it2->first);
return keys;
}
static void AddAlias(const Anope::string &t, const Anope::string &n, const Anope::string &v)
{
std::map<Anope::string, Anope::string> &smap = Aliases[t];
smap[n] = v;
}
static void DelAlias(const Anope::string &t, const Anope::string &n)
{
std::map<Anope::string, Anope::string> &smap = Aliases[t];
smap.erase(n);
if (smap.empty())
Aliases.erase(t);
}
Module *owner;
/* Service type, which should be the class name (eg "Command") */
Anope::string type;
/* Service name, commands are usually named service/command */
Anope::string name;
Service(Module *o, const Anope::string &t, const Anope::string &n) : owner(o), type(t), name(n)
{
this->Register();
}
virtual ~Service()
{
this->Unregister();
}
void Register()
{
std::map<Anope::string, Service *> &smap = Services[this->type];
if (smap.find(this->name) != smap.end())
throw ModuleException("Service " + this->type + " with name " + this->name + " already exists");
smap[this->name] = this;
}
void Unregister()
{
std::map<Anope::string, Service *> &smap = Services[this->type];
smap.erase(this->name);
if (smap.empty())
Services.erase(this->type);
}
};
/** Like Reference, but used to refer to Services.
*/
template<typename T>
class ServiceReference : public Reference<T>
{
Anope::string type;
Anope::string name;
public:
ServiceReference() { }
ServiceReference(const Anope::string &t, const Anope::string &n) : type(t), name(n)
{
}
inline void operator=(const Anope::string &n)
{
this->name = n;
this->invalid = true;
}
operator bool() anope_override
{
if (this->invalid)
{
this->invalid = false;
this->ref = NULL;
}
if (!this->ref)
{
/* This really could be dynamic_cast in every case, except for when a module
* creates its own service type (that other modules must include the header file
* for), as the core is not compiled with it so there is no RTTI for it.
*/
this->ref = static_cast<T *>(Service::FindService(this->type, this->name));
if (this->ref)
this->ref->AddReference(this);
}
return this->ref;
}
};
class ServiceAlias
{
Anope::string t, f;
public:
ServiceAlias(const Anope::string &type, const Anope::string &from, const Anope::string &to) : t(type), f(from)
{
Service::AddAlias(type, from, to);
}
~ServiceAlias()
{
Service::DelAlias(t, f);
}
};
#endif // SERVICE_H
+24 -909
View File
@@ -1,6 +1,6 @@
/*
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -8,143 +8,33 @@
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifndef SERVICES_H
#define SERVICES_H
/*************************************************************************/
#include "sysconf.h"
#define BUFSIZE 1024
/* Some SUN fixs */
#ifdef __sun
# ifndef INADDR_NONE
# define INADDR_NONE (-1)
# endif
#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <stdexcept>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <errno.h>
#include <limits.h>
#include <sys/stat.h> /* for umask() on some systems */
#include <sys/types.h>
#include <fcntl.h>
#include <typeinfo>
#if GETTEXT_FOUND
# include <libintl.h>
#endif
#define _(x) x
#ifndef _WIN32
# include <unistd.h>
# include <grp.h>
# include <netdb.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <sys/socket.h>
# include <sys/time.h>
# include <dirent.h>
# define DllExport
# define CoreExport
# define MARK_DEPRECATED __attribute((deprecated))
# define DeleteFile unlink
#else
# include "anope_windows.h"
#endif
/* Telling compilers about printf()-like functions: */
#ifdef __GNUC__
# define FORMAT(type, fmt, start) __attribute__((format(type, fmt, start)))
#else
# define FORMAT(type, fmt, start)
#endif
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef _AIX
/* Some AIX boxes seem to have bogus includes that don't have these
* prototypes. */
extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, size_t);
# undef FD_ZERO
# define FD_ZERO(p) memset((p), 0, sizeof(*(p)))
#endif /* _AIX */
/* Alias stricmp/strnicmp to strcasecmp/strncasecmp if we have the latter
* but not the former. */
#if !HAVE_STRICMP && HAVE_STRCASECMP
# define stricmp strcasecmp
# define strnicmp strncasecmp
#ifndef _WIN32
#include <unistd.h>
#endif
/* We have our own versions of toupper()/tolower(). */
#include <ctype.h>
#undef tolower
#undef toupper
#define tolower tolower_
#define toupper toupper_
/** This definition is used as shorthand for the various classes
* and functions needed to make a module loadable by the OS.
* It defines the class factory and external AnopeInit and AnopeFini functions.
*/
#ifdef _WIN32
# define MODULE_INIT(x) \
extern "C" DllExport Module *AnopeInit(const Anope::string &, const Anope::string &); \
extern "C" Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \
{ \
return new x(modname, creator); \
} \
BOOLEAN WINAPI DllMain(HINSTANCE, DWORD nReason, LPVOID) \
{ \
switch (nReason) \
{ \
case DLL_PROCESS_ATTACH: \
case DLL_PROCESS_DETACH: \
break; \
} \
return TRUE; \
} \
extern "C" DllExport void AnopeFini(x *); \
extern "C" void AnopeFini(x *m) \
{ \
delete m; \
}
#else
# define MODULE_INIT(x) \
extern "C" DllExport Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \
{ \
return new x(modname, creator); \
} \
extern "C" DllExport void AnopeFini(x *m) \
{ \
delete m; \
}
#endif
/* Miscellaneous definitions. */
#include "hashcomp.h"
/* Pull in the various bits of STL */
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <map>
#include <exception>
#include <list>
@@ -152,802 +42,27 @@ extern int strncasecmp(const char *, const char *, size_t);
#include <deque>
#include <bitset>
#include <set>
#include <algorithm>
#include "anope.h"
#include "defs.h"
/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
* When a module whishes to abort, e.g. within a constructor, it should throw an exception using ModuleException or
* a class derived from ModuleException. If a module throws an exception during its constructor, the module will not
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/
class CoreException : public std::exception
{
protected:
/** Holds the error message to be displayed
*/
Anope::string err;
/** Source of the exception
*/
Anope::string source;
public:
/** Default constructor, just uses the error mesage 'Core threw an exception'.
*/
CoreException() : err("Core threw an exception"), source("The core") { }
/** This constructor can be used to specify an error message before throwing.
*/
CoreException(const Anope::string &message) : err(message), source("The core") { }
/** This constructor can be used to specify an error message before throwing,
* and to specify the source of the exception.
*/
CoreException(const Anope::string &message, const Anope::string &src) : err(message), source(src) { }
/** This destructor solves world hunger, cancels the world debt, and causes the world to end.
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
virtual ~CoreException() throw() { }
/** Returns the reason for the exception.
* The module should probably put something informative here as the user will see this upon failure.
*/
virtual const Anope::string &GetReason() const
{
return err;
}
#define _(x) x
virtual const Anope::string &GetSource() const
{
return source;
}
};
class FatalException : public CoreException
{
public:
FatalException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~FatalException() throw() { }
};
class ModuleException : public CoreException
{
public:
/** Default constructor, just uses the error mesage 'Module threw an exception'.
*/
ModuleException() : CoreException("Module threw an exception", "A Module") { }
/** This constructor can be used to specify an error message before throwing.
*/
ModuleException(const Anope::string &message) : CoreException(message, "A Module") { }
/** This destructor solves world hunger, cancels the world debt, and causes the world to end.
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
virtual ~ModuleException() throw() { }
};
class DatabaseException : public CoreException
{
public:
/** This constructor can be used to specify an error message before throwing.
* @param mmessage The exception
*/
DatabaseException(const Anope::string &message) : CoreException(message, "A database module") { }
/** Destructor
* @throws Nothing
*/
virtual ~DatabaseException() throw() { }
};
class Signal
{
static std::vector<Signal *> SignalHandlers;
static void SignalHandler(int signal);
struct sigaction action, old;
sig_atomic_t called;
public:
static void Process();
int signal;
Signal(int s);
~Signal();
virtual void OnSignal() = 0;
};
/** Debug cast to be used instead of dynamic_cast, this uses dynamic_cast
* for debug builds and static_cast on releass builds to speed up the program
* because dynamic_cast relies on RTTI.
*/
template<typename T, typename O> inline T debug_cast(O ptr)
{
#ifdef DEBUG_BUILD
T ret = dynamic_cast<T>(ptr);
if (ptr != NULL && ret == NULL)
throw CoreException(Anope::string("debug_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail");
return ret;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# define anope_override override
# define anope_final final
#else
return static_cast<T>(ptr);
# define anope_override
# define anope_final
#endif
}
/*************************************************************************/
#ifndef _WIN32
# define DllExport
# define CoreExport
# define MARK_DEPRECATED __attribute((deprecated))
# define anope_close close
#else
# include "anope_windows.h"
#endif
/** Class with the ability to keep flags on items, they should extend from this
* where T is an enum.
*/
template<typename T, size_t Size = 32> class Flags
{
protected:
std::bitset<Size> Flag_Values;
const Anope::string *Flag_Strings;
public:
Flags() : Flag_Strings(NULL) { }
Flags(const Anope::string *flag_strings) : Flag_Strings(flag_strings) { }
/** Add a flag to this item
* @param Value The flag
*/
void SetFlag(T Value)
{
Flag_Values[Value] = true;
}
/** Remove a flag from this item
* @param Value The flag
*/
void UnsetFlag(T Value)
{
Flag_Values[Value] = false;
}
/** Check if this item has a flag
* @param Value The flag
* @return true or false
*/
bool HasFlag(T Value) const
{
return Flag_Values.test(Value);
}
/** Check how many flags are set
* @return The number of flags set
*/
size_t FlagCount() const
{
return Flag_Values.count();
}
/** Unset all of the flags
*/
void ClearFlags()
{
Flag_Values.reset();
}
std::vector<Anope::string> ToString()
{
std::vector<Anope::string> ret;
for (unsigned i = 0; this->Flag_Strings && !this->Flag_Strings[i].empty(); ++i)
if (this->HasFlag(static_cast<T>(i)))
ret.push_back(this->Flag_Strings[i]);
return ret;
}
void FromString(const std::vector<Anope::string> &strings)
{
for (unsigned i = 0; this->Flag_Strings && !this->Flag_Strings[i].empty(); ++i)
for (unsigned j = 0; j < strings.size(); ++j)
if (this->Flag_Strings[i] == strings[j])
this->SetFlag(static_cast<T>(i));
}
};
class Module;
class CoreExport Service : public Base
{
public:
Module *owner;
Anope::string name;
Service(Module *o, const Anope::string &n);
virtual ~Service();
};
#include "sockets.h"
#include "socketengine.h"
#include "extensible.h"
#include "timers.h"
#include "dns.h"
/*************************************************************************/
class ConvertException : public CoreException
{
public:
ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~ConvertException() throw() { }
};
template<typename T> inline Anope::string stringify(const T &x)
{
std::ostringstream stream;
if (!(stream << x))
throw ConvertException("Stringify fail");
return stream.str();
}
template<typename T> inline void convert(const Anope::string &s, T &x, Anope::string &leftover, bool failIfLeftoverChars = true)
{
leftover.clear();
std::istringstream i(s.str());
char c;
bool res = i >> x;
if (!res)
throw ConvertException("Convert fail");
if (failIfLeftoverChars)
{
if (i.get(c))
throw ConvertException("Convert fail");
}
else
{
std::string left;
getline(i, left);
leftover = left;
}
}
template<typename T> inline void convert(const Anope::string &s, T &x, bool failIfLeftoverChars = true)
{
Anope::string Unused;
convert(s, x, Unused, failIfLeftoverChars);
}
template<typename T> inline T convertTo(const Anope::string &s, Anope::string &leftover, bool failIfLeftoverChars = true)
{
T x;
convert(s, x, leftover, failIfLeftoverChars);
return x;
}
template<typename T> inline T convertTo(const Anope::string &s, bool failIfLeftoverChars = true)
{
T x;
convert(s, x, failIfLeftoverChars);
return x;
}
/*************************************************************************/
class User;
class NickCore;
class NickAlias;
class BotInfo;
class ChannelInfo;
class Channel;
class Server;
class Entry;
#include "threadengine.h"
#include "opertype.h"
#include "modes.h"
/*************************************************************************/
/* Protocol tweaks */
struct IRCDVar
{
const char *name; /* Name of the IRCd command */
const char *pseudoclient_mode; /* Mode used by BotServ Bots */
int svsnick; /* Supports SVSNICK */
int vhost; /* Supports vhost */
int snline; /* Supports SNline */
int sqline; /* Supports SQline */
int szline; /* Supports SZline */
int join2msg; /* Join 2 Message */
int chansqline; /* Supports Channel Sqlines */
int quitonkill; /* IRCD sends QUIT when kill */
int vident; /* Supports vidents */
int svshold; /* Supports svshold */
int tsonmode; /* Timestamp on mode changes */
int omode; /* On the fly o:lines */
int umode; /* change user modes */
int knock_needs_i; /* Check if we needed +i when setting NOKNOCK */
int svsmode_ucmode; /* Can remove User Channel Modes with SVSMODE */
int sglineenforce;
int ts6; /* ircd is TS6 */
const char *globaltldprefix; /* TLD prefix used for Global */
unsigned maxmodes; /* Max modes to send per line */
int certfp; /* IRCd sends a SSL users certificate fingerprint */
};
/*************************************************************************/
/** Memo Flags
*/
enum MemoFlag
{
/* Memo is unread */
MF_UNREAD,
/* Sender requests a receipt */
MF_RECEIPT
};
const Anope::string MemoFlagStrings[] = {
"MF_UNREAD", "MF_RECEIPT", ""
};
/* Memo info structures. Since both nicknames and channels can have memos,
* we encapsulate memo data in a MemoList to make it easier to handle. */
class CoreExport Memo : public Flags<MemoFlag>
{
public:
Memo();
time_t time; /* When it was sent */
Anope::string sender;
Anope::string text;
};
struct CoreExport MemoInfo
{
int16 memomax;
std::vector<Memo *> memos;
std::vector<Anope::string> ignores;
unsigned GetIndex(Memo *m) const;
void Del(unsigned index);
void Del(Memo *m);
bool HasIgnore(User *u);
};
struct Session
{
Anope::string host; /* Host of the session */
unsigned count; /* Number of clients with this host */
unsigned hits; /* Number of subsequent kills for a host */
};
struct Exception
{
Anope::string mask; /* Hosts to which this exception applies */
unsigned limit; /* Session limit for exception */
Anope::string who; /* Nick of person who added the exception */
Anope::string reason; /* Reason for exception's addition */
time_t time; /* When this exception was added */
time_t expires; /* Time when it expires. 0 == no expiry */
};
/*************************************************************************/
class CoreExport HostInfo
{
private:
Anope::string Ident;
Anope::string Host;
Anope::string Creator;
time_t Time;
public:
/** Set a vhost for the user
* @param ident The ident
* @param host The host
* @param creator Who created the vhost
* @param time When the vhost was craated
*/
void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime);
/** Remove a users vhost
**/
void RemoveVhost();
/** Check if the user has a vhost
* @return true or false
*/
bool HasVhost() const;
/** Retrieve the vhost ident
* @return the ident
*/
const Anope::string &GetIdent() const;
/** Retrieve the vhost host
* @return the host
*/
const Anope::string &GetHost() const;
/** Retrieve the vhost creator
* @return the creator
*/
const Anope::string &GetCreator() const;
/** Retrieve when the vhost was crated
* @return the time it was created
*/
const time_t GetTime() const;
};
/** Flags for badwords
*/
enum BadWordType
{
/* Always kicks if the word is said */
BW_ANY,
/* User must way the entire word */
BW_SINGLE,
/* The word has to start with the badword */
BW_START,
/* The word has to end with the badword */
BW_END
};
/* Structure used to contain bad words. */
struct BadWord
{
Anope::string word;
BadWordType type;
};
/* BotServ SET flags */
enum BotServFlag
{
BS_BEGIN,
/* BotServ won't kick ops */
BS_DONTKICKOPS,
/* BotServ won't kick voices */
BS_DONTKICKVOICES,
/* BotServ bot accepts fantasy commands */
BS_FANTASY,
/* BotServ should show greets */
BS_GREET,
/* BotServ bots are not allowed to be in this channel */
BS_NOBOT,
/* BotServ kicks for bolds */
BS_KICK_BOLDS,
/* BotServ kicks for colors */
BS_KICK_COLORS,
/* BOtServ kicks for reverses */
BS_KICK_REVERSES,
/* BotServ kicks for underlines */
BS_KICK_UNDERLINES,
/* BotServ kicks for badwords */
BS_KICK_BADWORDS,
/* BotServ kicks for caps */
BS_KICK_CAPS,
/* BotServ kicks for flood */
BS_KICK_FLOOD,
/* BotServ kicks for repeating */
BS_KICK_REPEAT,
/* BotServ kicks for italics */
BS_KICK_ITALICS,
/* BotServ kicks for amsgs */
BS_KICK_AMSGS,
/* Send fantasy replies back to the channel via PRIVMSG */
BS_MSG_PRIVMSG,
/* Send fantasy replies back to the channel via NOTICE */
BS_MSG_NOTICE,
/* Send fantasy replies back to the channel via NOTICE to ops */
BS_MSG_NOTICEOPS,
BS_END
};
const Anope::string BotServFlagStrings[] = {
"BEGIN", "DONTKICKOPS", "DONTKICKVOICES", "FANTASY", "GREET", "NOBOT",
"KICK_BOLDs", "KICK_COLORS", "KICK_REVERSES", "KICK_UNDERLINES", "KICK_BADWORDS", "KICK_CAPS",
"KICK_FLOOD", "KICK_REPEAT", "KICK_ITALICS", "KICK_AMSGS", "MSG_PRIVMSG", "MSG_NOTICE",
"MSG_NOTICEOPS", ""
};
/* Indices for TTB (Times To Ban) */
enum
{
TTB_BOLDS,
TTB_COLORS,
TTB_REVERSES,
TTB_UNDERLINES,
TTB_BADWORDS,
TTB_CAPS,
TTB_FLOOD,
TTB_REPEAT,
TTB_ITALICS,
TTB_AMSGS,
TTB_SIZE
};
#include "access.h"
#include "regchannel.h"
/*************************************************************************/
/* This structure stocks ban data since it must not be removed when
* user is kicked.
*/
#include "users.h"
#include "account.h"
#include "commands.h"
#include "bots.h"
#include "channels.h"
/** Channelban type flags
*/
enum EntryType
{
ENTRYTYPE_NONE,
ENTRYTYPE_CIDR,
ENTRYTYPE_NICK_WILD,
ENTRYTYPE_NICK,
ENTRYTYPE_USER_WILD,
ENTRYTYPE_USER,
ENTRYTYPE_HOST_WILD,
ENTRYTYPE_HOST
};
class CoreExport Entry : public Flags<EntryType>
{
ChannelModeName modename;
public:
unsigned char cidr_len;
Anope::string mask;
Anope::string nick, user, host;
/** Constructor
* @param _host A full nick!ident@host/cidr mask
* @param mode What mode this host is for - can be CMODE_BEGIN for unknown/no mode
*/
Entry(ChannelModeName mode, const Anope::string &_host);
/** Get the banned mask for this entry
* @return The mask
*/
const Anope::string GetMask();
/** Check if this entry matches a user
* @param u The user
* @param full True to match against a users real host and IP
* @return true on match
*/
bool Matches(User *u, bool full = false) const;
};
/*************************************************************************/
/* Mail data */
struct MailInfo
{
FILE *pipe;
User *sender;
NickCore *recipient;
};
/*************************************************************************/
/* Defcon */
/*************************************************************************/
/**
* RFC: defination of a valid nick
* nickname = ( letter / special ) *8( letter / digit / special / "-" )
* letter = %x41-5A / %x61-7A ; A-Z / a-z
* digit = %x30-39 ; 0-9
* special = %x5B-60 / %x7B-7D ; "[", "]", "\", "`", "_", "^", "{", "|", "}"
**/
#define isvalidnick(c) (isalnum(c) || ((c) >= '\x5B' && (c) <= '\x60') || ((c) >= '\x7B' && (c) <= '\x7D') || (c) == '-')
/*************************************************************************/
/*
* Forward declaration reqired, because the base IRCDProto class uses some crap from in here.
*/
class IRCDProto;
class IRCdMessage;
struct Uplink;
class ServerConfig;
class ConfigurationFile;
class XLine;
#include "extern.h"
#include "language.h"
#include "mail.h"
#include "servers.h"
#include "logger.h"
#include "config.h"
class CoreExport IRCDProto
{
private:
virtual void SendSVSKillInternal(const BotInfo *, const User *, const Anope::string &) = 0;
virtual void SendModeInternal(const BotInfo *, const Channel *, const Anope::string &) = 0;
virtual void SendModeInternal(const BotInfo *, const User *, const Anope::string &) = 0;
virtual void SendKickInternal(const BotInfo *, const Channel *, const User *, const Anope::string &) = 0;
virtual void SendNoticeChanopsInternal(const BotInfo *bi, const Channel *, const Anope::string &) = 0;
virtual void SendMessageInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendNoticeInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &msg);
virtual void SendPrivmsgInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendQuitInternal(const User *u, const Anope::string &buf);
virtual void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf);
virtual void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf);
virtual void SendCTCPInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendNumericInternal(const Anope::string &source, int numeric, const Anope::string &dest, const Anope::string &buf);
public:
virtual ~IRCDProto() { }
virtual void SendSVSNOOP(const Server *, bool) { }
virtual void SendTopic(BotInfo *, Channel *) = 0;
virtual void SendVhostDel(User *) { }
virtual void SendAkill(User *, const XLine *) = 0;
virtual void SendAkillDel(const XLine *) = 0;
virtual void SendSVSKill(const BotInfo *source, const User *user, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const Channel *dest, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const User *u, const char *fmt, ...);
virtual void SendClientIntroduction(const User *u) = 0;
virtual void SendKick(const BotInfo *bi, const Channel *chan, const User *user, const char *fmt, ...);
virtual void SendNoticeChanops(const BotInfo *bi, const Channel *dest, const char *fmt, ...);
virtual void SendMessage(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendNotice(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendAction(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendPrivmsg(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg);
virtual void SendGlobalPrivmsg(const BotInfo *bi, const Server *desc, const Anope::string &msg);
virtual void SendQuit(const User *u, const char *fmt, ...);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
virtual void SendJoin(User *, Channel *, const ChannelStatus *) = 0;
virtual void SendSQLineDel(const XLine *x) { }
virtual void SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick);
virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...);
virtual void SendGlobops(const BotInfo *source, const char *fmt, ...);
virtual void SendSQLine(User *, const XLine *x) { }
virtual void SendSquit(const Anope::string &servname, const Anope::string &message);
virtual void SendSVSO(const Anope::string &, const Anope::string &, const Anope::string &) { }
virtual void SendChangeBotNick(const BotInfo *bi, const Anope::string &newnick);
virtual void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when);
virtual void SendVhost(User *, const Anope::string &, const Anope::string &) { }
virtual void SendConnect() = 0;
virtual void SendSVSHold(const Anope::string &) { }
virtual void SendSVSHoldDel(const Anope::string &) { }
virtual void SendSGLineDel(const XLine *) { }
virtual void SendSZLineDel(const XLine *) { }
virtual void SendSZLine(User *u, const XLine *) { }
virtual void SendSGLine(User *, const XLine *) { }
virtual void SendUnregisteredNick(const User *) { }
virtual void SendCTCP(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendSVSJoin(const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &) { }
virtual void SendSWhois(const Anope::string &, const Anope::string &, const Anope::string &) { }
virtual void SendBOB() { }
virtual void SendEOB() { }
virtual void SendServer(const Server *) = 0;
virtual bool IsNickValid(const Anope::string &) { return true; }
virtual bool IsChannelValid(const Anope::string &);
virtual void SendNumeric(const Anope::string &source, int numeric, const Anope::string &dest, const char *fmt, ...);
/** Sends a message logging a user into an account, where ircds support such a feature.
* @param u The user logging in
* @param account The account the user is logging into
*/
virtual void SendAccountLogin(const User *u, const NickCore *account) { }
/** Sends a message logging a user out of an account, where ircds support such a feature.
* @param u The user logging out
* @param account The account the user is logging out of
*/
virtual void SendAccountLogout(const User *u, const NickCore *account) { }
/** Set a users auto identification token
* @param u The user
*/
virtual void SetAutoIdentificationToken(User *u) { }
/** Send a channel creation message to the uplink.
* On most TS6 IRCds this is a SJOIN with no nick
*/
virtual void SendChannel(Channel *c) { }
};
class CoreExport IRCdMessage
{
public:
virtual bool On436(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnAway(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnJoin(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnKick(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnKill(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnMode(const Anope::string &, const std::vector<Anope::string> &) = 0;
virtual bool OnUID(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnNick(const Anope::string &, const std::vector<Anope::string> &) = 0;
virtual bool OnPart(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnPing(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnPrivmsg(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnQuit(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnServer(const Anope::string &, const std::vector<Anope::string> &) = 0;
virtual bool OnSQuit(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnTopic(const Anope::string &, const std::vector<Anope::string> &) = 0;
virtual bool OnWhois(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnCapab(const Anope::string &, const std::vector<Anope::string> &);
virtual bool OnSJoin(const Anope::string &, const std::vector<Anope::string> &) = 0;
virtual bool OnError(const Anope::string &, const std::vector<Anope::string> &);
};
/*************************************************************************/
struct Uplink
{
Anope::string host;
unsigned port;
Anope::string password;
bool ipv6;
Uplink(const Anope::string &_host, int _port, const Anope::string &_password, bool _ipv6) : host(_host), port(_port), password(_password), ipv6(_ipv6) { }
bool operator==(const Uplink &other) const
{
if (this->host != other.host)
return false;
if (this->port != other.port)
return false;
if (this->password != other.password)
return false;
if (this->ipv6 != other.ipv6)
return false;
return true;
}
inline bool operator!=(const Uplink &other) const { return !(*this == other); }
};
/** A class to process numbered lists (passed to most DEL/LIST/VIEW commands).
* The function HandleNumber is called for every number in the list. Note that
* if descending is true it gets called in descending order. This is so deleting
* the index passed to the function from an array will not cause the other indexes
* passed to the function to be incorrect. This keeps us from having to have an
* 'in use' flag on everything.
*/
class CoreExport NumberList
{
private:
bool is_valid;
std::set<unsigned> numbers;
bool desc;
public:
/** Processes a numbered list
* @param list The list
* @param descending True to make HandleNumber get called with numbers in descending order
*/
NumberList(const Anope::string &list, bool descending);
/** Destructor, does nothing
*/
virtual ~NumberList();
/** Should be called after the constructors are done running. This calls the callbacks.
*/
void Process();
/** Called with a number from the list
* @param Number The number
*/
virtual void HandleNumber(unsigned Number);
/** Called when there is an error with the numbered list
* Return false to immediatly stop processing the list and return
* This is all done before we start calling HandleNumber, so no numbers will have been processed yet
* @param list The list
* @return false to stop processing
*/
virtual bool InvalidRange(const Anope::string &list);
};
#endif /* SERVICES_H */
#endif // SERVICES_H
+10 -18
View File
@@ -1,19 +1,24 @@
/*
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef SOCKETENGINE_H
#define SOCKETENGINE_H
#include "services.h"
#include "sockets.h"
class CoreExport SocketEngine
{
static const int DefaultSize = 2; // Uplink, mode stacker
public:
/* Map of sockets */
static std::map<int, Socket *> Sockets;
@@ -26,25 +31,12 @@ class CoreExport SocketEngine
*/
static void Shutdown();
/** Add a socket to the internal list
/** Set a flag on a socket
* @param s The socket
* @param set Whether setting or unsetting
* @param flag The flag to set or unset
*/
static void AddSocket(Socket *s);
/** Delete a socket from the internal list
* @param s The socket
*/
static void DelSocket(Socket *s);
/** Mark a socket as writeable
* @param s The socket
*/
static void MarkWritable(Socket *s);
/** Unmark a socket as writeable
* @param s The socket
*/
static void ClearWritable(Socket *s);
static void Change(Socket *s, bool set, SocketFlag flag);
/** Read from sockets and do things
*/
+178 -123
View File
@@ -1,27 +1,28 @@
/*
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef SOCKETS_H
#define SOCKETS_H
#ifndef _WIN32
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#endif
#include "anope.h"
#define NET_BUFSIZE 65535
#ifdef _WIN32
# define CloseSocket closesocket
#else
# define CloseSocket close
#endif
/** A sockaddr union used to combine IPv4 and IPv6 sockaddrs
*/
union CoreExport sockaddrs
@@ -32,7 +33,7 @@ union CoreExport sockaddrs
/** Construct the object, sets everything to 0
*/
sockaddrs();
sockaddrs(const Anope::string &address = "");
/** Memset the object to 0
*/
@@ -90,47 +91,48 @@ class CoreExport cidr
cidr(const Anope::string &ip, unsigned char len);
Anope::string mask() const;
bool match(sockaddrs &other);
bool operator<(const cidr &other) const;
bool operator==(const cidr &other) const;
bool operator!=(const cidr &other) const;
struct CoreExport hash
{
size_t operator()(const cidr &s) const;
};
};
class SocketException : public CoreException
{
public:
/** Default constructor for socket exceptions
/** Constructor for socket exceptions
* @param message Error message
*/
SocketException(const Anope::string &message) : CoreException(message) { }
/** Default destructor
/** Destructor
* @throws Nothing
*/
virtual ~SocketException() throw() { }
};
enum SocketType
{
SOCKTYPE_BASE,
SOCKTYPE_BUFFERED,
SOCKTYPE_CONNECTION,
SOCKTYPE_CLIENT,
SOCKTYPE_LISTEN
};
enum SocketFlag
{
SF_DEAD,
SF_WRITABLE
SF_DEAD = 1,
SF_READABLE,
SF_WRITABLE,
SF_CONNECTING,
SF_CONNECTED,
SF_ACCEPTING,
SF_ACCEPTED,
SF_SIZE
};
static const Anope::string SocketFlagStrings[] = { "SF_DEAD", "SF_WRITABLE", "" };
class Socket;
class ClientSocket;
class ListenSocket;
class ConnectionSocket;
class CoreExport SocketIO
{
public:
virtual ~SocketIO() { }
/** Receive something from the buffer
* @param s The socket
* @param buf The buf to read to
@@ -140,11 +142,12 @@ class CoreExport SocketIO
virtual int Recv(Socket *s, char *buf, size_t sz);
/** Write something to the socket
* @param s The socket
* @param buf What to write
* @return Number of bytes written
* @param s The socket
* @param buf The data to write
* @param size The length of the data
*/
virtual int Send(Socket *s, const Anope::string &buf);
virtual int Send(Socket *s, const char *buf, size_t sz);
int Send(Socket *s, const Anope::string &buf);
/** Accept a connection from a socket
* @param s The socket
@@ -152,11 +155,11 @@ class CoreExport SocketIO
*/
virtual ClientSocket *Accept(ListenSocket *s);
/** Check if a connection has been accepted
* @param s The client socket
* @return -1 on error, 0 to wait, 1 on success
/** Finished accepting a connection from a socket
* @param s The socket
* @return SF_ACCEPTED if accepted, SF_ACCEPTING if still in process, SF_DEAD on error
*/
virtual int Accepted(ClientSocket *cs);
virtual SocketFlag FinishAccept(ClientSocket *cs);
/** Bind a socket
* @param s The socket
@@ -172,47 +175,46 @@ class CoreExport SocketIO
*/
virtual void Connect(ConnectionSocket *s, const Anope::string &target, int port);
/** Check if this socket is connected
/** Called to potentially finish a pending connection
* @param s The socket
* @return -1 for error, 0 for wait, 1 for connected
* @return SF_CONNECTED on success, SF_CONNECTING if still pending, and SF_DEAD on error.
*/
virtual int Connected(ConnectionSocket *s);
virtual SocketFlag FinishConnect(ConnectionSocket *s);
/** Called when the socket is destructing
*/
virtual void Destroy() { }
};
class CoreExport Socket : public Flags<SocketFlag, 2>
class CoreExport Socket
{
protected:
/* Socket FD */
int Sock;
int sock;
/* Is this an IPv6 socket? */
bool IPv6;
bool ipv6;
public:
std::bitset<SF_SIZE> flags;
/* Sockaddrs for bind() (if it's bound) */
sockaddrs bindaddr;
/* I/O functions used for this socket */
SocketIO *IO;
SocketIO *io;
/* Type this socket is */
SocketType Type;
/** Empty constructor, used for things such as the pipe socket
/** Empty constructor, should not be called.
*/
Socket();
/** Default constructor
* @param sock The socket to use, 0 if we need to create our own
/** Constructor, possibly creates the socket and adds it to the engine
* @param sock The socket to use, -1 if we need to create our own
* @param ipv6 true if using ipv6
* @param type The socket type, defaults to SOCK_STREAM
*/
Socket(int sock, bool ipv6, int type = SOCK_STREAM);
Socket(int sock, bool ipv6 = false, int type = SOCK_STREAM);
/** Default destructor
/** Destructor, closes the socket and removes it from the engine
*/
virtual ~Socket();
@@ -226,15 +228,11 @@ class CoreExport Socket : public Flags<SocketFlag, 2>
*/
bool IsIPv6() const;
/** Mark a socket as blockig
/** Mark a socket as (non)blocking
* @param state true to enable blocking, false to disable blocking
* @return true if the socket is now blocking
*/
bool SetBlocking();
/** Mark a socket as non-blocking
* @return true if the socket is now non-blocking
*/
bool SetNonBlocking();
bool SetBlocking(bool state);
/** Bind the socket to an ip and port
* @param ip The ip
@@ -242,6 +240,11 @@ class CoreExport Socket : public Flags<SocketFlag, 2>
*/
void Bind(const Anope::string &ip, int port = 0);
/** Called when there either is a read or write event.
* @return true to continue to call ProcessRead/ProcessWrite, false to not continue
*/
virtual bool Process();
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
*/
@@ -258,51 +261,40 @@ class CoreExport Socket : public Flags<SocketFlag, 2>
virtual void ProcessError();
};
class CoreExport BufferedSocket : public Socket
class CoreExport BufferedSocket : public virtual Socket
{
protected:
/* Things read from the socket */
Anope::string read_buffer;
/* Things to be written to the socket */
Anope::string WriteBuffer;
/* Part of a message sent from the server, but not totally received */
Anope::string extrabuf;
/* How much data was received from this socket */
int RecvLen;
Anope::string write_buffer;
/* How much data was received from this socket on this recv() */
int recv_len;
public:
/** Blank constructor
*/
BufferedSocket();
/** Constructor
* @param fd FD to use
* @param ipv6 true for ipv6
* @param type socket type, defaults to SOCK_STREAM
*/
BufferedSocket(int fd, bool ipv6, int type = SOCK_STREAM);
/** Default destructor
*/
virtual ~BufferedSocket();
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
*/
bool ProcessRead();
bool ProcessRead() anope_override;
/** Called when the socket is ready to be written to
* @return true on success, false to drop this socket
*/
bool ProcessWrite();
bool ProcessWrite() anope_override;
/** Called with a line received from the socket
* @param buf The line
* @return true to continue reading, false to drop the socket
/** Gets the new line from the input buffer, if any
*/
virtual bool Read(const Anope::string &buf);
const Anope::string GetLine();
/** Write to the socket
* @param message The message
*/
protected:
virtual void Write(const char *buffer, size_t l);
public:
void Write(const char *message, ...);
void Write(const Anope::string &message);
@@ -317,7 +309,53 @@ class CoreExport BufferedSocket : public Socket
int WriteBufferLen() const;
};
class CoreExport ListenSocket : public Socket
class CoreExport BinarySocket : public virtual Socket
{
protected:
struct DataBlock
{
char *orig;
char *buf;
size_t len;
DataBlock(const char *b, size_t l);
~DataBlock();
};
/* Data to be written out */
std::deque<DataBlock *> write_buffer;
public:
BinarySocket();
virtual ~BinarySocket();
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
*/
bool ProcessRead() anope_override;
/** Called when the socket is ready to be written to
* @return true on success, false to drop this socket
*/
bool ProcessWrite() anope_override;
/** Write data to the socket
* @param buffer The data to write
* @param l The length of the data
*/
virtual void Write(const char *buffer, size_t l);
void Write(const char *message, ...);
void Write(const Anope::string &message);
/** Called with data from the socket
* @param buffer The data
* @param l The length of buffer
* @return true to continue reading, false to drop the socket
*/
virtual bool Read(const char *buffer, size_t l);
};
class CoreExport ListenSocket : public virtual Socket
{
public:
/** Constructor
@@ -326,9 +364,6 @@ class CoreExport ListenSocket : public Socket
* @param ipv6 true for ipv6
*/
ListenSocket(const Anope::string &bindip, int port, bool ipv6);
/** Destructor
*/
virtual ~ListenSocket();
/** Process what has come in from the connection
@@ -341,22 +376,18 @@ class CoreExport ListenSocket : public Socket
* @param addr The sockaddr for where the connection came from
* @return The new socket
*/
virtual ClientSocket *OnAccept(int fd, const sockaddrs &addr);
virtual ClientSocket *OnAccept(int fd, const sockaddrs &addr) = 0;
};
class CoreExport ConnectionSocket : public BufferedSocket
class CoreExport ConnectionSocket : public virtual Socket
{
public:
/* Sockaddrs for connection ip/port */
sockaddrs conaddr;
/* True if connected */
bool connected;
/** Constructor
* @param ipv6 true to use IPv6
* @param type The socket type, defaults to SOCK_STREAM
*/
ConnectionSocket(bool ipv6 = false, int type = SOCK_STREAM);
ConnectionSocket();
/** Connect the socket
* @param TargetHost The target host to connect to
@@ -364,20 +395,16 @@ class CoreExport ConnectionSocket : public BufferedSocket
*/
void Connect(const Anope::string &TargetHost, int Port);
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
/** Called when there either is a read or write event.
* Used to determine whether or not this socket is connected yet.
* @return true to continue to call ProcessRead/ProcessWrite, false to not continue
*/
bool ProcessRead();
/** Called when the socket is ready to be written to
* @return true on success, false to drop this socket
*/
bool ProcessWrite();
bool Process() anope_override;
/** Called when there is an error for this socket
* @return true on success, false to drop this socket
*/
void ProcessError();
void ProcessError() anope_override;
/** Called on a successful connect
*/
@@ -389,59 +416,87 @@ class CoreExport ConnectionSocket : public BufferedSocket
virtual void OnError(const Anope::string &error);
};
class CoreExport ClientSocket : public BufferedSocket
class CoreExport ClientSocket : public virtual Socket
{
public:
/* Listen socket this connection came from */
ListenSocket *LS;
ListenSocket *ls;
/* Clients address */
sockaddrs clientaddr;
/** Constructor
* @param ls Listen socket this connection is from
* @param fd New FD for this socket
* @param addr Address the connection came from
*/
ClientSocket(ListenSocket *ls, int fd, const sockaddrs &addr);
ClientSocket(ListenSocket *ls, const sockaddrs &addr);
/** Called when there is something to be received for this socket
/** Called when there either is a read or write event.
* Used to determine whether or not this socket is connected yet.
* @return true to continue to call ProcessRead/ProcessWrite, false to not continue
*/
bool Process() anope_override;
/** Called when there is an error for this socket
* @return true on success, false to drop this socket
*/
bool ProcessRead();
void ProcessError() anope_override;
/** Called when the socket is ready to be written to
* @return true on success, false to drop this socket
/** Called when a client has been accepted() successfully.
*/
bool ProcessWrite();
virtual void OnAccept();
/** Called when there was an error accepting the client
*/
virtual void OnError(const Anope::string &error);
};
class CoreExport Pipe : public BufferedSocket
class CoreExport Pipe : public Socket
{
public:
/** The FD of the write pipe (if this isn't evenfd)
* this->Sock is the readfd
/** The FD of the write pipe
* this->sock is the readfd
*/
int WritePipe;
int write_pipe;
/** Constructor
*/
Pipe();
~Pipe();
/** Called when data is to be read
/** Called when data is to be read, reads the data then calls OnNotify
*/
bool ProcessRead();
bool ProcessRead() anope_override;
/** Function that calls OnNotify
/** Write data to this pipe
* @param data The data to write
* @param sz The amount of data to wirite
*/
bool Read(const Anope::string &);
void Write(const char *data, size_t sz);
inline void Write(const Anope::string &data) { this->Write(data.c_str(), data.length() + 1); }
/** Read data from this pipe
* @param data A buffer to read data into
* @param sz The size of the buffer
* @return The amount of data read
*/
int Read(char *data, size_t sz);
/** Mark the write end of this pipe (non)blocking
* @param state true to enable blocking, false to disable blocking
* @return true if the socket is now blocking
*/
bool SetWriteBlocking(bool state);
/** Called when this pipe needs to be woken up
* Is the same as Write("\0", 1)
*/
void Notify();
/** Should be overloaded to do something useful
/** Called after ProcessRead comes back from Notify(), overload to do something useful
*/
virtual void OnNotify();
virtual void OnNotify() = 0;
};
extern CoreExport uint32_t TotalRead;
extern CoreExport uint32_t TotalWritten;
extern CoreExport SocketIO NormalSocketIO;
#endif // SOCKET_H
+9 -79
View File
@@ -4,10 +4,9 @@
#cmakedefine DEBUG_BUILD
#cmakedefine DEFUMASK @DEFUMASK@
#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_CSTDINT 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_STDDEF_H 1
#cmakedefine HAVE_SETGRENT 1
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE_STRICMP 1
#cmakedefine HAVE_STRINGS_H 1
@@ -16,89 +15,20 @@
#cmakedefine HAVE_EPOLL 1
#cmakedefine HAVE_POLL 1
#cmakedefine GETTEXT_FOUND 1
#cmakedefine RUNGROUP "@RUNGROUP@"
#cmakedefine HAVE_UINT8_T 1
#cmakedefine HAVE_U_INT8_T 1
#cmakedefine HAVE_INT16_T 1
#cmakedefine HAVE_UINT16_T 1
#cmakedefine HAVE_U_INT16_T 1
#cmakedefine HAVE_INT32_T 1
#cmakedefine HAVE_UINT32_T 1
#cmakedefine HAVE_U_INT32_T 1
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#ifdef HAVE_CSTDINT
# include <cstdint>
#else
# ifdef HAVE_STDINT_H
# include <stdint.h>
# else
# include "pstdint.h"
# endif
#endif
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
#ifdef HAVE_UINT8_T
typedef uint8_t uint8;
#else
# ifdef HAVE_U_INT8_T
typedef u_int8_t uint8;
# else
# ifdef _WIN32
typedef unsigned __int8 uint8;
# else
typedef unsigned short uint8;
# endif
# endif
#endif
#ifdef HAVE_INT16_T
typedef int16_t int16;
#else
# ifdef _WIN32
typedef signed __int16 int16;
# else
typedef int int16;
# endif
#endif
#ifdef HAVE_UINT16_T
typedef uint16_t uint16;
#else
# ifdef HAVE_U_INT16_T
typedef u_int16_t uint16;
# else
# ifdef _WIN32
typedef unsigned __int16 uint16;
# else
typedef unsigned int uint16;
# endif
# endif
#endif
#ifdef HAVE_INT32_T
typedef int32_t int32;
#else
# ifdef _WIN32
typedef signed __int32 int32;
# else
typedef long int32;
# endif
#endif
#ifdef HAVE_UINT32_T
typedef uint32_t uint32;
#else
# ifdef HAVE_U_INT32_T
typedef u_int32_t uint32;
# else
# ifdef _WIN32
typedef unsigned __int32 uint32;
# else
typedef unsigned long uint32;
# endif
# endif
#endif
#ifdef _WIN32
# define popen _popen
# define pclose _pclose
+28 -45
View File
@@ -1,47 +1,22 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef THREADENGINE_H
#define THREADENGINE_H
#ifdef _WIN32
typedef HANDLE ThreadHandle;
typedef CRITICAL_SECTION MutexHandle;
typedef HANDLE CondHandle;
#else
# include <pthread.h>
typedef pthread_t ThreadHandle;
typedef pthread_mutex_t MutexHandle;
typedef pthread_cond_t CondHandle;
#endif
#include "sockets.h"
#include "extensible.h"
class ThreadEngine;
class Thread;
extern CoreExport ThreadEngine threadEngine;
class CoreExport ThreadEngine
{
public:
/* Vector of threads */
std::vector<Thread *> threads;
/** Threadengines constructor
*/
ThreadEngine();
/** Threadengines destructor
*/
~ThreadEngine();
/** Start a new thread
* @param thread A pointer to a newley allocated thread
*/
void Start(Thread *thread);
/** Check for finished threads
*/
void Process();
};
class CoreExport Thread : public Extensible
class CoreExport Thread : public Pipe, public Extensible
{
private:
/* Set to true to tell the thread to finish and we are waiting for it */
@@ -49,7 +24,7 @@ class CoreExport Thread : public Extensible
public:
/* Handle for this thread */
ThreadHandle Handle;
pthread_t handle;
/** Threads constructor
*/
@@ -71,21 +46,29 @@ class CoreExport Thread : public Extensible
*/
void Exit();
/** Launch the thread
*/
void Start();
/** Returns the exit state of the thread
* @return true if we want to exit
*/
bool GetExitState() const;
/** Called to run the thread, should be overloaded
/** Called when this thread should be joined to
*/
virtual void Run();
void OnNotify();
/** Called when the thread is run.
*/
virtual void Run() = 0;
};
class CoreExport Mutex
{
protected:
/* A mutex, used to keep threads in sync */
MutexHandle mutex;
pthread_mutex_t mutex;
public:
/** Constructor
@@ -115,7 +98,7 @@ class CoreExport Condition : public Mutex
{
private:
/* A condition */
CondHandle cond;
pthread_cond_t cond;
public:
/** Constructor
+12 -14
View File
@@ -1,23 +1,21 @@
/* Timer include stuff.
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef TIMERS_H
#define TIMERS_H
#include "services.h"
#include <time.h>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include "anope.h"
class CoreExport Timer : public Extensible
class CoreExport Timer
{
private:
/** The time this was created
@@ -37,14 +35,14 @@ class CoreExport Timer : public Extensible
bool repeat;
public:
/** Default constructor, initializes the triggering time
/** Constructor, initializes the triggering time
* @param time_from_now The number of seconds from now to trigger the timer
* @param now The time now
* @param repeating Repeat this timer every time_from_now if this is true
*/
Timer(long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
/** Default destructor, removes the timer from the list
/** Destructor, removes the timer from the list
*/
virtual ~Timer();
@@ -88,21 +86,21 @@ class CoreExport Timer : public Extensible
* This will ensure timers are not missed, as well as removing timers that have
* expired and allowing the addition of new ones.
*/
class CoreExport TimerManager : public Extensible
class CoreExport TimerManager
{
/** A list of timers
*/
static std::vector<Timer *> Timers;
public:
/** Add a timer to the list
* @param T A Timer derived class to add
* @param t A Timer derived class to add
*/
static void AddTimer(Timer *T);
static void AddTimer(Timer *t);
/** Deletes a timer
* @param T A Timer derived class to delete
* @param t A Timer derived class to delete
*/
static void DelTimer(Timer *T);
static void DelTimer(Timer *t);
/** Tick all pending timers
* @param ctime The current time
+57
View File
@@ -0,0 +1,57 @@
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef UPLINK_H
#define UPLINK_H
#include "sockets.h"
namespace Uplink
{
extern void Connect();
}
/* This is the socket to our uplink */
class UplinkSocket : public ConnectionSocket, public BufferedSocket
{
public:
UplinkSocket();
~UplinkSocket();
bool ProcessRead() anope_override;
void OnConnect() anope_override;
void OnError(const Anope::string &) anope_override;
/* A message sent over the uplink socket */
class CoreExport Message
{
private:
/* The source of the message, can be a server (Me), or any user (one of our bots) */
const Server *server;
const User *user;
std::stringstream buffer;
public:
Message();
explicit Message(const Server *);
explicit Message(const User *);
~Message();
template<typename T> Message &operator<<(const T &val)
{
this->buffer << val;
return *this;
}
};
};
extern CoreExport UplinkSocket *UplinkSock;
#endif // UPLINK_H
+137 -68
View File
@@ -1,72 +1,93 @@
/*
* Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
*
* (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef USERS_H
#define USERS_H
extern CoreExport Anope::insensitive_map<User *> UserListByNick;
extern CoreExport Anope::map<User *> UserListByUID;
#include "anope.h"
#include "modes.h"
#include "extensible.h"
#include "serialize.h"
#include "commands.h"
#include "account.h"
class CoreExport ChannelStatus : public Flags<ChannelModeName, CMODE_END * 2>
{
public:
ChannelStatus();
Anope::string BuildCharPrefixList() const;
Anope::string BuildModePrefixList() const;
};
typedef Anope::hash_map<User *> user_map;
struct ChannelContainer
{
Channel *chan;
ChannelStatus *Status;
extern CoreExport user_map UserListByNick, UserListByUID;
ChannelContainer(Channel *c) : chan(c) { }
virtual ~ChannelContainer() { }
};
typedef std::list<ChannelContainer *> UChannelList;
extern CoreExport int OperCount;
extern CoreExport unsigned MaxUserCount;
extern CoreExport time_t MaxUserTime;
/* Online user and channel data. */
class CoreExport User : public Extensible
class CoreExport User : public virtual Base, public Extensible, public CommandReply
{
/* true if the user was quit or killed */
bool quit;
/* Users that are in the process of quitting */
static std::list<User *> quitting_users;
protected:
Anope::string vident;
Anope::string ident;
Anope::string uid;
bool OnAccess; /* If the user is on the access list of the nick theyre on */
Flags<UserModeName, UMODE_END * 2> modes; /* Bitset of mode names the user has set on them */
std::map<UserModeName, Anope::string> Params; /* Map of user modes and the params this user has */
NickCore *nc; /* NickCore account the user is currently loggged in as */
/* If the user is on the access list of the nick theyre on */
bool on_access;
/* Map of user modes and the params this user has (if any) */
std::map<Anope::string, Anope::string> modes;
/* NickCore account the user is currently loggged in as, if they are logged in */
Serialize::Reference<NickCore> nc;
/* # of invalid password attempts */
unsigned short invalid_pw_count;
/* Time of last invalid password */
time_t invalid_pw_time;
public: // XXX: exposing a tiny bit too much
Anope::string nick; /* User's current nick */
/* User's current nick */
Anope::string nick;
Anope::string host; /* User's real hostname */
Anope::string vhost; /* User's virtual hostname */
Anope::string chost; /* User's cloaked hostname */
Anope::string realname; /* Realname */
Anope::string fingerprint; /* SSL Fingerprint */
sockaddrs ip; /* User's IP */
Server *server; /* Server user is connected to */
time_t timestamp; /* Timestamp of the nick */
time_t my_signon; /* When did _we_ see the user? */
bool SuperAdmin; /* is SuperAdmin on or off? */
/* User's real hostname */
Anope::string host;
/* User's virtual hostname */
Anope::string vhost;
/* User's cloaked hostname */
Anope::string chost;
/* Realname */
Anope::string realname;
/* SSL Fingerprint */
Anope::string fingerprint;
/* User's IP */
Anope::string ip;
/* Server user is connected to */
Server *server;
/* When the user signed on. Set on connect and never modified. */
time_t signon;
/* Timestamp of the nick. Updated when the nick changes. */
time_t timestamp;
/* Is the user as super admin? */
bool super_admin;
/* Channels the user is in */
UChannelList chans;
typedef std::list<ChanUserContainer *> ChanUserList;
ChanUserList chans;
unsigned short invalid_pw_count; /* # of invalid password attempts */
time_t invalid_pw_time; /* Time of last invalid password */
time_t lastmemosend; /* Last time MS SEND command used */
time_t lastnickreg; /* Last time NS REGISTER cmd used */
time_t lastmail; /* Last time this user sent a mail */
/****************************************************************/
/* Last time this user sent a memo command used */
time_t lastmemosend;
/* Last time this user registered */
time_t lastnickreg;
/* Last time this user sent an email */
time_t lastmail;
/** Create a new user object, initialising necessary fields and
* adds it to the hash
@@ -74,18 +95,28 @@ class CoreExport User : public Extensible
* @param snick The nickname of the user.
* @param sident The username of the user
* @param shost The hostname of the user
* @param svhost The vhost of the user
* @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 smodes User's modes
* @param suid The unique identifier of the user.
*/
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &suid = "");
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 = "");
protected:
/** Destroy a user.
*/
virtual ~User();
public:
/** Update the nickname of a user record accordingly, should be
* called from ircd protocol.
* @param newnick The new username
* @param ts The time the nick was changed, User::timestamp will be updated to this.
*/
void SetNewNick(const Anope::string &newnick);
void ChangeNick(const Anope::string &newnick, time_t ts = Anope::CurTime);
/** Update the displayed (vhost) of a user record.
* This is used (if set) instead of real host.
@@ -108,8 +139,7 @@ class CoreExport User : public Extensible
*/
const Anope::string &GetCloakedHost() const;
/** Retrieves the UID of the user, where applicable, if set.
* This is not used on some IRCds, but is for a lot e.g. P10, TS6 protocols.
/** Retrieves the UID of the user, if set, else the nick.
* @return The UID of the user.
*/
const Anope::string &GetUID() const;
@@ -136,7 +166,7 @@ class CoreExport User : public Extensible
*/
const Anope::string &GetIdent() const;
/** Get the full mask ( nick!ident@realhost ) of a user
/** Get the full mask (nick!ident@realhost) of a user
*/
Anope::string GetMask() const;
@@ -154,8 +184,8 @@ class CoreExport User : public Extensible
* @param fmt Format of the Message
* @param ... any number of parameters
*/
void SendMessage(BotInfo *source, const char *fmt, ...);
virtual void SendMessage(BotInfo *source, Anope::string msg);
void SendMessage(const BotInfo *source, const char *fmt, ...);
void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override;
/** Collide a nick
* See the comment in users.cpp
@@ -182,19 +212,19 @@ class CoreExport User : public Extensible
/** Get the account the user is logged in using
* @return The account or NULL
*/
virtual NickCore *Account();
virtual NickCore *Account() const;
/** Check if the user is identified for their nick
* @param CheckNick True to check if the user is identified to the nickname they are on too
* @param check_nick True to check if the user is identified to the nickname they are on too
* @return true or false
*/
virtual bool IsIdentified(bool CheckNick = false);
bool IsIdentified(bool check_nick = false) const;
/** Check if the user is recognized for their nick (on the nicks access list)
* @param CheckSecure Only returns true if the user has secure off
* @param check_nick Only returns true if the user has secure off
* @return true or false
*/
virtual bool IsRecognized(bool CheckSecure = true);
bool IsRecognized(bool check_nick = true) const;
/** Check if the user is a services oper
* @return true if they are an oper
@@ -218,16 +248,16 @@ class CoreExport User : public Extensible
void UpdateHost();
/** Check if the user has a mode
* @param Name Mode name
* @param name Mode name
* @return true or false
*/
bool HasMode(UserModeName Name) const;
bool HasMode(const Anope::string &name) const;
/** Set a mode internally on the user, the IRCd is not informed
* @param um The user mode
* @param Param The param, if there is one
*/
void SetModeInternal(UserMode *um, const Anope::string &Param = "");
void SetModeInternal(UserMode *um, const Anope::string &param = "");
/** Remove a mode internally on the user, the IRCd is not informed
* @param um The user mode
@@ -239,32 +269,32 @@ class CoreExport User : public Extensible
* @param um The user mode
* @param Param Optional param for the mode
*/
void SetMode(BotInfo *bi, UserMode *um, const Anope::string &Param = "");
void SetMode(const BotInfo *bi, UserMode *um, const Anope::string &param = "");
/** Set a mode on the user
* @param bi The client setting the mode
* @param Name The mode name
* @param name The mode name
* @param Param Optional param for the mode
*/
void SetMode(BotInfo *bi, UserModeName Name, const Anope::string &Param = "");
void SetMode(const BotInfo *bi, const Anope::string &name, const Anope::string &param = "");
/** Remove a mode on the user
* @param bi The client setting the mode
* @param um The user mode
*/
void RemoveMode(BotInfo *bi, UserMode *um);
void RemoveMode(const BotInfo *bi, UserMode *um);
/** Remove a mode from the user
* @param bi The client setting the mode
* @param Name The mode name
* @param name The mode name
*/
void RemoveMode(BotInfo *bi, UserModeName Name);
void RemoveMode(const BotInfo *bi, const Anope::string &name);
/** Set a string of modes on a user
* @param bi The client setting the modes
* @param umodes The modes
*/
void SetModes(BotInfo *bi, const char *umodes, ...);
void SetModes(const BotInfo *bi, const char *umodes, ...);
/** Set a string of modes on a user internally
* @param umodes The modes
@@ -282,7 +312,7 @@ class CoreExport User : public Extensible
* @param c The channel
* @return The channel container, or NULL
*/
ChannelContainer *FindChannel(const Channel *c);
ChanUserContainer *FindChannel(const Channel *c) const;
/** Check if the user is protected from kicks and negative mode changes
* @return true or false
@@ -294,6 +324,45 @@ class CoreExport User : public Extensible
* @param reason The reason for the kill
*/
void Kill(const Anope::string &source, const Anope::string &reason);
/** Process a kill for a user
* @param source The user/server doing the kill
* @param reason The reason for the kill
*/
void KillInternal(const Anope::string &source, const Anope::string &reason);
/** Processes a quit for the user, and marks them as quit
* @param reason The reason for the quit
*/
void Quit(const Anope::string &reason = "");
bool Quitting() const;
/* Returns a mask that will most likely match any address the
* user will have from that location. For IP addresses, wildcards the
* appropriate subnet mask (e.g. 35.1.1.1 -> 35.*; 128.2.1.1 -> 128.2.*);
* for named addresses, wildcards the leftmost part of the name unless the
* name only contains two parts. If the username begins with a ~, delete
* it.
*/
Anope::string Mask() const;
/** Notes the usage of an incorrect password. If too many
* incorrect passwords are used the user might be killed.
* @return true if the user was killed
*/
bool BadPassword();
/** Finds a user by nick, or possibly UID
* @param name The nick, or possibly UID, to lookup
* @param nick_only set to true to only look up by nick, not UID
* @return the user, if they exist
*/
static User* Find(const Anope::string &name, bool nick_only = false);
/** Quits all users who are pending to be quit
*/
static void QuitUsers();
};
#endif // USERS_H
+47 -21
View File
@@ -1,6 +1,6 @@
/* Build bumper
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -15,21 +15,54 @@
#include <sstream>
#include <list>
static std::string get_git_hash(const std::string &git_dir)
{
std::fstream fd;
std::string filebuf;
fd.open((git_dir + "/HEAD").c_str(), std::ios::in);
if (!fd.is_open())
return "";
if (!getline(fd, filebuf) || filebuf.find("ref: ") != 0)
{
fd.close();
return "";
}
fd.close();
filebuf = filebuf.substr(5);
fd.open((git_dir + "/" + filebuf).c_str(), std::ios::in);
if (!fd.is_open())
return "";
if (!getline(fd, filebuf))
{
fd.close();
return "";
}
fd.close();
return "g" + filebuf.substr(0, 7);
}
int main(int argc, char *argv[])
{
if (argc < 3)
{
std::cout << "Syntax: " << argv[0] << " <src/version.sh> <version.h>" << std::endl;
std::cerr << "Syntax: " << argv[0] << " <base> <version.h>" << std::endl;
return 1;
}
std::string version_sh = std::string(argv[1]) + "/src/version.sh";
std::string git_dir = std::string(argv[1]) + "/.git";
std::fstream fd;
fd.clear();
fd.open(argv[1], std::ios::in);
fd.open(version_sh.c_str(), std::ios::in);
if (!fd.is_open())
{
std::cout << "Error: Unable to open src/version.sh for reading: " << argv[1] << std::endl;
std::cerr << "Error: Unable to open src/version.sh for reading: " << version_sh << std::endl;
return 1;
}
@@ -41,7 +74,7 @@ int main(int argc, char *argv[])
{
size_t eq = filebuf.find('=');
std::string type = filebuf.substr(8, 5);
std::string type = filebuf.substr(0, eq);
std::string value = filebuf.substr(eq + 2, filebuf.length() - eq - 3);
versions.push_back(std::make_pair(type, value));
}
@@ -49,25 +82,19 @@ int main(int argc, char *argv[])
fd.close();
std::string git_version = get_git_hash(git_dir);
if (!git_version.empty())
versions.push_back(std::make_pair("VERSION_GIT", git_version));
fd.clear();
fd.open(argv[2], std::ios::in);
std::string version_build = "#define VERSION_BUILD 1";
std::string build = "#define BUILD 1";
std::string version_extra;
if (fd.is_open())
{
while (getline(fd, filebuf))
{
if (!filebuf.find("#define VERSION_BUILD"))
version_build = filebuf;
else if (!filebuf.find("#define VERSION_EXTRA"))
{
size_t q = filebuf.find('"');
version_extra = filebuf.substr(q + 1, filebuf.length() - q - 2);
}
else if (!filebuf.find("#define BUILD"))
if (!filebuf.find("#define BUILD"))
{
size_t tab = filebuf.find(' ');
@@ -87,7 +114,7 @@ int main(int argc, char *argv[])
if (!fd.is_open())
{
std::cout << "Error: Unable to include/version.h for writing: " << argv[2] << std::endl;
std::cerr << "Error: Unable to include/version.h for writing: " << argv[2] << std::endl;
return 1;
}
@@ -95,13 +122,12 @@ int main(int argc, char *argv[])
for (std::list<std::pair<std::string, std::string> >::iterator it = versions.begin(), it_end = versions.end(); it != it_end; ++it)
{
if (it->first == "EXTRA")
fd << "#define VERSION_EXTRA \"" << (!version_extra.empty() ? version_extra : "") << (version_extra.find(it->second) == std::string::npos ? it->second : "") << "\"" << std::endl;
if (it->first == "VERSION_EXTRA" || it->first == "VERSION_GIT")
fd << "#define " << it->first << " \"" << it->second << "\"" << std::endl;
else
fd << "#define VERSION_" << it->first << " " << it->second << std::endl;
fd << "#define " << it->first << " " << it->second << std::endl;
}
fd << version_build << std::endl;
fd << build << std::endl;
fd.close();
+76 -58
View File
@@ -1,57 +1,63 @@
/* OperServ support
/*
*
* (C) 2008-2011 Anope Team
* (C) 2008-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
*/
#ifndef OPER_H
#define OPER_H
#ifndef XLINE_H
#define XLINE_H
class XLineManager;
#include "serialize.h"
#include "service.h"
class CoreExport XLine
/* An Xline, eg, anything added with operserv/akill, or any of the operserv/sxline commands */
class CoreExport XLine : public Serializable
{
void InitRegex();
public:
Anope::string Mask;
Anope::string By;
time_t Created;
time_t Expires;
Anope::string Reason;
Anope::string mask;
Regex *regex;
Anope::string by;
time_t created;
time_t expires;
Anope::string reason;
XLineManager *manager;
Anope::string id;
XLine(const Anope::string &mask, const Anope::string &reason = "");
XLine(const Anope::string &mask, const Anope::string &reason = "", const Anope::string &uid = "");
XLine(const Anope::string &mask, const Anope::string &by, const time_t expires, const Anope::string &reason);
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;
Anope::string GetReason() const;
bool HasNickOrReal() const;
bool IsRegex() const;
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
};
/* Managers XLines. There is one XLineManager per type of XLine. */
class CoreExport XLineManager : public Service
{
char type;
protected:
/* List of XLines in this XLineManager */
std::vector<XLine *> XLines;
Serialize::Checker<std::vector<XLine *> > xlines;
/* Akills can have the same IDs, sometimes */
static Serialize::Checker<std::multimap<Anope::string, XLine *, ci::less> > XLinesByUID;
public:
/* List of XLine managers we check users against in XLineManager::CheckAll */
static std::list<XLineManager *> XLineManagers;
/** Constructor
*/
XLineManager(Module *creator, const Anope::string &name, char t);
/** Destructor
*/
virtual ~XLineManager();
/** The type of xline provided by this service
* @return The type
*/
const char &Type();
/** Register a XLineManager, places it in XLineManagers for use in XLineManager::CheckAll
* It is important XLineManagers are registered in the proper order. Eg, if you had one akilling
* clients and one handing them free olines, you would want the akilling one first. This way if a client
@@ -69,7 +75,25 @@ class CoreExport XLineManager : public Service
* Wparam u The user
* @return A pair of the XLineManager the user was found in and the XLine they matched, both may be NULL for no match
*/
static std::pair<XLineManager *, XLine *> CheckAll(User *u);
static void CheckAll(User *u);
/** Generate a unique ID for this XLine
* @return A unique ID
*/
static Anope::string GenerateUID();
/** Constructor
*/
XLineManager(Module *creator, const Anope::string &name, char t);
/** Destructor
*/
virtual ~XLineManager();
/** The type of xline provided by this service
* @return The type
*/
const char &Type();
/** Get the number of XLines in this XLineManager
* @return The number of XLines
@@ -96,67 +120,61 @@ class CoreExport XLineManager : public Service
* @param index The index
* @return The XLine, or NULL if the index is out of bounds
*/
XLine *GetEntry(unsigned index);
XLine* GetEntry(unsigned index);
/** Clear the XLine vector
* Note: This does not remove the XLines from the IRCd
*/
void Clear();
/** Add an entry to this XLine Manager
* @param mask The mask of the XLine
* @param creator The creator of the XLine
* @param expires When this should expire
* @param reaosn The reason
* @return A pointer to the XLine
*/
virtual XLine *Add(const Anope::string &mask, const Anope::string &creator, time_t expires, const Anope::string &reason);
private:
/** Delete an XLine, eg, remove it from the IRCd.
* @param x The xline
*/
virtual void Del(XLine *x);
public:
/** Checks if a mask can/should be added to the XLineManager
* @param source The source adding the mask.
* @param mask The mask
* @param expires When the mask would expire
* @return A pair of int and XLine*.
* 1 - Mask already exists
* 2 - Mask already exists, but the expiry time was changed
* 3 - Mask is already covered by another mask
* In each case the XLine it matches/is covered by is returned in XLine*
* @param reason the reason
* @return true if the mask can be added
*/
std::pair<int, XLine *> CanAdd(const Anope::string &mask, time_t expires);
bool CanAdd(CommandSource &source, const Anope::string &mask, time_t expires, const Anope::string &reason);
/** Checks if this list has an entry
* @param mask The mask
* @return The XLine the user matches, or NULL
*/
XLine *HasEntry(const Anope::string &mask);
XLine* HasEntry(const Anope::string &mask);
/** Check a user against all of the xlines in this XLineManager
* @param u The user
* @return The xline the user marches, if any. Also calls OnMatch()
* @return The xline the user marches, if any.
*/
virtual XLine *Check(User *u);
XLine *CheckAllXLines(User *u);
/** Check a user against an xline
* @param u The user
* @param x The xline
*/
virtual bool Check(User *u, const XLine *x) = 0;
/** Called when a user matches a xline in this XLineManager
* @param u The user
* @param x The XLine they match
*/
virtual void OnMatch(User *u, XLine *x);
virtual void OnMatch(User *u, XLine *x) = 0;
/** Called when an XLine expires
* @param x The xline
*/
virtual void OnExpire(XLine *x);
virtual void OnExpire(const XLine *x);
/** Called to send an XLine to the IRCd
* @param u The user, if we know it
* @param x The xline
*/
virtual void Send(User *u, XLine *x) = 0;
/** Called to remove an XLine from the IRCd
* @param x The XLine
*/
virtual void SendDel(XLine *x) = 0;
};
#endif // OPER_H
#endif // XLINE_H
+1 -2
View File
@@ -29,8 +29,7 @@ if(GETTEXT_FOUND)
endif(NOT WIN32)
# Install the new language file
install(CODE "FILE(MAKE_DIRECTORY \${CMAKE_INSTALL_PREFIX}/data/languages/${LANG_LANG}/LC_MESSAGES/)")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION data/languages/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS})
endforeach(LANG_PO)
# Generate languages, depends on the mo files
+6050 -6060
View File
File diff suppressed because it is too large Load Diff
+6213 -6783
View File
File diff suppressed because it is too large Load Diff
+6952 -11016
View File
File diff suppressed because it is too large Load Diff
+5693 -5679
View File
File diff suppressed because it is too large Load Diff
+6638 -6765
View File
File diff suppressed because it is too large Load Diff
+6610 -6828
View File
File diff suppressed because it is too large Load Diff
+5946 -5997
View File
File diff suppressed because it is too large Load Diff
+5641 -5629
View File
File diff suppressed because it is too large Load Diff
+6609 -6778
View File
File diff suppressed because it is too large Load Diff
+6348 -6446
View File
File diff suppressed because it is too large Load Diff
+6956 -12115
View File
File diff suppressed because it is too large Load Diff
+6339 -6586
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -4,7 +4,7 @@ rm -f anope.pot
touch anope.pot
cd ..
FILES=`find ./ -name *.cpp -o -name *.h | grep -v /modules/third/`
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
@@ -14,7 +14,7 @@ cd -
for f in *.po
do
msgmerge -E -v -s -U $f `echo $f | cut -d'.' -f1`.pot
msgmerge -v -s -U $f `echo $f | cut -d'.' -f1`.pot
done
rm -f *~
+19 -11
View File
@@ -42,7 +42,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Temporary variable for the current source's include directories
set(TEMP_INCLUDES)
# Calculate the header file dependencies for the given source file
calculate_depends(${SRC} SKIP_DEPENDS TEMP_INCLUDES)
calculate_depends(${SRC} SKIP_DEPENDS FALSE TEMP_INCLUDES)
# If there were some extra include directories, add them to the list
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
@@ -54,7 +54,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Reset skip_libraries
set(SKIP_LIBRARIES)
# Calculate the library dependencies for the given source file
calculate_libraries(${SRC} SKIP_LIBRARIES TEMP_LDFLAGS TEMP_DEPENDENCIES)
calculate_libraries(${SRC} SKIP_LIBRARIES FALSE TEMP_LDFLAGS TEMP_DEPENDENCIES)
if(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES)
# Reset has_function
set(HAS_FUNCTION)
@@ -76,7 +76,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
else(WIN32)
set(WIN32_NO_LIBS)
endif(WIN32)
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${TEMP_LDFLAGS} ${WIN32_NO_LIBS}")
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${TEMP_LDFLAGS} ${WIN32_NO_LIBS}" INSTALL_RPATH_USE_LINK_PATH ON BUILD_WITH_INSTALL_RPATH ON)
add_dependencies(${SO} ${PROGRAM_NAME})
if(GETTEXT_FOUND)
add_dependencies(${SO} module_language)
@@ -85,14 +85,16 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
if(WIN32)
target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY} ${TEMP_DEPENDENCIES})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
else(WIN32)
target_link_libraries(${SO} ${TEMP_DEPENDENCIES})
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO}
DESTINATION data/modules
DESTINATION ${LIB_DIR}/modules
)
endif(HAS_FUNCTION)
else(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES)
message(" This is not a fatal error - ${SRC} will not be built.")
message(" ${SRC} can not be built due to missing dependencies.")
endif(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES)
endforeach(SRC)
@@ -103,7 +105,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
foreach(SUBDIR ${SUBMODULE_DIRS})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
file(GLOB MODULES_SUBDIR_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${SUBDIR}/*.cpp")
file(GLOB_RECURSE MODULES_SUBDIR_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${SUBDIR}/*.cpp")
sort_list(MODULES_SUBDIR_SRCS)
# Set all the files to use C++ as well as set their compile flags (use the module-specific compile flags, though)
@@ -135,7 +137,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Temporary variable for the current source's include directories
set(TEMP_INCLUDES)
# Calculate the header file dependencies for the given source file
calculate_depends(${SRC} SKIP_DEPENDS TEMP_INCLUDES)
calculate_depends(${SRC} SKIP_DEPENDS FALSE TEMP_INCLUDES)
# If there were some extra include directories, add them to the list
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
@@ -145,7 +147,7 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Reset extra dependencies
set(TEMP_DEPENDENCIES)
# Calculate the library dependencies for the given source file
calculate_libraries(${SRC} SKIP_LIBRARIES TEMP_LDFLAGS TEMP_DEPENDENCIES)
calculate_libraries(${SRC} SKIP_LIBRARIES FALSE TEMP_LDFLAGS TEMP_DEPENDENCIES)
# Check the function dependencies for the given source file
check_functions(${SRC} HAS_FUNCTION)
@@ -176,8 +178,9 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${SO} MODULE ${MODULES_SUBDIR_SRCS})
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${SUBDIR_LDFLAGS}")
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${SUBDIR_LDFLAGS}" INSTALL_RPATH_USE_LINK_PATH ON BUILD_WITH_INSTALL_RPATH ON)
add_dependencies(${SO} ${PROGRAM_NAME})
target_link_libraries(${SO} ${PROGRAM_NAME})
if(GETTEXT_FOUND)
add_dependencies(${SO} module_language)
endif(GETTEXT_FOUND)
@@ -188,11 +191,16 @@ foreach(MODULE_FOLDER ${MODULES_FOLDERS})
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO}
DESTINATION data/modules
DESTINATION ${LIB_DIR}/modules
)
else(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES AND HAS_FUNCTION)
message(" This is not a fatal error - ${SUBDIR} will not be built.")
message(" ${SRC} can not be built due to missing dependencies.")
endif(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES AND HAS_FUNCTION)
# Run the directories CMakeLists.txt if there is one
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt")
endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
endforeach(SUBDIR)
endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_FOLDER}")
+22 -26
View File
@@ -1,6 +1,6 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -22,40 +22,39 @@ class CommandBSAssign : public Command
this->SetSyntax(_("\037channel\037 \037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &chan = params[0];
const Anope::string &nick = params[1];
User *u = source.u;
if (readonly)
if (Anope::ReadOnly)
{
source.Reply(BOT_ASSIGN_READONLY);
return;
}
ChannelInfo *ci = cs_findchan(params[0]);
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
BotInfo *bi = findbot(nick);
BotInfo *bi = BotInfo::Find(nick, true);
if (!bi)
{
source.Reply(BOT_DOES_NOT_EXIST, nick.c_str());
return;
}
if (ci->botflags.HasFlag(BS_NOBOT) || (!ci->AccessFor(u).HasPriv(CA_ASSIGN) && !u->HasPriv("botserv/administration")))
AccessGroup access = source.AccessFor(ci);
if (ci->HasExt("BS_NOBOT") || (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration")))
{
source.Reply(ACCESS_DENIED);
return;
}
if (bi->HasFlag(BI_PRIVATE) && !u->HasCommand("botserv/assign/private"))
if (bi->oper_only && !source.HasPriv("botserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -67,14 +66,14 @@ class CommandBSAssign : public Command
return;
}
bool override = !ci->AccessFor(u).HasPriv(CA_ASSIGN);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << bi->nick;
bool override = !access.HasPriv("ASSIGN");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << bi->nick;
bi->Assign(u, ci);
bi->Assign(source.GetUser(), ci);
source.Reply(_("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), ci->name.c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
@@ -94,24 +93,23 @@ class CommandBSUnassign : public Command
this->SetSyntax(_("\037channel\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
User *u = source.u;
if (readonly)
if (Anope::ReadOnly)
{
source.Reply(BOT_ASSIGN_READONLY);
return;
}
ChannelInfo *ci = cs_findchan(params[0]);
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv(CA_ASSIGN))
AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("ASSIGN"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -123,20 +121,20 @@ class CommandBSUnassign : public Command
return;
}
if (ci->HasFlag(CI_PERSIST) && !ModeManager::FindChannelModeByName(CMODE_PERM))
if (ci->HasExt("PERSIST") && !ModeManager::FindChannelModeByName("PERM"))
{
source.Reply(_("You can not unassign bots while persist is set on the channel."));
return;
}
bool override = !ci->AccessFor(u).HasPriv(CA_ASSIGN);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << ci->bi->nick;
bool override = !access.HasPriv("ASSIGN");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << ci->bi->nick;
ci->bi->UnAssign(u, ci);
ci->bi->UnAssign(source.GetUser(), ci);
source.Reply(_("There is no bot assigned to %s anymore."), ci->name.c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
@@ -160,8 +158,6 @@ class BSAssign : public Module
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbsassign);
ModuleManager::RegisterService(&commandbsunassign);
}
};
+84 -91
View File
@@ -1,6 +1,6 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -13,74 +13,38 @@
#include "module.h"
class BadwordsListCallback : public NumberList
{
CommandSource &source;
ChannelInfo *ci;
bool SentHeader;
public:
BadwordsListCallback(CommandSource &_source, ChannelInfo *_ci, const Anope::string &list) : NumberList(list, false), source(_source), ci(_ci), SentHeader(false)
{
}
~BadwordsListCallback()
{
if (!SentHeader)
source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str());
}
void HandleNumber(unsigned Number)
{
if (!Number || Number > ci->GetBadWordCount())
return;
if (!SentHeader)
{
SentHeader = true;
source.Reply(_("Bad words list for %s:\n"
" Num Word Type"), ci->name.c_str());
}
DoList(source, Number - 1, ci->GetBadWord(Number - 1));
}
static void DoList(CommandSource &source, unsigned Number, BadWord *bw)
{
source.Reply(_(" %3d %-30s %s"), Number + 1, bw->word.c_str(), bw->type == BW_SINGLE ? "(SINGLE)" : (bw->type == BW_START ? "(START)" : (bw->type == BW_END ? "(END)" : "")));
}
};
class BadwordsDelCallback : public NumberList
{
CommandSource &source;
ChannelInfo *ci;
Command *c;
unsigned Deleted;
unsigned deleted;
bool override;
public:
BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), Deleted(0), override(false)
BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), override(false)
{
if (!ci->AccessFor(source.u).HasPriv(CA_BADWORDS) && source.u->HasPriv("botserv/administration"))
if (!source.AccessFor(ci).HasPriv("BADWORDS") && source.HasPriv("botserv/administration"))
this->override = true;
}
~BadwordsDelCallback()
{
if (!Deleted)
if (!deleted)
source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str());
else if (Deleted == 1)
else if (deleted == 1)
source.Reply(_("Deleted 1 entry from %s bad words list."), ci->name.c_str());
else
source.Reply(_("Deleted %d entries from %s bad words list."), Deleted, ci->name.c_str());
source.Reply(_("Deleted %d entries from %s bad words list."), deleted, ci->name.c_str());
}
void HandleNumber(unsigned Number)
void HandleNumber(unsigned Number) anope_override
{
if (!Number || Number > ci->GetBadWordCount())
return;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, c, ci) << "DEL " << ci->GetBadWord(Number - 1)->word;
++Deleted;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "DEL " << ci->GetBadWord(Number - 1)->word;
++deleted;
ci->EraseBadWord(Number - 1);
}
};
@@ -90,49 +54,81 @@ class CommandBSBadwords : public Command
private:
void DoList(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
{
bool override = !ci->AccessFor(source.u).HasPriv(CA_BADWORDS);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "LIST";
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "LIST";
ListFormatter list;
list.AddColumn("Number").AddColumn("Word").AddColumn("Type");
if (!ci->GetBadWordCount())
{
source.Reply(_("%s bad words list is empty."), ci->name.c_str());
return;
}
else if (!word.empty() && word.find_first_not_of("1234567890,-") == Anope::string::npos)
{
BadwordsListCallback list(source, ci, word);
list.Process();
class BadwordsListCallback : public NumberList
{
ListFormatter &list;
ChannelInfo *ci;
public:
BadwordsListCallback(ListFormatter &_list, ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, false), list(_list), ci(_ci)
{
}
void HandleNumber(unsigned Number) anope_override
{
if (!Number || Number > ci->GetBadWordCount())
return;
const BadWord *bw = ci->GetBadWord(Number - 1);
ListFormatter::ListEntry entry;
entry["Number"] = stringify(Number);
entry["Word"] = bw->word;
entry["Type"] = bw->type == BW_SINGLE ? "(SINGLE)" : (bw->type == BW_START ? "(START)" : (bw->type == BW_END ? "(END)" : ""));
this->list.AddEntry(entry);
}
}
nl_list(list, ci, word);
nl_list.Process();
}
else
{
bool SentHeader = false;
for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i)
{
BadWord *bw = ci->GetBadWord(i);
const BadWord *bw = ci->GetBadWord(i);
if (!word.empty() && !Anope::Match(bw->word, word))
continue;
if (!SentHeader)
{
SentHeader = true;
source.Reply(_("Bad words list for %s:\n"
" Num Word Type"), ci->name.c_str());
}
BadwordsListCallback::DoList(source, i, bw);
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Word"] = bw->word;
entry["Type"] = bw->type == BW_SINGLE ? "(SINGLE)" : (bw->type == BW_START ? "(START)" : (bw->type == BW_END ? "(END)" : ""));
list.AddEntry(entry);
}
if (!SentHeader)
source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str());
}
return;
if (list.IsEmpty())
source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str());
else
{
std::vector<Anope::string> replies;
list.Process(replies);
source.Reply(_("Bad words list for %s:"), ci->name.c_str());
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
source.Reply(_("End of bad words list."));
}
}
void DoAdd(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
{
size_t pos = word.rfind(' ');
BadWordType type = BW_ANY;
BadWordType bwtype = BW_ANY;
Anope::string realword = word;
if (pos != Anope::string::npos)
@@ -141,11 +137,11 @@ class CommandBSBadwords : public Command
if (!opt.empty())
{
if (opt.equals_ci("SINGLE"))
type = BW_SINGLE;
bwtype = BW_SINGLE;
else if (opt.equals_ci("START"))
type = BW_START;
bwtype = BW_START;
else if (opt.equals_ci("END"))
type = BW_END;
bwtype = BW_END;
}
realword = word.substr(0, pos);
}
@@ -158,7 +154,7 @@ class CommandBSBadwords : public Command
for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i)
{
BadWord *bw = ci->GetBadWord(i);
const BadWord *bw = ci->GetBadWord(i);
if (!bw->word.empty() && ((Config->BSCaseSensitive && realword.equals_cs(bw->word)) || (!Config->BSCaseSensitive && realword.equals_ci(bw->word))))
{
@@ -167,9 +163,9 @@ class CommandBSBadwords : public Command
}
}
bool override = !ci->AccessFor(source.u).HasPriv(CA_BADWORDS);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "ADD " << realword;
ci->AddBadWord(realword, type);
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "ADD " << realword;
ci->AddBadWord(realword, bwtype);
source.Reply(_("\002%s\002 added to %s bad words list."), realword.c_str(), ci->name.c_str());
@@ -187,7 +183,7 @@ class CommandBSBadwords : public Command
else
{
unsigned i, end;
BadWord *badword;
const BadWord *badword;
for (i = 0, end = ci->GetBadWordCount(); i < end; ++i)
{
@@ -203,8 +199,8 @@ class CommandBSBadwords : public Command
return;
}
bool override = !ci->AccessFor(source.u).HasPriv(CA_BADWORDS);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "DEL " << badword->word;
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "DEL " << badword->word;
source.Reply(_("\002%s\002 deleted from %s bad words list."), badword->word.c_str(), ci->name.c_str());
@@ -216,8 +212,8 @@ class CommandBSBadwords : public Command
void DoClear(CommandSource &source, ChannelInfo *ci)
{
bool override = !ci->AccessFor(source.u).HasPriv(CA_BADWORDS);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "CLEAR";
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "CLEAR";
ci->ClearBadWords();
source.Reply(_("Bad words list is now empty."));
@@ -226,18 +222,17 @@ class CommandBSBadwords : public Command
public:
CommandBSBadwords(Module *creator) : Command(creator, "botserv/badwords", 2, 3)
{
this->SetDesc(_("Maintains bad words list"));
this->SetDesc(_("Maintains the bad words list"));
this->SetSyntax(_("\037channel\037 ADD \037word\037 [\037SINGLE\037 | \037START\037 | \037END\037]"));
this->SetSyntax(_("\037channel\037 DEL {\037word\037 | \037entry-num\037 | \037list\037}"));
this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 CLEAR"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &cmd = params[1];
const Anope::string &word = params.size() > 2 ? params[2] : "";
User *u = source.u;
bool need_args = cmd.equals_ci("LIST") || cmd.equals_ci("CLEAR");
if (!need_args && word.empty())
@@ -246,21 +241,20 @@ class CommandBSBadwords : public Command
return;
}
ChannelInfo *ci = cs_findchan(params[0]);
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!ci->AccessFor(u).HasPriv(CA_BADWORDS) && (!need_args || !u->HasPriv("botserv/administration")))
if (!source.AccessFor(ci).HasPriv("BADWORDS") && (!need_args || !source.HasPriv("botserv/administration")))
{
source.Reply(ACCESS_DENIED);
return;
}
if (readonly)
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, channel bad words list modification is temporarily disabled."));
return;
@@ -278,7 +272,7 @@ class CommandBSBadwords : public Command
this->OnSyntaxError(source, "");
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
@@ -288,14 +282,14 @@ class CommandBSBadwords : public Command
"type \002%s%s HELP KICK %s\002.\n"
" \n"
"The \002ADD\002 command adds the given word to the\n"
"badword list. If SINGLE is specified, a kick will be\n"
"done only if a user says the entire word. If START is \n"
"bad words list. If SINGLE is specified, a kick will be\n"
"done only if a user says the entire word. If START is\n"
"specified, a kick will be done if a user says a word\n"
"that starts with \037word\037. If END is specified, a kick\n"
"will be done if a user says a word that ends with\n"
"\037word\037. If you don't specify anything, a kick will\n"
"be issued every time \037word\037 is said by a user.\n"
" \n"), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
" \n"), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str());
source.Reply(_("The \002DEL\002 command removes the given word from the\n"
"bad words list. If a list of entry numbers is given, those\n"
"entries are deleted. (See the example for LIST below.)\n"
@@ -324,7 +318,6 @@ class BSBadwords : public Module
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbsbadwords);
}
};
+50 -98
View File
@@ -1,6 +1,6 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -22,9 +22,8 @@ class CommandBSBot : public Command
const Anope::string &user = params[2];
const Anope::string &host = params[3];
const Anope::string &real = params[4];
BotInfo *bi;
if (findbot(nick))
if (BotInfo::Find(nick, true))
{
source.Reply(_("Bot \002%s\002 already exists."), nick.c_str());
return;
@@ -32,70 +31,53 @@ class CommandBSBot : public Command
if (nick.length() > Config->NickLen)
{
source.Reply(_("Bot Nicks may only contain valid nick characters."));
source.Reply(_("Bot nicks may only be %d characters long."), Config->NickLen);
return;
}
if (user.length() > Config->UserLen)
{
source.Reply(_("Bot Idents may only contain %d characters."), Config->UserLen);
source.Reply(_("Bot idents may only be %d characters long."), Config->UserLen);
return;
}
if (host.length() > Config->HostLen)
{
source.Reply(_("Bot Hosts may only contain %d characters."), Config->HostLen);
source.Reply(_("Bot hosts may only be %d characters long."), Config->HostLen);
return;
}
/* Check the nick is valid re RFC 2812 */
if (isdigit(nick[0]) || nick[0] == '-')
if (!IRCD->IsNickValid(nick))
{
source.Reply(_("Bot Nicks may only contain valid nick characters."));
source.Reply(_("Bot nicks may only contain valid nick characters."));
return;
}
for (unsigned i = 0, end = nick.length(); i < end && i < Config->NickLen; ++i)
if (!isvalidnick(nick[i]))
{
source.Reply(_("Bot Nicks may only contain valid nick characters."));
return;
}
/* check for hardcored ircd forbidden nicks */
if (!ircdproto->IsNickValid(nick))
if (!IRCD->IsIdentValid(user))
{
source.Reply(_("Bot Nicks may only contain valid nick characters."));
source.Reply(_("Bot idents may only contain valid ident characters."));
return;
}
/* Check the host is valid re RFC 2812 */
if (!isValidHost(host, 3))
if (!IRCD->IsHostValid(host))
{
source.Reply(_("Bot Hosts may only contain valid host characters."));
source.Reply(_("Bot hosts may only contain valid host characters."));
return;
}
for (unsigned i = 0, end = user.length(); i < end && i < Config->UserLen; ++i)
if (!isalnum(user[i]))
{
source.Reply(_("Bot Idents may only contain valid characters."), Config->UserLen);
return;
}
/* We check whether the nick is registered, and inform the user
* if so. You need to drop the nick manually before you can use
* it as a bot nick from now on -GD
*/
if (findnick(nick))
if (NickAlias::Find(nick))
{
source.Reply(NICK_ALREADY_REGISTERED, nick.c_str());
return;
}
bi = new BotInfo(nick, user, host, real);
BotInfo *bi = new BotInfo(nick, user, host, real);
Log(LOG_ADMIN, source.u, this) << "ADD " << bi->GetMask() << " " << bi->realname;
Log(LOG_ADMIN, source, this) << "ADD " << bi->GetMask() << " " << bi->realname;
source.Reply(_("%s!%s@%s (%s) added to the bot list."), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str());
@@ -110,7 +92,6 @@ class CommandBSBot : public Command
const Anope::string &user = params.size() > 3 ? params[3] : "";
const Anope::string &host = params.size() > 4 ? params[4] : "";
const Anope::string &real = params.size() > 5 ? params[5] : "";
BotInfo *bi;
if (oldnick.empty() || nick.empty())
{
@@ -118,39 +99,34 @@ class CommandBSBot : public Command
return;
}
if (!(bi = findbot(oldnick)))
BotInfo *bi = BotInfo::Find(oldnick, true);
if (!bi)
{
source.Reply(BOT_DOES_NOT_EXIST, oldnick.c_str());
return;
}
if (!oldnick.equals_ci(nick) && nickIsServices(oldnick, false))
if (bi->conf)
{
source.Reply(BOT_DOES_NOT_EXIST, oldnick.c_str());
source.Reply(_("Bot %s is not changeable."), bi->nick.c_str());
return;
}
if (nick.length() > Config->NickLen)
{
source.Reply(_("Bot Nicks may only contain valid nick characters."));
source.Reply(_("Bot nicks may only be %d characters long."), Config->NickLen);
return;
}
if (!user.empty() && user.length() > Config->UserLen)
{
source.Reply(_("Bot Idents may only contain %d characters."), Config->UserLen);
source.Reply(_("Bot idents may only be %d characters long."), Config->UserLen);
return;
}
if (!host.empty() && host.length() > Config->HostLen)
{
source.Reply(_("Bot Hosts may only contain %d characters."), Config->HostLen);
return;
}
if (!oldnick.equals_ci(nick) && nickIsServices(nick, false))
{
source.Reply(BOT_DOES_NOT_EXIST, oldnick.c_str());
source.Reply(_("Bot hosts may only be %d characters long."), Config->HostLen);
return;
}
@@ -165,42 +141,25 @@ class CommandBSBot : public Command
return;
}
/* Check the nick is valid re RFC 2812 */
if (isdigit(nick[0]) || nick[0] == '-')
if (!IRCD->IsNickValid(nick))
{
source.Reply(_("Bot Nicks may only contain valid nick characters."));
source.Reply(_("Bot nicks may only contain valid nick characters."));
return;
}
for (unsigned i = 0, end = nick.length(); i < end && i < Config->NickLen; ++i)
if (!isvalidnick(nick[i]))
{
source.Reply(_("Bot Nicks may only contain valid nick characters."));
return;
}
/* check for hardcored ircd forbidden nicks */
if (!ircdproto->IsNickValid(nick))
if (!user.empty() && !IRCD->IsIdentValid(user))
{
source.Reply(_("Bot Nicks may only contain valid nick characters."));
source.Reply(_("Bot idents may only contain valid ident characters."));
return;
}
if (!host.empty() && !isValidHost(host, 3))
if (!host.empty() && !IRCD->IsHostValid(host))
{
source.Reply(_("Bot Hosts may only contain valid host characters."));
source.Reply(_("Bot hosts may only contain valid host characters."));
return;
}
if (!user.empty())
for (unsigned i = 0, end = user.length(); i < end && i < Config->UserLen; ++i)
if (!isalnum(user[i]))
{
source.Reply(_("Bot Idents may only contain valid characters."), Config->UserLen);
return;
}
if (!nick.equals_ci(bi->nick) && findbot(nick))
if (!nick.equals_ci(bi->nick) && BotInfo::Find(nick, true))
{
source.Reply(_("Bot \002%s\002 already exists."), nick.c_str());
return;
@@ -212,30 +171,25 @@ class CommandBSBot : public Command
* if so. You need to drop the nick manually before you can use
* it as a bot nick from now on -GD
*/
if (findnick(nick))
if (NickAlias::Find(nick))
{
source.Reply(NICK_ALREADY_REGISTERED, nick.c_str());
return;
}
/* The new nick is really different, so we remove the Q line for the old nick. */
if (ircd->sqline)
{
XLine x(bi->nick);
ircdproto->SendSQLineDel(&x);
}
XLine x_del(bi->nick);
IRCD->SendSQLineDel(&x_del);
/* Add a Q line for the new nick */
XLine x(nick, "Reserved for services");
ircdproto->SendSQLine(NULL, &x);
IRCD->SendSQLine(NULL, &x);
}
if (!user.empty())
ircdproto->SendQuit(bi, "Quit: Be right back");
IRCD->SendQuit(bi, "Quit: Be right back");
else
{
ircdproto->SendChangeBotNick(bi, nick);
}
IRCD->SendNickChange(bi, nick);
if (!nick.equals_cs(bi->nick))
bi->SetNewNick(nick);
@@ -249,12 +203,12 @@ class CommandBSBot : public Command
if (!user.empty())
{
ircdproto->SendClientIntroduction(bi);
IRCD->SendClientIntroduction(bi);
bi->RejoinAll();
}
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.u, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname;
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;
FOREACH_MOD(I_OnBotChange, OnBotChange(bi));
return;
@@ -263,7 +217,6 @@ class CommandBSBot : public Command
void DoDel(CommandSource &source, const std::vector<Anope::string> &params)
{
const Anope::string &nick = params[1];
BotInfo *bi;
if (nick.empty())
{
@@ -271,21 +224,22 @@ class CommandBSBot : public Command
return;
}
if (!(bi = findbot(nick)))
BotInfo *bi = BotInfo::Find(nick, true);
if (!bi)
{
source.Reply(BOT_DOES_NOT_EXIST, nick.c_str());
return;
}
if (nickIsServices(nick, false))
if (bi->conf)
{
source.Reply(BOT_DOES_NOT_EXIST, nick.c_str());
source.Reply(_("Bot %s is not deletable."), bi->nick.c_str());
return;
}
FOREACH_MOD(I_OnBotDelete, OnBotDelete(bi));
Log(LOG_ADMIN, source.u, this) << "DEL " << bi->nick;
Log(LOG_ADMIN, source, this) << "DEL " << bi->nick;
source.Reply(_("Bot \002%s\002 has been deleted."), nick.c_str());
delete bi;
@@ -300,12 +254,11 @@ class CommandBSBot : public Command
this->SetSyntax(_("\002DEL \037nick\037\002"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &cmd = params[0];
User *u = source.u;
if (readonly)
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot modification is temporarily disabled."));
return;
@@ -314,7 +267,7 @@ class CommandBSBot : public Command
if (cmd.equals_ci("ADD"))
{
// ADD nick user host real - 5
if (!u->HasCommand("botserv/bot/add"))
if (!source.HasCommand("botserv/bot/add"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -337,7 +290,7 @@ class CommandBSBot : public Command
{
// CHANGE oldn newn user host real - 6
// but only oldn and newn are required
if (!u->HasCommand("botserv/bot/change"))
if (!source.HasCommand("botserv/bot/change"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -354,7 +307,7 @@ class CommandBSBot : public Command
else if (cmd.equals_ci("DEL"))
{
// DEL nick
if (!u->HasCommand("botserv/bot/del"))
if (!source.HasCommand("botserv/bot/del"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -374,7 +327,7 @@ class CommandBSBot : public Command
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
@@ -383,12 +336,12 @@ class CommandBSBot : public Command
"channels.\n"
" \n"
"\002BOT ADD\002 adds a bot with the given nickname, username,\n"
"hostname and realname. Since no integrity checks are done \n"
"hostname and realname. Since no integrity checks are done\n"
"for these settings, be really careful.\n"
"\002BOT CHANGE\002 allows to change nickname, username, hostname\n"
"or realname of a bot without actually delete it (and all\n"
"the data associated with it).\n"
"\002BOT DEL\002 removes the given bot from the bot list. \n"
"\002BOT DEL\002 removes the given bot from the bot list.\n"
" \n"
"\002Note\002: you cannot create a bot that has a nick that is\n"
"currently registered. If an unregistered user is currently\n"
@@ -407,7 +360,6 @@ class BSBot : public Module
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbsbot);
}
};
+23 -28
View File
@@ -1,6 +1,6 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -22,54 +22,50 @@ class CommandBSBotList : public Command
this->SetSyntax("");
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
User *u = source.u;
unsigned count = 0;
ListFormatter list;
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
list.AddColumn("Nick").AddColumn("Mask");
for (botinfo_map::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
{
BotInfo *bi = it->second;
if (!bi->HasFlag(BI_PRIVATE))
if (source.HasPriv("botserv/administration") || !bi->oper_only)
{
if (!count)
source.Reply(_("Bot list:"));
++count;
source.Reply(" %-15s (%s@%s)", bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str());
ListFormatter::ListEntry entry;
entry["Nick"] = (bi->oper_only ? "* " : "") + bi->nick;
entry["Mask"] = bi->GetIdent() + "@" + bi->host;
list.AddEntry(entry);
}
}
if (u->HasCommand("botserv/botlist") && count < BotListByNick.size())
{
source.Reply(_("Bots reserved to IRC operators:"));
for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
{
BotInfo *bi = it->second;
if (bi->HasFlag(BI_PRIVATE))
{
source.Reply(" %-15s (%s@%s)", bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str());
++count;
}
}
}
std::vector<Anope::string> replies;
list.Process(replies);
if (!count)
source.Reply(_("There are no bots available at this time.\n"
"Ask a Services Operator to create one!"));
else
source.Reply(_("%d bots available."), count);
{
source.Reply(_("Bot list:"));
return;
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
source.Reply(_("%d bots available."), count);
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Lists all available bots on this network."));
source.Reply(_("Lists all available bots on this network.\n"
"Bots prefixed by a * are reserved for IRC Operators."));
return true;
}
};
@@ -84,7 +80,6 @@ class BSBotList : public Module
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbsbotlist);
}
};
+13 -18
View File
@@ -1,6 +1,6 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -22,20 +22,18 @@ class CommandBSSay : public Command
this->SetSyntax(_("\037channel\037 \037text\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &text = params[1];
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!ci->AccessFor(u).HasPriv(CA_SAY))
if (!source.AccessFor(ci).HasPriv("SAY"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -59,16 +57,16 @@ class CommandBSSay : public Command
return;
}
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str());
IRCD->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str());
ci->bi->lastmsg = Anope::CurTime;
// XXX need a way to find if someone is overriding this
Log(LOG_COMMAND, u, this, ci) << text;
Log(LOG_COMMAND, source, this, ci) << text;
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
@@ -86,19 +84,18 @@ class CommandBSAct : public Command
this->SetSyntax(_("\037channel\037 \037text\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
User *u = source.u;
Anope::string message = params[1];
ChannelInfo *ci = cs_findchan(params[0]);
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!ci->AccessFor(u).HasPriv(CA_SAY))
if (!source.AccessFor(ci).HasPriv("SAY"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -120,16 +117,16 @@ class CommandBSAct : public Command
while ((i = message.find(1)) && i != Anope::string::npos)
message.erase(i, 1);
ircdproto->SendAction(ci->bi, ci->name, "%s", message.c_str());
IRCD->SendAction(ci->bi, ci->name, "%s", message.c_str());
ci->bi->lastmsg = Anope::CurTime;
// XXX Need to be able to find if someone is overriding this.
Log(LOG_COMMAND, u, this, ci) << message;
Log(LOG_COMMAND, source, this, ci) << message;
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
@@ -150,8 +147,6 @@ class BSControl : public Module
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbssay);
ModuleManager::RegisterService(&commandbsact);
}
};
+114 -109
View File
@@ -1,6 +1,6 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -17,204 +17,210 @@
class CommandBSInfo : public Command
{
private:
void send_bot_channels(CommandSource &source, BotInfo *bi)
void send_bot_channels(std::vector<Anope::string> &buffers, const BotInfo *bi)
{
Anope::string buf;
for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it)
for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
{
ChannelInfo *ci = it->second;
const ChannelInfo *ci = it->second;
if (ci->bi == bi)
{
if (buf.length() + ci->name.length() > 300)
buf += " " + ci->name + " ";
if (buf.length() > 300)
{
source.Reply("%s", buf.c_str());
buffers.push_back(buf);
buf.clear();
}
buf += " " + ci->name + " ";
}
}
if (!buf.empty())
source.Reply("%s", buf.c_str());
return;
buffers.push_back(buf);
}
void CheckOptStr(Anope::string &buf, const Anope::string &flag, const char *option, Extensible *flags, const NickCore *nc)
{
if (flags->HasExt(flag))
{
if (!buf.empty())
buf += ", ";
buf += Language::Translate(nc, option);
}
}
public:
CommandBSInfo(Module *creator) : Command(creator, "botserv/info", 1, 1)
{
this->SetDesc(_("Allows you to see BotServ information about a channel or a bot"));
this->SetSyntax(_("\002INFO {\037chan\037 | \037nick\037}\002"));
this->SetSyntax(_("{\037chan\037|\037nick\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &query = params[0];
bool need_comma = false;
char buf[BUFSIZE], *end;
User *u = source.u;
BotInfo *bi = findbot(query);
const BotInfo *bi = BotInfo::Find(query, true);
ChannelInfo *ci;
InfoFormatter info(source.nc);
if (bi)
{
source.Reply(_("Information for bot \002%s\002:"), bi->nick.c_str());
source.Reply(_(" Mask : %s@%s"), bi->GetIdent().c_str(), bi->host.c_str());
source.Reply(_(" Real name : %s"), bi->realname.c_str());
source.Reply(_(" Created : %s"), do_strftime(bi->created).c_str());
source.Reply(_(" Options : %s"), bi->HasFlag(BI_PRIVATE) ? _("Private") : _("None"));
source.Reply(_(" Used on : %d channel(s)"), bi->chancount);
info[_("Mask")] = bi->GetIdent() + "@" + bi->host;
info[_("Real name")] = bi->realname;
info[_("Created")] = Anope::strftime(bi->created);
info[_("Options")] = bi->oper_only ? _("Private") : _("None");
info[_("Used on")] = stringify(bi->GetChannelCount()) + " channel(s)";
std::vector<Anope::string> replies;
info.Process(replies);
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
if (source.HasPriv("botserv/administration"))
{
std::vector<Anope::string> buf;
this->send_bot_channels(buf, bi);
for (unsigned i = 0; i < buf.size(); ++i)
source.Reply(buf[i]);
}
if (u->HasPriv("botserv/administration"))
this->send_bot_channels(source, bi);
}
else if ((ci = cs_findchan(query)))
else if ((ci = ChannelInfo::Find(query)))
{
if (!ci->AccessFor(u).HasPriv(CA_FOUNDER) && !u->HasPriv("botserv/administration"))
if (!source.AccessFor(ci).HasPriv("INFO") && !source.HasPriv("botserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
}
source.Reply(CHAN_INFO_HEADER, ci->name.c_str());
if (ci->bi)
source.Reply(_(" Bot nick : %s"), ci->bi->nick.c_str());
else
source.Reply(_(" Bot nick : not assigned yet."));
info[_("Bot nick")] = ci->bi ? ci->bi->nick : "not assigned yet";
if (ci->botflags.HasFlag(BS_KICK_BADWORDS))
Anope::string enabled = Language::Translate(source.nc, _("Enabled"));
Anope::string disabled = Language::Translate(source.nc, _("Disabled"));
if (ci->HasExt("BS_KICK_BADWORDS"))
{
if (ci->ttb[TTB_BADWORDS])
source.Reply(_(" Bad words kicker : %s (%d kick(s) to ban)"), ENABLED, ci->ttb[TTB_BADWORDS]);
info[_("Bad words kicker")] = Anope::printf("%s (%d kick(s) to ban)", enabled.c_str(), ci->ttb[TTB_BADWORDS]);
else
source.Reply(_(" Bad words kicker : %s"), ENABLED);
info[_("Bad words kicker")] = enabled;
}
else
source.Reply(_(" Bad words kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_BOLDS))
info[_("Bad words kicker")] = disabled;
if (ci->HasExt("BS_KICK_BOLDS"))
{
if (ci->ttb[TTB_BOLDS])
source.Reply(_(" Bolds kicker : %s (%d kick(s) to ban)"), ENABLED, ci->ttb[TTB_BOLDS]);
info[_("Bolds kicker")] = Anope::printf("%s (%d kick(s) to ban)", enabled.c_str(), ci->ttb[TTB_BOLDS]);
else
source.Reply(_(" Bolds kicker : %s"), ENABLED);
info[_("Bolds kicker")] = enabled;
}
else
source.Reply(_(" Bolds kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_CAPS))
info[_("Bolds kicker")] = disabled;
if (ci->HasExt("BS_KICK_CAPS"))
{
if (ci->ttb[TTB_CAPS])
source.Reply(_(" Caps kicker : %s (%d kick(s) to ban; minimum %d/%d%%)"), ENABLED, ci->ttb[TTB_CAPS], ci->capsmin, ci->capspercent);
info[_("Caps kicker")] = Anope::printf(_("%s (%d kick(s) to ban; minimum %d/%d%%"), enabled.c_str(), ci->ttb[TTB_CAPS], ci->capsmin, ci->capspercent);
else
source.Reply(_(" Caps kicker : %s (minimum %d/%d%%)"), ENABLED, ci->capsmin, ci->capspercent);
info[_("Caps kicker")] = Anope::printf(_("%s (minimum %d/%d%%)"), enabled.c_str(), ci->capsmin, ci->capspercent);
}
else
source.Reply(_(" Caps kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_COLORS))
info[_("Caps kicker")] = disabled;
if (ci->HasExt("BS_KICK_COLORS"))
{
if (ci->ttb[TTB_COLORS])
source.Reply(_(" Colors kicker : %s (%d kick(s) to ban)"), ENABLED, ci->ttb[TTB_COLORS]);
info[_("Colors kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_COLORS]);
else
source.Reply(_(" Colors kicker : %s"), ENABLED);
info[_("Colors kicker")] = enabled;
}
else
source.Reply(_(" Colors kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_FLOOD))
info[_("Colors kicker")] = disabled;
if (ci->HasExt("BS_KICK_FLOOD"))
{
if (ci->ttb[TTB_FLOOD])
source.Reply(_(" Flood kicker : %s (%d kick(s) to ban; %d lines in %ds)"), ENABLED, ci->ttb[TTB_FLOOD], ci->floodlines, ci->floodsecs);
info[_("Flood kicker")] = Anope::printf(_("%s (%d kick(s) to ban; %d lines in %ds"), enabled.c_str(), ci->ttb[TTB_FLOOD], ci->floodlines, ci->floodsecs);
else
source.Reply(_(" Flood kicker : %s (%d lines in %ds)"), ENABLED, ci->floodlines, ci->floodsecs);
info[_("Flood kicker")] = Anope::printf(_("%s (%d lines in %ds)"), enabled.c_str(), ci->floodlines, ci->floodsecs);
}
else
source.Reply(_(" Flood kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_REPEAT))
info[_("Flood kicker")] = disabled;
if (ci->HasExt("BS_KICK_REPEAT"))
{
if (ci->ttb[TTB_REPEAT])
source.Reply(_(" Repeat kicker : %s (%d kick(s) to ban; %d times)"), ENABLED, ci->ttb[TTB_REPEAT], ci->repeattimes);
info[_("Repeat kicker")] = Anope::printf(_("%s (%d kick(s) to ban; %d times)"), enabled.c_str(), ci->ttb[TTB_REPEAT], ci->repeattimes);
else
source.Reply(_(" Repeat kicker : %s (%d times)"), ENABLED, ci->repeattimes);
info[_("Repeat kicker")] = Anope::printf(_("%s (%d times)"), enabled.c_str(), ci->repeattimes);
}
else
source.Reply(_(" Repeat kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_REVERSES))
info[_("Repeat kicker")] = disabled;
if (ci->HasExt("BS_KICK_REVERSES"))
{
if (ci->ttb[TTB_REVERSES])
source.Reply(_(" Reverses kicker : %s (%d kick(s) to ban)"), ENABLED, ci->ttb[TTB_REVERSES]);
info[_("Reverses kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_REVERSES]);
else
source.Reply(_(" Reverses kicker : %s"), ENABLED);
info[_("Reverses kicker")] = enabled;
}
else
source.Reply(_(" Reverses kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_UNDERLINES))
info[_("Reverses kicker")] = disabled;
if (ci->HasExt("BS_KICK_UNDERLINES"))
{
if (ci->ttb[TTB_UNDERLINES])
source.Reply(_(" Underlines kicker : %s (%d kick(s) to ban)"), ENABLED, ci->ttb[TTB_UNDERLINES]);
info[_("Underlines kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_UNDERLINES]);
else
source.Reply(_(" Underlines kicker : %s"), ENABLED);
info[_("Underlines kicker")] = enabled;
}
else
source.Reply(_(" Underlines kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_ITALICS))
info[_("Underlines kicker")] = disabled;
if (ci->HasExt("BS_KICK_ITALICS"))
{
if (ci->ttb[TTB_ITALICS])
source.Reply(_(" Italics kicker : %s (%d kick(s) to ban)"), ENABLED, ci->ttb[TTB_ITALICS]);
info[_("Italics kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_ITALICS]);
else
source.Reply(_(" Italics kicker : %s"), ENABLED);
info[_("Italics kicker")] = enabled;
}
else
source.Reply(_(" Italics kicker : %s"), DISABLED);
if (ci->botflags.HasFlag(BS_KICK_AMSGS))
info[_("Italics kicker")] = disabled;
if (ci->HasExt("BS_KICK_AMSGS"))
{
if (ci->ttb[TTB_AMSGS])
source.Reply(_(" AMSG kicker : %s (%d kick(s) to ban)"), ENABLED, ci->ttb[TTB_AMSGS]);
info[_("AMSG kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_AMSGS]);
else
source.Reply(_(" AMSG kicker : %s"), ENABLED);
info[_("AMSG kicker")] = enabled;
}
else
source.Reply(_(" AMSG kicker : %s"), DISABLED);
info[_("AMSG kicker")] = disabled;
if (ci->botflags.HasFlag(BS_MSG_PRIVMSG))
source.Reply(_(" Fantasy reply : %s"), "PRIVMSG");
else if (ci->botflags.HasFlag(BS_MSG_NOTICE))
source.Reply(_(" Fantasy reply : %s"), "NOTICE");
else if (ci->botflags.HasFlag(BS_MSG_NOTICEOPS))
source.Reply(_(" Fantasy reply : %s"), "NOTICEOPS");
end = buf;
*end = 0;
if (ci->botflags.HasFlag(BS_DONTKICKOPS))
{
end += snprintf(end, sizeof(buf) - (end - buf), "%s", _("Ops protection"));
need_comma = true;
}
if (ci->botflags.HasFlag(BS_DONTKICKVOICES))
{
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", _("Voices protection"));
need_comma = true;
}
if (ci->botflags.HasFlag(BS_FANTASY))
{
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", _("Fantasy"));
need_comma = true;
}
if (ci->botflags.HasFlag(BS_GREET))
{
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", _("Greet"));
need_comma = true;
}
if (ci->botflags.HasFlag(BS_NOBOT))
{
end += snprintf(end, sizeof(buf) - (end - buf), "%s%s", need_comma ? ", " : "", _("No bot"));
need_comma = true;
}
source.Reply(_(" Options : %s"), *buf ? buf : _("None"));
Anope::string flags;
CheckOptStr(flags, "BS_DONTKICKOPS", _("Ops protection"), ci, source.nc);
CheckOptStr(flags, "BS_DONTKICKVOICES", _("Voices protection"), ci, source.nc);
CheckOptStr(flags, "BS_FANTASY", _("Fantasy"), ci, source.nc);
CheckOptStr(flags, "BS_GREET", _("Greet"), ci, source.nc);
CheckOptStr(flags, "BS_NOBOT", _("No bot"), ci, source.nc);
info[_("Options")] = flags.empty() ? _("None") : flags;
std::vector<Anope::string> replies;
info.Process(replies);
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
}
else
source.Reply(_("\002%s\002 is not a valid bot or registered channel."), query.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
@@ -222,7 +228,7 @@ class CommandBSInfo : public Command
"If the parameter is a channel, then you'll get information\n"
"such as enabled kickers. If the parameter is a nick,\n"
"you'll get information about a bot, such as creation\n"
"time or number of channels it is on."), source.owner->nick.c_str());
"time or number of channels it is on."), source.service->nick.c_str());
return true;
}
};
@@ -237,7 +243,6 @@ class BSInfo : public Module
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbsinfo);
}
};
File diff suppressed because it is too large Load Diff
+384 -261
View File
@@ -1,6 +1,6 @@
/* BotServ core functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSet : public Command
@@ -19,290 +17,415 @@ class CommandBSSet : public Command
CommandBSSet(Module *creator) : Command(creator, "botserv/set", 3, 3)
{
this->SetDesc(_("Configures bot options"));
this->SetSyntax(_("\037(channel | bot)\037 \037option\037 \037settings\037"));
this->SetSyntax(_("\037option\037 \037(channel | bot)\037 \037settings\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &chan = params[0];
const Anope::string &option = params[1];
const Anope::string &value = params[2];
User *u = source.u;
ChannelInfo *ci;
if (readonly)
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
else if (u->HasCommand("botserv/set/private") && option.equals_ci("PRIVATE"))
{
BotInfo *bi;
if (!(bi = findbot(chan)))
{
source.Reply(BOT_DOES_NOT_EXIST, chan.c_str());
return;
}
if (value.equals_ci("ON"))
{
bi->SetFlag(BI_PRIVATE);
source.Reply(_("Private mode of bot %s is now \002on\002."), bi->nick.c_str());
}
else if (value.equals_ci("OFF"))
{
bi->UnsetFlag(BI_PRIVATE);
source.Reply(_("Private mode of bot %s is now \002off\002."), bi->nick.c_str());
}
else
this->OnSyntaxError(source, "PRIVATE");
return;
}
else if (!(ci = cs_findchan(chan)))
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
else if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv(CA_SET))
source.Reply(ACCESS_DENIED);
else
{
bool override = !ci->AccessFor(u).HasPriv(CA_SET);
Log(override ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << option << " " << value;
if (option.equals_ci("DONTKICKOPS"))
{
if (value.equals_ci("ON"))
{
ci->botflags.SetFlag(BS_DONTKICKOPS);
source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_DONTKICKOPS);
source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "DONTKICKOPS");
}
else if (option.equals_ci("DONTKICKVOICES"))
{
if (value.equals_ci("ON"))
{
ci->botflags.SetFlag(BS_DONTKICKVOICES);
source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_DONTKICKVOICES);
source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "DONTKICKVOICE");
}
else if (option.equals_ci("FANTASY"))
{
if (value.equals_ci("ON"))
{
ci->botflags.SetFlag(BS_FANTASY);
source.Reply(_("Fantasy mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_FANTASY);
source.Reply(_("Fantasy mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "FANTASY");
}
else if (option.equals_ci("GREET"))
{
if (value.equals_ci("ON"))
{
ci->botflags.SetFlag(BS_GREET);
source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_GREET);
source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "GREET");
}
else if (u->HasCommand("botserv/set/nobot") && option.equals_ci("NOBOT"))
{
if (value.equals_ci("ON"))
{
ci->botflags.SetFlag(BS_NOBOT);
if (ci->bi)
ci->bi->UnAssign(u, ci);
source.Reply(_("No Bot mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_NOBOT);
source.Reply(_("No Bot mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "NOBOT");
}
else if (option.equals_ci("MSG"))
{
if (value.equals_ci("OFF"))
{
ci->botflags.UnsetFlag(BS_MSG_PRIVMSG);
ci->botflags.UnsetFlag(BS_MSG_NOTICE);
ci->botflags.UnsetFlag(BS_MSG_NOTICEOPS);
source.Reply(_("Fantasy replies will no longer be sent to %s."), ci->name.c_str());
}
else if (value.equals_ci("PRIVMSG"))
{
ci->botflags.SetFlag(BS_MSG_PRIVMSG);
ci->botflags.UnsetFlag(BS_MSG_NOTICE);
ci->botflags.UnsetFlag(BS_MSG_NOTICEOPS);
source.Reply(_("Fantasy replies will be sent via PRIVMSG to %s."), ci->name.c_str());
}
else if (value.equals_ci("NOTICE"))
{
ci->botflags.UnsetFlag(BS_MSG_PRIVMSG);
ci->botflags.SetFlag(BS_MSG_NOTICE);
ci->botflags.UnsetFlag(BS_MSG_NOTICEOPS);
source.Reply(_("Fantasy replies will be sent via NOTICE to %s."), ci->name.c_str());
}
else if (value.equals_ci("NOTICEOPS"))
{
ci->botflags.UnsetFlag(BS_MSG_PRIVMSG);
ci->botflags.UnsetFlag(BS_MSG_NOTICE);
ci->botflags.SetFlag(BS_MSG_NOTICEOPS);
source.Reply(_("Fantasy replies will be sent via NOTICE to channel ops on %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "MSG");
}
else
this->OnSyntaxError(source, "");
}
return;
this->OnSyntaxError(source, "");
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
if (subcommand.empty())
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Configures bot options.\n"
" \n"
"Available options:"));
Anope::string this_name = source.command;
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Configures bot options. \037option\037 can be one of:\n"
" \n"
" DONTKICKOPS To protect ops against bot kicks\n"
" DONTKICKVOICES To protect voices against bot kicks\n"
" GREET Enable greet messages\n"
" FANTASY Enable fantaisist commands\n"
" MSG Configure how fantasy commands should be replied to\n"
" \n"
"Type \002%s%s HELP SET \037option\037\002 for more information\n"
"on a specific option.\n"
"Note: access to this command is controlled by the\n"
"level SET."), Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str());
User *u = source.u;
if (u->IsServicesOper())
source.Reply(_("These options are reserved to Services Operators:\n"
" \n"
" NOBOT Prevent a bot from being assigned to \n"
" a channel\n"
" PRIVATE Prevent a bot from being assigned by\n"
" non IRC operators"));
const Anope::string &c_name = it->first;
const CommandInfo &info = it->second;
if (c_name.find_ci(this_name + " ") == 0)
{
ServiceReference<Command> command("Command", info.name);
if (command)
{
source.command = it->first;
command->OnServHelp(source);
}
}
}
else if (subcommand.equals_ci("DONTKICKOPS"))
source.Reply(_("Syntax: \002SET \037channel\037 DONTKICKOPS {\037ON|OFF\037}\n"
" \n"
"Enables or disables \002ops protection\002 mode on a channel.\n"
"When it is enabled, ops won't be kicked by the bot\n"
"even if they don't match the NOKICK level."));
else if (subcommand.equals_ci("DONTKICKVOICES"))
source.Reply(_("Syntax: \002SET \037channel\037 DONTKICKVOICES {\037ON|OFF\037}\n"
" \n"
"Enables or disables \002voices protection\002 mode on a channel.\n"
"When it is enabled, voices won't be kicked by the bot\n"
"even if they don't match the NOKICK level."));
else if (subcommand.equals_ci("FANTASY"))
source.Reply(_("Syntax: \002SET \037channel\037 FANTASY {\037ON|OFF\037}\n"
"Enables or disables \002fantasy\002 mode on a channel.\n"
"When it is enabled, users will be able to use\n"
"commands !op, !deop, !voice, !devoice,\n"
"!kick, !kb, !unban, !seen on a channel (find how \n"
"to use them; try with or without nick for each, \n"
"and with a reason for some?).\n"
" \n"
"Note that users wanting to use fantaisist\n"
"commands MUST have enough level for both\n"
"the FANTASIA and another level depending\n"
"of the command if required (for example, to use \n"
"!op, user must have enough access for the OPDEOP\n"
"level)."));
else if (subcommand.equals_ci("GREET"))
source.Reply(_("Syntax: \002SET \037channel\037 GREET {\037ON|OFF\037}\n"
" \n"
"Enables or disables \002greet\002 mode on a channel.\n"
"When it is enabled, the bot will display greet\n"
"messages of users joining the channel, provided\n"
"they have enough access to the channel."));
else if (subcommand.equals_ci("NOBOT"))
source.Reply(_("Syntax: \002SET \037channel\037 NOBOT {\037ON|OFF\037}\002\n"
" \n"
"This option makes a channel be unassignable. If a bot \n"
"is already assigned to the channel, it is unassigned\n"
"automatically when you enable the option."));
else if (subcommand.equals_ci("PRIVATE"))
source.Reply(_("Syntax: \002SET \037bot-nick\037 PRIVATE {\037ON|OFF\037}\002\n"
"This option prevents a bot from being assigned to a\n"
"channel by users that aren't IRC operators."));
else if (subcommand.equals_ci("MSG"))
source.Reply(_("Syntax: \002SET \037channel\037 MSG {\037OFF|PRIVMSG|NOTICE|NOTICEOPS\037}\002\n"
" \n"
"Configures how fantasy commands should be returned to the channel. Off disables\n"
"fantasy from replying to the channel. Privmsg, notice, and noticeops message the\n"
"channel, notice the channel, and notice the channel ops respectively.\n"
" \n"
"Note that replies over one line will not use this setting to prevent spam, and will\n"
"go directly to the user who executed it."));
else
return false;
source.Reply(_("Type \002%s%s HELP SET \037option\037\002 for more information on a\n"
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
return true;
}
};
void OnSyntaxError(CommandSource &source, const Anope::string &subcommand)
class CommandBSSetDontKickOps : public Command
{
public:
CommandBSSetDontKickOps(Module *creator, const Anope::string &sname = "botserv/set/dontkickops") : Command(creator, sname, 2, 2)
{
if (subcommand.empty())
Command::OnSyntaxError(source, "");
else if (subcommand.equals_ci("PRIVATE"))
this->SendSyntax(source, "\037botname\037 PRIVATE {\037ON|OFF\037}");
else if (subcommand.equals_ci("DONTKICKOPS"))
this->SendSyntax(source, "\037channel\037 DONTKICKOPS {\037ON|OFF\037}");
else if (subcommand.equals_ci("DONTKICKVOICES"))
this->SendSyntax(source, "\037channel\037 DONTKICKVOICES {\037ON|OFF\037}");
else if (subcommand.equals_ci("FANTASY"))
this->SendSyntax(source, "\037channel\037 FANTASY {\037ON|OFF\037}");
else if (subcommand.equals_ci("GREET"))
this->SendSyntax(source, "\037channel\037 GREET {\037ON|OFF\037}");
else if (subcommand.equals_ci("MSG"))
this->SendSyntax(source, "\037channel\037 MSG {\037PRIVMSG|NOTICE|NOTICEOPS|OFF\037}");
else if (subcommand.equals_ci("NOBOT"))
this->SendSyntax(source, "\037channel\037 NOBOT {\037ON|OFF\037}");
this->SetDesc(_("To protect ops against bot kicks"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (params[1].equals_ci("ON"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops";
ci->ExtendMetadata("BS_DONTKICKOPS");
source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops";
ci->Shrink("BS_DONTKICKOPS");
source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "");
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002ops protection\002 mode on a channel.\n"
"When it is enabled, ops won't be kicked by the bot\n"
"even if they don't match the NOKICK level."));
return true;
}
};
class CommandBSSetDontKickVoices : public Command
{
public:
CommandBSSetDontKickVoices(Module *creator, const Anope::string &sname = "botserv/set/dontkickvoices") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("To protect voices against bot kicks"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (params[1].equals_ci("ON"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickvoices";
ci->ExtendMetadata("BS_DONTKICKVOICES");
source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickvoices";
ci->Shrink("BS_DONTKICKVOICES");
source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002voices protection\002 mode on a channel.\n"
"When it is enabled, voices won't be kicked by the bot\n"
"even if they don't match the NOKICK level."));
return true;
}
};
class CommandBSSetFantasy : public Command
{
public:
CommandBSSetFantasy(Module *creator, const Anope::string &sname = "botserv/set/fantasy") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Enable fantaisist commands"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable fantasy";
ci->ExtendMetadata("BS_FANTASY");
source.Reply(_("Fantasy mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable fantasy";
ci->Shrink("BS_FANTASY");
source.Reply(_("Fantasy mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002fantasy\002 mode on a channel.\n"
"When it is enabled, users will be able to use\n"
"%s commands on a channel when prefixed\n"
"with one of the following fantasy characters: \002%s\002\n"
" \n"
"Note that users wanting to use fantaisist\n"
"commands MUST have enough level for both\n"
"the FANTASIA and another level depending\n"
"of the command if required (for example, to use\n"
"!op, user must have enough access for the OPDEOP\n"
"level)."), Config->ChanServ.c_str(), Config->BSFantasyCharacter.c_str());
return true;
}
};
class CommandBSSetGreet : public Command
{
public:
CommandBSSetGreet(Module *creator, const Anope::string &sname = "botserv/set/greet") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Enable greet messages"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets";
ci->ExtendMetadata("BS_GREET");
source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets";
ci->Shrink("BS_GREET");
source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002greet\002 mode on a channel.\n"
"When it is enabled, the bot will display greet\n"
"messages of users joining the channel, provided\n"
"they have enough access to the channel."));
return true;
}
};
class CommandBSSetNoBot : public Command
{
public:
CommandBSSetNoBot(Module *creator, const Anope::string &sname = "botserv/set/nobot") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Prevent a bot from being assigned to a channel"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to enable nobot";
ci->ExtendMetadata("BS_NOBOT");
if (ci->bi)
ci->bi->UnAssign(source.GetUser(), ci);
source.Reply(_("No-bot mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to disable nobot";
ci->Shrink("BS_NOBOT");
source.Reply(_("No-bot mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"This option makes a channel be unassignable. If a bot\n"
"is already assigned to the channel, it is unassigned\n"
"automatically when you enable the option."));
return true;
}
};
class CommandBSSetPrivate : public Command
{
public:
CommandBSSetPrivate(Module *creator, const Anope::string &sname = "botserv/set/private") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Prevent a bot from being assigned by non IRC operators"));
this->SetSyntax(_("\037botname\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
BotInfo *bi = BotInfo::Find(params[0], true);
const Anope::string &value = params[1];
if (bi == NULL)
{
source.Reply(BOT_DOES_NOT_EXIST, params[0].c_str());
return;
}
if (value.equals_ci("ON"))
{
bi->ExtendMetadata("PRIVATE");
source.Reply(_("Private mode of bot %s is now \002on\002."), bi->nick.c_str());
}
else if (value.equals_ci("OFF"))
{
bi->Shrink("PRIVATE");
source.Reply(_("Private mode of bot %s is now \002off\002."), bi->nick.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"This option prevents a bot from being assigned to a\n"
"channel by users that aren't IRC Operators."));
return true;
}
};
class BSSet : public Module
{
CommandBSSet commandbsset;
CommandBSSetDontKickOps commandbssetdontkickops;
CommandBSSetDontKickVoices commandbssetdontkickvoices;
CommandBSSetFantasy commandbssetfantasy;
CommandBSSetNoBot commandbssetnobot;
CommandBSSetPrivate commandbssetprivate;
public:
BSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbsset(this)
commandbsset(this), commandbssetdontkickops(this), commandbssetdontkickvoices(this),
commandbssetfantasy(this), commandbssetnobot(this), commandbssetprivate(this)
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandbsset);
}
};
File diff suppressed because it is too large Load Diff
+228 -240
View File
@@ -1,6 +1,6 @@
/* ChanServ core functions
*
* (C) 2003-2011 Anope Team
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -46,126 +46,18 @@ static void split_usermask(const Anope::string &mask, Anope::string &nick, Anope
}
}
class AkickListCallback : public NumberList
{
protected:
CommandSource &source;
ChannelInfo *ci;
bool SentHeader;
public:
AkickListCallback(CommandSource &_source, ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, false), source(_source), ci(_ci), SentHeader(false)
{
}
~AkickListCallback()
{
if (!SentHeader)
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
}
virtual void HandleNumber(unsigned Number)
{
if (!Number || Number > ci->GetAkickCount())
return;
if (!SentHeader)
{
SentHeader = true;
source.Reply(_("Autokick list for %s:"), ci->name.c_str());
}
DoList(source, ci, Number - 1, ci->GetAkick(Number - 1));
}
static void DoList(CommandSource &source, ChannelInfo *ci, unsigned index, AutoKick *akick)
{
source.Reply(_(" %3d %s (%s)"), index + 1, akick->HasFlag(AK_ISNICK) ? akick->nc->display.c_str() : akick->mask.c_str(), !akick->reason.empty() ? akick->reason.c_str() : NO_REASON);
}
};
class AkickViewCallback : public AkickListCallback
{
public:
AkickViewCallback(CommandSource &_source, ChannelInfo *_ci, const Anope::string &numlist) : AkickListCallback(_source, _ci, numlist)
{
}
void HandleNumber(unsigned Number)
{
if (!Number || Number > ci->GetAkickCount())
return;
if (!SentHeader)
{
SentHeader = true;
source.Reply(_("Autokick list for %s:"), ci->name.c_str());
}
DoList(source, ci, Number - 1, ci->GetAkick(Number - 1));
}
static void DoList(CommandSource &source, ChannelInfo *ci, unsigned index, AutoKick *akick)
{
Anope::string timebuf;
if (akick->addtime)
timebuf = do_strftime(akick->addtime);
else
timebuf = UNKNOWN;
source.Reply(CHAN_AKICK_VIEW_FORMAT, index + 1, akick->HasFlag(AK_ISNICK) ? akick->nc->display.c_str() : akick->mask.c_str(), !akick->creator.empty() ? akick->creator.c_str() : UNKNOWN, timebuf.c_str(), !akick->reason.empty() ? akick->reason.c_str() : _(NO_REASON));
if (akick->last_used)
source.Reply(_(" Last used %s"), do_strftime(akick->last_used).c_str());
}
};
class AkickDelCallback : public NumberList
{
CommandSource &source;
ChannelInfo *ci;
Command *c;
unsigned Deleted;
public:
AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), Deleted(0)
{
}
~AkickDelCallback()
{
User *u = source.u;
bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, c, ci) << "DEL on " << Deleted << " users";
if (!Deleted)
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
else if (Deleted == 1)
source.Reply(_("Deleted 1 entry from %s autokick list."), ci->name.c_str());
else
source.Reply(_("Deleted %d entries from %s autokick list."), Deleted, ci->name.c_str());
}
void HandleNumber(unsigned Number)
{
if (!Number || Number > ci->GetAkickCount())
return;
++Deleted;
ci->EraseAkick(Number - 1);
}
};
class CommandCSAKick : public Command
{
void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
User *u = source.u;
Anope::string mask = params[2];
Anope::string reason = params.size() > 3 ? params[3] : "";
NickAlias *na = findnick(mask);
const NickAlias *na = NickAlias::Find(mask);
NickCore *nc = NULL;
AutoKick *akick;
const AutoKick *akick;
if (reason.length() > Config->CSReasonMax)
reason = reason.substr(0, Config->CSReasonMax);
if (!na)
{
@@ -180,7 +72,7 @@ class CommandCSAKick : public Command
/* Check excepts BEFORE we get this far */
if (ci->c)
{
std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> modes = ci->c->GetModeList(CMODE_EXCEPT);
std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> modes = ci->c->GetModeList("EXCEPT");
for (; modes.first != modes.second; ++modes.first)
{
if (Anope::Match(modes.first->second, mask))
@@ -193,27 +85,27 @@ class CommandCSAKick : public Command
/* Check whether target nick has equal/higher access
* or whether the mask matches a user with higher/equal access - Viper */
if (ci->HasFlag(CI_PEACE) && nc)
if (ci->HasExt("PEACE") && nc)
{
AccessGroup nc_access = ci->AccessFor(nc), u_access = ci->AccessFor(u);
AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
if (nc == ci->GetFounder() || nc_access >= u_access)
{
source.Reply(ACCESS_DENIED);
return;
}
}
else if (ci->HasFlag(CI_PEACE))
else if (ci->HasExt("PEACE"))
{
/* Match against all currently online users with equal or
* higher access. - Viper */
for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it)
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
User *u2 = it->second;
AccessGroup nc_access = ci->AccessFor(nc), u_access = ci->AccessFor(u);
Entry entry_mask(CMODE_BEGIN, mask);
AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
Entry entry_mask("", mask);
if ((ci->AccessFor(u2).HasPriv(CA_FOUNDER) || nc_access >= u_access) && entry_mask.Matches(u2))
if ((ci->AccessFor(u2).HasPriv("FOUNDER") || nc_access >= u_access) && entry_mask.Matches(u2))
{
source.Reply(ACCESS_DENIED);
return;
@@ -222,11 +114,11 @@ class CommandCSAKick : public Command
/* Match against the lastusermask of all nickalias's with equal
* or higher access. - Viper */
for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; ++it)
for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ++it)
{
na = it->second;
AccessGroup nc_access = ci->AccessFor(na->nc), u_access = ci->AccessFor(u);
AccessGroup nc_access = ci->AccessFor(na->nc), u_access = source.AccessFor(ci);
if (na->nc && (na->nc == ci->GetFounder() || nc_access >= u_access))
{
Anope::string buf = na->nick + "!" + na->last_usermask;
@@ -242,9 +134,9 @@ class CommandCSAKick : public Command
for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j)
{
akick = ci->GetAkick(j);
if (akick->HasFlag(AK_ISNICK) ? akick->nc == nc : mask.equals_ci(akick->mask))
if (akick->nc ? akick->nc == nc : mask.equals_ci(akick->mask))
{
source.Reply(_("\002%s\002 already exists on %s autokick list."), akick->HasFlag(AK_ISNICK) ? akick->nc->display.c_str() : akick->mask.c_str(), ci->name.c_str());
source.Reply(_("\002%s\002 already exists on %s autokick list."), akick->nc ? akick->nc->display.c_str() : akick->mask.c_str(), ci->name.c_str());
return;
}
}
@@ -256,14 +148,14 @@ class CommandCSAKick : public Command
}
if (nc)
akick = ci->AddAkick(u->nick, nc, reason);
akick = ci->AddAkick(source.GetNick(), nc, reason);
else
akick = ci->AddAkick(u->nick, mask, reason);
akick = ci->AddAkick(source.GetNick(), mask, reason);
bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << mask << ": " << reason;
bool override = !source.AccessFor(ci).HasPriv("AKICK");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << (reason == "" ? "" : ": ") << reason;
FOREACH_MOD(I_OnAkickAdd, OnAkickAdd(u, ci, akick));
FOREACH_MOD(I_OnAkickAdd, OnAkickAdd(source, ci, akick));
source.Reply(_("\002%s\002 added to %s autokick list."), mask.c_str(), ci->name.c_str());
@@ -272,10 +164,7 @@ class CommandCSAKick : public Command
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &mask = params[2];
AutoKick *akick;
unsigned i, end;
if (!ci->GetAkickCount())
@@ -287,19 +176,54 @@ class CommandCSAKick : public Command
/* Special case: is it a number/list? Only do search if it isn't. */
if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
{
AkickDelCallback list(source, ci, this, mask);
list.Process();
class AkickDelCallback : public NumberList
{
CommandSource &source;
ChannelInfo *ci;
Command *c;
unsigned deleted;
public:
AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0)
{
}
~AkickDelCallback()
{
bool override = !source.AccessFor(ci).HasPriv("AKICK");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << deleted << (deleted == 1 ? " entry" : " entries");
if (!deleted)
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
else if (deleted == 1)
source.Reply(_("Deleted 1 entry from %s autokick list."), ci->name.c_str());
else
source.Reply(_("Deleted %d entries from %s autokick list."), deleted, ci->name.c_str());
}
void HandleNumber(unsigned number) anope_override
{
if (!number || number > ci->GetAkickCount())
return;
FOREACH_MOD(I_OnAkickDel, OnAkickDel(source, ci, ci->GetAkick(number - 1)));
++deleted;
ci->EraseAkick(number - 1);
}
}
delcallback(source, ci, this, mask);
delcallback.Process();
}
else
{
NickAlias *na = findnick(mask);
NickCore *nc = na ? na->nc : NULL;
const NickAlias *na = NickAlias::Find(mask);
const NickCore *nc = na ? *na->nc : NULL;
for (i = 0, end = ci->GetAkickCount(); i < end; ++i)
{
akick = ci->GetAkick(i);
const AutoKick *akick = ci->GetAkick(i);
if ((akick->HasFlag(AK_ISNICK) && akick->nc == nc) || (!akick->HasFlag(AK_ISNICK) && mask.equals_ci(akick->mask)))
if (akick->nc ? akick->nc == nc : mask.equals_ci(akick->mask))
break;
}
@@ -309,8 +233,10 @@ class CommandCSAKick : public Command
return;
}
bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "DEL " << mask;
bool override = !source.AccessFor(ci).HasPriv("AKICK");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask;
FOREACH_MOD(I_OnAkickDel, OnAkickDel(source, ci, ci->GetAkick(i)));
ci->EraseAkick(i);
@@ -318,109 +244,137 @@ class CommandCSAKick : public Command
}
}
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
void ProcessList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params, ListFormatter &list)
{
User *u = source.u;
const Anope::string &mask = params.size() > 2 ? params[2] : "";
bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "LIST";
if (!mask.empty() && isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
{
class AkickListCallback : public NumberList
{
ListFormatter &list;
ChannelInfo *ci;
public:
AkickListCallback(ListFormatter &_list, ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, false), list(_list), ci(_ci)
{
}
void HandleNumber(unsigned number) anope_override
{
if (!number || number > ci->GetAkickCount())
return;
const AutoKick *akick = ci->GetAkick(number - 1);
Anope::string timebuf, lastused;
if (akick->addtime)
timebuf = Anope::strftime(akick->addtime, NULL, false);
else
timebuf = UNKNOWN;
if (akick->last_used)
lastused = Anope::strftime(akick->last_used, NULL, false);
else
lastused = UNKNOWN;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(number);
if (akick->nc)
entry["Mask"] = akick->nc->display;
else
entry["Mask"] = akick->mask;
entry["Creator"] = akick->creator;
entry["Created"] = timebuf;
entry["Last used"] = lastused;
entry["Reason"] = akick->reason;
this->list.AddEntry(entry);
}
}
nl_list(list, ci, mask);
nl_list.Process();
}
else
{
for (unsigned i = 0, end = ci->GetAkickCount(); i < end; ++i)
{
const AutoKick *akick = ci->GetAkick(i);
if (!mask.empty())
{
if (!akick->nc && !Anope::Match(akick->mask, mask))
continue;
if (akick->nc && !Anope::Match(akick->nc->display, mask))
continue;
}
Anope::string timebuf, lastused;
if (akick->addtime)
timebuf = Anope::strftime(akick->addtime);
else
timebuf = UNKNOWN;
if (akick->last_used)
lastused = Anope::strftime(akick->last_used);
else
lastused = UNKNOWN;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
if (akick->nc)
entry["Mask"] = akick->nc->display;
else
entry["Mask"] = akick->mask;
entry["Creator"] = akick->creator;
entry["Created"] = timebuf;
entry["Last used"] = lastused;
entry["Reason"] = akick->reason;
list.AddEntry(entry);
}
}
if (list.IsEmpty())
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
else
{
std::vector<Anope::string> replies;
list.Process(replies);
source.Reply(_("Autokick list for %s:"), ci->name.c_str());
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
source.Reply(_("End of autokick list"));
}
}
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
if (!ci->GetAkickCount())
{
source.Reply(_("%s autokick list is empty."), ci->name.c_str());
return;
}
if (!mask.empty() && isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
{
AkickListCallback list(source, ci, mask);
list.Process();
}
else
{
bool SentHeader = false;
for (unsigned i = 0, end = ci->GetAkickCount(); i < end; ++i)
{
AutoKick *akick = ci->GetAkick(i);
if (!mask.empty())
{
if (!akick->HasFlag(AK_ISNICK) && !Anope::Match(akick->mask, mask))
continue;
if (akick->HasFlag(AK_ISNICK) && !Anope::Match(akick->nc->display, mask))
continue;
}
if (!SentHeader)
{
SentHeader = true;
source.Reply(_("Autokick list for %s:"), ci->name.c_str());
}
AkickListCallback::DoList(source, ci, i, akick);
}
if (!SentHeader)
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
}
ListFormatter list;
list.AddColumn("Number").AddColumn("Mask").AddColumn("Reason");
this->ProcessList(source, ci, params, list);
}
void DoView(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
User *u = source.u;
const Anope::string &mask = params.size() > 2 ? params[2] : "";
bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "VIEW";
if (!ci->GetAkickCount())
{
source.Reply(_("%s autokick list is empty."), ci->name.c_str());
return;
}
if (!mask.empty() && isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
{
AkickViewCallback list(source, ci, mask);
list.Process();
}
else
{
bool SentHeader = false;
for (unsigned i = 0, end = ci->GetAkickCount(); i < end; ++i)
{
AutoKick *akick = ci->GetAkick(i);
if (!mask.empty())
{
if (!akick->HasFlag(AK_ISNICK) && !Anope::Match(akick->mask, mask))
continue;
if (akick->HasFlag(AK_ISNICK) && !Anope::Match(akick->nc->display, mask))
continue;
}
if (!SentHeader)
{
SentHeader = true;
source.Reply(_("Autokick list for %s:"), ci->name.c_str());
}
AkickViewCallback::DoList(source, ci, i, akick);
}
if (!SentHeader)
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
}
ListFormatter list;
list.AddColumn("Number").AddColumn("Mask").AddColumn("Creator").AddColumn("Created").AddColumn("Last used").AddColumn("Reason");
this->ProcessList(source, ci, params, list);
}
void DoEnforce(CommandSource &source, ChannelInfo *ci)
{
User *u = source.u;
Channel *c = ci->c;
int count = 0;
@@ -430,25 +384,24 @@ class CommandCSAKick : public Command
return;
}
for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; )
for (User::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; )
{
UserContainer *uc = *it++;
ChanUserContainer *uc = *it++;
if (ci->CheckKick(uc->user))
++count;
}
bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ENFORCE, affects " << count << " users";
bool override = !source.AccessFor(ci).HasPriv("AKICK");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "ENFORCE, affects " << count << " users";
source.Reply(_("AKICK ENFORCE for \002%s\002 complete; \002%d\002 users were affected."), ci->name.c_str(), count);
}
void DoClear(CommandSource &source, ChannelInfo *ci)
{
User *u = source.u;
bool override = !ci->AccessFor(u).HasPriv(CA_AKICK);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "CLEAR";
bool override = !source.AccessFor(ci).HasPriv("AKICK");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the akick list";
ci->ClearAkick();
source.Reply(_("Channel %s akick list has been cleared."), ci->name.c_str());
@@ -461,20 +414,18 @@ class CommandCSAKick : public Command
this->SetSyntax(_("\037channel\037 ADD {\037nick\037 | \037mask\037} [\037reason\037]"));
this->SetSyntax(_("\037channel\037 DEL {\037nick\037 | \037mask\037 | \037entry-num\037 | \037list\037}"));
this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | \037entry-num\037 | \037list\037]"));
this->SetSyntax(_("\002AKICK \037channel\037 VIEW [\037mask\037 | \037entry-num\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 VIEW [\037mask\037 | \037entry-num\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 ENFORCE"));
this->SetSyntax(_("\037channel\037 CLEAR"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params)
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
Anope::string chan = params[0];
Anope::string cmd = params[1];
Anope::string mask = params.size() > 2 ? params[2] : "";
User *u = source.u;
ChannelInfo *ci = cs_findchan(params[0]);
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
@@ -483,9 +434,9 @@ class CommandCSAKick : public Command
if (mask.empty() && (cmd.equals_ci("ADD") || cmd.equals_ci("DEL")))
this->OnSyntaxError(source, cmd);
else if (!ci->AccessFor(u).HasPriv(CA_AKICK) && !u->HasPriv("chanserv/access/modify"))
else if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify"))
source.Reply(ACCESS_DENIED);
else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && readonly)
else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && Anope::ReadOnly)
source.Reply(_("Sorry, channel autokick list modification is temporarily disabled."));
else if (cmd.equals_ci("ADD"))
this->DoAdd(source, ci, params);
@@ -505,7 +456,7 @@ class CommandCSAKick : public Command
return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand)
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
@@ -522,7 +473,7 @@ class CommandCSAKick : public Command
"When akicking a \037registered nick\037 the nickserv account\n"
"will be added to the akick list instead of the mask.\n"
"All users within that nickgroup will then be akicked.\n"),
source.owner->nick.c_str());
source.service->nick.c_str());
source.Reply(_(
" \n"
"The \002AKICK DEL\002 command removes the given nick or mask\n"
@@ -534,7 +485,7 @@ class CommandCSAKick : public Command
"optionally only those AutoKick entries which match the\n"
"given mask.\n"
" \n"
"The \002AKICK VIEW\002 command is a more verbose version of\n"
"The \002AKICK VIEW\002 command is a more verbose version of the\n"
"\002AKICK LIST\002 command.\n"
" \n"
"The \002AKICK ENFORCE\002 command causes %s to enforce the\n"
@@ -542,7 +493,7 @@ class CommandCSAKick : public Command
"AKICK mask.\n"
" \n"
"The \002AKICK CLEAR\002 command clears all entries of the\n"
"akick list."), source.owner->nick.c_str());
"akick list."), source.service->nick.c_str());
return true;
}
};
@@ -557,7 +508,44 @@ class CSAKick : public Module
{
this->SetAuthor("Anope");
ModuleManager::RegisterService(&commandcsakick);
Implementation i[] = { I_OnCheckKick };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override
{
if (ci->c->MatchesList(u, "EXCEPT"))
return EVENT_CONTINUE;
for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j)
{
AutoKick *autokick = ci->GetAkick(j);
bool kick = false;
if (autokick->nc)
{
if (autokick->nc == u->Account())
kick = true;
}
else
{
Entry akick_mask("", autokick->mask);
if (akick_mask.Matches(u))
kick = true;
}
if (kick)
{
Log(LOG_DEBUG_2) << u->nick << " matched akick " << (autokick->nc ? autokick->nc->display : autokick->mask);
autokick->last_used = Anope::CurTime;
if (!autokick->nc)
mask = autokick->mask;
reason = autokick->reason.empty() ? Config->CSAutokickReason : autokick->reason;
return EVENT_STOP;
}
}
return EVENT_CONTINUE;
}
};

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