mirror of
https://github.com/anope/anope.git
synced 2026-06-12 18:54:47 +02:00
Compare commits
632 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 469a04e7e0 | |||
| 605b5d5717 | |||
| f7aa46fb33 | |||
| b4450294af | |||
| 57327a5e33 | |||
| 4a3c64291f | |||
| 036b3c9053 | |||
| 7da33344d1 | |||
| cbdb9f59f3 | |||
| 5d3d6bcead | |||
| 0cdc628db0 | |||
| 4a733c93d4 | |||
| 03d2378a9f | |||
| 5e027c196d | |||
| 3aeaef5b9a | |||
| 4d26070a92 | |||
| f601b04594 | |||
| ca169489b2 | |||
| 713c2eb704 | |||
| 660e0c78ac | |||
| 0862de6577 | |||
| 2cd511d3a3 | |||
| efe5fedde9 | |||
| c8c6845452 | |||
| bd62c4891e | |||
| 9535541f5a | |||
| 711a570d24 | |||
| cb9ccc443d | |||
| c681bdd2e3 | |||
| 74844c0f28 | |||
| 905207093b | |||
| 73a944fb74 | |||
| d1328d876a | |||
| faa85564fc | |||
| 8dec0c1f17 | |||
| 8098ed899a | |||
| 77c98f0750 | |||
| 8dbdfa9a44 | |||
| 685e99be02 | |||
| b14b7bd55e | |||
| 365769d14c | |||
| 01b901eba1 | |||
| 26de1d9f93 | |||
| 451fb82e54 | |||
| c02d51f523 | |||
| b95027ba28 | |||
| 5b476a2597 | |||
| bceeda8087 | |||
| ee9636bba2 | |||
| ddfb16de1a | |||
| 2555d0d637 | |||
| ed73d76751 | |||
| 4fe49af840 | |||
| beabbb3a20 | |||
| b4888c21ed | |||
| b75fa1c6ec | |||
| 3fbf39b25d | |||
| 15a833283b | |||
| 5a0d04bb81 | |||
| fbae3344ff | |||
| 95469fde30 | |||
| 9f46972f19 | |||
| 46a3afadb9 | |||
| 1b2f3bf369 | |||
| bb3b421385 | |||
| 1ee3d3d810 | |||
| 97c2e0957d | |||
| 09a5791bc6 | |||
| 8db5ecd736 | |||
| e9aa04a8f4 | |||
| 8eb23e7d48 | |||
| 093b3d258e | |||
| 48e6221cf0 | |||
| ef0c095712 | |||
| a0355dfd9d | |||
| 6fe2d8af97 | |||
| 90e5d0feaa | |||
| d79e22bfaa | |||
| a9fb6bab15 | |||
| dd968c07be | |||
| feb81c51d2 | |||
| aecf675e6b | |||
| bcaf406747 | |||
| f234a2bfab | |||
| 28d17a40ce | |||
| 7cfca37e2a | |||
| c38b6392c5 | |||
| ee38756982 | |||
| eea7d2eb77 | |||
| b15410fd3a | |||
| c83b2b73d7 | |||
| dfbb5264fa | |||
| f49a3e03c1 | |||
| 109d1744a0 | |||
| 470f8af97c | |||
| a1296a3b7c | |||
| f38fe242cd | |||
| 536ea2189a | |||
| ab0422b4d4 | |||
| 18bd33f9a4 | |||
| d436e4ca4a | |||
| 1372dc1953 | |||
| 9ef7352e69 | |||
| 2529ff6dae | |||
| 7bdf592f7e | |||
| f463b772b0 | |||
| eec897762c | |||
| f87c665b63 | |||
| 36d3fd1710 | |||
| d26a19b41d | |||
| a55b3742cb | |||
| 83556667fd | |||
| faf5f3128f | |||
| a53a797271 | |||
| 08583dc107 | |||
| c362a1e077 | |||
| 140208e5ee | |||
| 679d3c373f | |||
| 557eceeefc | |||
| 9704ccc8a6 | |||
| e62664138b | |||
| 3eadc1509f | |||
| 9910aa3cc6 | |||
| 2a53e5f80e | |||
| 2e8acfb98c | |||
| 48fa096943 | |||
| bf559d788f | |||
| 3bfc8e9a39 | |||
| a162f1d18e | |||
| a86873c93e | |||
| 05933e9f21 | |||
| ab2e34d817 | |||
| e7a8bcc30b | |||
| 34c6c664c9 | |||
| 4a3ee91c55 | |||
| 6f0d1af596 | |||
| 01feb5b489 | |||
| 8975b52cc3 | |||
| 7acbbbbf5b | |||
| 4fecafa612 | |||
| a4ded88e85 | |||
| 1b6aab0cd7 | |||
| c669820481 | |||
| ecc2fc6029 | |||
| e490202a1b | |||
| fd2412a5f6 | |||
| 07528ea8f2 | |||
| ce8a069eb5 | |||
| 2ba97aee6c | |||
| a674d81caf | |||
| efb61ed4a8 | |||
| 2e7d08c10b | |||
| 47b87e903b | |||
| ddeff72544 | |||
| 43995b4c6d | |||
| 512d23d60f | |||
| 0eb9152749 | |||
| 4403849126 | |||
| 9efebe5461 | |||
| 7198fa73d1 | |||
| 03ba592c48 | |||
| 57a06f72e2 | |||
| 3019ba6f43 | |||
| 2784cd17fc | |||
| 03cc9eb5c5 | |||
| 72b8f4609b | |||
| d36e53f702 | |||
| a36f14c1bf | |||
| 292e187524 | |||
| 16cab979da | |||
| fd7f542bd9 | |||
| 5ead326454 | |||
| a1c635b050 | |||
| d896bf9a1c | |||
| 49dd1c3409 | |||
| fce491e18c | |||
| 87d0fc8bb5 | |||
| f638d1078a | |||
| 8af2465a61 | |||
| 1b3f2567bc | |||
| 036d4514f0 | |||
| 80721d1873 | |||
| aa9e33cf74 | |||
| 86900175c8 | |||
| d5c1d6ebec | |||
| 35e328bcb6 | |||
| befb4b3644 | |||
| 4235df2b28 | |||
| a6c8a6a9f2 | |||
| 1a3ba00c24 | |||
| e8a2072792 | |||
| 4886b56edb | |||
| 15d29edae9 | |||
| 3009540a00 | |||
| a0ad3c4fef | |||
| 265006b691 | |||
| 11b3b8a5ff | |||
| 2783c82685 | |||
| 184e7b3f64 | |||
| 18377ac9fd | |||
| 184e14ea83 | |||
| 21125cf2cb | |||
| 0d20c47703 | |||
| 7f9a5e01c6 | |||
| eb9b12ed11 | |||
| 4a4c0886cc | |||
| 02476332ea | |||
| 49d3c97b67 | |||
| 97467cb2c8 | |||
| 6a43886807 | |||
| 5d56a2486e | |||
| eb138a02d6 | |||
| 2a4d0e3e89 | |||
| 9f7a2e4da2 | |||
| 25e995b0f5 | |||
| ad5da2a988 | |||
| 6ab7cf9689 | |||
| 099ead02a5 | |||
| f1d04a2f8e | |||
| aed53dbb47 | |||
| a507816701 | |||
| c41c828574 | |||
| 5fe41fb8a0 | |||
| 0ba566491e | |||
| 2a4d57a1ca | |||
| 71c433cc50 | |||
| 2b10cc84ea | |||
| cb6ef574e3 | |||
| 37e02a3594 | |||
| 7d1cfe9514 | |||
| 9870ee04dd | |||
| 1a286397e3 | |||
| 697dc89382 | |||
| 4d342d955d | |||
| c5eb349d41 | |||
| 7790a7f98c | |||
| 246f44b988 | |||
| a85112172d | |||
| 5f18cb018d | |||
| 872bc3fa5e | |||
| 1625a5af0c | |||
| 2e9a632e14 | |||
| 3c9d4e9daf | |||
| c792c7f62d | |||
| e512760364 | |||
| ac41137ce2 | |||
| 28aba58e25 | |||
| 4ec661c0bb | |||
| 87bdf73cb7 | |||
| 21c8e89671 | |||
| 8fbe36635c | |||
| 5cd4fefb4c | |||
| 82e588a790 | |||
| 7b7301eeff | |||
| 70d65376b7 | |||
| af8cf445b8 | |||
| be4ec3c0c4 | |||
| 587e5d9421 | |||
| 35f03811e8 | |||
| 14e396baf7 | |||
| ba01e7a3bb | |||
| 52d9ed428f | |||
| 8f825821e0 | |||
| d1ba920729 | |||
| 56b269e6b3 | |||
| 7e03427272 | |||
| 72ab27af76 | |||
| 3445f4d680 | |||
| aab915f2e9 | |||
| 27652144ec | |||
| 4f8dfc2132 | |||
| 4415a779a3 | |||
| 8662b0989e | |||
| 12c5314863 | |||
| 0d2db1f9f9 | |||
| fe6d7913ce | |||
| dc1252597a | |||
| 721ef7d345 | |||
| 5209e73995 | |||
| 07e2ec0fa7 | |||
| f5d20579ee | |||
| cbd0f52eff | |||
| 4fb4858952 | |||
| 477ff30cec | |||
| daa97f0343 | |||
| 3edc6d70b9 | |||
| 9db85375ee | |||
| e3f368f67b | |||
| 2170823059 | |||
| 011582ff3c | |||
| 98bdd9749a | |||
| cd21bd758c | |||
| fb9f41b3e5 | |||
| a7e5d51616 | |||
| b8df88a1bc | |||
| 257fb256e9 | |||
| 8ff0b0ed99 | |||
| 180aa6b67b | |||
| a26f119bc8 | |||
| a79da4bba1 | |||
| 09160d1289 | |||
| 1d931401cd | |||
| bd7b6b16ec | |||
| ec5fa9e63e | |||
| 7e47b97740 | |||
| 1bd975b90e | |||
| eb8f3a799c | |||
| 791c2b89a5 | |||
| 4f317a2421 | |||
| f3c2933542 | |||
| 4ddb469864 | |||
| d24e810262 | |||
| bc812eeb03 | |||
| 5e9db23883 | |||
| c4075c032e | |||
| dc0c07b408 | |||
| afb55a1842 | |||
| d7aa5f6a3a | |||
| 717c123441 | |||
| 0ac77d0e42 | |||
| 5ca2df1edb | |||
| b3dd5668f6 | |||
| 63b1f9ce88 | |||
| d5e6bd8391 | |||
| 7e62fcf4b3 | |||
| 21a61f162e | |||
| 7df71750cb | |||
| b4f675adcf | |||
| 5298107ae8 | |||
| 7f4362138a | |||
| 4da258ff78 | |||
| 9ab50eedf2 | |||
| 64a3bda235 | |||
| acec166702 | |||
| 00ed18b421 | |||
| 10833f9d3f | |||
| 592060ac75 | |||
| 92338c13b8 | |||
| 3fa2659309 | |||
| 58a3e2bbb7 | |||
| ab5ebc2245 | |||
| cf98cd3e06 | |||
| 632f8df76b | |||
| 663a8b9a1c | |||
| 90f0a7c92a | |||
| 0d684191e9 | |||
| 3499edc427 | |||
| 8a0cf62d70 | |||
| 59f35732f6 | |||
| 76b10625d9 | |||
| b0070bbd3b | |||
| 0a8bb88085 | |||
| a62d824cb4 | |||
| e3afb119b9 | |||
| d44f7971b1 | |||
| 70056dd468 | |||
| 5d9df2bdc1 | |||
| 9d2ef3f130 | |||
| 6ca09be663 | |||
| 7db5e19f74 | |||
| f3840ed110 | |||
| 7d5893a1c8 | |||
| d646d455e2 | |||
| 05e6815d91 | |||
| 3459206980 | |||
| 6f707920ff | |||
| ce69f294a1 | |||
| f8ee95ef98 | |||
| 1e3d2f3739 | |||
| aa9ab7c6db | |||
| 22f2b25f97 | |||
| ebd2997b79 | |||
| 06faf6affc | |||
| 5ec605e424 | |||
| 227909e2cf | |||
| f71fb6e813 | |||
| 74566d869a | |||
| 61e7564633 | |||
| 86c1dab286 | |||
| cd1e9f3181 | |||
| ccc6109879 | |||
| 8131851058 | |||
| 6239b5a053 | |||
| e7ac33fd62 | |||
| 630f3815ce | |||
| 4da2af64ec | |||
| 22b9da7f1d | |||
| 47872e53ed | |||
| e30370af10 | |||
| 89c5b203c3 | |||
| f00e76d30a | |||
| 9eb7562bee | |||
| 46813ccb8c | |||
| fdd196e50b | |||
| 7a522d1c34 | |||
| f276927365 | |||
| d70f1a43bc | |||
| 4319319f97 | |||
| e820e1af0d | |||
| 26ba944d55 | |||
| 4cc6604326 | |||
| 5fbe0c845c | |||
| 2aac8b05ef | |||
| 10d901084f | |||
| 334e5a4ef9 | |||
| 56045afda2 | |||
| c2ddecc2b1 | |||
| 73fb94c553 | |||
| ea9b945830 | |||
| 2803190255 | |||
| f20512c849 | |||
| ada65a3baf | |||
| 8a4c6ae618 | |||
| 88d3338fdd | |||
| 32c31f25ec | |||
| 6608f16b7d | |||
| fb551f0d5d | |||
| 931b0777fb | |||
| b180d5f975 | |||
| fa7684b3a3 | |||
| e65d8b2f3d | |||
| 2575008baa | |||
| 5fb10d27de | |||
| de8eeab2d9 | |||
| c2a97d9f3f | |||
| a950ed8cab | |||
| 4d0a1aaabd | |||
| c24ec06861 | |||
| d4c7f67b58 | |||
| d05afb3ca3 | |||
| bbff5ae4d3 | |||
| de7643a14f | |||
| 46e88e3595 | |||
| f78243b6b1 | |||
| 9da927889f | |||
| 8703afe116 | |||
| 9696118ff5 | |||
| 263f69a40e | |||
| a659f82814 | |||
| 44387a2587 | |||
| 59ee16c7cb | |||
| 7b27a4e491 | |||
| 4ffdd7ca6b | |||
| 503215f39c | |||
| ddb886aa99 | |||
| 48d58d9b88 | |||
| 15a0f998a7 | |||
| ca26c4d9ca | |||
| 80f0351a8b | |||
| 5258549305 | |||
| 94371e69a9 | |||
| f887b37453 | |||
| fd31d4aa29 | |||
| 4fe1c9233c | |||
| 90976b6672 | |||
| e8d6524411 | |||
| d59c1b95e1 | |||
| 2f6c0e435c | |||
| cb3a18e524 | |||
| 5b68782133 | |||
| 084766069c | |||
| 1175ef320e | |||
| a65e9df8dc | |||
| bfd94136c6 | |||
| 11663765e2 | |||
| c770c47e18 | |||
| 9d0d44d738 | |||
| 602d2378f5 | |||
| afb3782aa3 | |||
| ef651b667e | |||
| 7a7b8933bb | |||
| a68e215bad | |||
| 174cc58a8d | |||
| 527304ed2c | |||
| 0cacbf30d2 | |||
| 8e6fe99181 | |||
| e353b15df8 | |||
| 5ed69ed678 | |||
| abfc9926db | |||
| cc64903179 | |||
| 04200cc838 | |||
| 06cb137fde | |||
| 971df4825c | |||
| aa9610a56f | |||
| 4700c96268 | |||
| a2573a2c30 | |||
| 4b870cc5f9 | |||
| 66c0e280ee | |||
| 92edce8ef9 | |||
| 502c985072 | |||
| 1144744c85 | |||
| d4048134af | |||
| 57bb759305 | |||
| 6e6b6b46aa | |||
| 8ea033dd35 | |||
| aa2c1009ee | |||
| 707268f30b | |||
| ae38212c1c | |||
| 15d7f0f6fe | |||
| 5cd986e82b | |||
| 2328c3e7ec | |||
| b218d52a31 | |||
| b899a5c269 | |||
| f9cd3f4238 | |||
| a22f8d3b2d | |||
| 43b1e43afb | |||
| 63d7142465 | |||
| a495213026 | |||
| fa622aae38 | |||
| 07ec79e881 | |||
| 4b1e76c3bb | |||
| 166d6f5d09 | |||
| 7e20659522 | |||
| 1cf4ebb231 | |||
| 8f8b1e46d6 | |||
| f71d5b4d3a | |||
| de1bf10690 | |||
| 950cfcd31e | |||
| 1037a469d3 | |||
| d99ee2d9a4 | |||
| f1cb4b86b7 | |||
| 4502038e3d | |||
| 85b07a94d7 | |||
| 2e4099e9f2 | |||
| 00aa4a0ad4 | |||
| 28e12bc24a | |||
| 051ebe3eea | |||
| f17c4d4d04 | |||
| 0eb007a1b3 | |||
| 1e53c2d50a | |||
| ccc92376be | |||
| 8cf8faf529 | |||
| 6e1fa85cbc | |||
| 9269d20a70 | |||
| 57caa0b53f | |||
| d49aee6cf8 | |||
| e51d6e2fe1 | |||
| 36c646c7d2 | |||
| 4e31757f14 | |||
| 6dc3af5db4 | |||
| c7cb8897b4 | |||
| d5ee411aca | |||
| 03fbc7d281 | |||
| cbcead4e89 | |||
| e447933c02 | |||
| 7bb90e1922 | |||
| c4233e9f9a | |||
| 959a1a69a5 | |||
| 7e872db956 | |||
| 980a2feff8 | |||
| e8d7c65ecf | |||
| 6a8c359b4f | |||
| 1e20877e2f | |||
| fb16ce72a0 | |||
| 36bf5fcb26 | |||
| 16854ae793 | |||
| 17040c088a | |||
| 0d2d7e9968 | |||
| 63d7bee2a6 | |||
| 381c9c8870 | |||
| e8a1570ed9 | |||
| 968e4d0bdd | |||
| 7b7e2a6150 | |||
| 448eadd747 | |||
| 68b54f3fb5 | |||
| 7530c030a9 | |||
| 2528dc80bd | |||
| 52058fe87b | |||
| 43e951aed5 | |||
| c2ae11dd92 | |||
| 87ac831206 | |||
| f74f82619d | |||
| 03dcccc461 | |||
| 35a1c2c1bf | |||
| a2131b7da6 | |||
| c0ea25fb94 | |||
| e05919a1a5 | |||
| d5fd2f5d57 | |||
| 31acdea1aa | |||
| 7b1f345284 | |||
| df9d291bcb | |||
| 7c4a9cf979 | |||
| e6447fa2c4 | |||
| 6cd8849466 | |||
| b8f9116b19 | |||
| 435c9116e9 | |||
| c43666e344 | |||
| 1394c96173 | |||
| f0a44ba894 | |||
| 4a2b9ebcf3 | |||
| 2fba686904 | |||
| 3a2c2a916a | |||
| 0358ae062b | |||
| cab6fcc82d | |||
| 17ab410400 | |||
| 2a22d9c2fd | |||
| c477360dbf | |||
| ee57f57193 | |||
| c966d7ec17 | |||
| f049124905 | |||
| 81a45520a7 | |||
| e6263dba84 | |||
| 631d11d6a8 | |||
| 4e1286ca10 | |||
| 4149afd45d | |||
| 6db15e1783 | |||
| e78a055c2b | |||
| af805e5b45 | |||
| b775c84402 | |||
| ebfff71599 | |||
| 9439cac6b1 | |||
| a93be9ff1c | |||
| 5d437d9ab5 | |||
| 031bc4a8b0 | |||
| 503958aa77 | |||
| c1d161dec4 | |||
| 73e93305c1 | |||
| fa82890696 | |||
| 2ba89de64d | |||
| c4b725b2e1 | |||
| 428d930e2b | |||
| cc3104fc3f | |||
| 1c7c4708d0 | |||
| bc86550c2c | |||
| ad45dbacbb | |||
| 116e5c7479 | |||
| 2d7e5c07d0 | |||
| 184b96946a | |||
| a8b6e44c69 | |||
| 3a2eb6307f | |||
| 4e6ede0e18 | |||
| 475f5afafc |
+3
-4
@@ -1,5 +1,4 @@
|
||||
/autom4te.cache
|
||||
Makefile
|
||||
config.cache
|
||||
config.log
|
||||
config.status
|
||||
include/version.h
|
||||
include/sysconf.h
|
||||
build/
|
||||
|
||||
+67
-21
@@ -68,7 +68,7 @@ else(MINOR_VERSION GREATER 5)
|
||||
endif(MINOR_VERSION GREATER 5)
|
||||
|
||||
# Override the module include path to include our directory, for our Anope.cmake, as well as we are using our own version of the NSIS template
|
||||
set(CMAKE_MODULE_PATH ${Anope_SOURCE_DIR})
|
||||
set(CMAKE_MODULE_PATH ${Anope_SOURCE_DIR}/cmake)
|
||||
|
||||
include(Anope)
|
||||
|
||||
@@ -105,9 +105,13 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(DEFAULT_LIBRARY_DIRS)
|
||||
remove_list_duplicates(DEFAULT_LIBRARY_DIRS)
|
||||
endif(DEFAULT_LIBRARY_DIRS)
|
||||
# Create a temporary file to test for the default include directories
|
||||
FILE(WRITE empty.cpp "")
|
||||
# Next, we look for the compiler's default include directories
|
||||
# Run the command to find the default include directories
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -v -x c++ -E ${CMAKE_CURRENT_SOURCE_DIR}/empty.c ERROR_VARIABLE LINES OUTPUT_QUIET ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -v -x c++ -E ${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp ERROR_VARIABLE LINES OUTPUT_QUIET ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
# Remove the empty file, it is no longer needed
|
||||
FILE(REMOVE empty.cpp)
|
||||
# Convert the new lines to semicolons
|
||||
string(REGEX REPLACE "\n" ";" LINES ${LINES})
|
||||
# Temporary variable saying if we are in the search list or not
|
||||
@@ -203,15 +207,28 @@ else(CMAKE244_OR_BETTER)
|
||||
include(TestCXXAcceptsFlag)
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
|
||||
# If extra directories were specified, tell cmake about them.
|
||||
if(EXTRA_INCLUDE)
|
||||
include_directories(${EXTRA_INCLUDE})
|
||||
link_directories(${EXTRA_INCLUDE})
|
||||
endif(EXTRA_INCLUDE)
|
||||
|
||||
# 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)
|
||||
|
||||
# Use the following directories as includes
|
||||
include_directories(${Anope_SOURCE_DIR}/include ${Anope_BINARY_DIR}/include ${Anope_BINARY_DIR}/lang)
|
||||
# Note that it is important the binary include directory comes before the
|
||||
# source include directory so the precompiled headers work correctly.
|
||||
include_directories(${Anope_BINARY_DIR}/include ${Anope_SOURCE_DIR}/include ${Anope_BINARY_DIR}/language)
|
||||
|
||||
# If using Windows, always add the _WIN32 define
|
||||
if(WIN32)
|
||||
add_definitions(-D_WIN32)
|
||||
# And include the windows specific folder for our anope_windows.h
|
||||
include_directories(${Anope_SOURCE_DIR}/src/win32)
|
||||
endif(WIN32)
|
||||
|
||||
# If using Visual Studio, set the C++ flags accordingly
|
||||
@@ -227,11 +244,12 @@ if(MSVC)
|
||||
else(MSVC)
|
||||
# Set the compile flags to have all warnings on (including shadowed variables)
|
||||
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
|
||||
# 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 -fno-leading-underscore")
|
||||
# Set the module-specific compile flags to the same setting as the compile flags
|
||||
set(MODULE_CXXFLAGS "${CXXFLAGS}")
|
||||
set(CXXFLAGS "${CXXFLAGS} -ansi -pedantic")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CXXFLAGS "${CXXFLAGS} -fno-leading-underscore")
|
||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# If we aren't on a *nix system, we are using MinGW
|
||||
else(UNIX)
|
||||
# Also, if we are building under MinGW, add another define for MinGW
|
||||
@@ -286,6 +304,13 @@ if(NOT MSVC)
|
||||
if(HAVE_NSL_LIB)
|
||||
set(LDFLAGS "${LDFLAGS} -lnsl")
|
||||
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")
|
||||
else(HAVE_PTHREAD)
|
||||
message(FATAL_ERROR "The pthread library is required to build Anope")
|
||||
endif(HAVE_PTHREAD)
|
||||
endif(NOT WIN32)
|
||||
endif(NOT MSVC)
|
||||
|
||||
@@ -298,14 +323,17 @@ if(NOT DEFUMASK)
|
||||
endif(RUNGROUP)
|
||||
endif(NOT DEFUMASK)
|
||||
|
||||
# Set the DEBUG_BUILD for sysconf.h
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
set(DEBUG_BUILD TRUE)
|
||||
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(strings.h HAVE_STRINGS_H)
|
||||
check_include_file(sys/select.h HAVE_SYS_SELECT_H)
|
||||
check_include_file(sys/eventfd.h HAVE_SYS_EVENTFD_H)
|
||||
|
||||
# Check for the existance of the following functions
|
||||
check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
|
||||
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
|
||||
check_function_exists(setgrent HAVE_SETGRENT)
|
||||
check_function_exists(strcasecmp HAVE_STRCASECMP)
|
||||
check_function_exists(stricmp HAVE_STRICMP)
|
||||
@@ -313,6 +341,7 @@ check_function_exists(strlcat HAVE_STRLCAT)
|
||||
check_function_exists(strlcpy HAVE_STRLCPY)
|
||||
check_function_exists(umask HAVE_UMASK)
|
||||
check_function_exists(backtrace HAVE_BACKTRACE)
|
||||
check_function_exists(eventfd HAVE_EVENTFD)
|
||||
|
||||
# Check for the existance of the following types
|
||||
check_type_size(uint8_t UINT8_T)
|
||||
@@ -355,8 +384,8 @@ else(INSTDIR)
|
||||
endif(INSTDIR)
|
||||
|
||||
# Version number processing
|
||||
# Find all lines in version.log that start with VERSION_
|
||||
read_from_file(${Anope_SOURCE_DIR}/version.log "^VERSION_" VERSIONS)
|
||||
# Find all lines in src/version.sh that start with VERSION_
|
||||
read_from_file(${Anope_SOURCE_DIR}/src/version.sh "^VERSION_" VERSIONS)
|
||||
# Iterate through the strings found
|
||||
foreach(VERSION_STR ${VERSIONS})
|
||||
# Get the length of the string
|
||||
@@ -371,6 +400,25 @@ foreach(VERSION_STR ${VERSIONS})
|
||||
set(VERSION_${VERSION_TYPE} ${VERSION})
|
||||
endforeach(VERSION_STR ${VERSIONS})
|
||||
|
||||
# Default build version to 0
|
||||
set(VERSION_BUILD 0)
|
||||
|
||||
# Only change the build number if version.h exists
|
||||
if(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
|
||||
# Attempt to read the build number from include/version.h
|
||||
read_from_file(${Anope_SOURCE_DIR}/include/version.h "^#define VERSION_BUILD" VERSIONS)
|
||||
foreach(VERSION_STR ${VERSIONS})
|
||||
# Get the length of the string
|
||||
string(LENGTH ${VERSION_STR} VERSION_LEN)
|
||||
# Subtract 22 from the string's length
|
||||
math(EXPR VERSION_NUM_LEN "${VERSION_LEN} - 22")
|
||||
# Extract the value from the string
|
||||
string(SUBSTRING ${VERSION_STR} 22 ${VERSION_NUM_LEN} VERSION)
|
||||
# Set VERSION_BUILD correctly
|
||||
set(VERSION_BUILD ${VERSION})
|
||||
endforeach(VERSION_STR ${VERSIONS})
|
||||
endif(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
|
||||
|
||||
# Set the version variables based on what was found above
|
||||
set(VERSION_COMMA "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_BUILD}")
|
||||
set(VERSION_DOTTED_NOBUILD "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
@@ -381,11 +429,11 @@ set(VERSION_FULL_NOBUILD "${VERSION_DOTTED_NOBUILD}${VERSION_EXTRA}")
|
||||
# Only do the following for Windows
|
||||
if(WIN32)
|
||||
# Generate the win32.rc file using the above variables
|
||||
configure_file(${Anope_SOURCE_DIR}/src/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32.rc)
|
||||
configure_file(${Anope_SOURCE_DIR}/src/win32/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32/win32.rc)
|
||||
endif(WIN32)
|
||||
|
||||
# Add the initial files to ignore which will be ignored regardless of if you are building in-source or out-of-source
|
||||
add_to_cpack_ignored_files(".git\;config.cache\;.svn\;CMakeFiles\;sysconf.h$\;Makefile.inc$\;config.log\;config.status\;build\;autom4te.cache" TRUE)
|
||||
add_to_cpack_ignored_files(".git\;config.cache\;CMakeFiles\;sysconf.h$\;build" TRUE)
|
||||
# Add the files we don't want the periods converted for
|
||||
add_to_cpack_ignored_files(".\\\\\\\\.so$;.\\\\\\\\.o$;.\\\\\\\\.s$;${Anope_SOURCE_DIR}/Makefile$")
|
||||
# If the two directories are the same, we are building in-source, thus we need to ignore more files from the build
|
||||
@@ -403,8 +451,9 @@ endif(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
|
||||
# Go into the following directories and run their CMakeLists.txt as well
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(docs)
|
||||
add_subdirectory(lang)
|
||||
add_subdirectory(language)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(modules)
|
||||
add_subdirectory(include)
|
||||
|
||||
# Get the filename of the Anope binary, to use later
|
||||
@@ -424,12 +473,9 @@ if(NOT WIN32 AND RUNGROUP)
|
||||
endif(NOT WIN32 AND RUNGROUP)
|
||||
# On Windows platforms, install extra files
|
||||
if(WIN32)
|
||||
install(FILES ${Anope_SOURCE_DIR}/anope.bat
|
||||
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
|
||||
DESTINATION bin
|
||||
)
|
||||
install(FILES ${Anope_SOURCE_DIR}/docs/Changes ${Anope_SOURCE_DIR}/docs/Changes.conf ${Anope_SOURCE_DIR}/docs/Changes.lang
|
||||
DESTINATION .
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
# Only process the CPack section if we have CPack
|
||||
@@ -460,8 +506,8 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
)
|
||||
# The following doesn't work, but a bug report has been filed about it
|
||||
#set(CPACK_CREATE_DESKTOP_LINK_${SERVICES_BINARY} TRUE)
|
||||
set(CPACK_NSIS_MUI_ICON "${Anope_SOURCE_DIR}/src\\\\anope-icon.ico")
|
||||
set(CPACK_NSIS_MUI_UNIICON "${Anope_SOURCE_DIR}/src\\\\anope-icon.ico")
|
||||
set(CPACK_NSIS_MUI_ICON "${Anope_SOURCE_DIR}/src\\\\win32\\\\anope-icon.ico")
|
||||
set(CPACK_NSIS_MUI_UNIICON "${Anope_SOURCE_DIR}/src\\\\win32\\\\anope-icon.ico")
|
||||
set(CPACK_NSIS_INSTALLED_ICON_NAME "${SERVICES_BINARY}")
|
||||
set(CPACK_NSIS_URL_INFO_ABOUT "http://www.anope.org/")
|
||||
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Configuration script for Services.
|
||||
#
|
||||
# Anope (c) 2003-2010 Anope team
|
||||
# Anope (c) 2003-2011 Anope team
|
||||
# Contact us at team@anope.org
|
||||
#
|
||||
# This program is free but copyrighted software; see the file COPYING for
|
||||
@@ -40,94 +40,58 @@ Run_Build_System () {
|
||||
WITH_INST=""
|
||||
WITH_RUN=""
|
||||
WITH_PERM=""
|
||||
BUILD_TYPE=""
|
||||
RUN_CC_PL=""
|
||||
GEN_TYPE=""
|
||||
|
||||
if [ "$INSTDIR" != "" ] ; then
|
||||
if [ "$BUILD_SYSTEM" = "cmake" ] ; then
|
||||
WITH_INST="-DINSTDIR:STRING=$INSTDIR"
|
||||
else
|
||||
WITH_INST="--with-instdir=$INSTDIR"
|
||||
fi
|
||||
WITH_INST="-DINSTDIR:STRING=$INSTDIR"
|
||||
fi
|
||||
|
||||
if [ "$RUNGROUP" != "" ] ; then
|
||||
if [ "$BUILD_SYSTEM" = "cmake" ] ; then
|
||||
WITH_RUN="-DRUNGROUP:STRING=$RUNGROUP"
|
||||
else
|
||||
WITH_RUN="--with-rungroup=$RUNGROUP"
|
||||
fi
|
||||
WITH_RUN="-DRUNGROUP:STRING=$RUNGROUP"
|
||||
fi
|
||||
|
||||
if [ "$UMASK" != "" ] ; then
|
||||
if [ "$BUILD_SYSTEM" = "cmake" ] ; then
|
||||
WITH_PERM="-DDEFUMASK:STRING=$UMASK"
|
||||
else
|
||||
WITH_PERM="--with-permissions=$UMASK"
|
||||
fi
|
||||
WITH_PERM="-DDEFUMASK:STRING=$UMASK"
|
||||
fi
|
||||
|
||||
if [ "$DEBUG" = "yes" ] ; then
|
||||
if [ "$BUILD_SYSTEM" = "cmake" ] ; then
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=DEBUG"
|
||||
else
|
||||
BUILD_TYPE="--with-debugsym"
|
||||
fi
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=DEBUG"
|
||||
else
|
||||
if [ "$BUILD_SYSTEM" = "cmake" ] ; then
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=RELEASE"
|
||||
fi
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=RELEASE"
|
||||
fi
|
||||
|
||||
if [ "$USE_RUN_CC_PL" = "yes" ] ; then
|
||||
if [ "$BUILD_SYSTEM" = "cmake" ] ; then
|
||||
RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=ON"
|
||||
else
|
||||
pwdsave=`pwd`
|
||||
cd "`dirname $SOURCE_DIR/run-cc.pl`"
|
||||
RUN_CC_PL="--with-makebin=`pwd`/run-cc.pl"
|
||||
cd "$pwdsave"
|
||||
fi
|
||||
RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=ON"
|
||||
else
|
||||
if [ "$BUILD_SYSTEM" = "cmake" ] ; then
|
||||
RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=OFF"
|
||||
else
|
||||
RUN_CC_PL="--with-makebin="
|
||||
fi
|
||||
RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=OFF"
|
||||
fi
|
||||
|
||||
if [ "$BUILD_SYSTEM" = "cmake" ] ; then
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
GEN_TYPE="-G\"MSYS Makefiles\""
|
||||
;;
|
||||
esac
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
GEN_TYPE="-G\"MSYS Makefiles\""
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$SOURCE_DIR" = "." ] ; then
|
||||
pwdsave=`pwd`
|
||||
test -d build || mkdir build
|
||||
cd "build"
|
||||
REAL_SOURCE_DIR=".."
|
||||
else
|
||||
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"
|
||||
|
||||
cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
|
||||
|
||||
echo ""
|
||||
if [ "$SOURCE_DIR" = "." ] ; then
|
||||
echo "Now cd build, then run make to build Anope."
|
||||
cd "$pwdsave"
|
||||
else
|
||||
echo "Now run make to build Anope."
|
||||
fi
|
||||
if [ "$SOURCE_DIR" = "." ] ; then
|
||||
pwdsave=`pwd`
|
||||
test -d build || mkdir build
|
||||
cd "build"
|
||||
REAL_SOURCE_DIR=".."
|
||||
else
|
||||
echo "./configure $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_CONFIG_ARGS $RUN_CC_PL"
|
||||
REAL_SOURCE_DIR="$SOURCE_DIR"
|
||||
fi
|
||||
|
||||
./configure $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_CONFIG_ARGS $RUN_CC_PL
|
||||
echo "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 $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
|
||||
|
||||
echo ""
|
||||
if [ "$SOURCE_DIR" = "." ] ; then
|
||||
echo "Now cd build, then run make to build Anope."
|
||||
cd "$pwdsave"
|
||||
else
|
||||
echo "Now run make to build Anope."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -148,7 +112,6 @@ export ECHO2 ECHO2SUF
|
||||
# Init values
|
||||
###########################################################################
|
||||
|
||||
BUILD_SYSTEM="cmake"
|
||||
INSTDIR=$HOME/services
|
||||
RUNGROUP=
|
||||
UMASK=
|
||||
@@ -158,11 +121,6 @@ EXTRA_CONFIG_ARGS=
|
||||
CAN_QUICK="no"
|
||||
SOURCE_DIR=`dirname $0`
|
||||
|
||||
which cmake > /dev/null
|
||||
if [ $? -ne 0 ] ; then
|
||||
BUILD_SYSTEM="configure"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
# Check out the options
|
||||
###########################################################################
|
||||
@@ -195,6 +153,17 @@ done
|
||||
|
||||
###########################################################################
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
|
||||
if [ ! "$NO_INTRO" ] ; then
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
@@ -205,8 +174,18 @@ if [ ! "$NO_INTRO" ] ; then
|
||||
clear
|
||||
;;
|
||||
esac
|
||||
. $SOURCE_DIR/version.log
|
||||
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
|
||||
. $SOURCE_DIR/src/version.sh
|
||||
if [ -d .git ] ; then
|
||||
VERSION=`git describe --tags`
|
||||
VERSION_BUILD=`echo "$VERSION" | cut -d'-' -f2`
|
||||
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" > include/version.h
|
||||
echo "#define VERSION_EXTRA \"-$VERSION_EXTRA\"" >> include/version.h
|
||||
fi
|
||||
fi
|
||||
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
@@ -229,36 +208,6 @@ export ok INPUT
|
||||
|
||||
####
|
||||
|
||||
ok=0
|
||||
echo "Note: press Return for the default, or enter a new value."
|
||||
echo "Are you using configure or cmake?"
|
||||
while [ $ok -eq 0 ] ; do
|
||||
echo2 "[$BUILD_SYSTEM] "
|
||||
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
|
||||
if [ ! "$INPUT" ] ; then
|
||||
INPUT=$BUILD_SYSTEM
|
||||
fi
|
||||
case $INPUT in
|
||||
cmake)
|
||||
ok=1
|
||||
;;
|
||||
configure)
|
||||
ok=1
|
||||
;;
|
||||
*)
|
||||
echo "That is not a valid choice!"
|
||||
ok=0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
BUILD_SYSTEM=$INPUT
|
||||
echo ""
|
||||
|
||||
if [ "$SOURCE_DIR" != "." -a "$BUILD_SYSTEM" = "configure" ] ; then
|
||||
echo "You can not use configure unless you are in the same folder as Config!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ok=0
|
||||
echo "In what directory do you want the binaries to be installed?"
|
||||
while [ $ok -eq 0 ] ; do
|
||||
@@ -387,9 +336,10 @@ echo ""
|
||||
|
||||
####
|
||||
|
||||
echo "Are there any extra arguments you wish to pass to $BUILD_SYSTEM?"
|
||||
echo "(You may only need to do this if $BUILD_SYSTEM is unable to locate"
|
||||
echo "missing dependencies without hints)"
|
||||
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"
|
||||
echo "missing dependencies without hints."
|
||||
echo "You can do this by: -DEXTRA_INCLUDE:STRING=/path/to/files;/path/to/more/files"
|
||||
echo2 "[$EXTRA_CONFIG_ARGS] "
|
||||
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
|
||||
if [ "$INPUT" ] ; then
|
||||
@@ -406,7 +356,6 @@ echo ""
|
||||
echo2 "Saving configuration results in config.cache... "
|
||||
|
||||
cat <<EOT >$SOURCE_DIR/config.cache
|
||||
BUILD_SYSTEM="$BUILD_SYSTEM"
|
||||
INSTDIR="$INSTDIR"
|
||||
RUNGROUP="$RUNGROUP"
|
||||
UMASK=$UMASK
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
cscript /nologo "%~dp0\install.js"
|
||||
pause
|
||||
BIN
Binary file not shown.
-103
@@ -1,103 +0,0 @@
|
||||
CC=g++ # probably wrong but oh well.
|
||||
INCLUDEDIR=../include
|
||||
ANOPELIBS=@ANOPELIBS@
|
||||
CFLAGS=@CFLAGS@ -Wall -ansi -pedantic -Wshadow
|
||||
PROFILE=-pg
|
||||
LDPROFILE=
|
||||
SHELL=/bin/sh
|
||||
INSTDIR=@INSTDIR@
|
||||
MAKEBIN=@MAKEBIN@
|
||||
MYSQLDIR=@MYSQLDIR@
|
||||
INSTALL=@INSTALL@
|
||||
RM=@RM@
|
||||
CP=@CP@
|
||||
TOUCH=@TOUCH@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
RUNGROUP=@RUNGROUP@
|
||||
SHARED=@SHARED@
|
||||
MODULEFLAGS=@MODULEFLAGS@
|
||||
|
||||
all: language headers build core protocols tools modules
|
||||
profile: language headers profile_build profile_core profile_protocols profile_tools profile_modules
|
||||
|
||||
MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \
|
||||
'LDFLAGS=${LDFLAGS}' 'INSTDIR=${INSTDIR}' 'INSTALL=${INSTALL}' \
|
||||
'INCLUDEDIR=${INCLUDEDIR}' 'RM=${RM}' 'CP=${CP}' \
|
||||
'TOUCH=${TOUCH}' 'SHELL=${SHELL}' \
|
||||
'RUNGROUP=${RUNGROUP}' \
|
||||
'SHARED=${SHARED}' 'MODULEFLAGS=${MODULEFLAGS}' \
|
||||
'MAKEBIN=${MAKEBIN}' 'MYSQLDIR=${MYSQLDIR}'
|
||||
|
||||
build: language headers
|
||||
@${MAKE} -C src ${MAKEARGS} all
|
||||
|
||||
profile_build:
|
||||
@${MAKE} -C src ${MAKEARGS} 'CFLAGS=${CFLAGS} $(PROFILE)' 'LDFLAGS=${LDFLAGS} ${PROFILE}' all
|
||||
|
||||
modules: build
|
||||
@src/modules/configure src/modules
|
||||
@${MAKE} -C src/modules ${MAKEARGS} all
|
||||
@echo "*** All done, now (g)make install to install Anope/Modules";
|
||||
|
||||
clean_modules:
|
||||
@${MAKE} -C src ${MAKEARGS} clean_modules
|
||||
|
||||
distclean_modules:
|
||||
@${MAKE} -C src ${MAKEARGS} distclean_modules
|
||||
|
||||
protocols: build
|
||||
@echo "*** Building protocol support";
|
||||
@src/protocol/configure src/protocol
|
||||
@${MAKE} -C src/protocol ${MAKEARGS} all
|
||||
|
||||
profile_protocols: build
|
||||
@echo "*** Building protocol support";
|
||||
@src/protocol/configure src/protocol
|
||||
@${MAKE} -C src/protocol ${MAKEARGS} 'CFLAGS=${CFLAGS} ${PROFILE}' 'PROFILE=${PROFILE}' all
|
||||
|
||||
core: build
|
||||
@echo "*** Building Core modules";
|
||||
@${MAKE} -C src ${MAKEARGS} core
|
||||
|
||||
profile_core: build
|
||||
@echo "*** Building Core modules";
|
||||
@${MAKE} -C src ${MAKEARGS} 'CFLAGS=${CFLAGS} ${PROFILE}' 'PROFILE=${PROFILE}' core
|
||||
|
||||
tools: build
|
||||
@${MAKE} -C src/tools ${MAKEARGS} all
|
||||
@echo "*** All done, now (g)make install to install Anope/Modules/Tools";
|
||||
|
||||
profile_tools: profile_build
|
||||
@${MAKE} -C src/tools ${MAKEARGS} 'CFLAGS=${CFLAGS} $(PROFILE)' all
|
||||
@echo "*** All done, now (g)make install to install Anope/Modules/Tools";
|
||||
|
||||
profile_modules: profile_build
|
||||
@src/modules/configure src/modules
|
||||
@${MAKE} -C src/modules ${MAKEARGS} 'CFLAGS=${CFLAGS} ${PROFILE}' 'PROFILE=${PROFILE}' all
|
||||
@echo "*** All done, now (g)make install to install Anope/Modules";
|
||||
|
||||
language:
|
||||
@$(MAKE) -C lang ${MAKEARGS} all language.h
|
||||
|
||||
headers:
|
||||
@${MAKE} -C include ${MAKEARGS}
|
||||
|
||||
clean:
|
||||
${MAKE} -C lang ${MAKEARGS} clean
|
||||
${MAKE} -C include ${MAKEARGS} clean
|
||||
${MAKE} -C src ${MAKEARGS} clean
|
||||
${MAKE} -C src/tools ${MAKEARGS} clean
|
||||
|
||||
distclean: clean
|
||||
${MAKE} -C lang ${MAKEARGS} distclean
|
||||
${MAKE} -C include ${MAKEARGS} distclean
|
||||
${MAKE} -C src ${MAKEARGS} distclean
|
||||
${MAKE} -C src/tools ${MAKEARGS} distclean
|
||||
rm -f config.log config.status config.cache Makefile src/bin/anoperc
|
||||
|
||||
install: DUMMY
|
||||
${MAKE} -C src ${MAKEARGS} install
|
||||
${MAKE} -C src/tools ${MAKEARGS} install
|
||||
@echo "*** All done, Anope is now installed. Please read docs/INSTALL for details on what to do now.";
|
||||
|
||||
DUMMY:
|
||||
Vendored
-871
@@ -1,871 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4-p6
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
# lib-prefix.m4 serial 4 (gettext-0.14.2)
|
||||
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
|
||||
dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
|
||||
dnl require excessive bracketing.
|
||||
ifdef([AC_HELP_STRING],
|
||||
[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
|
||||
[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
|
||||
|
||||
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
|
||||
dnl to access previously installed libraries. The basic assumption is that
|
||||
dnl a user will want packages to use other packages he previously installed
|
||||
dnl with the same --prefix option.
|
||||
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
|
||||
dnl libraries, but is otherwise very convenient.
|
||||
AC_DEFUN([AC_LIB_PREFIX],
|
||||
[
|
||||
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
dnl By default, look in $includedir and $libdir.
|
||||
use_additional=yes
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
AC_LIB_ARG_WITH([lib-prefix],
|
||||
[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
|
||||
--without-lib-prefix don't search for libraries in includedir and libdir],
|
||||
[
|
||||
if test "X$withval" = "Xno"; then
|
||||
use_additional=no
|
||||
else
|
||||
if test "X$withval" = "X"; then
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
else
|
||||
additional_includedir="$withval/include"
|
||||
additional_libdir="$withval/lib"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
if test $use_additional = yes; then
|
||||
dnl Potentially add $additional_includedir to $CPPFLAGS.
|
||||
dnl But don't add it
|
||||
dnl 1. if it's the standard /usr/include,
|
||||
dnl 2. if it's already present in $CPPFLAGS,
|
||||
dnl 3. if it's /usr/local/include and we are using GCC on Linux,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
if test "X$additional_includedir" != "X/usr/include"; then
|
||||
haveit=
|
||||
for x in $CPPFLAGS; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-I$additional_includedir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test "X$additional_includedir" = "X/usr/local/include"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_includedir"; then
|
||||
dnl Really add $additional_includedir to $CPPFLAGS.
|
||||
CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
dnl Potentially add $additional_libdir to $LDFLAGS.
|
||||
dnl But don't add it
|
||||
dnl 1. if it's the standard /usr/lib,
|
||||
dnl 2. if it's already present in $LDFLAGS,
|
||||
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
if test "X$additional_libdir" != "X/usr/lib"; then
|
||||
haveit=
|
||||
for x in $LDFLAGS; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-L$additional_libdir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test "X$additional_libdir" = "X/usr/local/lib"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux*) haveit=yes;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_libdir"; then
|
||||
dnl Really add $additional_libdir to $LDFLAGS.
|
||||
LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
|
||||
dnl acl_final_exec_prefix, containing the values to which $prefix and
|
||||
dnl $exec_prefix will expand at the end of the configure script.
|
||||
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
|
||||
[
|
||||
dnl Unfortunately, prefix and exec_prefix get only finally determined
|
||||
dnl at the end of configure.
|
||||
if test "X$prefix" = "XNONE"; then
|
||||
acl_final_prefix="$ac_default_prefix"
|
||||
else
|
||||
acl_final_prefix="$prefix"
|
||||
fi
|
||||
if test "X$exec_prefix" = "XNONE"; then
|
||||
acl_final_exec_prefix='${prefix}'
|
||||
else
|
||||
acl_final_exec_prefix="$exec_prefix"
|
||||
fi
|
||||
acl_save_prefix="$prefix"
|
||||
prefix="$acl_final_prefix"
|
||||
eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
|
||||
prefix="$acl_save_prefix"
|
||||
])
|
||||
|
||||
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
|
||||
dnl variables prefix and exec_prefix bound to the values they will have
|
||||
dnl at the end of the configure script.
|
||||
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
|
||||
[
|
||||
acl_save_prefix="$prefix"
|
||||
prefix="$acl_final_prefix"
|
||||
acl_save_exec_prefix="$exec_prefix"
|
||||
exec_prefix="$acl_final_exec_prefix"
|
||||
$1
|
||||
exec_prefix="$acl_save_exec_prefix"
|
||||
prefix="$acl_save_prefix"
|
||||
])
|
||||
|
||||
# lib-link.m4 serial 6 (gettext-0.14.3)
|
||||
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
|
||||
dnl the libraries corresponding to explicit and implicit dependencies.
|
||||
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
|
||||
dnl augments the CPPFLAGS variable.
|
||||
AC_DEFUN([AC_LIB_LINKFLAGS],
|
||||
[
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
AC_REQUIRE([AC_LIB_RPATH])
|
||||
define([Name],[translit([$1],[./-], [___])])
|
||||
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
|
||||
AC_LIB_LINKFLAGS_BODY([$1], [$2])
|
||||
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
|
||||
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
|
||||
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
|
||||
])
|
||||
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
|
||||
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
|
||||
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
|
||||
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
|
||||
AC_SUBST([LIB]NAME)
|
||||
AC_SUBST([LTLIB]NAME)
|
||||
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
|
||||
dnl results of this search when this library appears as a dependency.
|
||||
HAVE_LIB[]NAME=yes
|
||||
undefine([Name])
|
||||
undefine([NAME])
|
||||
])
|
||||
|
||||
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
|
||||
dnl searches for libname and the libraries corresponding to explicit and
|
||||
dnl implicit dependencies, together with the specified include files and
|
||||
dnl the ability to compile and link the specified testcode. If found, it
|
||||
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
|
||||
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
|
||||
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
|
||||
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
|
||||
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
||||
[
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
AC_REQUIRE([AC_LIB_RPATH])
|
||||
define([Name],[translit([$1],[./-], [___])])
|
||||
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||
|
||||
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
|
||||
dnl accordingly.
|
||||
AC_LIB_LINKFLAGS_BODY([$1], [$2])
|
||||
|
||||
dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
|
||||
dnl because if the user has installed lib[]Name and not disabled its use
|
||||
dnl via --without-lib[]Name-prefix, he wants to use it.
|
||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
|
||||
|
||||
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIB[]NAME"
|
||||
AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
|
||||
LIBS="$ac_save_LIBS"
|
||||
])
|
||||
if test "$ac_cv_lib[]Name" = yes; then
|
||||
HAVE_LIB[]NAME=yes
|
||||
AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
|
||||
AC_MSG_CHECKING([how to link with lib[]$1])
|
||||
AC_MSG_RESULT([$LIB[]NAME])
|
||||
else
|
||||
HAVE_LIB[]NAME=no
|
||||
dnl If $LIB[]NAME didn't lead to a usable library, we don't need
|
||||
dnl $INC[]NAME either.
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||
LIB[]NAME=
|
||||
LTLIB[]NAME=
|
||||
fi
|
||||
AC_SUBST([HAVE_LIB]NAME)
|
||||
AC_SUBST([LIB]NAME)
|
||||
AC_SUBST([LTLIB]NAME)
|
||||
undefine([Name])
|
||||
undefine([NAME])
|
||||
])
|
||||
|
||||
dnl Determine the platform dependent parameters needed to use rpath:
|
||||
dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
|
||||
dnl hardcode_direct, hardcode_minus_L.
|
||||
AC_DEFUN([AC_LIB_RPATH],
|
||||
[
|
||||
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
|
||||
m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
|
||||
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
|
||||
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
|
||||
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
|
||||
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
|
||||
AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
|
||||
CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
|
||||
${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
|
||||
. ./conftest.sh
|
||||
rm -f ./conftest.sh
|
||||
acl_cv_rpath=done
|
||||
])
|
||||
wl="$acl_cv_wl"
|
||||
libext="$acl_cv_libext"
|
||||
shlibext="$acl_cv_shlibext"
|
||||
hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
|
||||
hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
|
||||
hardcode_direct="$acl_cv_hardcode_direct"
|
||||
hardcode_minus_L="$acl_cv_hardcode_minus_L"
|
||||
dnl Determine whether the user wants rpath handling at all.
|
||||
AC_ARG_ENABLE(rpath,
|
||||
[ --disable-rpath do not hardcode runtime library paths],
|
||||
:, enable_rpath=yes)
|
||||
])
|
||||
|
||||
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
|
||||
dnl the libraries corresponding to explicit and implicit dependencies.
|
||||
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
|
||||
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
||||
[
|
||||
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||
dnl By default, look in $includedir and $libdir.
|
||||
use_additional=yes
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
AC_LIB_ARG_WITH([lib$1-prefix],
|
||||
[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
|
||||
--without-lib$1-prefix don't search for lib$1 in includedir and libdir],
|
||||
[
|
||||
if test "X$withval" = "Xno"; then
|
||||
use_additional=no
|
||||
else
|
||||
if test "X$withval" = "X"; then
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
else
|
||||
additional_includedir="$withval/include"
|
||||
additional_libdir="$withval/lib"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
dnl Search the library and its dependencies in $additional_libdir and
|
||||
dnl $LDFLAGS. Using breadth-first-seach.
|
||||
LIB[]NAME=
|
||||
LTLIB[]NAME=
|
||||
INC[]NAME=
|
||||
rpathdirs=
|
||||
ltrpathdirs=
|
||||
names_already_handled=
|
||||
names_next_round='$1 $2'
|
||||
while test -n "$names_next_round"; do
|
||||
names_this_round="$names_next_round"
|
||||
names_next_round=
|
||||
for name in $names_this_round; do
|
||||
already_handled=
|
||||
for n in $names_already_handled; do
|
||||
if test "$n" = "$name"; then
|
||||
already_handled=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$already_handled"; then
|
||||
names_already_handled="$names_already_handled $name"
|
||||
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
|
||||
dnl or AC_LIB_HAVE_LINKFLAGS call.
|
||||
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
|
||||
eval value=\"\$HAVE_LIB$uppername\"
|
||||
if test -n "$value"; then
|
||||
if test "$value" = yes; then
|
||||
eval value=\"\$LIB$uppername\"
|
||||
test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
|
||||
eval value=\"\$LTLIB$uppername\"
|
||||
test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
|
||||
else
|
||||
dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
|
||||
dnl that this library doesn't exist. So just drop it.
|
||||
:
|
||||
fi
|
||||
else
|
||||
dnl Search the library lib$name in $additional_libdir and $LDFLAGS
|
||||
dnl and the already constructed $LIBNAME/$LTLIBNAME.
|
||||
found_dir=
|
||||
found_la=
|
||||
found_so=
|
||||
found_a=
|
||||
if test $use_additional = yes; then
|
||||
if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
|
||||
found_dir="$additional_libdir"
|
||||
found_so="$additional_libdir/lib$name.$shlibext"
|
||||
if test -f "$additional_libdir/lib$name.la"; then
|
||||
found_la="$additional_libdir/lib$name.la"
|
||||
fi
|
||||
else
|
||||
if test -f "$additional_libdir/lib$name.$libext"; then
|
||||
found_dir="$additional_libdir"
|
||||
found_a="$additional_libdir/lib$name.$libext"
|
||||
if test -f "$additional_libdir/lib$name.la"; then
|
||||
found_la="$additional_libdir/lib$name.la"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "X$found_dir" = "X"; then
|
||||
for x in $LDFLAGS $LTLIB[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/lib$name.$shlibext"
|
||||
if test -f "$dir/lib$name.la"; then
|
||||
found_la="$dir/lib$name.la"
|
||||
fi
|
||||
else
|
||||
if test -f "$dir/lib$name.$libext"; then
|
||||
found_dir="$dir"
|
||||
found_a="$dir/lib$name.$libext"
|
||||
if test -f "$dir/lib$name.la"; then
|
||||
found_la="$dir/lib$name.la"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "X$found_dir" != "X"; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test "X$found_dir" != "X"; then
|
||||
dnl Found the library.
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
|
||||
if test "X$found_so" != "X"; then
|
||||
dnl Linking with a shared library. We attempt to hardcode its
|
||||
dnl directory into the executable's runpath, unless it's the
|
||||
dnl standard /usr/lib.
|
||||
if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
|
||||
dnl No hardcoding is needed.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
dnl Use an explicit option to hardcode DIR into the resulting
|
||||
dnl binary.
|
||||
dnl Potentially add DIR to ltrpathdirs.
|
||||
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
|
||||
haveit=
|
||||
for x in $ltrpathdirs; do
|
||||
if test "X$x" = "X$found_dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
ltrpathdirs="$ltrpathdirs $found_dir"
|
||||
fi
|
||||
dnl The hardcoding into $LIBNAME is system dependent.
|
||||
if test "$hardcode_direct" = yes; then
|
||||
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
dnl resulting binary.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
|
||||
dnl Use an explicit option to hardcode DIR into the resulting
|
||||
dnl binary.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
dnl Potentially add DIR to rpathdirs.
|
||||
dnl The rpathdirs will be appended to $LIBNAME at the end.
|
||||
haveit=
|
||||
for x in $rpathdirs; do
|
||||
if test "X$x" = "X$found_dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
rpathdirs="$rpathdirs $found_dir"
|
||||
fi
|
||||
else
|
||||
dnl Rely on "-L$found_dir".
|
||||
dnl But don't add it if it's already contained in the LDFLAGS
|
||||
dnl or the already constructed $LIBNAME
|
||||
haveit=
|
||||
for x in $LDFLAGS $LIB[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-L$found_dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
|
||||
fi
|
||||
if test "$hardcode_minus_L" != no; then
|
||||
dnl FIXME: Not sure whether we should use
|
||||
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
|
||||
dnl here.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
|
||||
dnl here, because this doesn't fit in flags passed to the
|
||||
dnl compiler. So give up. No hardcoding. This affects only
|
||||
dnl very old systems.
|
||||
dnl FIXME: Not sure whether we should use
|
||||
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
|
||||
dnl here.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test "X$found_a" != "X"; then
|
||||
dnl Linking with a static library.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
|
||||
else
|
||||
dnl We shouldn't come here, but anyway it's good to have a
|
||||
dnl fallback.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
|
||||
fi
|
||||
fi
|
||||
dnl Assume the include files are nearby.
|
||||
additional_includedir=
|
||||
case "$found_dir" in
|
||||
*/lib | */lib/)
|
||||
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
|
||||
additional_includedir="$basedir/include"
|
||||
;;
|
||||
esac
|
||||
if test "X$additional_includedir" != "X"; then
|
||||
dnl Potentially add $additional_includedir to $INCNAME.
|
||||
dnl But don't add it
|
||||
dnl 1. if it's the standard /usr/include,
|
||||
dnl 2. if it's /usr/local/include and we are using GCC on Linux,
|
||||
dnl 3. if it's already present in $CPPFLAGS or the already
|
||||
dnl constructed $INCNAME,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
if test "X$additional_includedir" != "X/usr/include"; then
|
||||
haveit=
|
||||
if test "X$additional_includedir" = "X/usr/local/include"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test -z "$haveit"; then
|
||||
for x in $CPPFLAGS $INC[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-I$additional_includedir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_includedir"; then
|
||||
dnl Really add $additional_includedir to $INCNAME.
|
||||
INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
dnl Look for dependencies.
|
||||
if test -n "$found_la"; then
|
||||
dnl Read the .la file. It defines the variables
|
||||
dnl dlname, library_names, old_library, dependency_libs, current,
|
||||
dnl age, revision, installed, dlopen, dlpreopen, libdir.
|
||||
save_libdir="$libdir"
|
||||
case "$found_la" in
|
||||
*/* | *\\*) . "$found_la" ;;
|
||||
*) . "./$found_la" ;;
|
||||
esac
|
||||
libdir="$save_libdir"
|
||||
dnl We use only dependency_libs.
|
||||
for dep in $dependency_libs; do
|
||||
case "$dep" in
|
||||
-L*)
|
||||
additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
|
||||
dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
|
||||
dnl But don't add it
|
||||
dnl 1. if it's the standard /usr/lib,
|
||||
dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
|
||||
dnl 3. if it's already present in $LDFLAGS or the already
|
||||
dnl constructed $LIBNAME,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
if test "X$additional_libdir" != "X/usr/lib"; then
|
||||
haveit=
|
||||
if test "X$additional_libdir" = "X/usr/local/lib"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test -z "$haveit"; then
|
||||
haveit=
|
||||
for x in $LDFLAGS $LIB[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-L$additional_libdir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_libdir"; then
|
||||
dnl Really add $additional_libdir to $LIBNAME.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
|
||||
fi
|
||||
fi
|
||||
haveit=
|
||||
for x in $LDFLAGS $LTLIB[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-L$additional_libdir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_libdir"; then
|
||||
dnl Really add $additional_libdir to $LTLIBNAME.
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
-R*)
|
||||
dir=`echo "X$dep" | sed -e 's/^X-R//'`
|
||||
if test "$enable_rpath" != no; then
|
||||
dnl Potentially add DIR to rpathdirs.
|
||||
dnl The rpathdirs will be appended to $LIBNAME at the end.
|
||||
haveit=
|
||||
for x in $rpathdirs; do
|
||||
if test "X$x" = "X$dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
rpathdirs="$rpathdirs $dir"
|
||||
fi
|
||||
dnl Potentially add DIR to ltrpathdirs.
|
||||
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
|
||||
haveit=
|
||||
for x in $ltrpathdirs; do
|
||||
if test "X$x" = "X$dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
ltrpathdirs="$ltrpathdirs $dir"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
-l*)
|
||||
dnl Handle this in the next round.
|
||||
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
|
||||
;;
|
||||
*.la)
|
||||
dnl Handle this in the next round. Throw away the .la's
|
||||
dnl directory; it is already contained in a preceding -L
|
||||
dnl option.
|
||||
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
|
||||
;;
|
||||
*)
|
||||
dnl Most likely an immediate library name.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
else
|
||||
dnl Didn't find the library; assume it is in the system directories
|
||||
dnl known to the linker and runtime loader. (All the system
|
||||
dnl directories known to the linker should also be known to the
|
||||
dnl runtime loader, otherwise the system is severely misconfigured.)
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
if test "X$rpathdirs" != "X"; then
|
||||
if test -n "$hardcode_libdir_separator"; then
|
||||
dnl Weird platform: only the last -rpath option counts, the user must
|
||||
dnl pass all path elements in one option. We can arrange that for a
|
||||
dnl single library, but not when more than one $LIBNAMEs are used.
|
||||
alldirs=
|
||||
for found_dir in $rpathdirs; do
|
||||
alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
|
||||
done
|
||||
dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
|
||||
acl_save_libdir="$libdir"
|
||||
libdir="$alldirs"
|
||||
eval flag=\"$hardcode_libdir_flag_spec\"
|
||||
libdir="$acl_save_libdir"
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
|
||||
else
|
||||
dnl The -rpath options are cumulative.
|
||||
for found_dir in $rpathdirs; do
|
||||
acl_save_libdir="$libdir"
|
||||
libdir="$found_dir"
|
||||
eval flag=\"$hardcode_libdir_flag_spec\"
|
||||
libdir="$acl_save_libdir"
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if test "X$ltrpathdirs" != "X"; then
|
||||
dnl When using libtool, the option that works for both libraries and
|
||||
dnl executables is -R. The -R options are cumulative.
|
||||
for found_dir in $ltrpathdirs; do
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
|
||||
dnl unless already present in VAR.
|
||||
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
|
||||
dnl contains two or three consecutive elements that belong together.
|
||||
AC_DEFUN([AC_LIB_APPENDTOVAR],
|
||||
[
|
||||
for element in [$2]; do
|
||||
haveit=
|
||||
for x in $[$1]; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X$element"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
[$1]="${[$1]}${[$1]:+ }$element"
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
# lib-ld.m4 serial 3 (gettext-0.13)
|
||||
dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Subroutines of libtool.m4,
|
||||
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
|
||||
dnl with libtool.m4.
|
||||
|
||||
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
|
||||
AC_DEFUN([AC_LIB_PROG_LD_GNU],
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
case `$LD -v 2>&1 </dev/null` in
|
||||
*GNU* | *'with BFD'*)
|
||||
acl_cv_prog_gnu_ld=yes ;;
|
||||
*)
|
||||
acl_cv_prog_gnu_ld=no ;;
|
||||
esac])
|
||||
with_gnu_ld=$acl_cv_prog_gnu_ld
|
||||
])
|
||||
|
||||
dnl From libtool-1.4. Sets the variable LD.
|
||||
AC_DEFUN([AC_LIB_PROG_LD],
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
# Prepare PATH_SEPARATOR.
|
||||
# The user is always right.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
echo "#! /bin/sh" >conf$$.sh
|
||||
echo "exit 0" >>conf$$.sh
|
||||
chmod +x conf$$.sh
|
||||
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
|
||||
PATH_SEPARATOR=';'
|
||||
else
|
||||
PATH_SEPARATOR=:
|
||||
fi
|
||||
rm -f conf$$.sh
|
||||
fi
|
||||
ac_prog=ld
|
||||
if test "$GCC" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
case $host in
|
||||
*-*-mingw*)
|
||||
# gcc leaves a trailing carriage return which upsets mingw
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
|
||||
*)
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
|
||||
esac
|
||||
case $ac_prog in
|
||||
# Accept absolute paths.
|
||||
[[\\/]* | [A-Za-z]:[\\/]*)]
|
||||
[re_direlt='/[^/][^/]*/\.\./']
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(acl_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
acl_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
|
||||
*GNU* | *'with BFD'*)
|
||||
test "$with_gnu_ld" != no && break ;;
|
||||
*)
|
||||
test "$with_gnu_ld" != yes && break ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
acl_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$acl_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_LIB_PROG_LD_GNU
|
||||
])
|
||||
|
||||
dnl Macro: anope_CHECK_TYPE_SIZES
|
||||
dnl
|
||||
dnl Check the size of several types and define a valid int16_t and int32_t.
|
||||
dnl
|
||||
AC_DEFUN(anope_CHECK_TYPE_SIZES,
|
||||
[dnl Check type sizes
|
||||
dnl AC_CHECK_SIZEOF(short)
|
||||
dnl AC_CHECK_SIZEOF(int)
|
||||
dnl AC_CHECK_SIZEOF(long)
|
||||
dnl if test "$ac_cv_sizeof_int" = 2 ; then
|
||||
dnl AC_CHECK_TYPE(int16_t, int)
|
||||
dnl AC_CHECK_TYPE(u_int16_t, unsigned int)
|
||||
dnl elif test "$ac_cv_sizeof_short" = 2 ; then
|
||||
dnl AC_CHECK_TYPE(int16_t, short)
|
||||
dnl AC_CHECK_TYPE(u_int16_t, unsigned short)
|
||||
dnl else
|
||||
dnl AC_MSG_ERROR([Cannot find a type with size of 16 bits])
|
||||
dnl fi
|
||||
dnl if test "$ac_cv_sizeof_int" = 4 ; then
|
||||
dnl AC_CHECK_TYPE(int32_t, int)
|
||||
dnl AC_CHECK_TYPE(u_int32_t, unsigned int)
|
||||
dnl elif test "$ac_cv_sizeof_short" = 4 ; then
|
||||
dnl AC_CHECK_TYPE(int32_t, short)
|
||||
dnl AC_CHECK_TYPE(u_int32_t, unsigned short)
|
||||
dnl elif test "$ac_cv_sizeof_long" = 4 ; then
|
||||
dnl AC_CHECK_TYPE(int32_t, long)
|
||||
dnl AC_CHECK_TYPE(u_int32_t, unsigned long)
|
||||
dnl else
|
||||
dnl AC_MSG_ERROR([Cannot find a type with size of 32 bits])
|
||||
dnl fi
|
||||
AC_CHECK_TYPE(uint8_t, AC_DEFINE(HAVE_UINT8_T, 1, "Has uint8_t type"))
|
||||
AC_CHECK_TYPE(u_int8_t, AC_DEFINE(HAVE_U_INT8_T, 1, "Has u_int8_t type"))
|
||||
AC_CHECK_TYPE(int16_t, AC_DEFINE(HAVE_INT16_T, 1, "Has int16_t type"))
|
||||
AC_CHECK_TYPE(uint16_t, AC_DEFINE(HAVE_UINT16_T, 1, "Has uint16_t type"))
|
||||
AC_CHECK_TYPE(u_int16_t, AC_DEFINE(HAVE_U_INT16_T, 1, "Has u_int16_t type"))
|
||||
AC_CHECK_TYPE(int32_t, AC_DEFINE(HAVE_INT32_T, 1, "Has int32_t type"))
|
||||
AC_CHECK_TYPE(uint32_t, AC_DEFINE(HAVE_UINT32_T, 1, "Has uint32_t type"))
|
||||
AC_CHECK_TYPE(u_int32_t, AC_DEFINE(HAVE_U_INT32_T, 1, "Has u_int32_t type"))
|
||||
])
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
dnl Macro: anope_CHECK_TYPE_SIZES
|
||||
dnl
|
||||
dnl Check the size of several types and define a valid int16_t and int32_t.
|
||||
dnl
|
||||
AC_DEFUN(anope_CHECK_TYPE_SIZES,
|
||||
[dnl Check type sizes
|
||||
dnl AC_CHECK_SIZEOF(short)
|
||||
dnl AC_CHECK_SIZEOF(int)
|
||||
dnl AC_CHECK_SIZEOF(long)
|
||||
dnl if test "$ac_cv_sizeof_int" = 2 ; then
|
||||
dnl AC_CHECK_TYPE(int16_t, int)
|
||||
dnl AC_CHECK_TYPE(u_int16_t, unsigned int)
|
||||
dnl elif test "$ac_cv_sizeof_short" = 2 ; then
|
||||
dnl AC_CHECK_TYPE(int16_t, short)
|
||||
dnl AC_CHECK_TYPE(u_int16_t, unsigned short)
|
||||
dnl else
|
||||
dnl AC_MSG_ERROR([Cannot find a type with size of 16 bits])
|
||||
dnl fi
|
||||
dnl if test "$ac_cv_sizeof_int" = 4 ; then
|
||||
dnl AC_CHECK_TYPE(int32_t, int)
|
||||
dnl AC_CHECK_TYPE(u_int32_t, unsigned int)
|
||||
dnl elif test "$ac_cv_sizeof_short" = 4 ; then
|
||||
dnl AC_CHECK_TYPE(int32_t, short)
|
||||
dnl AC_CHECK_TYPE(u_int32_t, unsigned short)
|
||||
dnl elif test "$ac_cv_sizeof_long" = 4 ; then
|
||||
dnl AC_CHECK_TYPE(int32_t, long)
|
||||
dnl AC_CHECK_TYPE(u_int32_t, unsigned long)
|
||||
dnl else
|
||||
dnl AC_MSG_ERROR([Cannot find a type with size of 32 bits])
|
||||
dnl fi
|
||||
AC_CHECK_TYPE(uint8_t, AC_DEFINE(HAVE_UINT8_T, 1, "Has uint8_t type"))
|
||||
AC_CHECK_TYPE(u_int8_t, AC_DEFINE(HAVE_U_INT8_T, 1, "Has u_int8_t type"))
|
||||
AC_CHECK_TYPE(int16_t, AC_DEFINE(HAVE_INT16_T, 1, "Has int16_t type"))
|
||||
AC_CHECK_TYPE(uint16_t, AC_DEFINE(HAVE_UINT16_T, 1, "Has uint16_t type"))
|
||||
AC_CHECK_TYPE(u_int16_t, AC_DEFINE(HAVE_U_INT16_T, 1, "Has u_int16_t type"))
|
||||
AC_CHECK_TYPE(int32_t, AC_DEFINE(HAVE_INT32_T, 1, "Has int32_t type"))
|
||||
AC_CHECK_TYPE(uint32_t, AC_DEFINE(HAVE_UINT32_T, 1, "Has uint32_t type"))
|
||||
AC_CHECK_TYPE(u_int32_t, AC_DEFINE(HAVE_U_INT32_T, 1, "Has u_int32_t type"))
|
||||
])
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Generating build information using aclocal, autoheader, automake and autoconf."
|
||||
echo
|
||||
|
||||
# Regerate configuration files
|
||||
aclocal
|
||||
autoheader
|
||||
automake --gnu --add-missing --copy
|
||||
autoconf
|
||||
|
||||
echo
|
||||
echo "Now you are ready to run ./configure"
|
||||
@@ -359,22 +359,24 @@ macro(find_includes SRC INCLUDES)
|
||||
endmacro(find_includes)
|
||||
|
||||
###############################################################################
|
||||
# calculate_depends(<source filename> [<optional output variable for includes>])
|
||||
# calculate_depends(<source filename> <output variable set to TRUE on fail> [<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)
|
||||
# Temporarily set that we didn't get a 2nd argument before we actually check if we did get one or not
|
||||
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
|
||||
set(CHECK_ANGLE_INCLUDES FALSE)
|
||||
# Check for a second argument
|
||||
if(${ARGC} GREATER 1)
|
||||
# Check for a third argument
|
||||
if(${ARGC} GREATER 2)
|
||||
set(CHECK_ANGLE_INCLUDES TRUE)
|
||||
endif(${ARGC} GREATER 1)
|
||||
endif(${ARGC} GREATER 2)
|
||||
# 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
|
||||
set(HEADERS)
|
||||
# Reset skip
|
||||
set(${SKIP} FALSE)
|
||||
# Iterate through the strings containing #include (if any)
|
||||
foreach(INCLUDE ${INCLUDES})
|
||||
# Extract the filename from the #include line
|
||||
@@ -384,21 +386,22 @@ macro(calculate_depends SRC)
|
||||
if(CHECK_ANGLE_INCLUDES)
|
||||
# Find the path of the include file
|
||||
if(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include)
|
||||
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include ${EXTRA_INCLUDE})
|
||||
else(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME})
|
||||
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} ${EXTRA_INCLUDE})
|
||||
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)
|
||||
if(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
find_in_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)
|
||||
find_in_list(${ARGV2} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)
|
||||
if(FOUND_IN_INCLUDES EQUAL -1)
|
||||
append_to_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}")
|
||||
append_to_list(${ARGV2} "${FOUND_${FILENAME}_INCLUDE}")
|
||||
endif(FOUND_IN_INCLUDES EQUAL -1)
|
||||
endif(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
else(FOUND_${FILENAME}_INCLUDE)
|
||||
message(FATAL_ERROR "${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.")
|
||||
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.")
|
||||
endif(FOUND_${FILENAME}_INCLUDE)
|
||||
endif(CHECK_ANGLE_INCLUDES)
|
||||
endif(QUOTE_TYPE STREQUAL "angle brackets")
|
||||
@@ -406,12 +409,12 @@ macro(calculate_depends SRC)
|
||||
endmacro(calculate_depends)
|
||||
|
||||
###############################################################################
|
||||
# calculate_libraries(<source filename> <output variable for linker flags> <output variable for extra depends>)
|
||||
# calculate_libraries(<source filename> <output variable set to TRUE on fail> <output variable for linker flags> <output variable for extra depends>)
|
||||
#
|
||||
# This macro is used in most of the src (sub)directories to calculate the
|
||||
# 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 SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
macro(calculate_libraries SRC SKIP SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
# Set up a temporary LDFLAGS for this file
|
||||
set(THIS_LDFLAGS "${LDFLAGS}")
|
||||
# Reset extra dependencies
|
||||
@@ -420,6 +423,8 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
set(LIBRARY_PATHS)
|
||||
# Reset libraries
|
||||
set(LIBRARIES)
|
||||
# Default to not skipping this file
|
||||
set(${SKIP} FALSE)
|
||||
# Check to see if there are any lines matching: /* RequiredLibraries: [something] */
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
|
||||
# Iterate through those lines
|
||||
@@ -432,9 +437,9 @@ macro(calculate_libraries SRC 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)
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE})
|
||||
else(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY})
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${EXTRA_INCLUDE})
|
||||
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)
|
||||
@@ -449,34 +454,68 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
append_to_list(LIBRARIES "${LIBRARY}")
|
||||
endif(MSVC)
|
||||
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(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.")
|
||||
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.")
|
||||
endif(FOUND_${LIBRARY}_LIBRARY)
|
||||
endforeach(LIBRARY)
|
||||
endforeach(REQUIRED_LIBRARY)
|
||||
# Remove duplicates from the library paths
|
||||
if(LIBRARY_PATHS)
|
||||
remove_list_duplicates(LIBRARY_PATHS)
|
||||
endif(LIBRARY_PATHS)
|
||||
# Remove diplicates from the libraries
|
||||
if(LIBRARIES)
|
||||
remove_list_duplicates(LIBRARIES)
|
||||
endif(LIBRARIES)
|
||||
# Iterate through library paths and add them to the linker flags
|
||||
foreach(LIBRARY_PATH ${LIBRARY_PATHS})
|
||||
find_in_list(DEFAULT_LIBRARY_DIRS "${LIBRARY_PATH}" FOUND_IN_DEFAULTS)
|
||||
if(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
|
||||
endif(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
endforeach(LIBRARY_PATH)
|
||||
# Iterate through libraries and add them to the linker flags
|
||||
foreach(LIBRARY ${LIBRARIES})
|
||||
set(THIS_LDFLAGS "${THIS_LDFLAGS} -l${LIBRARY}")
|
||||
endforeach(LIBRARY)
|
||||
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
|
||||
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
|
||||
if(NOT ${SKIP})
|
||||
# Remove duplicates from the library paths
|
||||
if(LIBRARY_PATHS)
|
||||
remove_list_duplicates(LIBRARY_PATHS)
|
||||
endif(LIBRARY_PATHS)
|
||||
# Remove diplicates from the libraries
|
||||
if(LIBRARIES)
|
||||
remove_list_duplicates(LIBRARIES)
|
||||
endif(LIBRARIES)
|
||||
# Iterate through library paths and add them to the linker flags
|
||||
foreach(LIBRARY_PATH ${LIBRARY_PATHS})
|
||||
find_in_list(DEFAULT_LIBRARY_DIRS "${LIBRARY_PATH}" FOUND_IN_DEFAULTS)
|
||||
if(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
|
||||
endif(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
endforeach(LIBRARY_PATH)
|
||||
# Iterate through libraries and add them to the linker flags
|
||||
foreach(LIBRARY ${LIBRARIES})
|
||||
set(THIS_LDFLAGS "${THIS_LDFLAGS} -l${LIBRARY}")
|
||||
endforeach(LIBRARY)
|
||||
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
|
||||
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
|
||||
endif(NOT ${SKIP})
|
||||
endmacro(calculate_libraries)
|
||||
|
||||
###############################################################################
|
||||
# check_functions(<source filename> <output variable set to TRUE on success>)
|
||||
#
|
||||
# This macro is used in most of the module (sub)directories to calculate the
|
||||
# fcuntion dependencies for the given source file.
|
||||
###############################################################################
|
||||
macro(check_functions SRC SUCCESS)
|
||||
# Default to true
|
||||
set(${SUCCESS} TRUE)
|
||||
# Check to see if there are any lines matching: /* RequiredFunctions: [something] */
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredFunctions:[ \t]*.*[ \t]*\\\\*/" REQUIRED_FUNCTIONS)
|
||||
# Iterate through those lines
|
||||
foreach(REQUIRED_FUNCTION ${REQUIRED_FUNCTIONS})
|
||||
# Strip off the /* RequiredFunctions: and */ from the line
|
||||
string(REGEX REPLACE "/\\*[ \t]*RequiredFunctions:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_FUNCTION ${REQUIRED_FUNCTION})
|
||||
# Replace all commas with semicolons
|
||||
string(REGEX REPLACE "," ";" REQUIRED_FUNCTION ${REQUIRED_FUNCTION})
|
||||
# Iterate through the functions given
|
||||
foreach(FUNCTION ${REQUIRED_FUNCTION})
|
||||
# Check if the function exists
|
||||
check_function_exists(${REQUIRED_FUNCTION} HAVE_${REQUIRED_FUNCTION})
|
||||
# If we don't have the function warn the user and set SUCCESS to FALSE
|
||||
if(NOT HAVE_${REQUIRED_FUNCTION})
|
||||
message("${SRC} needs function ${REQUIRED_FUNCTION} but we were unable to locate that function!")
|
||||
set(${SUCCESS} FALSE)
|
||||
endif(NOT HAVE_${REQUIRED_FUNCTION})
|
||||
endforeach(FUNCTION)
|
||||
endforeach(REQUIRED_FUNCTION)
|
||||
endmacro(check_functions)
|
||||
|
||||
###############################################################################
|
||||
# add_to_cpack_ignored_files(<item> [TRUE])
|
||||
#
|
||||
@@ -0,0 +1,33 @@
|
||||
# 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_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_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)
|
||||
endif(GETTEXT_INCLUDE AND GETTEXT_MSGFMT AND ICONV_LIBRARY AND MINGWEX_LIBRARY AND GCC_LIBRARY)
|
||||
endif(NOT WIN32)
|
||||
|
||||
# If we found everything we need set variables correctly for lang/CMakeLists.txt to use
|
||||
if(GETTEXT_FOUND)
|
||||
include_directories("${GETTEXT_INCLUDE}")
|
||||
set(GETTEXT_MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT})
|
||||
|
||||
if(WIN32)
|
||||
set(GETTEXT_LIBRARIES libiconv libintl libmingwex libgcc)
|
||||
else(WIN32)
|
||||
if(GETTEXT_LIBRARY)
|
||||
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
|
||||
endif(GETTEXT_LIBRARY)
|
||||
endif(WIN32)
|
||||
endif(GETTEXT_FOUND)
|
||||
Vendored
-1526
File diff suppressed because it is too large
Load Diff
Vendored
-1662
File diff suppressed because it is too large
Load Diff
-245
@@ -1,245 +0,0 @@
|
||||
dnl autoconf.in for Services.
|
||||
dnl
|
||||
dnl Anope (c) 2003-2010 Anope team
|
||||
dnl Contact us at team@anope.org
|
||||
|
||||
dnl This program is free but copyrighted software; see the file COPYING for
|
||||
dnl details.
|
||||
|
||||
dnl Based heavily on the Unreal configure.in script, and extra thanks to
|
||||
dnl codemastr from UnrealIRCD.
|
||||
|
||||
AC_INIT
|
||||
|
||||
# Clear out any CFLAGS (cept -g) the os is using, usually -g -O2
|
||||
CFLAGS="-g"
|
||||
|
||||
# If no bindir, we tell him to run ./Config.
|
||||
if test "${with_instdir+set}" != set; then
|
||||
echo "You might want to run ./Config or provide some parameters to this script."
|
||||
echo "./configure --help for information about this script"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
AC_CONFIG_SRCDIR([src/actions.c])
|
||||
AC_CONFIG_HEADER(include/sysconf.h)
|
||||
AC_PROG_CC
|
||||
if test "$ac_cv_c_compiler_gnu" = "yes"; then
|
||||
# CFLAGS="$CFLAGS -funsigned-char"
|
||||
AC_CACHE_CHECK(if gcc has a working -pipe, ac_cv_pipe, [
|
||||
save_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ac_cv_pipe="yes"],[ac_cv_pipe="no"])
|
||||
CFLAGS="$save_cflags"
|
||||
])
|
||||
if test "$ac_cv_pipe" = "yes"; then
|
||||
CFLAGS="-pipe $CFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl CFLAGS="$CFLAGS -W -Wall"
|
||||
|
||||
AC_PATH_PROG(RM,rm)
|
||||
AC_PATH_PROG(CP,cp)
|
||||
AC_PATH_PROG(TOUCH,touch)
|
||||
AC_PATH_PROG(INSTALL,install)
|
||||
AC_CHECK_LIB(nsl,inet_ntoa,ANOPELIBS="$ANOPELIBS-lnsl ")
|
||||
AC_CHECK_LIB(socket, socket,ANOPELIBS="$ANOPELIBS-lsocket ")
|
||||
AC_CHECK_LIB(resolv, res_query,ANOPELIBS="$ANOPELIBS-lresolv ")
|
||||
AC_CHECK_LIB(bsd, revoke,ANOPELIBS="$ANOPELIBS-lbsd ")
|
||||
|
||||
dnl Does this platform require array notation to assign to a va_list?
|
||||
dnl If cross-compiling, we assume va_list is "normal". If this breaks
|
||||
dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
|
||||
dnl also just to be sure.
|
||||
|
||||
dnl NOTE: this autoconf test is taken from mozilla: www.mozilla.org.
|
||||
|
||||
AC_MSG_CHECKING(whether va_list assignments need array notation)
|
||||
AC_CACHE_VAL(ac_cv_valistisarray,
|
||||
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
void foo(int i, ...) {
|
||||
va_list ap1, ap2;
|
||||
va_start(ap1, i);
|
||||
ap2 = ap1;
|
||||
if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123) { exit(1); }
|
||||
va_end(ap1); va_end(ap2);
|
||||
}
|
||||
int main()
|
||||
{ foo(0, 123); return(0); }]])],[ac_cv_valistisarray=false],[ac_cv_valistisarray=true],[ac_cv_valistisarray=false])])
|
||||
|
||||
if test "$ac_cv_valistisarray" = true ; then
|
||||
AC_DEFINE(HAVE_VA_LIST_AS_ARRAY,[1],[va_list as array])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether this is a bit or little endian system)
|
||||
AC_TRY_RUN([
|
||||
int main()
|
||||
{
|
||||
short s = 1;
|
||||
short* ptr = &s;
|
||||
unsigned char c = *((char*)ptr);
|
||||
return c;
|
||||
}
|
||||
]
|
||||
, AC_DEFINE(BIG_ENDIAN)
|
||||
AC_MSG_RESULT(big)
|
||||
, AC_DEFINE(LITTLE_ENDIAN)
|
||||
AC_MSG_RESULT(little)
|
||||
)
|
||||
|
||||
AC_SUBST(ANOPELIBS)
|
||||
AC_SUBST(LDFLAGS)
|
||||
|
||||
AC_CHECK_HEADER(sys/types.h,AC_DEFINE(HAS_SYS_TYPES_H,1,"Has sys/types.h"))
|
||||
dnl module checking based on Unreal's module checking code
|
||||
AC_DEFUN(AC_ENABLE_DYN,
|
||||
[
|
||||
AC_CHECK_FUNC(dlopen,, AC_CHECK_LIB(dl,dlopen,[
|
||||
ANOPELIBS="$ANOPELIBS -ldl"
|
||||
],
|
||||
[
|
||||
AC_ERROR("dlopen() is required for Anope to be compiled and used. Sorry.")
|
||||
]))
|
||||
|
||||
hold_cflags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -export-dynamic"
|
||||
AC_CACHE_CHECK(if we need the -export-dynamic flag, ac_cv_export_dynamic, [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[ac_cv_export_dynamic=yes],[ac_cv_export_dynamic=no])])
|
||||
if test "$ac_cv_export_dynamic" = "no"; then
|
||||
CFLAGS=$hold_cflags
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(for compiler option to produce PIC,ac_cv_pic,[
|
||||
if test "$ac_cv_c_compiler_gnu" = "yes"; then
|
||||
ac_cv_pic="-fPIC -DPIC -shared"
|
||||
case `uname -s` in
|
||||
Darwin*[)]
|
||||
ac_cv_pic="-bundle -flat_namespace -undefined suppress"
|
||||
;;
|
||||
HP-UX*[)]
|
||||
ac_cv_pic="-fPIC"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
case `uname -s` in
|
||||
SunOS*[)]
|
||||
ac_cv_pic="-KPIC -DPIC -G"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c_compiler_gnu" = "yes"; then
|
||||
case `uname -s` in
|
||||
Darwin*[)]
|
||||
SHARED="-bundle -flat_namespace -undefined suppress"
|
||||
AC_SUBST(SHARED)
|
||||
;;
|
||||
*[)]
|
||||
SHARED="-shared"
|
||||
AC_SUBST(SHARED)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(if your system prepends an underscore on symbols,ac_cv_underscore,[
|
||||
cat >uscore.c << __EOF__
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
__EOF__
|
||||
$CC -o uscore $CFLAGS uscore.c 1>&5
|
||||
if test -z "`strings -a uscore |grep '^_main$'`"; then
|
||||
ac_cv_underscore=no
|
||||
else
|
||||
ac_cv_underscore=yes
|
||||
fi
|
||||
|
||||
rm -f uscore uscore.c
|
||||
])
|
||||
if test "$ac_cv_underscore" = "yes"; then
|
||||
AC_DEFINE(DL_PREFIX,"_","Underscore needed for dlopen")
|
||||
else
|
||||
AC_DEFINE(DL_PREFIX,"","No prefix needed for dlopen")
|
||||
fi
|
||||
|
||||
MODULEFLAGS=$ac_cv_pic
|
||||
AC_SUBST(MODULEFLAGS)
|
||||
])
|
||||
|
||||
AC_ENABLE_DYN
|
||||
anope_CHECK_TYPE_SIZES
|
||||
|
||||
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H,1,""))
|
||||
AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H,1,""))
|
||||
|
||||
AC_CHECK_FUNCS(backtrace,AC_DEFINE(HAVE_BACKTRACE,1))
|
||||
AC_CHECK_FUNCS(stricmp,AC_DEFINE(HAVE_STRICMP,1))
|
||||
AC_CHECK_FUNCS(strcasecmp,AC_DEFINE(HAVE_STRCASECMP,1))
|
||||
AC_CHECK_FUNCS(gettimeofday,AC_DEFINE(HAVE_GETTIMEOFDAY,1))
|
||||
AC_CHECK_FUNCS(setgrent,AC_DEFINE(HAVE_SETGRENT,1))
|
||||
AC_CHECK_FUNCS(umask,AC_DEFINE(HAVE_UMASK,1))
|
||||
AC_CHECK_FUNCS(fork,AC_DEFINE(HAVE_FORK,1))
|
||||
AC_CHECK_FUNCS(gethostbyname,AC_DEFINE(HAVE_GETHOSTBYNAME,1))
|
||||
AC_CHECK_FUNCS(gethostbyname_r,AC_DEFINE(HAVE_GETHOSTBYNAME_R,1))
|
||||
AC_CHECK_FUNCS(strlcpy,AC_DEFINE(HAVE_STRLCPY,1))
|
||||
AC_CHECK_FUNCS(strlcat,AC_DEFINE(HAVE_STRLCAT,1))
|
||||
|
||||
AC_ARG_WITH(rungroup, [ --with-rungroup=group Specify the rungroup for anope], [
|
||||
AC_DEFINE_UNQUOTED(RUNGROUP,"$withval","Run group")
|
||||
RUNGROUP=$withval
|
||||
])
|
||||
|
||||
AC_SUBST(RUNGROUP)
|
||||
|
||||
dnl AC_DEFINE_UNQUOTED(MYOSNAME,"`uname -a`","uname")
|
||||
|
||||
AC_ARG_WITH(permissions, [ --with-permissions=permissions Specify the default permissions for anope], AC_DEFINE_UNQUOTED(DEFUMASK,$withval,"Default umask permissions"), AC_DEFINE(DEFUMASK, 007,"Default umask Permissions"))
|
||||
|
||||
AC_ARG_WITH(instdir, [ --with-instdir=instdir Specify the default install dir for anope], [
|
||||
INSTDIR=$withval
|
||||
])
|
||||
|
||||
MAKEBIN=`pwd`/run-cc.pl
|
||||
|
||||
AC_ARG_WITH(makebin, [ --with-makebin=run-cc.pl Specify the default make binary to use],[MAKEBIN=$withval])
|
||||
|
||||
MYSQLDIR=/usr/local/
|
||||
AC_ARG_WITH(mysqlpp, [ --with-mysqlpp=/usr/local/ The base directory of the MySQL++ installation],[MYSQLDIR=$withval])
|
||||
|
||||
AC_SUBST(INSTDIR)
|
||||
AC_SUBST(MAKEBIN)
|
||||
AC_SUBST(MYSQLDIR)
|
||||
|
||||
AC_ARG_WITH(optimization, [ --with-optimization=1|2|3|4|5 Specify the optimization level], [
|
||||
CFLAGS="$CFLAGS -O$withval"
|
||||
])
|
||||
|
||||
AC_ARG_WITH(debugsym, [ --with-debugsym Include debugging symbols], [
|
||||
CFLAGS="$CFLAGS -g"
|
||||
])
|
||||
|
||||
|
||||
AC_CONFIG_FILES( \
|
||||
Makefile \
|
||||
src/bin/anoperc \
|
||||
)
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
cat <<EOT
|
||||
|
||||
$DIS_MODULES
|
||||
|
||||
|
||||
All done! Now run "make" (or possibly "gmake") to compile Anope.
|
||||
See the INSTALL, README and FAQ files if you have any problems.
|
||||
EOT
|
||||
|
||||
+1
-1
@@ -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 example.conf tables.sql)
|
||||
set(DATA example.chk example.conf mysql/tables.sql)
|
||||
install(FILES ${DATA}
|
||||
DESTINATION data
|
||||
)
|
||||
|
||||
+963
-304
File diff suppressed because it is too large
Load Diff
@@ -1,174 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* (C) 2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** Object representing a MySQL query
|
||||
*/
|
||||
class MySQLQuery
|
||||
{
|
||||
/* Our query */
|
||||
private $Query;
|
||||
/* The result */
|
||||
private $Result;
|
||||
/* Socket used to connect to MySQL */
|
||||
private $MysqlSock;
|
||||
|
||||
/** Constructor
|
||||
* @param MysqlSock The MySQL socket
|
||||
*/
|
||||
function __construct($MysqlSock)
|
||||
{
|
||||
$this->MysqlSock = $MysqlSock;
|
||||
}
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
function __destruct()
|
||||
{
|
||||
}
|
||||
|
||||
/** Execute a query
|
||||
* @return true or false
|
||||
*/
|
||||
private function Execute()
|
||||
{
|
||||
$Res = mysql_query($this->Query, $this->MysqlSock);
|
||||
$this->Result = array();
|
||||
|
||||
if (!empty($Res))
|
||||
{
|
||||
while (($Result = @mysql_fetch_assoc($Res)))
|
||||
{
|
||||
$this->Result[] = $Result;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Get the result for the query
|
||||
* @return The result
|
||||
*/
|
||||
public function Result()
|
||||
{
|
||||
return $this->Result;
|
||||
}
|
||||
|
||||
/** Execute a query
|
||||
* @param A formatted string
|
||||
* @param ... Args
|
||||
* @return true or false
|
||||
*/
|
||||
public function Query($String, $P1 = NULL, $P2 = NULL, $P3 = NULL, $P4 = NULL, $P5 = NULL, $P6 = NULL, $P7 = NULL,
|
||||
$P8 = NULL, $P9 = NULL, $P10 = NULL, $P11 = NULL, $P12 = NULL, $P13 = NULL, $P14 = NULL)
|
||||
{
|
||||
$this->Query = sprintf($String, $P1, $P2, $P3, $P4, $P5, $P6, $P7, $P8, $P9, $P10, $P11, $P12, $P13, $P14);
|
||||
return $this->Execute();
|
||||
|
||||
}
|
||||
|
||||
/** Escape a string to by MySQL safe
|
||||
* @return A new, MySQL safe string
|
||||
*/
|
||||
public function Escape($String)
|
||||
{
|
||||
return mysql_real_escape_string($String, $this->MysqlSock);
|
||||
}
|
||||
}
|
||||
|
||||
/** Main Anope class
|
||||
*/
|
||||
class Anope
|
||||
{
|
||||
/* Socket used to connect to MySQL */
|
||||
private $MysqlSock;
|
||||
/* True if we were able to connect successfully */
|
||||
private $Connected;
|
||||
|
||||
/** Constructor
|
||||
* @param MysqlHost The host of the MySQLd server, port can be included on this too
|
||||
* @param MysqlUser The username to authenticate to MySQL with
|
||||
* @param MysqlPassword The password to authenticate with
|
||||
* @param MysqlDatabase The name of the Anope database
|
||||
*/
|
||||
function __construct($MysqlHost, $MysqlUser, $MysqlPassword, $MysqlDatabase)
|
||||
{
|
||||
$this->Connected = false;
|
||||
$this->MysqlSock = @mysql_connect($MysqlHost, $MysqlUser, $MysqlPassword);
|
||||
if ($this->MysqlSock)
|
||||
$this->Connected = @mysql_select_db($MysqlDatabase, $this->MysqlSock);
|
||||
}
|
||||
|
||||
/** Destructor
|
||||
* Closes the connection to the MySQL server
|
||||
*/
|
||||
function __destruct()
|
||||
{
|
||||
if ($this->MysqlSock)
|
||||
@mysql_close($this->MysqlSock);
|
||||
}
|
||||
|
||||
/** Check if we are connected successfully
|
||||
* @return true or false
|
||||
*/
|
||||
public function Connected()
|
||||
{
|
||||
return $this->Connected;
|
||||
}
|
||||
|
||||
/** Retrieve a new query object
|
||||
* @return A new Query object
|
||||
*/
|
||||
public function Query()
|
||||
{
|
||||
return new MySQLQuery($this->MysqlSock);
|
||||
}
|
||||
|
||||
/** Anope Functions **/
|
||||
|
||||
/** Execute a command in Anope
|
||||
* For more information read docs/MYSQL
|
||||
* @param Nick The nickname to execute the command from
|
||||
* @param Service The service to execute the command on
|
||||
* @param Command The command to execute
|
||||
*/
|
||||
public function Command($Nick, $Service, $Command)
|
||||
{
|
||||
$Query = $this->Query();
|
||||
return $Query->Query("INSERT DELAYED INTO `anope_commands` (nick, service, command) VALUES('%s', '%s', '%s')", $Query->Escape($Nick), $Query->Escape($Service), $Query->Escape($Command));
|
||||
}
|
||||
|
||||
/** Register a nick
|
||||
* @param Nick The nick to be registered
|
||||
* @param Password The password
|
||||
* @param Email The email address to use, defaults to NULL
|
||||
* @param Returns a message confirming or denying the registration process
|
||||
*/
|
||||
public function Register($Nick, $Password, $Email = NULL)
|
||||
{
|
||||
$Query = $this->Query();
|
||||
$Query->Query("SELECT nick FROM `anope_ns_alias` WHERE `nick` = '%s'", $Query->Escape($Nick));
|
||||
$Result = $Query->Result();
|
||||
if (isset($Result[0]['nick']))
|
||||
{
|
||||
return "Nickname already registered";
|
||||
}
|
||||
|
||||
if ($this->Command($Nick, "NickServ", "REGISTER ".$Password." ".$Email))
|
||||
{
|
||||
return "Nick registration successful. If your network has email registration enabled check your inbox for the next step of the registration process.";
|
||||
}
|
||||
|
||||
return "Error registering nick";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* (C) 2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* This is an example functional webpage showing how to use Anopes MySQL
|
||||
* Execute feature to register a nickname online
|
||||
*/
|
||||
|
||||
/* Include Anope's PHP API */
|
||||
include('Anope.php');
|
||||
|
||||
function IsValidEmail($Email)
|
||||
{
|
||||
return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email);
|
||||
}
|
||||
|
||||
if (!empty($_POST['nick']) && !empty($_POST['password1']) && !empty($_POST['password2']) && !empty($_POST['email']))
|
||||
{
|
||||
if ($_POST['password1'] != $_POST['password2'])
|
||||
{
|
||||
echo 'Passwords do not match';
|
||||
}
|
||||
else if (!IsValidEmail($_POST['email']))
|
||||
{
|
||||
echo 'Invalid email address';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create a new connection, arguments are hostname, username, password, and database name */
|
||||
$Anope = new Anope("localhost", "anope", "anoperules", "anope");
|
||||
/* Check if we connected */
|
||||
if (!$Anope->Connected())
|
||||
{
|
||||
echo "Error connecting to MySQL database";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $Anope->Register($_POST['nick'], $_POST['password1'], $_POST['email']);
|
||||
}
|
||||
die;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</br>
|
||||
<form method="post" action="Register.php">
|
||||
Nick: <input type="text" name="nick"></br>
|
||||
Password: <input type="password" name="password1"></br>
|
||||
Confirm Password: <input type="password" name="password2"></br>
|
||||
Email: <input type="text" name="email"></br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
@@ -0,0 +1,445 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 3.3.5
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Apr 28, 2011 at 07:08 PM
|
||||
-- Server version: 5.1.50
|
||||
-- PHP Version: 5.3.3-pl1-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` (
|
||||
`level` int(11) NOT NULL DEFAULT '0',
|
||||
`display` 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 '',
|
||||
UNIQUE KEY `channel` (`channel`,`display`)
|
||||
) 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,
|
||||
`forbidby` text NOT NULL,
|
||||
`forbidreason` 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,
|
||||
`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 '',
|
||||
`channelcount` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`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_akills`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `anope_os_akills` (
|
||||
`user` varchar(255) NOT NULL,
|
||||
`host` 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;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- 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',
|
||||
`akills_count` int(11) NOT NULL DEFAULT '0',
|
||||
`snlines_count` int(11) NOT NULL DEFAULT '0',
|
||||
`sqlines_count` int(11) NOT NULL DEFAULT '0',
|
||||
`szlines_count` int(11) 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(20) 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;
|
||||
|
||||
-386
@@ -1,386 +0,0 @@
|
||||
|
||||
-- If you need to create your db, uncomment the following lines.
|
||||
--
|
||||
-- CREATE DATABASE anope;
|
||||
-- USE anope;
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_extra'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_extra;
|
||||
CREATE TABLE anope_extra (
|
||||
data text NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_commands'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_commands;
|
||||
CREATE TABLE anope_commands (
|
||||
nick varchar(255) NOT NULL default '',
|
||||
service varchar(255) NOT NULL default '',
|
||||
command text NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_ns_core'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_ns_core;
|
||||
CREATE TABLE anope_ns_core (
|
||||
display varchar(255) NOT NULL default '',
|
||||
pass text NOT NULL,
|
||||
email text NOT NULL default '',
|
||||
greet text NOT NULL default '',
|
||||
icq int(10) unsigned NOT NULL default '0',
|
||||
url text NOT NULL default '',
|
||||
flags text NOT NULL default '',
|
||||
language smallint(5) unsigned NOT NULL default '0',
|
||||
channelcount smallint(5) unsigned NOT NULL default '0',
|
||||
memomax smallint(5) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (display)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_ns_core_metadata'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_ns_core_metadata;
|
||||
CREATE TABLE anope_ns_core_metadata (
|
||||
nick varchar(255) NOT NULL default '',
|
||||
name varchar(255) NOT NULL default '',
|
||||
value text NOT NULL default '',
|
||||
PRIMARY KEY (name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- ---------------------------------------------------------
|
||||
--
|
||||
-- Table structure for table 'anope_ns_alias'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_ns_alias;
|
||||
CREATE TABLE anope_ns_alias (
|
||||
nick varchar(255) NOT NULL default '',
|
||||
last_quit text NOT NULL,
|
||||
last_realname text NOT NULL,
|
||||
last_usermask 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 default '',
|
||||
display varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (nick)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_ns_alias_metadata'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_ns_alias_metadata;
|
||||
CREATE TABLE anope_ns_alias_metadata (
|
||||
nick varchar(255) NOT NULL default '',
|
||||
name varchar(255) NOT NULL default '',
|
||||
value text NOT NULL default '',
|
||||
PRIMARY KEY (name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_ns_access'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_ns_access;
|
||||
CREATE TABLE anope_ns_access (
|
||||
display varchar(255) NOT NULL default '',
|
||||
access varchar(160) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- ---------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_ns_request'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_ns_request;
|
||||
CREATE TABLE anope_ns_request (
|
||||
nick varchar(255) NOT NULL default '',
|
||||
passcode text NOT NULL,
|
||||
password text NOT NULL,
|
||||
email text NOT NULL,
|
||||
requested int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (nick)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_cs_access'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_cs_access;
|
||||
CREATE TABLE anope_cs_access (
|
||||
level int(11) NOT NULL default '0',
|
||||
display 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 '',
|
||||
UNIQUE KEY (channel,display)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_cs_akick'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_cs_akick;
|
||||
CREATE TABLE 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 default '',
|
||||
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=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_bs_badwords'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_bs_badwords;
|
||||
CREATE TABLE 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=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_cs_info'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_cs_info;
|
||||
CREATE TABLE anope_cs_info (
|
||||
name varchar(255) NOT NULL default '',
|
||||
founder text NOT NULL,
|
||||
successor text NOT NULL,
|
||||
descr text NOT NULL,
|
||||
url text NOT NULL,
|
||||
email 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 default '',
|
||||
forbidby text NOT NULL,
|
||||
forbidreason text NOT NULL,
|
||||
bantype smallint(6) NOT NULL default '0',
|
||||
mlock_on text NOT NULL default '',
|
||||
mlock_off text NOT NULL default '',
|
||||
mlock_params text NOT NULL default '',
|
||||
entry_message text NOT NULL,
|
||||
memomax smallint(5) unsigned NOT NULL default '0',
|
||||
botnick varchar(255) NOT NULL default '',
|
||||
botflags text NOT NULL default '',
|
||||
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=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_cs_info_metadata'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_cs_info_metadata;
|
||||
CREATE TABLE anope_cs_info_metadata (
|
||||
channel varchar(255) NOT NULL default '',
|
||||
name varchar(255) NOT NULL default '',
|
||||
value text NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_cs_levels'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_cs_levels;
|
||||
CREATE TABLE 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=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_cs_ttb'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_cs_ttb;
|
||||
CREATE TABLE 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=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_bs_core'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_bs_core;
|
||||
CREATE TABLE anope_bs_core (
|
||||
nick varchar(255) NOT NULL default '',
|
||||
user varchar(255) NOT NULL default '',
|
||||
host text NOT NULL default '',
|
||||
rname text NOT NULL default '',
|
||||
flags text NOT NULL default '',
|
||||
created int(10) unsigned NOT NULL default '0',
|
||||
chancount int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (nick)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_bs_info_metadata'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_bs_info_metadata;
|
||||
CREATE TABLE anope_bs_info_metadata (
|
||||
botname varchar(255) NOT NULL default '',
|
||||
name varchar(255) NOT NULL default '',
|
||||
value text NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_ms_info'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_ms_info;
|
||||
CREATE TABLE anope_ms_info (
|
||||
receiver varchar(255) NOT NULL,
|
||||
number int(11) NOT NULL default '0',
|
||||
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'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_os_akills'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_os_akills;
|
||||
CREATE TABLE anope_os_akills (
|
||||
user varchar(255) NOT NULL,
|
||||
host 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=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_os_core'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_os_core;
|
||||
CREATE TABLE anope_os_core (
|
||||
maxusercnt int(11) NOT NULL default '0',
|
||||
maxusertime int(10) unsigned NOT NULL default '0',
|
||||
akills_count int(11) NOT NULL default '0',
|
||||
sglines_count int(11) NOT NULL default '0',
|
||||
sqlines_count int(11) NOT NULL default '0',
|
||||
szlines_count int(11) NOT NULL default '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_os_exceptions'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_os_exceptions;
|
||||
CREATE TABLE 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=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_os_sxlines'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_os_sxlines;
|
||||
CREATE TABLE anope_os_sxlines (
|
||||
type varchar(20) 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=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_metadata'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_metadata;
|
||||
CREATE TABLE anope_metadata (
|
||||
name varchar(255) NOT NULL default '',
|
||||
value text NOT NULL default '',
|
||||
PRIMARY KEY (name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table 'anope_info'
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS anope_info;
|
||||
CREATE TABLE anope_info (
|
||||
version int(11) default NULL,
|
||||
date datetime default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
+3056
File diff suppressed because it is too large
Load Diff
Executable
+1
@@ -0,0 +1 @@
|
||||
git log --pretty=format:"Revision %h - %cD - %s" > version.log
|
||||
@@ -1,4 +1 @@
|
||||
Reported Bugs from Bugzilla: http://bugs.anope.org/
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
For all bug reports / updates please see http://bugs.anope.org
|
||||
|
||||
@@ -78,6 +78,11 @@ This is safer than C-style casting in that an invalid pointer conversion will
|
||||
return a NULL pointer, and an invalid reference conversion will throw a
|
||||
Bad_cast exception.
|
||||
|
||||
Note that in Anope we prefer if Anope::debug_cast is used.
|
||||
This uses dynamic_cast (and checks for a NULL pointer return) on debug builds
|
||||
and static_cast on release builds, to speed up the program beacuse of dynamic_cast's
|
||||
reliance on RTTI.
|
||||
|
||||
reinterpret_cast
|
||||
----------------
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ if(WIN32)
|
||||
# Add README.txt to list of files for CPack to ignore
|
||||
add_to_cpack_ignored_files("README.txt$" TRUE)
|
||||
endif(IN_SOURCE)
|
||||
set(DOCS DEFCON FAQ INSTALL MODULES NEWS PROXY ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
|
||||
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
|
||||
install(FILES ${DOCS}
|
||||
DESTINATION docs
|
||||
)
|
||||
|
||||
+209
-140
@@ -1,170 +1,239 @@
|
||||
Orginally pulled from: http://www.inspircd.org/wiki/Coding_Guidelines
|
||||
Yes, I'm aware the formatting of this document is ugly. It'll be fixed when someone cares. Read the wiki page if you want pretty for now.
|
||||
|
||||
---
|
||||
|
||||
|
||||
InspIRCd Coding Guidelines
|
||||
|
||||
The following are a set of guidelines for writing patches to InspIRCd, or for creating modules for distribution with the official package. These
|
||||
guidelines were written a time after InspIRCd development started, and so not all code yet follows these. This will be rectified with time.
|
||||
The following are a set of guidelines for writing patches to InspIRCd, or for
|
||||
creating modules for distribution with the official package. These guidelines
|
||||
were written a time after InspIRCd development started, and so not all code
|
||||
yet follows these. This will be rectified with time.
|
||||
|
||||
|
||||
1. Comments
|
||||
Multi Line
|
||||
Multiple line comments should follow the C-style comment, for example:
|
||||
/*
|
||||
* This is a multiple line comment, huzzah..
|
||||
*/
|
||||
|
||||
Single Line
|
||||
Single line comments should also be in the C style, for example:
|
||||
/* This is a boring one-line comment */
|
||||
* Multi Line
|
||||
Multiple line comments should follow the C-style comment, for example:
|
||||
/*
|
||||
* This is a multiple line comment, huzzah..
|
||||
*/
|
||||
|
||||
Doxygen commenting
|
||||
If you wish your comment to show in doxygen, the comment should be directly above the item you are documenting (a class, function, enum, etc)
|
||||
and the first line should be "/**". For example:
|
||||
/** This is a doxygen multiline comment.
|
||||
* Description of thingymebob here.
|
||||
*/
|
||||
The first line after the "**" is used as the short description of the item (up to the full stop) and everything afterwards as the detailed
|
||||
description.
|
||||
* Single Line
|
||||
Single line comments should also be in the C style, for example:
|
||||
/* This is a boring one-line comment */
|
||||
|
||||
Indentation
|
||||
Tabs. Tabs. ONLY TABS. Use a single tab for each level of indentation, for example:
|
||||
int main()
|
||||
{
|
||||
<tab>if (condition)
|
||||
<tab>{
|
||||
<tab><tab>code
|
||||
<tab>}
|
||||
}
|
||||
* Doxygen commenting
|
||||
If you wish your comment to show in doxygen, the comment should be directly
|
||||
above the item you are documenting (a class, function, enum, etc) and the
|
||||
first line should be "/**". For example:
|
||||
/** This is a doxygen multiline comment.
|
||||
* Description of thingymebob here.
|
||||
*/
|
||||
|
||||
The first line after the "**" is used as the short description of the item
|
||||
(up to the full stop) and everything afterwards as the detailed description.
|
||||
|
||||
|
||||
Separation
|
||||
Always put a space in between a keyword like if/while and the condition, for example:
|
||||
if (foo == bar)
|
||||
NOT
|
||||
if(foo == bar)
|
||||
2. Indentation
|
||||
|
||||
Braces
|
||||
Always put braces opening and closing blocks on separate lines, see the identation example. For example, place braces like this:
|
||||
if (apples == "green")
|
||||
{
|
||||
cout << "Apples are green" << endl;
|
||||
}
|
||||
Tabs. Tabs. ONLY TABS. Use a single tab for each level of indentation,
|
||||
for example:
|
||||
int main()
|
||||
{
|
||||
<tab>if (condition)
|
||||
<tab>{
|
||||
<tab><tab>code
|
||||
<tab>}
|
||||
}
|
||||
|
||||
and not:
|
||||
if (apples == "green") {
|
||||
cout << "Apples are green" << endl;
|
||||
}
|
||||
The one exception to this is if you are declaring a class method which is only one line long, in that case the following is acceptable in most cases:
|
||||
class foo : public bar
|
||||
{
|
||||
foo() { }
|
||||
getrandomfoo() { return rand(); }
|
||||
};
|
||||
|
||||
Templates
|
||||
Where possible, use templates rather than #defines. Avoid use of RTTI.
|
||||
Structs
|
||||
Structs should be declared in the following fashion:
|
||||
struct BodyPartBasket
|
||||
{
|
||||
int arms;
|
||||
int legs;
|
||||
int scrotalsacs;
|
||||
};
|
||||
and not like this:
|
||||
typedef struct
|
||||
{
|
||||
int arms;
|
||||
int legs;
|
||||
int scrotalsacs;
|
||||
} BodyPartBasket;
|
||||
The second way is not required in C++ to be able to do this:
|
||||
BodyPartBasket mybasket;
|
||||
Plus, placing the name at the bottom of the declaration makes readability more difficult (as you have to scroll down to the bottom of the
|
||||
struct to find its name).
|
||||
(where possible, call them classes rather than structs.)
|
||||
3. Separation
|
||||
|
||||
Variable naming
|
||||
Class and struct names should be in camel case with a leading capital letter, for example "MyBagOfBones" and not "my_bag_of_bones" or
|
||||
"mybagofbones". Variable names can be in either camel case with a leading capital letter or alternatively all lower case, so long as the same
|
||||
naming convention is adhered to throughout the class. No classes or variables should be named in capitals unless this makes sense for the
|
||||
name (for example "class DNS"). Constants and enum values should always be completely in CAPITALS and underscores may be used, for example:
|
||||
enum DecayState
|
||||
{
|
||||
DECAYED_MOULDY = 0,
|
||||
DECAYED_SMELLY = 1,
|
||||
DECAYED_MAGGOTS = 2
|
||||
};
|
||||
All value names in an enum should be started with the same text which should be related in some way to the enum's use. For example "DNS_CNAME,
|
||||
DNS_A, DNS_AAAA".
|
||||
Always put a space in between a keyword like if/while and the condition,
|
||||
for example:
|
||||
if (foo == bar)
|
||||
NOT
|
||||
if(foo == bar)
|
||||
|
||||
Use of references
|
||||
Wherever possible, when dealing with any complex class, pass a const reference rather than a copy of the class. For example:
|
||||
MyThingy::MyThingy(const std::string &thingyvalue)
|
||||
{
|
||||
}
|
||||
Of course, if you intended to change the string you can just omit the 'const'.
|
||||
|
||||
Use of char pointers
|
||||
Whenever you use char pointers (char*, char**) try to use const equivalents. This is much safer and avoids ugly and dangerous casts. For example:
|
||||
MyThingy::Thingify(const char* const* wotsits)
|
||||
{
|
||||
}
|
||||
If it is possible without performance loss, consider avoiding char pointers altogether and using std::string instead.
|
||||
4. Braces
|
||||
|
||||
Use of STL
|
||||
For more information on use of STL in InspIRCd, please see the separate STL FAQ.
|
||||
Always put braces opening and closing blocks on separate lines, see the
|
||||
identation example. For example, place braces like this:
|
||||
if (apples == "green")
|
||||
{
|
||||
cout << "Apples are green" << endl;
|
||||
}
|
||||
|
||||
Making copies of data
|
||||
Never ever make a copy of a piece of data unless it is absolutely necessary. For example, don't use strlcpy() to make a copy of the const char* string
|
||||
returned by std::string::c_str(), if the change can be done to the std::string itself. The same goes for unnecessary variable assignments, especially
|
||||
those which assign large classes.
|
||||
and not:
|
||||
if (apples == "green") {
|
||||
cout << "Apples are green" << endl;
|
||||
}
|
||||
|
||||
namespace std
|
||||
Avoid the following:
|
||||
using namespace std;
|
||||
It might take a bit more typing, but things work better if you don't set (then later assume) the namespace -- specify it explicitly when you want to
|
||||
use it.
|
||||
The one exception to this is if you are declaring a class method which is
|
||||
only one line long, in that case the following is acceptable in most cases:
|
||||
class foo : public bar
|
||||
{
|
||||
foo() { }
|
||||
getrandomfoo() { return rand(); }
|
||||
};
|
||||
|
||||
Linefeeds
|
||||
Unix linefeeds only please. We do not like to see our screens covered in ^M. :-)
|
||||
|
||||
Portability
|
||||
Always make sure your code is portable to all supported operating systems, remember of course that as of 1.1.8 this includes windows. Don't write code
|
||||
that only works on windows, or only works on Linux. Test your code on all platforms or ask for help from other developers who have the platforms you
|
||||
want to test on.
|
||||
5. Templates
|
||||
|
||||
new() and delete(), malloc() and free()
|
||||
Apart from the fact that using malloc() and free() is bad practice in C++ code, you must never use malloc() or free() in InspIRCd, within its modules
|
||||
or within the core. This is because if you use malloc() or free() in windows, the memory is claimed from the program's local heap. In windows, each
|
||||
shared object (module, dll) has its own heap, which is protected from other dlls and executables. To get around this issue and allow more posix-like
|
||||
memory access from other dlls in the program (other modules), InspIRCd overrides the operators new and delete to ensure that memory allocated by them
|
||||
comes from the windows global heap. If you use malloc() and free() for this, the ircd will segfault when another module tries to access the memory you
|
||||
have allocated!
|
||||
Where possible, use templates rather than #defines. Avoid use of RTTI.
|
||||
|
||||
strdup()
|
||||
As with malloc(), above, strdup() should be avoided. Where strdup() is absolutely necessary, use strnewdup() which is our strdup() implementation that
|
||||
calls operator new instead of using malloc(). char arrays allocated by strnewdup() should be deleted with operator delete[].
|
||||
|
||||
CoreExport and DllImport
|
||||
Prefix all types you want to import or export to other modules with CoreExport and DllImport macros. These do nothing in POSIX operating systems,
|
||||
however in windows these are expanded to the instructions __declspec(dllimport) and __declspec(dllexport) respectively depending on where they are
|
||||
used and how.
|
||||
6. Structs
|
||||
|
||||
External Dependencies
|
||||
If a module is compiled as standard, or the code is part of the core, you must not use any dependencies that are not available as standard on all
|
||||
supported operating systems beyond libstdc++, libc, and whatever else is currently required to build the core. Modules which use nonstandard
|
||||
dependencies belong in the modules/extra directory.
|
||||
Structs should be declared in the following fashion:
|
||||
struct BodyPartBasket
|
||||
{
|
||||
int arms;
|
||||
int legs;
|
||||
int scrotalsacs;
|
||||
};
|
||||
and not like this:
|
||||
typedef struct
|
||||
{
|
||||
int arms;
|
||||
int legs;
|
||||
int scrotalsacs;
|
||||
} BodyPartBasket;
|
||||
|
||||
Profiling and Performance
|
||||
It is one thing to assume that code performs bad, it is another thing to prove that it actually is. A lot of experienced programmers talk about
|
||||
'premature optimisation', and here is what it means: if you have a piece of code called once on startup that takes 10 seconds instead of one second to
|
||||
run, and a piece of code that takes 0.05 seconds to run when it should take 0.01, and it is called once per second, the second piece of code is the
|
||||
priority.
|
||||
In other words, make sure that what you think is slow, and a performance problem in Insp actually is.
|
||||
To do this, use the callgrind tool from Valgrind (valgrind --tool=cachegrind bin/inspircd -nofork -debug), and kcachegrind (or similar) to view the
|
||||
output files.
|
||||
The second way is not required in C++ to be able to do this:
|
||||
BodyPartBasket mybasket;
|
||||
|
||||
Plus, placing the name at the bottom of the declaration makes readability
|
||||
more difficult (as you have to scroll down to the bottom of the struct to
|
||||
find its name). (where possible, call them classes rather than structs.)
|
||||
|
||||
|
||||
7. Variable naming
|
||||
|
||||
Class and struct names should be in camel case with a leading capital letter,
|
||||
for example "MyBagOfBones" and not "my_bag_of_bones" or "mybagofbones".
|
||||
Variable names can be in either camel case with a leading capital letter or
|
||||
alternatively all lower case, so long as the same naming convention is
|
||||
adhered to throughout the class. No classes or variables should be named in
|
||||
capitals unless this makes sense for the name (for example "class DNS").
|
||||
Constants and enum values should always be completely in CAPITALS and
|
||||
underscores may be used, for example:
|
||||
enum DecayState
|
||||
{
|
||||
DECAYED_MOULDY = 0,
|
||||
DECAYED_SMELLY = 1,
|
||||
DECAYED_MAGGOTS = 2
|
||||
};
|
||||
All value names in an enum should be started with the same text which should
|
||||
be related in some way to the enum's use. For example "DNS_CNAME, DNS_A,
|
||||
DNS_AAAA".
|
||||
|
||||
|
||||
8. Use of references
|
||||
|
||||
Wherever possible, when dealing with any complex class, pass a const reference
|
||||
rather than a copy of the class. For example:
|
||||
MyThingy::MyThingy(const std::string &thingyvalue)
|
||||
{
|
||||
}
|
||||
Of course, if you intended to change the string you can just omit the 'const'.
|
||||
|
||||
|
||||
9. Use of char pointers
|
||||
|
||||
Whenever you use char pointers (char*, char**) try to use const equivalents.
|
||||
This is much safer and avoids ugly and dangerous casts. For example:
|
||||
MyThingy::Thingify(const char* const* wotsits)
|
||||
{
|
||||
}
|
||||
If it is possible without performance loss, consider avoiding char pointers
|
||||
altogether and using std::string instead.
|
||||
|
||||
|
||||
10. Use of STL
|
||||
|
||||
For more information on use of STL in InspIRCd, please see the separate
|
||||
STL FAQ.
|
||||
|
||||
|
||||
11. Making copies of data
|
||||
|
||||
Never ever make a copy of a piece of data unless it is absolutely necessary.
|
||||
For example, don't use strlcpy() to make a copy of the const char* string
|
||||
returned by std::string::c_str(), if the change can be done to the std::string
|
||||
itself. The same goes for unnecessary variable assignments, especially those
|
||||
which assign large classes.
|
||||
|
||||
|
||||
12. namespace std
|
||||
|
||||
Avoid the following:
|
||||
using namespace std;
|
||||
It might take a bit more typing, but things work better if you don't set
|
||||
(then later assume) the namespace -- specify it explicitly when you want to
|
||||
use it.
|
||||
|
||||
|
||||
13. Linefeeds
|
||||
|
||||
Unix linefeeds only please. We do not like to see our screens covered in ^M.
|
||||
|
||||
|
||||
14. Portability
|
||||
|
||||
Always make sure your code is portable to all supported operating systems,
|
||||
remember of course that as of 1.1.8 this includes windows. Don't write code
|
||||
that only works on windows, or only works on Linux. Test your code on all
|
||||
platforms or ask for help from other developers who have the platforms you
|
||||
want to test on.
|
||||
|
||||
* new() and delete(), malloc() and free()
|
||||
Apart from the fact that using malloc() and free() is bad practice in C++
|
||||
code, you must never use malloc() or free() in InspIRCd, within its modules
|
||||
or within the core. This is because if you use malloc() or free() in windows,
|
||||
the memory is claimed from the program's local heap.
|
||||
In windows, each shared object (module, dll) has its own heap, which is
|
||||
protected from other dlls and executables. To get around this issue and
|
||||
allow more posix-like memory access from other dlls in the program (other
|
||||
modules), InspIRCd overrides the operators new and delete to ensure that
|
||||
memory allocated by them comes from the windows global heap. If you use
|
||||
malloc() and free() for this, the ircd will segfault when another module
|
||||
tries to access the memory you have allocated!
|
||||
|
||||
* strdup()
|
||||
As with malloc(), above, strdup() should be avoided. Where strdup() is
|
||||
absolutely necessary, use strnewdup() which is our strdup() implementation
|
||||
that calls operator new instead of using malloc().
|
||||
char arrays allocated by strnewdup() should be deleted with operator delete[].
|
||||
|
||||
* CoreExport and DllImport
|
||||
Prefix all types you want to import or export to other modules with CoreExport
|
||||
and DllImport macros. These do nothing in POSIX operating systems, however
|
||||
in windows these are expanded to the instructions __declspec(dllimport) and
|
||||
__declspec(dllexport) respectively depending on where they are used and how.
|
||||
|
||||
|
||||
15. External Dependencies
|
||||
|
||||
If a module is compiled as standard, or the code is part of the core, you must
|
||||
not use any dependencies that are not available as standard on all supported
|
||||
operating systems beyond libstdc++, libc, and whatever else is currently
|
||||
required to build the core. Modules which use nonstandard dependencies belong
|
||||
in the modules/extra directory.
|
||||
|
||||
|
||||
16. Profiling and Performance
|
||||
|
||||
It is one thing to assume that code performs bad, it is another thing to prove
|
||||
that it actually is. A lot of experienced programmers talk about 'premature
|
||||
optimisation', and here is what it means: if you have a piece of code called
|
||||
once on startup that takes 10 seconds instead of one second to run, and a
|
||||
piece of code that takes 0.05 seconds to run when it should take 0.01, and
|
||||
it is called once per second, the second piece of code is the priority.
|
||||
|
||||
In other words, make sure that what you think is slow, and a performance
|
||||
problem in Insp actually is.
|
||||
To do this, use the callgrind tool from Valgrind (valgrind --tool=cachegrind
|
||||
bin/inspircd -nofork -debug), and kcachegrind (or similar) to view the output
|
||||
files.
|
||||
|
||||
@@ -1,3 +1,51 @@
|
||||
Anope Version 1.9.4
|
||||
--------------------
|
||||
A Automatically set channel founder to the user with the highest access if there is no successor
|
||||
A /chanserv clone command to copy settings from one channel to another.
|
||||
A /chanserv mode command
|
||||
A Ability for users to delete their own access in channels
|
||||
A Added support for Plexus 3
|
||||
A Readded in support for /cs op/deop/etc to op/deop you in all channels
|
||||
A Added LDAP support
|
||||
A Added live SQL support
|
||||
A Added support for learning tracking/storing/locking all modes at runtime
|
||||
A Added m_alias
|
||||
A Added support for XMLRPC queries
|
||||
A Added /botserv set msg
|
||||
A Added /operserv config
|
||||
A Added /ns cert
|
||||
A Added /operserv login
|
||||
F Changed the GHOST command to not allow ghosting unidentified users if the RECOVER command exists
|
||||
F Some failed logic in /operserv exception that prevents proper exceptions from being added
|
||||
F Fixed the anope_os_sxlines MySQL table and code to work after restarting
|
||||
|
||||
Anope Version 1.9.3
|
||||
--------------------
|
||||
A Added italics BotServ kicks support
|
||||
A Tell users when their nicks expire in /ns glist and /ns info
|
||||
A Added SSL support
|
||||
A Prevent negaitve mode changes, kicks, bans, and autokicks from affecting people with the 'god' user mode (On UnrealIRCd, usermode +q)
|
||||
A Added nickserv/auxpex permission
|
||||
A Added nickserv ungroup command
|
||||
A Renamed the SGLINE to be SNLINE
|
||||
A Added /chanserv saset command
|
||||
A Added threads for mail sending
|
||||
A Added m_dnsbl and an asynchronous DNS system
|
||||
A Added a new language system that uses gettext
|
||||
A Added m_mysql which uses threads to execute queries
|
||||
A Added many subcommand modules for some commands, eg ns_set_autoop, ns_set_email, etc
|
||||
A Added a new logging system that is a bit more flexible
|
||||
A Added cs_set_misc and ns_set_misc to add miscellaneous set commands
|
||||
A Added os_modreload, which allows reloading some modules not normally unloable, like the protocol module
|
||||
A Added FOUNDER access level
|
||||
A Made OperServ, Global, MemoServ, and ChanServ optional
|
||||
F Shutting down if a config reload fails
|
||||
F Autoid to live through restarts on Unreal
|
||||
F Storing vhosts in MySQL
|
||||
F Not flushing the anope_extra table before rewriting databaes
|
||||
F Anoperc start/stop to send the globaloncycle global, and fixed anoperc rehash to really rehash
|
||||
F Fixed a potential crash if HostServ or BotServ was disbled
|
||||
|
||||
Anope Version 1.9.2
|
||||
--------------------
|
||||
A K alias to chanserv kick command
|
||||
|
||||
@@ -1,3 +1,59 @@
|
||||
Anope Version 1.9.4
|
||||
-------------------
|
||||
** ADDED CONFIGURATION DIRECTIVES **
|
||||
memoserv:modules added ms_ignore
|
||||
chanserv:modules added cs_clone and cs_mode
|
||||
nickserv:suspendexpire and nickserv:forbidexpire added
|
||||
chanserv:suspendexpire and chanserv:forbidexpire added
|
||||
module added cs_entrymsg
|
||||
nickserv:modules added ns_ajoin, ns_cert
|
||||
options:nomlock added
|
||||
log:target added globops
|
||||
nickserv:confirmemailchanges added
|
||||
operserv:modules added os_config, os_login
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
operserv:notifications removed osglobal, osmode, oskick, osakill, ossnline, ossqline, osszline, osnoop, osjupe, getpass, setpass, forbid, drop
|
||||
renamed nickserv:preregexpire to nickserv:unconfirmedexpire
|
||||
|
||||
** DELETED CONFIGURATION DIRECTIVES **
|
||||
opertype:commands removed operserv/umode
|
||||
operserv:modules removed os_umode
|
||||
|
||||
Anope Version 1.9.3
|
||||
------------------
|
||||
** ADDED CONFIGURATION DIRECTIVES **
|
||||
nickserv/auspex privilege added
|
||||
SSL module added for SSL support
|
||||
opertype:inherits added to allow opertypes to inherit commands and privs from other opertypes
|
||||
Various nickserv/saset/* and chanserv/saset/* opertype command privileges added
|
||||
nickserv:modules added many new ns_set_command modules
|
||||
chanserv:modules added many new cs_set_command modules
|
||||
opertype:commands added nickserv/saset/* and chanserv/saset/*
|
||||
options:socketengine added to choose what socket engine to use
|
||||
module:cs_set_misc and module:ns_set_misc added to replace the old set url/icq/email modules
|
||||
options:hideprivilegedcommands added to hide privileged commands from normal users
|
||||
log block added to customize logging
|
||||
dns block added to configure dns settings
|
||||
m_dnsbl added
|
||||
mysql configuration block added
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
opertype:commands changed operserv/sgline to opserv/snline
|
||||
operserv:modules changed os_sgline to os_snline
|
||||
operserv:modules added os_modreload
|
||||
operserv:sglineexpiry changed to operserv:snlineexpiry
|
||||
operserv:killonsgline changed to operserv:killonsnline
|
||||
operserv:notifications ossgline changed ossnline
|
||||
memoserv was made optional
|
||||
moved operserv:global configuration into its own global block
|
||||
chanserv was made optional
|
||||
|
||||
** DELETED CONFIGURATION DIRECTIVES **
|
||||
serverinfo:helpchannel removed because it has been readded in m_helpchan
|
||||
networkinfo:logchannel, logbot, logusers, logmaxusers, logchannel, and options:keeplogs removed because of the log block
|
||||
dumpcore because it really didn't do anything
|
||||
|
||||
Anope Version 1.9.2
|
||||
--------------------
|
||||
** ADDED CONFIGURATION DIRECTIVES **
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
Anope Version 1.9.2
|
||||
--------------------
|
||||
*** New Strings:
|
||||
CHAN_INVITE_OTHER_SUCCESS
|
||||
NICK_HELP_CONFIRM_OPER
|
||||
CHAN_QOP_DISABLED
|
||||
CHAN_QOP_NICKS_ONLY
|
||||
CHAN_QOP_ADDED
|
||||
CHAN_QOP_MOVED
|
||||
CHAN_QOP_NO_SUCH_ENTRY
|
||||
CHAN_QOP_NOT_FOUND
|
||||
CHAN_QOP_DELETED
|
||||
CHAN_QOP_DELETED_ONE
|
||||
CHAN_QOP_DELETED_SEVERAL
|
||||
CHAN_QOP_LIST_EMPTY
|
||||
CHAN_QOP_LIST_HEADER
|
||||
CHAN_QOP_CLEAR
|
||||
CHAN_HELP_QOP
|
||||
CHAN_QOP_SYNTAX
|
||||
CHAN_HELP_CMD_QOP
|
||||
CHAN_HELP_SET_PASSWORD
|
||||
CHAN_LEVEL_AUTOOWNER
|
||||
CHAN_LEVEL_OWNER
|
||||
CHAN_LEVEL_OWNERME
|
||||
CHAN_ACCESS_VIEW_XOP_FORMAT
|
||||
CHAN_ACCESS_VIEW_AXS_FORMAT
|
||||
CHAN_SET_PERSIST_SYNTAX
|
||||
CHAN_SET_PERSIST_ON
|
||||
CHAN_SET_PERSIST_OFF
|
||||
CHAN_INFO_OPT_PERSIST
|
||||
BOT_UNASSIGN_PERSISTANT_CHAN
|
||||
CHAN_HELP_SET_PERSIST
|
||||
NICK_RESETPASS_SYNTAX
|
||||
NICK_RESETPASS_SUBJECT
|
||||
NICK_RESETPASS_MESSAGE
|
||||
NICK_RESETPASS_COMPLETE
|
||||
NICK_CONFIRM_EXPIRED
|
||||
NICK_CONFIRM_SUCCESS
|
||||
NICK_HELP_CMD_RESETPASS
|
||||
NICK_HELP_RESETPASS
|
||||
CHAN_UNBANNED_OTHER
|
||||
OPER_HELP_SYNC
|
||||
OPER_HELP_CMD_SQLSYNC
|
||||
OPER_SYNC_UPDATING
|
||||
OPER_SYNC_UPDATED
|
||||
CHAN_LEVELS_CHANGED_FOUNDER
|
||||
|
||||
*** Mod Strings:
|
||||
CHAN_HELP_SET
|
||||
CHAN_REGISTER_SYNTAX
|
||||
CHAN_ACCESS_SYNTAX
|
||||
CHAN_HELP_ACCESS
|
||||
CHAN_HELP_SET
|
||||
NICK_HELP_CONFIRM
|
||||
CHAN_UNBAN_SYNTAX
|
||||
CHAN_HELP_CMD_UNBAN
|
||||
CHAN_HELP_UNBAN
|
||||
CHAN_HELP_REGISTER
|
||||
CHAN_HELP_DROP
|
||||
CHAN_HELP_LEVELS
|
||||
|
||||
*** Del Strings:
|
||||
CHAN_PASSWORD_IS
|
||||
CHAN_SET_PASSWORD_FAILED
|
||||
CHAN_PASSWORD_CHANGED
|
||||
CHAN_IDENTIFY_SUCCEEDED
|
||||
CHAN_IDENTIFY_FAILED
|
||||
CHAN_HELP_IDENTIFY
|
||||
CHAN_IDENTIFY_SYNTAX
|
||||
CHAN_HELP_CMD_IDENTIFY
|
||||
CHAN_LOGOUT_FOUNDER_FAILED
|
||||
CHAN_LOGOUT_SUCCEDED
|
||||
CHAN_LOGOUT_NOT_LOGGEDIN
|
||||
CHAN_LOGOUT_ALL_SUCCEEDED
|
||||
CHAN_SERVADMIN_HELP_LOGOUT
|
||||
CHAN_HELP_LOGOUT
|
||||
CHAN_LOGOUT_SERVADMIN_SYNTAX
|
||||
CHAN_LOGOUT_SYNTAX
|
||||
CHAN_HELP_CMD_LOGOUT
|
||||
CHAN_GETPASS_UNAVAILABLE
|
||||
CHAN_GETPASSWORD_IS
|
||||
CHAN_SERVADMIN_HELP_GETPASS
|
||||
CHAN_GETPASS_SYNTAX
|
||||
CHAN_HELP_CMD_GETPASS
|
||||
CHAN_SENDPASS_SUBJECT
|
||||
CHAN_SENDPASS_HEAD
|
||||
CHAN_SENDPASS_LINE_1
|
||||
CHAN_SENDPASS_LINE_2
|
||||
CHAN_SENDPASS_LINE_3
|
||||
CHAN_SENDPASS_LINE_4
|
||||
CHAN_SENDPASS_LINE_5
|
||||
CHAN_SENDPASS_OK
|
||||
CHAN_SENDPASS_UNAVAILABLE
|
||||
CHAN_HELP_SENDPASS
|
||||
CHAN_SENDPASS_SYNTAX
|
||||
CHAN_HELP_CMD_SENDPASS
|
||||
OPER_DEFCON_NO_CONF
|
||||
|
||||
Anope Version 1.9.1
|
||||
--------------------
|
||||
*** New Strings:
|
||||
COMMAND_REQUIRES_PERM
|
||||
COMMAND_IDENTIFY_REQUIRED
|
||||
COMMAND_CANNOT_USE
|
||||
COMMAND_CAN_USE
|
||||
NICK_STATUS_REPLY
|
||||
NICK_INFO_SERVICES_OPERTYPE
|
||||
CHAN_LOGOUT_NOT_LOGGEDIN
|
||||
CHAN_INVITE_ALREADY_IN
|
||||
CHAN_INVITE_SUCCESS
|
||||
CHAN_OP_SYNTAX
|
||||
CHAN_HALFOP_SYNTAX
|
||||
CHAN_VOICE_SYNTAX
|
||||
CHAN_PROTECT_SYNTAX
|
||||
CHAN_OWNER_SYNTAX
|
||||
CHAN_DEOP_SYNTAX
|
||||
CHAN_DEHALFOP_SYNTAX
|
||||
CHAN_DEVOICE_SYNTAX
|
||||
CHAN_DEPROTECT_SYNTAX
|
||||
CHAN_DEOWNER_SYNTAX
|
||||
CHAN_KICK_SYNTAX
|
||||
CHAN_BAN_SYNTAX
|
||||
MEMO_STAFF_SYNTAX
|
||||
OPER_JUPE_INVALID_SERVER
|
||||
|
||||
*** Mod Strings:
|
||||
NICK_LOGOUT_SERVICESADMIN
|
||||
CHAN_STATUS_SYNTAX
|
||||
CHAN_GETKEY_KEY
|
||||
MEMO_SET_NOTIFY_SYNTAX
|
||||
BOT_REASON_BADWORD
|
||||
BOT_BOTLIST_EMPTY
|
||||
OPER_IGNORE_SYNTAX
|
||||
OPER_DEFCON_SYNTAX
|
||||
OPER_HELP_EXCEPTION
|
||||
OPER_HELP_SESSION
|
||||
NEWS_LOGON_SYNTAX
|
||||
NEWS_OPER_SYNTAX
|
||||
NEWS_RANDOM_SYNTAX
|
||||
NEWS_HELP_LOGON
|
||||
NEWS_HELP_OPER
|
||||
NEWS_HELP_RANDOM
|
||||
NICK_HELP_STATUS
|
||||
NICK_HELP_SENDPASS
|
||||
NICK_SERVADMIN_HELP
|
||||
NICK_SERVADMIN_HELP_LOGOUT
|
||||
NICK_SERVADMIN_HELP_DROP
|
||||
NICK_SERVADMIN_HELP_INFO
|
||||
NICK_SERVADMIN_HELP_LIST
|
||||
NICK_SERVADMIN_HELP_ALIST
|
||||
NICK_SERVADMIN_HELP_GLIST
|
||||
CHAN_HELP_SET_RESTRICTED
|
||||
CHAN_HELP_OP
|
||||
CHAN_HELP_DEOP
|
||||
CHAN_HELP_VOICE
|
||||
CHAN_HELP_DEVOICE
|
||||
CHAN_HELP_HALFOP
|
||||
CHAN_HELP_DEHALFOP
|
||||
CHAN_HELP_PROTECT
|
||||
CHAN_HELP_DEPROTECT
|
||||
CHAN_HELP_OWNER
|
||||
CHAN_HELP_DEOWNER
|
||||
CHAN_HELP_KICK
|
||||
CHAN_HELP_CLEAR
|
||||
CHAN_HELP_GETKEY
|
||||
CHAN_HELP_SENDPASS
|
||||
CHAN_SERVADMIN_HELP
|
||||
CHAN_SERVADMIN_HELP_LOGOUT
|
||||
CHAN_SERVADMIN_HELP_DROP
|
||||
CHAN_SERVADMIN_HELP_SET
|
||||
CHAN_SERVADMIN_HELP_INFO
|
||||
CHAN_SERVADMIN_HELP_LIST
|
||||
MEMO_HELP_SET_NOTIFY
|
||||
MEMO_HELP_STAFF
|
||||
OPER_HELP_CMD_CHANKILL
|
||||
OPER_HELP_STATS
|
||||
OPER_HELP_IGNORE
|
||||
OPER_HELP_UMODE
|
||||
OPER_HELP_ULINE
|
||||
OPER_HELP_SVSNICK
|
||||
OPER_HELP_SET
|
||||
BOT_HELP
|
||||
BOT_SERVADMIN_HELP_BOT
|
||||
BOT_SERVADMIN_HELP_SET
|
||||
HOST_DELALL_SYNTAX
|
||||
HOST_SET_SYNTAX
|
||||
HOST_SETALL_SYNTAX
|
||||
HOST_DEL_SYNTAX
|
||||
|
||||
*** Del Strings:
|
||||
PERMISSION_DENIED
|
||||
RAW_DISABLED
|
||||
HELP_LIMIT_SERV_OPER
|
||||
HELP_LIMIT_SERV_ADMIN
|
||||
HELP_LIMIT_SERV_ROOT
|
||||
HELP_LIMIT_IRC_OPER
|
||||
HELP_LIMIT_HOST_SETTER
|
||||
HELP_LIMIT_HOST_REMOVER
|
||||
NICK_STATUS_0
|
||||
NICK_STATUS_1
|
||||
NICK_STATUS_2
|
||||
NICK_STATUS_3
|
||||
NICK_INFO_SERVICES_OPER
|
||||
NICK_INFO_SERVICES_ADMIN
|
||||
NICK_INFO_SERVICES_ROOT
|
||||
CHAN_MUST_REGISTER_NICK
|
||||
CHAN_MUST_IDENTIFY_NICK
|
||||
OPER_ADMIN_SYNTAX
|
||||
OPER_ADMIN_SKELETON
|
||||
OPER_ADMIN_EXISTS
|
||||
OPER_ADMIN_REACHED_LIMIT
|
||||
OPER_ADMIN_ADDED
|
||||
OPER_ADMIN_NOT_FOUND
|
||||
OPER_ADMIN_NO_MATCH
|
||||
OPER_ADMIN_DELETED
|
||||
OPER_ADMIN_DELETED_ONE
|
||||
OPER_ADMIN_DELETED_SEVERAL
|
||||
OPER_ADMIN_LIST_EMPTY
|
||||
OPER_ADMIN_LIST_HEADER
|
||||
OPER_ADMIN_LIST_FORMAT
|
||||
OPER_ADMIN_CLEAR
|
||||
OPER_ADMIN_MOVED
|
||||
OPER_OPER_SYNTAX
|
||||
OPER_OPER_SKELETON
|
||||
OPER_OPER_EXISTS
|
||||
OPER_OPER_REACHED_LIMIT
|
||||
OPER_OPER_ADDED
|
||||
OPER_OPER_NOT_FOUND
|
||||
OPER_OPER_NO_MATCH
|
||||
OPER_OPER_DELETED
|
||||
OPER_OPER_DELETED_ONE
|
||||
OPER_OPER_DELETED_SEVERAL
|
||||
OPER_OPER_LIST_EMPTY
|
||||
OPER_OPER_LIST_HEADER
|
||||
OPER_OPER_LIST_FORMAT
|
||||
OPER_OPER_CLEAR
|
||||
OPER_OPER_MOVED
|
||||
OPER_SET_SQL_ON
|
||||
OPER_SET_SQL_OFF
|
||||
OPER_SET_SQL_ERROR
|
||||
OPER_SET_SQL_ERROR_INIT
|
||||
OPER_SET_SQL_ERROR_DISABLED
|
||||
OPER_RAW_SYNTAX
|
||||
HELP_HELP
|
||||
HELP_HELP_BOT
|
||||
HELP_HELP_HOST
|
||||
OPER_HELP_CMD_OPER
|
||||
OPER_HELP_CMD_ADMIN
|
||||
OPER_HELP_OPER
|
||||
OPER_HELP_ADMIN
|
||||
OPER_HELP_SET_SQL
|
||||
OPER_HELP_RAW
|
||||
HOST_ID
|
||||
HOST_NOT_REGGED
|
||||
HOST_OFF_UNREAL
|
||||
+6
-8
@@ -162,7 +162,7 @@ Note: You should also read the README and FAQ files!
|
||||
4) Starting Anope
|
||||
|
||||
Go into the directory where binaries were installed (by default, this is
|
||||
~/services). Type ./services to launch Anope.
|
||||
~/services/bin). Type ./services to launch Anope.
|
||||
|
||||
If there are syntax errors in the configuration file they will be
|
||||
displayed on the screen. Correct them until there are no errors anymore.
|
||||
@@ -180,21 +180,19 @@ Note: You should also read the README and FAQ files!
|
||||
5) Setting up a crontab
|
||||
|
||||
A crontab entry will allow you to check periodically whether Anope is
|
||||
still running, and restart it if not. You'll need to have Anope binaries
|
||||
and data installed in the same directory for this to work without
|
||||
modification.
|
||||
still running, and restart it if not.
|
||||
|
||||
First rename the example.chk script that is in Anope path (by default,
|
||||
this is ~/services) to services.chk and edit it. You'll need to modify
|
||||
the CONFIGURATION part of the file. Then ensure that the file is marked
|
||||
as executable by typing chmod +x services.chk, and try to launch the
|
||||
this is ~/services/data) to services.chk and edit it. You'll need to
|
||||
modify the CONFIGURATION part of the file. Then ensure that the file is
|
||||
marked as executable by typing chmod +x services.chk, and try to launch the
|
||||
script to see if it works (Anope must not be running when you do this ;))
|
||||
|
||||
When this is done, you'll have to add the crontab entry. Type crontab -e.
|
||||
This will open the default text editor with the crontab file. Enter the
|
||||
following (with correct path):
|
||||
|
||||
*/5 * * * * /home/ircd/services/services.chk >/dev/null 2>&1
|
||||
*/5 * * * * /home/ircd/services/data/services.chk >/dev/null 2>&1
|
||||
|
||||
The */5 at the beginning means "check every 5 minutes". You may replace
|
||||
the 5 with other another number if you want (but less than 60). Consult
|
||||
|
||||
@@ -26,32 +26,9 @@ How To Add IRCd Support
|
||||
than the one you used as a base. This section covers the majority of the
|
||||
code that is in use.
|
||||
|
||||
The first bit of code you will face is the IRCDVar structure, which is
|
||||
explained in depth in the next section.
|
||||
|
||||
Scroll down to the bottom and find the class for this module and rename it
|
||||
to something reflecting your IRCd name. Find the function:
|
||||
|
||||
pmodule_ircd_version("Unreal 3.2+");
|
||||
|
||||
This is the protocol name which will appear in various places; especially
|
||||
when you do -version at the command prompt, this is where you state the
|
||||
server name. The version is not always needed unless you are showing that
|
||||
the support is for one branch of a ircd family, such as Unreal 3.1 and
|
||||
Unreal 3.2.
|
||||
|
||||
The next task that you will face is setting whether the IRCD sends time
|
||||
stamps on modes but does not tell us that it will do so. If it does, set
|
||||
UseTSMODE to 1; if it does not set it to be 0. If you're not sure refer
|
||||
to your IRCd's documentation on how MODE is sent.
|
||||
|
||||
pmodule_ircd_useTSMode(0);
|
||||
|
||||
3) The IRCDVar struct
|
||||
|
||||
Now you've come to the part where you setup your ircd. There are two
|
||||
structs which hold this information; This allows you to quickly setup
|
||||
your specific ircd.
|
||||
The first bit of code you will face is the IRCDVar structure, This is one
|
||||
of two structs which holds your IRCd information; This allows you to quickly
|
||||
setup your specific ircd.
|
||||
|
||||
IRCDVar myIrcd[] = { };
|
||||
|
||||
@@ -74,140 +51,76 @@ How To Add IRCd Support
|
||||
remember to count each possible mode, so +ov
|
||||
is 2.
|
||||
|
||||
4) Channelmode for bots: When a BotServ bot joins a channel, this is the
|
||||
mode set on them. Normally you will want them
|
||||
opped (+o), and protected (+a) on IRCd's that
|
||||
support it.
|
||||
|
||||
5) SVSNICK: Can the ircd use SVSNICK to change some ones nick? Otherwise,
|
||||
4) SVSNICK: Can the ircd use SVSNICK to change some ones nick? Otherwise,
|
||||
KILL is used. Use 1 for yes, 0 for no.
|
||||
|
||||
6) VHOST: Can a user's host be changed on the fly? Enabling this allow
|
||||
5) VHOST: Can a user's host be changed on the fly? Enabling this allow
|
||||
HostServ online. Use 1 for yes, 0 for no.
|
||||
|
||||
7) SGLINE: Does the IRCd support realname (geocs) bans? Use 1 for yes,
|
||||
6) SNLINE: Does the IRCd support realname (geocs) bans? Use 1 for yes,
|
||||
0 for no.
|
||||
|
||||
8) SQLINE: Does the IRCd support nick bans? Use 1 for yes, 0 for no.
|
||||
7) SQLINE: Does the IRCd support nick bans? Use 1 for yes, 0 for no.
|
||||
|
||||
9) SZLINE: Does the IRCd support SZLINES? Use 1 for yes, 0 for no.
|
||||
8) SZLINE: Does the IRCd support SZLINES? Use 1 for yes, 0 for no.
|
||||
|
||||
10) Number of Server Args: When an IRCd connects, this is the number of
|
||||
parameters that are passed.
|
||||
|
||||
11) Join to Set: Services must join a channel to set any modes on that
|
||||
channel. Use 1 for yes, 0 for no.
|
||||
|
||||
12) Join to Message: Services must join a channel to send any message to
|
||||
10) Join to Message: Services must join a channel to send any message to
|
||||
that channel (cannot override +n). Use 1 for yes,
|
||||
0 for no.
|
||||
|
||||
13) TS Topic Forward: Some IRCd's (like UnrealIRCd) like their topic TS
|
||||
set forward by +1. Use 1 for yes, 0 for no.
|
||||
|
||||
14) TS Topic Backward: Some IRCd's (mainly older DreamForge-like ones)
|
||||
like their topic TS set back by -1. Use 1 for yes,
|
||||
0 for no.
|
||||
|
||||
15) SQline Channels: The IRCd's supports banning channel names via
|
||||
11) SQline Channels: The IRCd's supports banning channel names via
|
||||
SQLINES. Use 1 for yes, 0 for no.
|
||||
|
||||
16) Quit On Kill: When we (SVS)KILL a user, does the IRCd send back a
|
||||
12) Quit On Kill: When we (SVS)KILL a user, does the IRCd send back a
|
||||
QUIT message for that user? Use 1 for yes, 0 for no.
|
||||
|
||||
17) SVSMODE -b: We can use SVSMODE to unban hosts from a channel. Use
|
||||
13) SVSMODE UNBAN: We can use SVSMODE to unban hosts from a channel. Use
|
||||
1 for yes, 0 for no.
|
||||
|
||||
18) Reverse: We can do a reverse check when unbanning. For use with
|
||||
14) Reverse: We can do a reverse check when unbanning. For use with
|
||||
DreamForge based IRCd's. Use 1 for yes, 0 for no.
|
||||
|
||||
19) vIdent: Support for including a user's ident in their vHost. Use
|
||||
15) vIdent: Support for including a user's ident in their vHost. Use
|
||||
1 for yes, 0 for no.
|
||||
|
||||
20) SVSHOLD: Support for temporarily 'holding' a nick, instead of using
|
||||
16) SVSHOLD: Support for temporarily 'holding' a nick, instead of using
|
||||
a nick enforcer client. Use 1 for yes, 0 for no.
|
||||
|
||||
21) TS on MODE: We need to send a timestamp when modes are being changed.
|
||||
17) TS on MODE: We need to send a timestamp when modes are being changed.
|
||||
Use 1 for yes, 0 for no.
|
||||
|
||||
22) NICKIP: The IP address of new users is being sent along with their
|
||||
hostname when new users are being introduced on the network.
|
||||
Use 1 for yes, 0 for no.
|
||||
|
||||
23) OMODE: We can use OperServ to give some user a temporary O:LINE.
|
||||
Use 1 for yes, 0 for no.
|
||||
|
||||
24) Umode: We can use OperServ to change a user's mode. Use 1 for yes,
|
||||
18) Umode: We can use OperServ to change a user's mode. Use 1 for yes,
|
||||
0 for no.
|
||||
|
||||
25) Vhost On Nick: On NICK the IRCd sends the VHOST. Use 1 for yes,
|
||||
0 for no.
|
||||
19) OMODE: We can use OperServ to give some user a temporary O:LINE.
|
||||
Use 1 for yes, 0 for no.
|
||||
|
||||
26) Change Realname: Change real name. Use 1 for yes, 0 for no.
|
||||
|
||||
27) Check Nick ID: Should we check if a user should remain identified when
|
||||
changing their nick? This is for IRCd's that remove
|
||||
their registered-user mode when someone changes their
|
||||
nick (like Bahamut does).
|
||||
Use 1 for yes, 0 for no.
|
||||
|
||||
28) No Knock Requires +i: Does the No Knock channel mode require invite
|
||||
20) No Knock Requires +i: Does the No Knock channel mode require invite
|
||||
only channels? Use 1 for yes, 0 for no.
|
||||
|
||||
29) Chan Modes: If sent in CAPAB/PROTOCOL, we store it in here. This is
|
||||
NULL by default.
|
||||
|
||||
30) Tokens: Can we use tokens to talk to the IRCd? Use 1 for yes,
|
||||
0 for no.
|
||||
|
||||
31) base64 SJOIN TS: Are the timestamps sent with a SJOIN in base64? Use
|
||||
1 for yes, 0 for no.
|
||||
|
||||
32) SJOIN Ban Char: Character used to identify bans. Use ''.
|
||||
|
||||
33) SJOIN Except Char: Character used to identify exceptions. Use ''.
|
||||
|
||||
34) SJOIN Invite char: Character used to idenfity invexs. Use ''.
|
||||
|
||||
35) SVSMODE UCMODE: Can we clear user channel modes with SVSMODE? Use
|
||||
21) SVSMODE UCMODE: Can we clear user channel modes with SVSMODE? Use
|
||||
1 for yes, 0 for no.
|
||||
|
||||
36) SGline Enforce: Does the IRCd enforce SGLINES for us or do we need to
|
||||
22) SGline Enforce: Does the IRCd enforce SNLINES for us or do we need to
|
||||
do so? Use 1 for yes, 0 for no.
|
||||
|
||||
37) Vhost Character: The character used to represent the vHost mode, if
|
||||
this is supported by the IRCd.
|
||||
23) TS6: Does the IRCd support TS6? Use 1 for yes, 0 for no.
|
||||
|
||||
38) TS6: Does the IRCd support TS6? Use 1 for yes, 0 for no.
|
||||
|
||||
39) P10: Is this IRCd a P10-style IRCd? Use 1 for yes, 0 for no.
|
||||
|
||||
40) Character Set: Unreal passes the character set during PROTOCTL,
|
||||
the value is stored here. Set this NULL to start.
|
||||
|
||||
41) Channel CIDR: Set to 1 if channel bans, excepts and invites
|
||||
support CIDR masks. Expected syntax: *!*@ip/mask.
|
||||
When set to 1, anope will only parse strict CIDR masks.
|
||||
IRCd's that try to correct invalid CIDR's (like nefarious)
|
||||
will need a custom implementation in the core.
|
||||
Contact the anope Dev Team if this is the case.
|
||||
Set to 0 if CIDR's are not supported by your IRCd.
|
||||
|
||||
42) Global TLD Prefix: Prefix used to send global messages, should probably
|
||||
24) Global TLD Prefix: Prefix used to send global messages, should probably
|
||||
be "$"
|
||||
|
||||
43) Max Modes: The max number of mode changes we can send in one line
|
||||
25) Max Modes: The max number of mode changes we can send in one line
|
||||
|
||||
4) Modes
|
||||
3) Modes
|
||||
|
||||
Anope is told about modes in the moduleAddModes() function.
|
||||
Anope is told about modes in the protocol module.
|
||||
For the most part, the syntax for adding channel and user modes are:
|
||||
|
||||
ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, 'N'));
|
||||
ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, "UMODE_NETADMIN", 'N'));
|
||||
Where 'N' is the char for the mode, and UMODE_NETADMIN shows what the
|
||||
mode does. Or:
|
||||
|
||||
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
|
||||
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c'));
|
||||
Where 'c' is the char for the mode and CMODE_BLOCKCOLOR shows what
|
||||
the mode does
|
||||
|
||||
@@ -220,7 +133,7 @@ How To Add IRCd Support
|
||||
arg of ChannelModeParam to false if the param should NOT be sent when unsetting
|
||||
it. Eg:
|
||||
|
||||
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
|
||||
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, "CMODE_JOINFLOOD", 'j', true));
|
||||
|
||||
Anope will internally track the params, and they can be retrieved through
|
||||
Channel::GetParam();
|
||||
@@ -234,132 +147,43 @@ How To Add IRCd Support
|
||||
|
||||
ModeManager::AddChannelMode(new ChannelModeOper('O'));
|
||||
|
||||
The CMODE_FLOOD param also has its own class, but due to the wide range of
|
||||
valid parameters accepted across IRCds, your protocol module MUST have the
|
||||
IsValid function for this.
|
||||
4) Functions and Events
|
||||
|
||||
bool ChannelModeFlood::IsValid(const std::string &value) { }
|
||||
A brief word about functions and events. All events are captured by creating a Message struct
|
||||
with the name of the message and the callback function:
|
||||
|
||||
5) Functions and Events
|
||||
Message my_message("MESSAGE", do_my_messsage);
|
||||
|
||||
A brief word about functions and events. All events are captured using:
|
||||
|
||||
void moduleAddIRCDMsgs(void)
|
||||
{
|
||||
m = createMessage("NICK", anope_event_nick);
|
||||
addCoreMessage(IRCD,m);
|
||||
}
|
||||
|
||||
Each event should have a event handler if its important enough to be
|
||||
Each message should have a message handler if its important enough to be
|
||||
processed by services. All event functions should be formed like this:
|
||||
|
||||
int anope_event_capab(char *source, int ac, char **av)
|
||||
bool do_my_message(const Anope::string &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
return MOD_CONT;
|
||||
return true;
|
||||
}
|
||||
|
||||
They will receive the source; this can be NULL at times depending on the
|
||||
event. Next, ac is the number of arguments that are in the event, and av
|
||||
holds the values for each; so av[0] is the first variable, av[1] will be
|
||||
the second one, and so on. Events are likely to pass to various upper
|
||||
level event handlers; see the previous ircd source for how they handle
|
||||
these events.
|
||||
They will receive the source; this can be empty at times depending on the
|
||||
event. Next, params holds the arguments for the event. Events are likely to
|
||||
pass to various upper level event handlers; see the previous ircd source for
|
||||
how they handle these events.
|
||||
|
||||
All commands are formed like this:
|
||||
5) CAPAB/PROTOCTL
|
||||
|
||||
void anope_cmd_svsnoop(char *server, int set)
|
||||
{
|
||||
send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-"));
|
||||
}
|
||||
|
||||
They may take any number of arguments, depending on the command. They
|
||||
should eventually come to a send_cmd(); this root function is how
|
||||
commands are sent to the IRCd.
|
||||
|
||||
6) CAPAB/PROTOCTL
|
||||
|
||||
Most IRCD send a CAPAB or PROTOCTL line so that they can work out what
|
||||
the other end of the connection is capable of doing. Anope has a function
|
||||
to read these lines and set itself up to to handle these events better.
|
||||
When adding support for your ircd, take the following steps.
|
||||
Most IRCDs send a CAPAB or PROTOCTL line so that they can work out what
|
||||
the other end of the connection is capable of doing. The protocol module should
|
||||
handle all of these without the cores knowledge with the exception of the following:
|
||||
|
||||
1) In the module constructor you must tell Anope what the uplink is capable of that
|
||||
isn't already passed in the CAPAB/PROTOCTL, you do this by something similar to:
|
||||
|
||||
CapabType c[] = { CAPAB_NOQUIT, CAPAB_NICKIP, CAPAB_ZIP, CAPAB_TOKEN, CAPAB_SSJ3, CAPAB_NICK2, CAPAB_VL, CAPAB_TLKEXT, CAPAB_CHANMODE, CAPAB_SJB64, CAPAB_NICKCHARS };
|
||||
for (unsigned i = 0; i < 11; ++i)
|
||||
Capab.SetFlag(c[i]);
|
||||
|
||||
Anything else given to Anope in the CAPAB/PROTOCTL message will be handled later by CapabParse.
|
||||
|
||||
The available CAPAB options are:
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
Define | Description
|
||||
----------------|------------|-----------|--------------------------------
|
||||
----------------|---------------------------------------------------------
|
||||
CAPAB_NOQUIT | NOQUIT protocol support
|
||||
CAPAB_TSMODE | Chanmodes are timestamped
|
||||
CAPAB_UNCONNECT | UNCONNECT protocol support
|
||||
CAPAB_NICKIP | IP sent in the NICK line
|
||||
CAPAB_NSJOIN | Smart SJOIN support
|
||||
CAPAB_ZIP | Support for gzipped links
|
||||
CAPAB_BURST | Supports BURST command
|
||||
CAPAB_TS3 | Support for TS3 protocol
|
||||
CAPAB_TS5 | Support for TS5 protocol
|
||||
CAPAB_DKEY | DH-Key exchange using DKEY
|
||||
CAPAB_DOZIP | Link traffic will be gzipped
|
||||
CAPAB_DODKEY | Do DKEY with this link
|
||||
CAPAB_QS | Supports quit storm removal
|
||||
CAPAB_SCS | String Cache System support
|
||||
CAPAB_PT4 | Support for PT4 protocol
|
||||
CAPAB_UID | Support for UIDs
|
||||
CAPAB_KNOCK | Supports KNOCK
|
||||
CAPAB_CLIENT | Supports CLIENT
|
||||
CAPAB_IPV6 | Support for IPv6 addresses
|
||||
CAPAB_SSJ5 | Smart Join protocol 5 support
|
||||
CAPAB_SN2 | Support for SN2 protocol
|
||||
CAPAB_VHOST | Supports VHOST protocol
|
||||
CAPAB_TOKEN | Supports s2s tokens
|
||||
CAPAB_SSJ3 | Smart Join protocol 3 support
|
||||
CAPAB_NICK2 | Support for extended NICK (v2)
|
||||
CAPAB_UMODE2 | Supports UMODE2 command
|
||||
CAPAB_VL | VLine information in info field
|
||||
CAPAB_TLKEXT | Not 8, but 10 params in TKL's
|
||||
CAPAB_CHANMODE | Channel modes are passed here
|
||||
CAPAB_SJB64 | SJOIN timestamps are base64 encoded
|
||||
CAPAB_NICKCHARS | Character set used by the IRCD for nicks
|
||||
CAPAB_QS | Quitstorm - same as NOQUIT
|
||||
|
||||
2) In the ircd.c find the function anope_cmd_capab(); this function will
|
||||
send the CAPAB/PROTOCTL line (consult your ircd documentation for
|
||||
which to send). In a single line type in the tokens that anope must
|
||||
send. Here is an example of Hybrid's capab line:
|
||||
You can override the default OnCapab method in IRCdMessage if required.
|
||||
|
||||
/* CAPAB */
|
||||
void anope_cmd_capab()
|
||||
{
|
||||
send_cmd(NULL, "CAPAB TS5 EX IE HOPS HUB AOPS");
|
||||
}
|
||||
|
||||
3) Ensure that the CAPAB/PROTOCTL event his handled correctly.
|
||||
|
||||
A) In the function module constructor make sure that you have the
|
||||
following two lines:
|
||||
|
||||
m = createMessage("CAPAB", anope_event_capab);
|
||||
addCoreMessage(IRCD,m);
|
||||
|
||||
B) Add the function to handle the event
|
||||
|
||||
int anope_event_capab(char *source, int ac, char **av)
|
||||
{
|
||||
CapabParse(ac, av);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
This function should call the CapabParse function which parses
|
||||
the received CAPAB/PROTOCTL line.
|
||||
|
||||
7) IRCDProto Class
|
||||
6) IRCDProto Class
|
||||
|
||||
The IRCDProto class is set up like:
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
Anope Mutli Language Support
|
||||
----------------------------
|
||||
|
||||
1) Building Anope with gettext support
|
||||
2) Adding a new language
|
||||
3) Using languages with modules
|
||||
|
||||
1) Building Anope with gettext support
|
||||
|
||||
To build Anope with gettext support gettext and its devlopmental libraries must be installed on the system.
|
||||
Anope does not require locales to be installed or enabled on the system, but does require the locales-all
|
||||
package on Debian and Debian based systems.
|
||||
|
||||
Building Anope on Windows with gettext support is explained in docs/WIN32.txt
|
||||
|
||||
2) Adding a new language
|
||||
|
||||
Anope uses gettext (http://www.gnu.org/software/gettext/) to translate messages for users. To add a new language
|
||||
install gettext and run `msginit -l language -o anope.language.po -i anope.pot`. For example if I was translating to
|
||||
Spanish I could run `msginit -l es_ES -o anope.es_ES.po -i anope.pot`. Open the newly generating .po file and start
|
||||
translating. Once you are done simply rerun ./Config; make && make install and add the language to your services.conf.
|
||||
Note that on Windows it is not quite this simple, windows.cpp must be edited and Anope recompiled and restarted.
|
||||
|
||||
Poedit (http://www.poedit.net/) is a popular po file editor, and we recommend using it or another editor designed to edit
|
||||
po files (especially on Windows).
|
||||
|
||||
If you have finished a language file translation and you want others to use it, please send it to team@anope.org
|
||||
(don't forget to mention clearly your (nick)name, your e-mail and the language name). You'll of course get full credit for it.
|
||||
|
||||
NOTE: There is no guarantee we will use your work so please do not be offended if we say no thanks.
|
||||
|
||||
3) Using langages with modules
|
||||
|
||||
Module authors can easially add the ability to have their modules translated by adding _() around the strings they
|
||||
need translated (messages to the user, etc). See a few of the modules in /modules/extras (cs_appendtopic, hs_request)
|
||||
for examples of this. If you want to translate a module someone has made, first generate a .pot file if there is none.
|
||||
Run `xgettext -s -d modulename -o modulename.pot --from-code=utf-8 modulename.cpp`. Then, run msginit on the .pot file
|
||||
with `msginit -l language -o modulename.language.po -i modulename.pot`. Translate the new .po file, then place it in
|
||||
the lang folder and rerun ./Config; make && make install.
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
Anope MySQL Support
|
||||
-------------------
|
||||
|
||||
MySQL support was readded in version 1.9.2 In the form of three modules.
|
||||
|
||||
db_mysql_read - Allows you to load your databases from MySQL.
|
||||
db_mysql_write - Allows live updating of SQL tables whenever something is executed in Anope.
|
||||
db_mysql_execute - Allows executing of Anope commands via SQL.
|
||||
|
||||
To execute commands via SQL, you must insert the command into the anope_commands table, an example is as follows:
|
||||
|
||||
INSERT INTO `anope_commands` (nick, service, command) VALUES('Adam', 'NickServ', 'REGISTER qwerty Adam@anope.org');
|
||||
|
||||
By default, every 60 seconds Anope checks this table for commands to execute. When Anope sees a new command to execute, it checks the following.
|
||||
|
||||
If the nick given is -SQLUser, then the command gets executed by a special fake user within Anope called -SQLUser. -SQLUser has every permission and command available, there are no permission checks at all for this user, it can do anything.
|
||||
|
||||
If the nick is not -SQLUser, it checks to see if it is a registered nick. If it is, it sees if there are any users online using the NickCore of that nick.
|
||||
If there is a user online with that core the command gets executed as if that user executed it, and the reply goes to that user.
|
||||
If there isn't a user online with the core, it creates a fake user as the nick given to it, and gives to it the permissions the user would have if they were online and identified.
|
||||
If the nick is not registered, it checks to see if there is a user currently on that nick. If there is, it executes the command as that user, and the reply goes to that user.
|
||||
If the nick is not registered and no one is using the nick, it creates a fake user of the nick given to it, and gives it regular nonidentified user access.
|
||||
|
||||
Currently there is no way to check to see if a command was executed successfully within Anope from SQL (even if there was, the possibly update delay would be a problem).
|
||||
|
||||
IMPORTANT: When using db_mysql_write when you already have a database, you need to do an initial import of the data to SQL (as db_mysql_write only updates it when it is changed, it never actually mass-dumps all of your data into SQL). To do this, start Anope and execute /OperServ SQLSYNC.
|
||||
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
Anope Proxy Detector
|
||||
--------------------
|
||||
|
||||
1) Introduction
|
||||
2) Alternatives
|
||||
|
||||
1) Introduction
|
||||
|
||||
Anope has had a built-in proxy detector since it's first version. Recently,
|
||||
however, this built-in proxy detector has been removed. This was because
|
||||
the Anope team found that the proxy detector was showing it's age, and the
|
||||
time needed to restore it to a good state wasn't worth it, also considering
|
||||
that there are currently good alternatives out there which do the job as
|
||||
good as it can be done already.
|
||||
|
||||
2) Alternatives
|
||||
|
||||
A) Blitzed Open Proxy Monitor (BOPM)
|
||||
B) NeoStats + OPSB
|
||||
|
||||
Note that these are seperate projects and that the Anope team won't give
|
||||
support on these programs. For support, please refer to the sites of the
|
||||
creators of the software packages.
|
||||
|
||||
A) Blitzed Open Proxy Monitor (BOPM)
|
||||
|
||||
URL: http://wiki.blitzed.org/BOPM
|
||||
|
||||
BOPM is currently the leading proxy detector for IRC networks out
|
||||
there. Altough it is not designed to run on a central place for the
|
||||
entire network, it can be done with some minor tweaking on most IRCd's.
|
||||
The Anope Team advises BOPM for the best security.
|
||||
|
||||
B) NeoStats + OPSB
|
||||
|
||||
URL: http://www.neostats.net/
|
||||
|
||||
NeoStats is the swiss knife of IRC tools. In combination with the OPSB
|
||||
module by NeoStats Software, it can scan for proxies in a similar way
|
||||
as BOPM does. The OPSB module is based on BOPM and has been adjusted to
|
||||
be able to scan all clients from one centralized proxy detector.
|
||||
+284
-367
@@ -1,367 +1,284 @@
|
||||
Anope -- a set of IRC services for IRC networks
|
||||
-----------------------------------------------
|
||||
|
||||
Anope is 2003-2010 Anope Team <team@anope.org>.
|
||||
Based on Epona 2000-2002 PegSoft <epona@pegsoft.net>.
|
||||
Based on Services 1996-1999 Andrew Church <achurch@achurch.org>.
|
||||
|
||||
This program is free but copyrighted software; see the file COPYING for
|
||||
details.
|
||||
|
||||
Information about Anope may be found at http://www.anope.org/
|
||||
Information about Epona may be found at http://www.epona.org/
|
||||
Information about Services may be found at http://www.ircservices.esper.net/
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
1) Credits
|
||||
2) Presentation
|
||||
3) Installation
|
||||
4) Command Line Options
|
||||
5) Messages Translation
|
||||
6) Contact and Mailing List
|
||||
|
||||
1) Credits
|
||||
|
||||
Anope is based on Lara's Epona version 1.4.14.
|
||||
Epona is based on Andy Church's IRC Services version 4.3.3.
|
||||
|
||||
The original credits:
|
||||
|
||||
* Mauritz Antunes
|
||||
Portuguese translation
|
||||
* Jose R. Holzmann, Raul S. Villarreal
|
||||
Spanish translation
|
||||
* Andrew Kempe <theshadow@shadowfire.org>
|
||||
News system
|
||||
* <d.duca@eurcom.net>
|
||||
Italian translation
|
||||
* <mikado@holyfire.com>
|
||||
Turkish translation
|
||||
* Andrew Kempe <theshadow@shadowfire.org>
|
||||
Session limiting
|
||||
|
||||
Epona credits:
|
||||
|
||||
* lara <lara@pegsoft.net>
|
||||
Main coding
|
||||
* CafeiN <oytuny@yahoo.com>
|
||||
Turkish translation
|
||||
* Sylvain Cresto aka tost <scresto@netsante.fr>
|
||||
FreeBSD 5 patch
|
||||
* Marcelo Conde Foscarini aka Bras <ircadmin@brmarket.net>
|
||||
Portuguese translation
|
||||
* Alvaro Toledo aka POLLITO <atoledo@keldon.org>
|
||||
Spanish translation
|
||||
* chemical <chemical@musicplay.de>
|
||||
German translation
|
||||
* shine <dh@shinewelt.de>
|
||||
German translation
|
||||
* Guven Guzelbey aka MeShGuL <guzelbey@cs.utk.edu>
|
||||
Turkish translation
|
||||
* Jordi Pujol <jordi.pujol@aujac.org>
|
||||
Catalan translation
|
||||
* Eva Dachs <evadachs@terra.es>
|
||||
Catalan translation
|
||||
* Toni Perez <toni.perez@aujac.org>
|
||||
Catalan translation
|
||||
* Sergios Karalis <sergios_k@hotmail.com>
|
||||
Greek translation
|
||||
* Thomas J. Stensas aka ShadowMaster <shadowmaster@shadow-realm.org>
|
||||
Ultimate 3.x support
|
||||
|
||||
Anope credits:
|
||||
|
||||
* Adam Kramer <ribosome@anope.org>
|
||||
* Adam <adam@anope.org>
|
||||
* Alvaro Toledo <atoledo@keldon.org>
|
||||
* Amanda Folson <amanda@anope.org>
|
||||
* Andrew Berquist <vash@anope.org>
|
||||
* Björn Stiddien <keeper@anope.org>
|
||||
* Charles Kingsley <chaz@anope.org>
|
||||
* Chris Hogben <heinz@anope.org>
|
||||
* Daniel Engel <dane@zero.org>
|
||||
* David <dv@diboo.net>
|
||||
* David Narayan <jester@phrixus.net>
|
||||
* David Robson <rob@anope.org>
|
||||
* Daniele Nicolucci <jollino@sogno.net>
|
||||
* Florian Schulze <certus@anope.org>
|
||||
* Gabriel Acevedo H. <drstein@anope.org>
|
||||
* Jan Milants <viper@anope.org>
|
||||
* Jens Voss <dukepyrolator@anope.org>
|
||||
* JH <jh@irc-chat.net>
|
||||
* Joris Vink <joris@anope.org>
|
||||
* Lucas Nussbaum <lucas@lucas-nussbaum.net>
|
||||
* Mark Summers <mark@goopler.net>
|
||||
* Matthew Beeching <jobe@invictachat.net>
|
||||
* Naram Qashat <cyberbotx@anope.org>
|
||||
* Pieter Bootsma <geniusdex@anope.org>
|
||||
* Robin Burchell <w00t@inspircd.org>
|
||||
* Thomas Juberg StensĂĄs <ShadowMaster@Shadow-Realm.org>
|
||||
* Trystan .S Lee <trystan@nomadirc.net>
|
||||
* openglx <openglx@brasnerd.com.br>
|
||||
|
||||
Anope Translations:
|
||||
|
||||
* GeniusDex <geniusdex@anope.org> (nl.l)
|
||||
* Kein <kein-of@yandex.ru> (ru.l)
|
||||
* Stuff <the.stuff@gmx.de> (de.l)
|
||||
* Gabriel Acevedo H. <drstein@anope.org> (es.l)
|
||||
* Janos Kapitany <sarkanyka@cjbchat.hu> (hun.l)
|
||||
* Szymon S'wierkosz <szymek@adres.pl> (pl.l)
|
||||
|
||||
Anope uses the strlcat() and strlcpy() functions from OpenSSH 2.5.1p2.
|
||||
These functions are copyrighted by Todd C. Miller:
|
||||
|
||||
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
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 `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.
|
||||
|
||||
|
||||
2) Presentation
|
||||
|
||||
Anope is a set of Services for IRC networks that allows users to manage
|
||||
their nicks and channels in a secure and efficient way, and administrators
|
||||
to manage their network with powerful tools.
|
||||
|
||||
Currently available services are:
|
||||
|
||||
* NickServ, a powerful nickname manager that users can use to protect
|
||||
themselves against nick stealing. Each user has its own nickname
|
||||
group, that allows the user to register as many nicks as needed
|
||||
while still being able to take profit of his privileges and to
|
||||
modify the nick configuration. NickServ also has an optional
|
||||
password retrieval feature.
|
||||
|
||||
* ChanServ, a powerful channel manager that helps users to administer
|
||||
their channels in a totally customizable way. ChanServ has an
|
||||
internal list of privileged users and banned users that controls
|
||||
accesses on a per-channel basis. It eliminates all takeover
|
||||
problems, because of its powerful op/unban/invite and even mass
|
||||
deop and mass kick functions.
|
||||
|
||||
* MemoServ, an helpful companion that allows sending short messages
|
||||
to offline users, that they can then read when they come online
|
||||
later.
|
||||
|
||||
* BotServ, an original service that allows users to get a permanent,
|
||||
friendly bot on their channels in an easy way. Each bot can be
|
||||
configured to monitor the channels against floods, repetitions,
|
||||
caps writing, and swearing, and to take appropriate actions. It
|
||||
also can handle user-friendly commands (like !op, !deop, !voice,
|
||||
!devoice, !kick, and many others), say a short greet message when
|
||||
an user joins a channel, and even "take over" ChanServ actions such
|
||||
as auto-opping users, saying the entry notice, and so on. This
|
||||
service can be disabled if you want to save some bandwidth.
|
||||
|
||||
* OperServ, the IRCops' and IRC admins' black box, that allows them
|
||||
to manage the list of network bans (also known as AKILL (DALnet) or
|
||||
GLINE (Undernet)), to configure messages displayed to users when
|
||||
they log on, to set modes and to kick users from any channel, to
|
||||
send notices quickly to the entire network, and much more!
|
||||
|
||||
* HostServ, a neat service that allows users to show custom vHosts
|
||||
(virtual hosts) instead of their real IP address; this only works
|
||||
on daemons supporting ip cloaking, such as UnrealIRCd, UltimateIRCd
|
||||
and ViagraIRCd.
|
||||
|
||||
Anope currently works with:
|
||||
|
||||
* Bahamut 1.4.27 or later (including 1.8)
|
||||
* InspIRCd 1.1, 1.2, or 2.0
|
||||
* Ratbox 2.0.6 or later
|
||||
* UnrealIRCd 3.2 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.
|
||||
|
||||
|
||||
3) Installation
|
||||
|
||||
See the INSTALL file for instruction on installing Anope.
|
||||
|
||||
|
||||
4) Command Line Options
|
||||
|
||||
Normally, Anope can be run simply by invoking the "services" executable.
|
||||
Anope will then use the defaults specified in the services.conf file, and
|
||||
connect to the specified uplink server. Alternatively, any of the
|
||||
following command-line options can be specified to change the default
|
||||
values:
|
||||
|
||||
-remote server[:port] Connect to the specified server
|
||||
-local host -or- Connect from the specified address (e.g. for
|
||||
[host]:[port] multihomed servers)
|
||||
-name servername Our server name (e.g. services.some.net)
|
||||
-desc string Description of us (e.g. SomeNet Services)
|
||||
-user username Username for Services' nicks (e.g. services)
|
||||
-host hostname Hostname for Services' nicks (e.g. esper.net)
|
||||
-dir directory Directory containing Services' data files
|
||||
(e.g. /usr/local/lib/services)
|
||||
-log filename Services log filename (e.g. services.log)
|
||||
-update secs How often to update databases (in seconds)
|
||||
-expire secs How often to check for nick/channel
|
||||
expiration (in seconds)
|
||||
|
||||
Additionally, the following command-line options can be used to modify
|
||||
the behavior of Anope:
|
||||
|
||||
-debug Enable debugging mode; more info sent to log (give
|
||||
option more times for more info)
|
||||
-readonly Enable read-only mode; no changes to databases
|
||||
allowed, .db files and log not written
|
||||
-skeleton Enable skeleton mode; like read-only mode, but only
|
||||
OperServ is available
|
||||
-nofork Do not fork after startup; log messages will be
|
||||
written to terminal (as well as to the log file
|
||||
if not in read-only mode)
|
||||
-forceload Try to load as much of the databases as possible,
|
||||
even if errors are encountered
|
||||
-noexpire Expiration routines won't be run at all
|
||||
-logchan Startup with logchan enabled
|
||||
-version Display the version of Anope
|
||||
-nothird Do not load the modules specified in ModulesAutoload
|
||||
or ModulesDelayedAutoload in the config file
|
||||
-protocoldebug Debug each incoming message after protocol parsing
|
||||
-support Used for support, same as -debug -nofork -nothird
|
||||
|
||||
Upon starting, Anope will parse its command-line parameters, open its
|
||||
logfile, then (assuming the -nofork option is not given) detach itself
|
||||
and run in the background. If Anope encounters a problem reading the
|
||||
database files or cannot connect to its uplink server, it will terminate
|
||||
immediately; otherwise, it will run until the connection is terminated
|
||||
(or a QUIT, SHUTDOWN, or RESTART command is sent; see OperServ's help).
|
||||
In the case of an error, an appropriate error message will be written to
|
||||
the log file.
|
||||
|
||||
If Anope is run with the "-readonly" command-line option, it can serve as
|
||||
a "backup" to the full version of services. A "full" version of services
|
||||
(run without -readonly) will automatically reintroduce its pseudo-clients
|
||||
(NickServ, ChanServ, etc.), while a "backup" services will not, thus
|
||||
allowing full services to be brought up at any time without disrupting
|
||||
the network (and without having to take backup services down beforehand).
|
||||
|
||||
If Anope is run with the "-skeleton" command-line option, it will not try
|
||||
to load the nickname or channel databases, and will respond with "service
|
||||
is inactive" messages to any commands sent to NickServ, ChanServ,
|
||||
MemoServ or BotServ. This can be useful as an emergency stopgap measure
|
||||
when the main copy of Anope cannot be started.
|
||||
|
||||
The "-debug" option is useful if you find or suspect a problem in Anope.
|
||||
Giving it once on the command line will cause all traffic to and from
|
||||
services as well as some other debugging information to be recorded in
|
||||
the log file; if you send a bug report, PLEASE include an excerpt from
|
||||
the log file WITH DEBUGGING ACTIVE; we cannot emphasize enough how
|
||||
important this is to tracking down problems. (You can also enable
|
||||
debugging while Services is running using OperServ's SET DEBUG command.)
|
||||
If you repeat the -debug option more than once, the debugging level will
|
||||
be increased, which provides more detailed information but may also slow
|
||||
Anope down considerably and make the log file grow dramatically faster
|
||||
(in particular, at debug level 4 a message is written to the log for
|
||||
every character received from the server). In general, a debug level of 1
|
||||
is sufficient for the coding team to be able to trace a problem, because
|
||||
all network traffic is included and we can usually reproduce the problem.
|
||||
|
||||
The "-forceload" option is provided to attempt recovery of data from
|
||||
corrupted or truncated databases. Normally, if Anope encounters an error
|
||||
writing to a database file, it will attempt to restore the original
|
||||
version of the file and report an error to the logfile and through
|
||||
WALLOPS. However, if this should fail (which normally should not happen),
|
||||
or if Anope is terminated abruptly e.g. by kill -9 or a power failure,
|
||||
then one or more of the databases may be corrupt. Normally, this will
|
||||
cause Anope to abort the next time you try to run it; however, if yo
|
||||
give the -forceload option to Anope, it will instead read as much as it
|
||||
can, then skip to the next database. For obvious reasons, it's highly
|
||||
recommended to keep backup copies of your databases in case something
|
||||
does happen (since Anope will stop at the first error in a database, even
|
||||
with -forceload, meaning you lose any data after that).
|
||||
|
||||
5) Messages Translations
|
||||
|
||||
Anope has a powerful option in NickServ allowing users to choose what
|
||||
language it must use when sending messages to users. Messages are stored
|
||||
in language files (located in the lang directory).
|
||||
|
||||
Anope is currently provided with thirteen languages: Catalan, Dutch,
|
||||
English, French, German, Greek, Hungarian, Italian, Polish, Portuguese,
|
||||
Russian, Spanish and Turkish. If you want to translate Anope messages
|
||||
into another language, follow this instructions:
|
||||
|
||||
* Copy the lang/en_us.l file to a meaningful name (for example, if
|
||||
you would like to translate messages in Spanish, you would rename
|
||||
it to es.l).
|
||||
|
||||
* Edit the file with your favorite text editor. Carefully read the
|
||||
instructions given at the top of the file, and start translating
|
||||
the whole file. The file is big, so make sure you have some coffee
|
||||
available ;) Try to avoid the use of English words as much as
|
||||
possible. If the new language contains only a few 'special'
|
||||
characters, try and use latin representations of it, if possible.
|
||||
Remember that most clients are only capable of handling the
|
||||
ISO-8859-1 charset. Of course, if you are translating Anope to a
|
||||
language with a totally different charset, such as Russian, feel
|
||||
free to use the one that suites it best (and the one that is in use
|
||||
by most speakers of that language ;)).
|
||||
|
||||
* When this is done, you have two solutions: either patch Services
|
||||
source code so they take in account the new language file
|
||||
(basically, you'll have to modify lang/Makefile, language.c and
|
||||
maybe services.h), or send us the translated file so we can make
|
||||
the patch and include your language in the next Anope release.
|
||||
|
||||
* Note that there is a language tool on bin/langtool.pl that can aid
|
||||
the verification process on newly created language files. Try to
|
||||
use it before you submit a language file.
|
||||
|
||||
When new major releases come out, you'll not have to retranslate the
|
||||
whole file; the Changes.lang file will help you to know which messages
|
||||
were added, modified or deleted.
|
||||
|
||||
If you did a language file translation, and want to let others use it,
|
||||
please send it to team@anope.org (don't forget to mention clearly your
|
||||
(nick)name, your e-mail and the language name). You'll of course get full
|
||||
credit for it, and will even get future final major releases before
|
||||
anyone else to complete the translation!... ;)
|
||||
|
||||
6) Contact
|
||||
|
||||
For announcements and discussions about Anope, please visit our
|
||||
Portal and Forums at http://www.anope.org/ -- make sure you register
|
||||
yourself and your network to get full benefits.
|
||||
|
||||
If you read the documentation carefully, and didn't find the answer to
|
||||
your question, feel free to post on the website forums or join our irc
|
||||
channel (irc.anope.org #anope). Once you join our Support channel, just
|
||||
type "? report" for instructions on how to report a Bug. Be as precise as
|
||||
possible when asking a question, because we have no extraordinary powers
|
||||
and can't guess things if they aren't provided. The more precise you are,
|
||||
the sooner you'll be likely to get an answer.
|
||||
|
||||
If you think you found a bug, add it to the bug tracking system
|
||||
(http://bugs.anope.org) and - again - be as precise as possible. Also say
|
||||
whether the bug happens always or under what circumstances, and anything
|
||||
that could be useful to track your bug down. If you wrote a patch, send
|
||||
it over. :)
|
||||
Anope -- a set of IRC services for IRC networks
|
||||
-----------------------------------------------
|
||||
|
||||
Anope is 2003-2011 Anope Team <team@anope.org>.
|
||||
Based on Epona 2000-2002 PegSoft <epona@pegsoft.net>.
|
||||
Based on Services 1996-1999 Andrew Church <achurch@achurch.org>.
|
||||
|
||||
This program is free but copyrighted software; see the file COPYING for
|
||||
details.
|
||||
|
||||
Information about Anope may be found at http://www.anope.org/
|
||||
Information about Epona may be found at http://www.epona.org/
|
||||
Information about Services may be found at http://www.ircservices.esper.net/
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
1) Credits
|
||||
2) Presentation
|
||||
3) Installation
|
||||
4) Command Line Options
|
||||
5) Messages Translation
|
||||
6) Contact and Mailing List
|
||||
|
||||
1) Credits
|
||||
|
||||
Anope is based on Lara's Epona version 1.4.14.
|
||||
Epona is based on Andy Church's IRC Services version 4.3.3.
|
||||
|
||||
The original credits:
|
||||
|
||||
* Mauritz Antunes
|
||||
Portuguese translation
|
||||
* Jose R. Holzmann, Raul S. Villarreal
|
||||
Spanish translation
|
||||
* Andrew Kempe <theshadow@shadowfire.org>
|
||||
News system
|
||||
* <d.duca@eurcom.net>
|
||||
Italian translation
|
||||
* <mikado@holyfire.com>
|
||||
Turkish translation
|
||||
* Andrew Kempe <theshadow@shadowfire.org>
|
||||
Session limiting
|
||||
|
||||
Epona credits:
|
||||
|
||||
* lara <lara@pegsoft.net>
|
||||
Main coding
|
||||
* CafeiN <oytuny@yahoo.com>
|
||||
Turkish translation
|
||||
* Sylvain Cresto aka tost <scresto@netsante.fr>
|
||||
FreeBSD 5 patch
|
||||
* Marcelo Conde Foscarini aka Bras <ircadmin@brmarket.net>
|
||||
Portuguese translation
|
||||
* Alvaro Toledo aka POLLITO <atoledo@keldon.org>
|
||||
Spanish translation
|
||||
* chemical <chemical@musicplay.de>
|
||||
German translation
|
||||
* shine <dh@shinewelt.de>
|
||||
German translation
|
||||
* Guven Guzelbey aka MeShGuL <guzelbey@cs.utk.edu>
|
||||
Turkish translation
|
||||
* Jordi Pujol <jordi.pujol@aujac.org>
|
||||
Catalan translation
|
||||
* Eva Dachs <evadachs@terra.es>
|
||||
Catalan translation
|
||||
* Toni Perez <toni.perez@aujac.org>
|
||||
Catalan translation
|
||||
* Sergios Karalis <sergios_k@hotmail.com>
|
||||
Greek translation
|
||||
* Thomas J. Stensas aka ShadowMaster <shadowmaster@shadow-realm.org>
|
||||
Ultimate 3.x support
|
||||
|
||||
Anope credits:
|
||||
|
||||
* Adam Kramer <ribosome@anope.org>
|
||||
* Adam <adam@anope.org>
|
||||
* Alvaro Toledo <atoledo@keldon.org>
|
||||
* Amanda Folson <amanda@anope.org>
|
||||
* Andrew Berquist <vash@anope.org>
|
||||
* Björn Stiddien <keeper@anope.org>
|
||||
* Charles Kingsley <chaz@anope.org>
|
||||
* Chris Hogben <heinz@anope.org>
|
||||
* Daniel Engel <dane@zero.org>
|
||||
* David <dv@diboo.net>
|
||||
* David Narayan <jester@phrixus.net>
|
||||
* David Robson <rob@anope.org>
|
||||
* Daniele Nicolucci <jollino@sogno.net>
|
||||
* Florian Schulze <certus@anope.org>
|
||||
* Gabriel Acevedo H. <drstein@anope.org>
|
||||
* Jan Milants <viper@anope.org>
|
||||
* Jens Voss <dukepyrolator@anope.org>
|
||||
* JH <jh@irc-chat.net>
|
||||
* Joris Vink <joris@anope.org>
|
||||
* Lee Holmes <lethality@anope.org>
|
||||
* Lucas Nussbaum <lucas@lucas-nussbaum.net>
|
||||
* Mark Summers <mark@goopler.net>
|
||||
* Matthew Beeching <jobe@invictachat.net>
|
||||
* Naram Qashat <cyberbotx@anope.org>
|
||||
* Phil Lavin <phil@anope.org>
|
||||
* Pieter Bootsma <geniusdex@anope.org>
|
||||
* Robin Burchell <w00t@inspircd.org>
|
||||
* Sean Roe <therock247uk@anope.org>
|
||||
* Sebastian V <hal9000@anope.org>
|
||||
* Thomas Juberg StensĂĄs <ShadowMaster@Shadow-Realm.org>
|
||||
* Trystan .S Lee <trystan@nomadirc.net>
|
||||
* openglx <openglx@brasnerd.com.br>
|
||||
|
||||
Anope Translations:
|
||||
|
||||
* GeniusDex <geniusdex@anope.org> (nl.l)
|
||||
* Kein <kein-of@yandex.ru> (ru.l)
|
||||
* Maik Funke <Han@mefalcon.org> (de.l)
|
||||
* Gabriel Acevedo H. <drstein@anope.org> (es.l)
|
||||
* Janos Kapitany <sarkanyka@cjbchat.hu> (hun.l)
|
||||
* Szymon S'wierkosz <szymek@adres.pl> (pl.l)
|
||||
* Christopher N. <saka@epiknet.org> (fr.l)
|
||||
* Yusuf Kurekci <ysfm.20@gmail.com> (tr.l)
|
||||
|
||||
Anope uses the strlcat() and strlcpy() functions from OpenSSH 2.5.1p2.
|
||||
These functions are copyrighted by Todd C. Miller:
|
||||
|
||||
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
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 `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.
|
||||
|
||||
|
||||
2) Presentation
|
||||
|
||||
Anope is a set of Services for IRC networks that allows users to manage
|
||||
their nicks and channels in a secure and efficient way, and administrators
|
||||
to manage their network with powerful tools.
|
||||
|
||||
Currently available services are:
|
||||
|
||||
* NickServ, a powerful nickname manager that users can use to protect
|
||||
themselves against nick stealing. Each user has its own nickname
|
||||
group, that allows the user to register as many nicks as needed
|
||||
while still being able to take profit of his privileges and to
|
||||
modify the nick configuration. NickServ also has an optional
|
||||
password retrieval feature.
|
||||
|
||||
* ChanServ, a powerful channel manager that helps users to administer
|
||||
their channels in a totally customizable way. ChanServ has an
|
||||
internal list of privileged users and banned users that controls
|
||||
accesses on a per-channel basis. It eliminates all takeover
|
||||
problems, because of its powerful op/unban/invite and even mass
|
||||
deop and mass kick functions.
|
||||
|
||||
* MemoServ, an helpful companion that allows sending short messages
|
||||
to offline users, that they can then read when they come online
|
||||
later.
|
||||
|
||||
* BotServ, an original service that allows users to get a permanent,
|
||||
friendly bot on their channels in an easy way. Each bot can be
|
||||
configured to monitor the channels against floods, repetitions,
|
||||
caps writing, and swearing, and to take appropriate actions. It
|
||||
also can handle user-friendly commands (like !op, !deop, !voice,
|
||||
!devoice, !kick, and many others), say a short greet message when
|
||||
an user joins a channel, and even "take over" ChanServ actions such
|
||||
as auto-opping users, saying the entry notice, and so on. This
|
||||
service can be disabled if you want to save some bandwidth.
|
||||
|
||||
* OperServ, the IRCops' and IRC admins' black box, that allows them
|
||||
to manage the list of network bans (also known as AKILL (DALnet) or
|
||||
GLINE (Undernet)), to configure messages displayed to users when
|
||||
they log on, to set modes and to kick users from any channel, to
|
||||
send notices quickly to the entire network, and much more!
|
||||
|
||||
* HostServ, a neat service that allows users to show custom vHosts
|
||||
(virtual hosts) instead of their real IP address; this only works
|
||||
on daemons supporting ip cloaking, such as UnrealIRCd.
|
||||
|
||||
Anope currently works with:
|
||||
|
||||
* Bahamut 1.4.27 or later (including 1.8)
|
||||
* InspIRCd 1.1, 1.2, or 2.0
|
||||
* 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.
|
||||
|
||||
|
||||
3) Installation
|
||||
|
||||
See the INSTALL file for instruction on installing Anope.
|
||||
|
||||
|
||||
4) Command Line Options
|
||||
|
||||
Normally, Anope can be run simply by invoking the "services" executable.
|
||||
Any of the following command-line options can be specified to change
|
||||
the behavior of Anope:
|
||||
|
||||
--debug Enable debugging mode; more info sent to log (give
|
||||
option more times for more info)
|
||||
--readonly Enable read-only mode; no changes to databases
|
||||
allowed
|
||||
--nofork Do not fork after startup; log messages will be
|
||||
written to terminal
|
||||
--noexpire Expiration routines won't be run at all
|
||||
--version Display the version of Anope
|
||||
--nothird Do not load the non-core modules specified
|
||||
--protocoldebug Debug each incoming message after protocol parsing
|
||||
--support Used for support, same as -debug -nofork -nothird
|
||||
|
||||
Upon starting, Anope will parse its command-line parameters then
|
||||
(assuming the -nofork option is not given) detach itself and run in the
|
||||
background. If Anope encounters a problem reading the database files or
|
||||
cannot connect to its uplink server, it will terminate immediately;
|
||||
otherwise, it will run until the connection is terminated (or a QUIT,
|
||||
SHUTDOWN, or RESTART command is sent; see OperServ's help).
|
||||
|
||||
In the case of an error, an appropriate error message will be written to
|
||||
the log file.
|
||||
|
||||
If Anope is run with the "--readonly" command-line option, it can serve as
|
||||
a "backup" to the full version of services. A "full" version of services
|
||||
(run without --readonly) will automatically reintroduce its pseudo-clients
|
||||
(NickServ, ChanServ, etc.), while a "backup" services will not, thus
|
||||
allowing full services to be brought up at any time without disrupting
|
||||
the network (and without having to take backup services down beforehand).
|
||||
|
||||
The "--debug" option is useful if you find or suspect a problem in Anope.
|
||||
Giving it once on the command line will cause all traffic to and from
|
||||
services as well as some other debugging information to be recorded in
|
||||
the log file; if you send a bug report, PLEASE include an excerpt from
|
||||
the log file WITH DEBUGGING ACTIVE; we cannot emphasize enough how
|
||||
important this is to tracking down problems. (You can also enable
|
||||
debugging while Services is running using OperServ's SET DEBUG command.)
|
||||
If you repeat use --debug=<level>, the debugging level will be increased,
|
||||
which provides more detailed information but may also slow Anope down
|
||||
considerably and make the log file grow dramatically faster. In general,
|
||||
a debug level of 1 is sufficient for the coding team to be able to trace
|
||||
a problem, because all network traffic is included and we can usually
|
||||
reproduce the problem.
|
||||
|
||||
5) Messages Translations
|
||||
|
||||
Please see LANGUAGE for this information
|
||||
|
||||
6) Contact
|
||||
|
||||
For announcements and discussions about Anope, please visit our
|
||||
Portal and Forums at http://www.anope.org/ -- make sure you register
|
||||
yourself to get full benefits.
|
||||
|
||||
If you read the documentation carefully, and didn't find the answer to
|
||||
your question, feel free to post on the website forums or join our irc
|
||||
channel (irc.anope.org #anope). Once you join our Support channel be as
|
||||
precise as possible when asking a question, because we have no extraordinary
|
||||
powers and can't guess things if they aren't provided.
|
||||
|
||||
The more precise you are the sooner you'll be likely to get an answer.
|
||||
|
||||
If you think you found a bug, add it to the bug tracking system
|
||||
(http://bugs.anope.org) and - again - be as precise as possible. Also say
|
||||
whether the bug happens always or under what circumstances, and anything
|
||||
that could be useful to track your bug down. If you wrote a patch, send
|
||||
it over. :)
|
||||
|
||||
@@ -3,78 +3,43 @@ Legend:
|
||||
? = unsure
|
||||
+ = in progress
|
||||
|
||||
1.9.2
|
||||
1.9.4
|
||||
-----
|
||||
[x] Redo database insanity.
|
||||
[x] Move database load/save to a module
|
||||
[x] realtime SQL/whatever module using events (possibly ongoing)
|
||||
[x] flatfile save on a periodic timer
|
||||
[x] SANE password encryption - prefix password with the method it was encrypted with, allowing for *seamless* upgrading to different methods
|
||||
[x] Salted SHA256 (contact Special for this)
|
||||
[x] New database format (text, not binary - works very well for merging and so on)
|
||||
[x] generic database routines modules can use to create their own database
|
||||
[?] IRCd capability support: don't rely on CAPAB, provide an interface to turn capabilities on specifically
|
||||
[x] Socket subsystem needs some serious loving
|
||||
[x] Multiple sockets
|
||||
[x] Asynchronous, using select() (multiple engines? not really needed..)
|
||||
[x] Callbacks, event style, see also inspircd
|
||||
[x] generic way to check which modes a user has set (u->HasUmode(UMODE_OPER))
|
||||
[x] way for one module to depend on another... not like 2 MOD_HEADs and it being unpredictable which is loaded first..
|
||||
the MOD_HEAD MOD_TAIL allows for too few combinations (interface code of insp, hooks code of insp?)
|
||||
[x] Last used time on AKICK/access entries
|
||||
[x] Channel passwords seem to be of limited use, think of a more appropriate way to handle this
|
||||
[+] General options block, ability to turn LOGCHAN on from the config file..
|
||||
[x] Docs directory cleanup
|
||||
[x] Fix permanent channels support properly
|
||||
[x] CS SET INHABIT to keep pseudoclient in a channel after it empties to maintain banlists and such
|
||||
[x] Set forbidden channels +s
|
||||
[x] SendAkill should just take a pointer to the Akill class instead of millions of fields (same for some other stuff)
|
||||
[x] burn do_sjoin with fire
|
||||
[x] Channel access additions
|
||||
[x] Setter
|
||||
[x] Last used
|
||||
[x] MS IGNORE. Make it take nick (accounts) or n!u@h masks. Fake success of memo send still, but send to opers?
|
||||
[x] Allow users to delete their own access
|
||||
[x] ChanServ CLONE command
|
||||
[x] XMLRPC to execute commands and get data from Anope
|
||||
[+] fantasy: allow replies/notifications to fantasy commands to go to the channel via notice
|
||||
[x] Method to store listmodes (more generically than AKICK, too) for e.g. +beI and extbans, etc.
|
||||
[ ] understanding extbans for /cs unban etc.
|
||||
[ ] (optional?) A way to confirm email changes by users
|
||||
[ ] Auto identify through SSL key
|
||||
[ ] Optional os_login system that can also use SSL keys.
|
||||
[ ] os_info module to show useful configuration settings to services opers.
|
||||
[ ] Remove nick requests. Instead use an unconfirmed nick group which cant recieve umode +r and auto expires after 1d?
|
||||
[ ] LDAP
|
||||
|
||||
Future
|
||||
------
|
||||
[ ] Asynchronous DNS
|
||||
[ ] CIDR Akills, session exceptions, etc
|
||||
[ ] Hashing system for storing just about everything needs to die
|
||||
[ ] Move a (lot) of stuff to class members as a defined interface rather than copypasta everywhere (ns_set, ns_saset!)
|
||||
[?] Remote identification (1.9.1? will this break stuff?)
|
||||
[ ] Language charset stuff, including collation (1.9.1? phoenix?)
|
||||
[ ] Add support for +k, +q, etc type umodes
|
||||
[ ] fantasy: allow replies/notifications to fantasy commands to go to the channel via notice
|
||||
[?] a way for a module to queue itself (or even another module) for unloading
|
||||
[ ] Language system is disgusting, it must die.
|
||||
[ ] Modules should also have a way to add strings programatically
|
||||
[ ] Should be able to add many strings by dropping a file in a set location.
|
||||
[ ] I forsee this working via a function rather than defines, as it seems to do now: e.g. _("NS_NICK_IS_REGISTERED").
|
||||
[?] Update help to reflect the fact /msg memoserv set notify mail - works just fine ;)
|
||||
[ ] Useful/common "third party" modules to core distro
|
||||
[ ] NS AJOIN
|
||||
[+] Method to store listmodes (more generically than AKICK, too) for e.g. +beI and extbans, etc.
|
||||
[ ] Channel access additions
|
||||
[ ] Time added
|
||||
[ ] Time modified
|
||||
[ ] Expiry (useful?)
|
||||
[ ] NS INFO: seperate field for last seen realhost, shown to SRA only
|
||||
[ ] NS SUSPEND: show suspender and reason, probably to sopers only (see CS SUSPEND)
|
||||
[ ] Merge NS INFO blah ALL with NS INFO blah, if you're requesting info, you really want the info anyway.
|
||||
[?] Don't allow soper accounts to expire
|
||||
[?] Reason for CS SET RESTRICTED
|
||||
[ ] 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 INFO: seperate field for last seen realhost, shown to SRA only
|
||||
[ ] 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
|
||||
[ ] NS AJOIN
|
||||
[x] CS ENTRYMSG
|
||||
[?] Don't allow soper accounts to expire
|
||||
[?] Reason for CS SET RESTRICTED
|
||||
[x] AKILL/SGLINE/etc..
|
||||
[x] Setter
|
||||
[x] Time added
|
||||
[+] Time modified (can they be modified?)
|
||||
[ ] Time until expiry/expiry time (YES, time until expiry *instead of* expiry time, more human)
|
||||
[x] Time until expiry/expiry time (YES, time until expiry *instead of* expiry time, more human)
|
||||
[x] Reason
|
||||
[ ] Unique IDs on each AKILL/blah so that networks may use them as ticket IDs
|
||||
[ ] HS ACTIVATE -ALL (rob sez this all needs reviewing)
|
||||
[?] NS MARK, CS MARK. Allow multiple marks. Combine into OS MARK? (AKA os_info)
|
||||
[?] MS IGNORE. Make it take nick (accounts) or n!u@h masks. Fake success of memo send still, but send to opers?
|
||||
[?] More "friendly" date displays of some things like registration time ("November 7th 2006 (2 years, 0 months, 0 days ago)")
|
||||
[?] OS INJECT
|
||||
[?] Drop CS SET ENTRYMSG, replace with a 'news' type system? (limited to a configured number of items, default 3)
|
||||
|
||||
@@ -8,16 +8,16 @@ Anope Bundled Tools
|
||||
|
||||
The SMTP client can be used instead of sendmail for use with Anope's mail
|
||||
options. To use the SMTP client instead of sendmail, find the line in your
|
||||
services configuration file (services.conf) that defines SendMailPath. On
|
||||
services configuration file (services.conf) that defines sendmailpath. On
|
||||
that line, change the path to your services installation directory, then
|
||||
followed by "tools/anopesmtp" and the IP address of a valid SMTP server. It
|
||||
followed by "bin/anopesmtp" and the IP address of a valid SMTP server. It
|
||||
should look like this:
|
||||
|
||||
SendMailPath "/home/anope/services/tools/anopesmtp 127.0.0.1"
|
||||
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 smtp.h, and look
|
||||
for "smtp_debug" near the bottom. Change this from 0 to 1 and recompile
|
||||
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
|
||||
to connect to the SMTP server.
|
||||
|
||||
@@ -1,309 +0,0 @@
|
||||
Troubleshooting Guide for Anope 1.9
|
||||
------------------------------------------------
|
||||
|
||||
NOTE:
|
||||
An updated version of this guide can be found on our wiki:
|
||||
|
||||
http://wiki.anope.org/index.php/Troubleshooting
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
|
||||
1) General
|
||||
1.1) Anope complains in the logfile about being unable to load the default
|
||||
language.
|
||||
1.2) Anope spricht kein Deutsch!, etc. (Anope doesn't speak my language!)
|
||||
1.3) I selected a language other than English, but sometimes Anope sends
|
||||
responses in English instead.
|
||||
1.4) Anope always dies after about five minutes, saying "FATAL ERROR! Can't
|
||||
back up nick.db".
|
||||
1.5) Anope crashed with a segmentation fault.
|
||||
1.6) I've found a bug that's not mentioned here or in the README or BUGS
|
||||
files. What should I do?
|
||||
1.7) My FreeBSD box complains about 'Shared object "nss_dns.so.1" not
|
||||
found'
|
||||
1.8) Anope and long (more then 30 character) nicknames.
|
||||
|
||||
2) Installation / Configuration
|
||||
2.1) When I run "make", I get an error message like "missing separator",
|
||||
"Unassociated shell command", "Unexpected end of line seen", etc.
|
||||
2.2) I get an error like "Makefile.inc not found".
|
||||
2.3) I typed "./services" at the command line, but nothing happened!
|
||||
2.4) Whenever I start Anope, I get a message on my IRC server saying
|
||||
"connection refused" or something similar, and Anope gives an error
|
||||
message from the server saying "Closing Link: ...".
|
||||
2.5) My IRC server is giving me messages like "Connection to
|
||||
services.whatever.net[127.0.0.1] activated" and then "Access denied --
|
||||
no N line". Why?
|
||||
2.6) When I say "/connect services.*", it doesn't work!
|
||||
2.7) Anope starts up okay, but if I try to register a nickname, it comes
|
||||
back with "Sorry, registration failed."
|
||||
2.8) Anope reports (via /stats u or /msg OperServ STATS) a different number
|
||||
of users online than I get from doing /lusers.
|
||||
|
||||
3) BotServ
|
||||
3.1) How do I add bots to BotServ?
|
||||
3.2) Why do kick triggers and fantasy commands fail to work with my Bahamut
|
||||
IRCd?
|
||||
|
||||
4) ChanServ
|
||||
4.1) Anope's channel mode setting doesn't work. I can't set modes with
|
||||
OperServ, and every time ChanServ tries to set a mode, my server
|
||||
reverses the change.
|
||||
4.2) Anope ignored the SET SUCCESSOR setting and deleted a channel when the
|
||||
founder expired.
|
||||
4.3) How to auto voice all those whom join my #channel?
|
||||
4.4) Channel options like RESTRICTED or SECUREOPS don't work. What's wrong?
|
||||
|
||||
5) OperServ
|
||||
5.1) Using the OperServ JUPE command results in server messages like
|
||||
"Server juped.server introduced by non-hub server services.my.net".
|
||||
5.2) When I add an AKILL, the users matching it don't get killed.
|
||||
5.3) Trying to use OperServ gives me "Access denied".
|
||||
5.4) I can't get /OS UMODES and /OS SVSNICK to work!
|
||||
5.5) What is a Super-Admin? How does it work? Why might it not work?
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
1) General
|
||||
|
||||
1.1) Anope complains in the logfile about being unable to load the default
|
||||
language.
|
||||
|
||||
You forgot to run "make install".
|
||||
|
||||
1.2) Anope spricht kein Deutsch!, etc. (Anope doesn't speak my language!)
|
||||
|
||||
See section 5 of the README file.
|
||||
|
||||
1.3) I selected a language other than English, but sometimes Anope sends
|
||||
responses in English instead.
|
||||
|
||||
Some language files are not complete--in other words, they only have a
|
||||
translation of some of the message Anope uses. In this case, the
|
||||
missing messages will be displayed in English. You can either wait for
|
||||
the primary translator to provide us with a translation, or do the
|
||||
translation yourself and send us the messages translated into your
|
||||
language.
|
||||
|
||||
1.4) Anope always dies after about five minutes, saying "FATAL ERROR! Can't
|
||||
back up nick.db".
|
||||
|
||||
Make sure that the user Anope runs as has write access to the data
|
||||
directory, and that the data directory actually exists (the latter
|
||||
shouldn't be a problem if you ran the Config script). This means Anope
|
||||
needs write and execute permission on the data directory itself and execute
|
||||
permission on every parent directory of the data directory.
|
||||
|
||||
1.5) Anope crashed with a segmentation fault.
|
||||
|
||||
See if you can reproduce this by doing a certain sequence of things. If
|
||||
so, please report it to us (see part 6 of README file). If not, you're
|
||||
probably out of luck; if you like, you can report it to us anyway, but
|
||||
chances are it won't get fixed if we don't have instructions on reproducing
|
||||
it. If you do have such a problem, you may find the crontab utility useful
|
||||
for dealing with it.
|
||||
|
||||
Also, see the DumpCore directive in the configuration file. It allows Anope
|
||||
to dump its core whenever it's segfaulting, usually calling it core and
|
||||
placing it into Anope's main directory. Open up gdb by issuing the
|
||||
following command at your shell:
|
||||
|
||||
* gdb services core
|
||||
|
||||
(of course replacing 'core' with the name of the core if different) and
|
||||
type 'bt' at the gdb prompt. After that, send us the output you got and
|
||||
keep the core file in a safe place, in case we need it to dig deeper into
|
||||
the problem.
|
||||
|
||||
1.6) I've found a bug that's not mentioned here or in the README or BUGS files.
|
||||
What should I do?
|
||||
|
||||
See section 6 of the README file.
|
||||
|
||||
1.7) My FreeBSD box complains about 'Shared object "nss_dns.so.1" not found'
|
||||
|
||||
We haven't figured out the exact cause yet, but as a quickfix you can
|
||||
delete the /etc/nsswitch.conf file. Please keep in mind that removing a
|
||||
configuration file can be dangerous, so only do this if you know what you
|
||||
are doing.
|
||||
|
||||
1.8) Anope and long (more then 30 character) nicknames.
|
||||
|
||||
By default, Anope only supports nicknames up to 30 characters (NICKLEN=30).
|
||||
If your IRCd allows for longer nicknames or has been modified to do so
|
||||
Anope will start logging a lot of ("NICK from nonexistent nick") messages.
|
||||
This is because once a user uses a nick that is too long for Anope to handle,
|
||||
Anope loses track of the user for the remainder of the session.
|
||||
It is POSSIBLE but not NOT RECOMMENDED to extend the maximum length of nicknames
|
||||
Anope can track, however this will also break database compatibility. DBs saved
|
||||
with Anope set to allow for example 40 chars cannot be read by a clean Anope
|
||||
installation and vice versa. So changing the maximum nick length is only possible
|
||||
when starting with fresh databases and even then the consequences of this are
|
||||
UNTESTED.
|
||||
In order to change the maximum internal nick length, change the NICKMAX setting
|
||||
in include/config.h, recompile anope and start without databases.
|
||||
|
||||
|
||||
2) Installation / Configuration
|
||||
|
||||
2.1) When I run "make", I get an error message like "missing separator",
|
||||
"Unassociated shell command", "Unexpected end of line seen", etc.
|
||||
|
||||
Your make program isn't compatible with the Makefile for Anope. The
|
||||
Makefile was designed to work with GNU make, and as such may not work on
|
||||
other systems' "make" programs. If you get an error from "make", obtain
|
||||
GNU make from ftp://prep.ai.mit.edu/pub/gnu/make/ (or wherever you prefer) and
|
||||
use it instead of your system's default "make". Note that GNU make may
|
||||
already be installed on your system; try using the command "gmake" instead
|
||||
of "make".
|
||||
|
||||
The make programs bundled with SunOS/Solaris and FreeBSD have been reported
|
||||
not to work; you will need to use GNU make on these systems.
|
||||
|
||||
2.2) I get an error like "Makefile.inc not found".
|
||||
|
||||
You forgot to run the Config script first. See the INSTALL file for
|
||||
compilation instructions.
|
||||
|
||||
2.3) I typed "./services" at the command line, but nothing happened!
|
||||
|
||||
Anope puts itself in the background when it starts, so you get your shell
|
||||
prompt right back. Meanwhile, Anope will continue setting up, then connect
|
||||
to the IRC server specified in services.conf (or on the command line). If
|
||||
it doesn't connect, you probably specified the wrong IRCd or RemoteServer in
|
||||
the configuration file. Check to make sure that you are actually running one of
|
||||
the supported IRCds, also. A list of supported IRCds can be found in the README
|
||||
file.
|
||||
|
||||
You can also check the log file (services.log by default) for error
|
||||
messages. Starting services with the -support command line option
|
||||
will prevent it from running in the background will output the
|
||||
messages written to the log file to the console as well. Please note that this
|
||||
will also prevent 3rd party modules from loading and will put Anope into
|
||||
debug mode.
|
||||
|
||||
2.4) Whenever I start Anope, I get a message on my IRC server saying
|
||||
"connection refused" or something similar, and Anope gives an error
|
||||
message from the server saying "Closing Link: ...".
|
||||
|
||||
See section 3 of the INSTALL file.
|
||||
|
||||
2.5) My IRC server is giving me messages like "Connection to
|
||||
services.whatever.net[127.0.0.1] activated" and then "Access denied -- no
|
||||
N line". Why?
|
||||
|
||||
This is typically caused by including a port number in the C:line for
|
||||
services, which tells your server to try to autoconnect to it (depending on
|
||||
the class (Y:line) settings). This is not what you want, because Anope
|
||||
will connect to the server itself, but does not listen for servers to
|
||||
connect to it. The solution is to remove the port number from the C:line.
|
||||
|
||||
2.6) When I say "/connect services.*", it doesn't work!
|
||||
|
||||
You cannot /connect services. When you start Anope, it will attempt to
|
||||
connect to the server you specified in services.conf. Please see the answer
|
||||
above for more information.
|
||||
|
||||
2.7) Anope starts up okay, but if I try to register a nickname, it comes back
|
||||
with "Sorry, registration failed."
|
||||
|
||||
Make sure you've selected the correct IRC server type in the configure
|
||||
script; see section 3 of the INSTALL file for details.
|
||||
|
||||
2.8) Anope reports (via /stats u or /msg OperServ STATS) a different number of
|
||||
users online than I get from doing /lusers.
|
||||
|
||||
Anope doesn't count its own pseudo-clients (NickServ, ChanServ, etc.) in
|
||||
its user count, while the IRC server does.
|
||||
|
||||
3) BotServ
|
||||
|
||||
3.1) How do I add bots to BotServ?
|
||||
|
||||
Read /msg BotServ HELP and /msg BotServ HELP BOT. Note that you need to be
|
||||
opered up and identified as a Services Administrator in Anope before you
|
||||
can use the BOT command.
|
||||
|
||||
3.2) Why do kick triggers and fantasy commands fail to work with my Bahamut
|
||||
IRCd?
|
||||
|
||||
Bahamut allows you to setup a server as 'serviceshub'. This will filter
|
||||
certain data that services usually don't need to process. This option also
|
||||
filters channel messages, because DALnet's services have no use for them.
|
||||
Anope parses the channel messages for kick triggers and fantasy commands.
|
||||
To make sure these work the server type of the hub they're linked to should
|
||||
be simply 'hub' and not 'serviceshub'.
|
||||
|
||||
|
||||
4) ChanServ
|
||||
|
||||
4.1) Anope's channel mode setting doesn't work. I can't set modes with
|
||||
OperServ, and every time ChanServ tries to set a mode, my server reverses
|
||||
the change.
|
||||
|
||||
Make sure EVERY server on your network has a U: line for Services in
|
||||
ircd.conf, for example:
|
||||
|
||||
U:services.whatever.net:*:*
|
||||
|
||||
4.2) Anope ignored the SET SUCCESSOR setting and deleted a channel when the
|
||||
founder expired.
|
||||
|
||||
Normally, this is because the successor had too many channels registered.
|
||||
In this case, you will see an entry in the log file like the following:
|
||||
|
||||
[date] Successor (SuccessorNick) of channel #somechannel owns too many
|
||||
channels, deleting channel #somechannel
|
||||
|
||||
If you don't get a message like this or you can verify that the successor
|
||||
wasn't running into the channel limit, please report it using the
|
||||
bug-reporting procedure in section 6 of the README file.
|
||||
|
||||
4.3) How to auto voice all those whom join my #channel?
|
||||
|
||||
Execute the following commands (/cs is an alias for /msg ChanServ):
|
||||
|
||||
/cs set #channel secure off
|
||||
/cs set #channel xop off
|
||||
/cs levels #channel set AUTOVOICE -1
|
||||
|
||||
4.4) Channel options like RESTRICTED or SECUREOPS don't work. What's wrong?
|
||||
|
||||
Make sure that you didn't put any of your normal IRCd's as a ULined server
|
||||
in Anope. Some access checks for clients from ULined servers are skipped to
|
||||
avoid fights between the ULined servers. This is usually only useful when
|
||||
you have a statistics server connected to your network.
|
||||
|
||||
5) OperServ
|
||||
|
||||
5.1) Using the OperServ JUPE command results in server messages like "Server
|
||||
juped.server introduced by non-hub server services.my.net".
|
||||
|
||||
Services' uplink must have an H: line for Services in the ircd.conf file,
|
||||
which looks something like:
|
||||
|
||||
H:*::services.whatever.net
|
||||
|
||||
5.2) When I add an AKILL, the users matching it don't get killed.
|
||||
|
||||
Use the AkillOnAdd configuration directive.
|
||||
|
||||
5.3) Trying to use OperServ gives me "Access denied".
|
||||
|
||||
Check that you're opered on your IRCd (ie, moded +o)
|
||||
Check that you're identified to a nickname listed within an opertype allowed to do the command you're trying.
|
||||
Check whether you can use /msg operserv staff
|
||||
|
||||
5.4) I can't get /OS UMODES and /OS SVSNICK to work!
|
||||
|
||||
You need to be a SuperAdmin to be able to use these commands.
|
||||
|
||||
5.5) What is a Super-Admin? How does it work? Why might it not work?
|
||||
|
||||
SuperAdmin's have extra privileges, including being founder on all
|
||||
channels. It must be activated on a per user basis and is only available to
|
||||
Services Roots. It is set using OperServ and is not persistent. It only
|
||||
works if SuperAdmin is not commented in the services configuration file,
|
||||
which is commented out by default. Read /msg OperServ HELP SET SUPERADMIN
|
||||
for further help.
|
||||
+23
-54
@@ -25,28 +25,20 @@ Anope for Windows
|
||||
|
||||
(NOTE: When installing, tell CMake to add itself to the PATH.)
|
||||
|
||||
If you have Visual C++ 6, 7 (.NET 2002/2003), 8 (2005), or 9 (2008) skip ahead to step 2, else you
|
||||
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.
|
||||
|
||||
* Microsoft Visual C++ 2008 Express Edition:
|
||||
* Microsoft Visual C++ 2010 Express Edition:
|
||||
http://www.microsoft.com/express/vc/
|
||||
|
||||
or
|
||||
|
||||
* Microsoft Visual C++ 2005 Express Edition:
|
||||
http://www.microsoft.com/downloads/details.aspx?FamilyId=7B0B0339-613A-46E6-AB4D-080D4D4A8C4E&displaylang=en
|
||||
|
||||
then download and install:
|
||||
|
||||
* Microsoft Windows 2008 SDK:
|
||||
http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en
|
||||
|
||||
or (if you prefer a smaller download)
|
||||
|
||||
* Microsoft Windows 2003 Platform SDK: (Requires WGA validation)
|
||||
http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&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
|
||||
@@ -54,10 +46,6 @@ Anope for Windows
|
||||
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.)
|
||||
|
||||
If you chose to download the 2003 SDK, it will not work out-of-the-box on either Visual C++ 2005 Express or
|
||||
Visual C++ 2008 Express. The 2008 SDK will work out-of-the-box with Visual C++ 2008 Express but not with
|
||||
Visual C++ 2005 Express.
|
||||
|
||||
2) Unpack the Anope tarball with your favorite uncompression program
|
||||
(WinZip or WinRAR, etc).
|
||||
|
||||
@@ -84,7 +72,7 @@ Anope for Windows
|
||||
|
||||
4) You now need to configure Anope to your requirements. At the prompt type:
|
||||
|
||||
<path to source directory>\Config.bat
|
||||
<path to source directory>\Config.exe
|
||||
|
||||
NOTE: If you run an Anti-Virus program such as McAfee or Norton, you may
|
||||
be unable to run this command due to the protection in place. Some Anti-
|
||||
@@ -103,6 +91,23 @@ Anope for Windows
|
||||
If you cannot find whats causing the error, please visit our forums or
|
||||
our IRC Support channel for assistance.
|
||||
|
||||
Some Anope modules require third party libraries, such as m_mysql and
|
||||
m_ssl. If these libraries are installed in nonstandard locations, cmake
|
||||
will probably not find them and should be told where they are by passing
|
||||
additional search paths to the last question in Config, such as:
|
||||
|
||||
-DEXTRA_INCLUDES:STRING=c:/openssl/include;c:/openssl/lib
|
||||
|
||||
Which would have cmake search both C:\openssl\include and
|
||||
C:\openssl\lib.
|
||||
|
||||
Building Anope with gettext requires libintl, libiconv, libgcc and
|
||||
libmingex. We have precompiled these libraries for you that you may
|
||||
use if you want. They are avaiable at http://anope.org/downloads/anope-extra.zip
|
||||
The OpenSSL, MySQL, and OpenLDAP header files and libraries are also included in
|
||||
this package. Once downloaded and extracted, you should run install.bat
|
||||
then give Config the path to the new 'installed' directory.
|
||||
|
||||
5) You are now ready to compile. If you said you wanted to use NMake in step 4,
|
||||
at the prompt type:
|
||||
|
||||
@@ -146,22 +151,10 @@ Anope for Windows
|
||||
edit the file correctly.
|
||||
|
||||
Open services.conf, and read through it carefully and adjust the settings
|
||||
you think you need to adjust. Pay special attention to these settings:
|
||||
|
||||
A) IRCDModule: This is the name of an IRCd Module that Anope will use
|
||||
to communicate with your server. Anope supports 15 IRCds,
|
||||
so ensure you set the right value here.
|
||||
B) RemoteServer: This is the address to your ircd, along with the port
|
||||
and password. You should consult your ircd
|
||||
documentation on how to link ircds.
|
||||
C) ServicesRoot: Remove the # and change the names to your nick so you
|
||||
can take control of services once they are online.
|
||||
D) UserKey1/2/3: Remove the # infront of the three UserKey settings, and
|
||||
change the parameters to numbers; around 6-7 digits will
|
||||
do.
|
||||
you think you need to adjust.
|
||||
|
||||
If you are unsure of the settings, you can go to the dos command prompt
|
||||
and run "anope.exe -nofork -debug" and watch the information as it
|
||||
and run "anope.exe --nofork --debug" and watch the information as it
|
||||
attempts to connect.
|
||||
|
||||
You can launch services in two ways. If you are sure that the entered
|
||||
@@ -174,31 +167,7 @@ Anope for Windows
|
||||
3) Compiling Modules
|
||||
|
||||
If you want to build other modules than the ones shipped by default, you
|
||||
will need to modify the Makefile.inc.win32 file, in the src\modules folder.
|
||||
|
||||
A) Add modules; find the line stating "SRCS=" and add the name of the
|
||||
file to the end of the line. So if you have two files:
|
||||
|
||||
SRCS=file.c file2.c
|
||||
|
||||
If you are compiling a folder of module components, such as the example
|
||||
"catserv", you will need to add/change the "SUBS=" line. If you were
|
||||
compiling the "catserv" example, the line would look like this:
|
||||
|
||||
SUBS=catserv
|
||||
|
||||
B) When you've done this, use the same command prompt you set up in part
|
||||
1, change directories to the src\modules folder, and type:
|
||||
|
||||
nmake -f Makefile.win32
|
||||
|
||||
followed afterwards, by:
|
||||
|
||||
nmake -f Makefile.win32 install
|
||||
|
||||
C) You should now be able to load your modules on IRC via OperServ, or via
|
||||
the services.conf file.
|
||||
|
||||
will need to rerun Config.exe
|
||||
|
||||
4) Other compile options
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
Starting with Anope 1.9.4 XMLRPC using PHP's xmlrpc_encode_request and xmlrpc_decode functions is supported.
|
||||
This allows external applications, such as websites, to execute remote procedure calls to Anope in real time.
|
||||
|
||||
Currently there are 5 supported XMLRPC calls, provided by m_xmlrpc_main:
|
||||
|
||||
checkAuthetication - Takes two parameters, an account name and a password. Checks if the account name is valid and the password
|
||||
is correct for the account name, useful for making login pages on websites.
|
||||
|
||||
command - Takes three parameters, a service name (BotServ, ChanServ, NickServ), a user name (whether online or not), and the command
|
||||
to execute. This will execute a the given command to Anope using the given service name. If the user given is online, the
|
||||
command reply will go to them, if not it is returned by XMLRPC.
|
||||
|
||||
stats - Takes no parameters, returns miscellaneous stats that can be found in the /operserv stats command.
|
||||
|
||||
channel - Takes one parameter, a channel name, and returns real time information regarding that channel, such as users, modes
|
||||
(ban lists and such), topic etc.
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/* XMLRPC Functions
|
||||
*
|
||||
* (C) 2003-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
*/
|
||||
|
||||
class AnopeXMLRPC
|
||||
{
|
||||
private $Host, $Bind, $Port;
|
||||
|
||||
private $Socket;
|
||||
|
||||
function __construct($Host, $Port, $Bind = NULL)
|
||||
{
|
||||
$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:
|
||||
* $this->RunXMLRPC("checkAuthentication", array("adam", "qwerty"));
|
||||
* If successful returns back an array of useful information.
|
||||
*
|
||||
* Note that $params["id"] is reserved for query ID, you may set it to something if you wish.
|
||||
* If you do, the same ID will be passed back with the reply from Anope.
|
||||
*/
|
||||
function RunXMLRPC($name, $params)
|
||||
{
|
||||
$xmlquery = xmlrpc_encode_request($name, $params);
|
||||
socket_write($this->Socket, $xmlquery);
|
||||
|
||||
$inbuf = socket_read($this->Socket, 4096);
|
||||
$inbuf = substr($inbuf, strpos($inbuf, "\r\n\r\n") + 4);
|
||||
$response = xmlrpc_decode($inbuf);
|
||||
|
||||
if (isset($response[0]))
|
||||
return $response[0];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Do Command on Service as User, eg:
|
||||
* $anope->DoCommand("ChanServ", "Adam", "REGISTER #adam");
|
||||
* Returns an array of information regarding the command execution, if
|
||||
* If 'online' is set to yes, then the reply to the command was sent to the user on IRC.
|
||||
* If 'online' is set to no, then the reply to the command is in the array member 'return'
|
||||
*/
|
||||
function DoCommand($Service, $User, $Command)
|
||||
{
|
||||
return $this->RunXMLRPC("command", array($Service, $User, $Command));
|
||||
}
|
||||
|
||||
/** Check an account/nick name and password to see if they are valid
|
||||
* Returns the account display name if valid
|
||||
*/
|
||||
function CheckAuthentication($Account, $Pass)
|
||||
{
|
||||
$ret = $this->RunXMLRPC("checkAuthentication", array($Account, $Pass));
|
||||
|
||||
if ($ret && $ret["result"] == "Success")
|
||||
return $ret["account"];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Returns an array of misc stats regarding Anope
|
||||
*/
|
||||
function DoStats()
|
||||
{
|
||||
return $this->RunXMLRPC("stats", NULL);
|
||||
}
|
||||
|
||||
/* Look up data for a channel
|
||||
* Returns an array containing channel information, or an array of size one
|
||||
* (just containing the name) if the channel does not exist
|
||||
*/
|
||||
function DoChannel($Channel)
|
||||
{
|
||||
return $this->RunXMLRPC("channel", NULL);
|
||||
}
|
||||
|
||||
/* Like DoChannel(), but different.
|
||||
*/
|
||||
function DoUser($User)
|
||||
{
|
||||
return $this->RunXMLRPC("user", array($User));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
+44
-27
@@ -1,30 +1,47 @@
|
||||
# If we are building for Visual Studio OR if the system we are on doesn't have sh (which would be odd on a *nix system...), we'll build a C++ program to create version.h
|
||||
if(MSVC OR NOT SH)
|
||||
# Set version.sh.c to use C++ as well as set it's compile flags
|
||||
set_source_files_properties(version.sh.c PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
# Generate version_sh executable to create version.h from the contents of version.sh, setting it's linker flags as well
|
||||
add_executable(version_sh version.sh.c)
|
||||
set_target_properties(version_sh PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
|
||||
# Generate version.h from the above executable and the version.log file from the main source directory, with dependencies to the given headers and all source files in the main Anope build
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
||||
COMMAND version_sh ${Anope_SOURCE_DIR}/version.log ${CMAKE_CURRENT_SOURCE_DIR}/version.sh ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/version.sh DEPENDS version_sh ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h ${CMAKE_CURRENT_SOURCE_DIR}/messages.h ${SRC_SRCS}
|
||||
)
|
||||
# Add version_sh to list of files for CPack to ignore
|
||||
get_target_property(version_sh_BINARY version_sh LOCATION)
|
||||
get_filename_component(version_sh_BINARY ${version_sh_BINARY} NAME)
|
||||
add_to_cpack_ignored_files("${version_sh_BINARY}$" TRUE)
|
||||
# For any non-Visual Studio platforms that do have sh, we will run version.h through the version.h shell script
|
||||
else(MSVC OR NOT SH)
|
||||
# Generate version.h from version.sh and the version.log file from the main source directory, with dependencies to the given headers and all source files in the main Anope build
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
||||
COMMAND ${SH} ${CMAKE_CURRENT_SOURCE_DIR}/version.sh ${Anope_SOURCE_DIR}/version.log ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/version.sh DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h ${CMAKE_CURRENT_SOURCE_DIR}/messages.h ${SRC_SRCS}
|
||||
)
|
||||
endif(MSVC OR NOT SH)
|
||||
# Set version.cpp to use C++ as well as set its compile flags
|
||||
set_source_files_properties(version.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
# Generate version executable to modify version.h, setting it's linker flags as well
|
||||
add_executable(version version.cpp)
|
||||
set_target_properties(version PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
|
||||
get_target_property(version_BINARY version LOCATION)
|
||||
# Modify version.h from the above executable, with dependencies to the given headers, version.cpp, and all source files in the main Anope build
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
|
||||
COMMAND ${version_BINARY} ${Anope_SOURCE_DIR}/src/version.sh ${CMAKE_CURRENT_SOURCE_DIR}/version.h
|
||||
DEPENDS version ${SRC_SRCS}
|
||||
)
|
||||
# Add version to list of files for CPack to ignore
|
||||
get_filename_component(version_BINARY ${version_BINARY} NAME)
|
||||
add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
|
||||
if(NOT WIN32)
|
||||
add_to_cpack_ignored_files("version.h$" TRUE)
|
||||
endif(NOT WIN32)
|
||||
|
||||
# Add version.h to the list of files for CPack to ignore
|
||||
add_to_cpack_ignored_files("version.h$" TRUE)
|
||||
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")
|
||||
|
||||
set(PCH_SOURCES "module.h;modules.h;services.h")
|
||||
foreach(PCH_SOURCE ${PCH_SOURCES})
|
||||
set(PCH_EXTRAFLAGS "")
|
||||
if(DEBUG_BUILD)
|
||||
set(PCH_EXTRAFLAGS "-g")
|
||||
endif(DEBUG_BUILD)
|
||||
if(PCH_SOURCE STREQUAL "module.h")
|
||||
set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC)
|
||||
endif(PCH_SOURCE STREQUAL "module.h")
|
||||
if(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
|
||||
)
|
||||
endforeach(PCH_SOURCE ${PCH_SOURCES})
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
# Add a custom target to the above file
|
||||
add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version.h ${PCH_SOURCES_GCH})
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
all: services.h extern.h pseudo.h version.h
|
||||
|
||||
version.h: Makefile version.sh services.h pseudo.h messages.h $(SRCS)
|
||||
sh version.sh ../version.log $@
|
||||
|
||||
services.h: sysconf.h config.h extern.h
|
||||
touch $@
|
||||
|
||||
extern.h: slist.h
|
||||
touch $@
|
||||
|
||||
pseudo.h: commands.h timers.h slist.h
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
(rm -f language.h)
|
||||
|
||||
distclean: clean
|
||||
(rm -f sysconf.h version.h)
|
||||
+139
-58
@@ -1,3 +1,16 @@
|
||||
#ifndef ACCOUNT_H
|
||||
#define ACCOUNT_H
|
||||
|
||||
#include "anope.h"
|
||||
|
||||
class NickAlias;
|
||||
class NickCore;
|
||||
|
||||
typedef unordered_map_namespace::unordered_map<Anope::string, NickAlias *, ci::hash, std::equal_to<ci::string> > nickalias_map;
|
||||
typedef unordered_map_namespace::unordered_map<Anope::string, NickCore *, ci::hash, std::equal_to<ci::string> > nickcore_map;
|
||||
|
||||
extern CoreExport nickalias_map NickAliasList;
|
||||
extern CoreExport nickcore_map NickCoreList;
|
||||
|
||||
/* NickServ nickname structures. */
|
||||
|
||||
@@ -25,6 +38,10 @@ enum NickNameFlag
|
||||
NS_END
|
||||
};
|
||||
|
||||
const Anope::string NickNameFlagStrings[] = {
|
||||
"BEGIN", "FORBIDDEN", "NO_EXPIRE", "HELD", "COLLIDED", ""
|
||||
};
|
||||
|
||||
/** Flags set on NickCores
|
||||
*/
|
||||
enum NickCoreFlag
|
||||
@@ -65,51 +82,41 @@ enum NickCoreFlag
|
||||
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
|
||||
};
|
||||
|
||||
/** XXX: this really needs to die with fire and be merged with metadata into NickCore or something.
|
||||
*/
|
||||
class CoreExport NickRequest
|
||||
{
|
||||
public:
|
||||
NickRequest(const std::string &nickname);
|
||||
|
||||
~NickRequest();
|
||||
|
||||
NickRequest *next, *prev;
|
||||
char *nick;
|
||||
std::string passcode;
|
||||
std::string password;
|
||||
char *email;
|
||||
time_t requested;
|
||||
time_t lastmail; /* Unsaved */
|
||||
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>
|
||||
class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_END>
|
||||
{
|
||||
public:
|
||||
/** Default constructor
|
||||
* @param nickname The nick
|
||||
* @param nickcore The nickcofe for this nick
|
||||
*/
|
||||
NickAlias(const std::string &nickname, NickCore *nickcore);
|
||||
NickAlias(const Anope::string &nickname, NickCore *nickcore);
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
~NickAlias();
|
||||
|
||||
NickAlias *next, *prev;
|
||||
char *nick; /* Nickname */
|
||||
char *last_quit; /* Last quit message */
|
||||
char *last_realname; /* Last realname */
|
||||
char *last_usermask; /* Last usermask */
|
||||
Anope::string nick; /* Nickname */
|
||||
Anope::string last_quit; /* Last quit message */
|
||||
Anope::string last_realname; /* Last realname */
|
||||
Anope::string last_usermask; /* Last usermask */
|
||||
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 */
|
||||
time_t last_seen; /* When it was seen online for the last time */
|
||||
NickCore *nc; /* I'm an alias of this */
|
||||
HostInfo hostinfo;
|
||||
|
||||
/** Release a nick
|
||||
@@ -125,63 +132,48 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag>
|
||||
void OnCancel(User *u);
|
||||
};
|
||||
|
||||
class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag>
|
||||
class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END>
|
||||
{
|
||||
public:
|
||||
/** Default constructor
|
||||
/** Default constructor
|
||||
* @param display The display nick
|
||||
*/
|
||||
NickCore(const std::string &nickdisplay);
|
||||
NickCore(const Anope::string &nickdisplay);
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
~NickCore();
|
||||
|
||||
NickCore *next, *prev;
|
||||
|
||||
std::list<User *> Users;
|
||||
|
||||
char *display; /* How the nick is displayed */
|
||||
std::string pass; /* Password of the nicks */
|
||||
char *email; /* E-mail associated to the nick */
|
||||
char *greet; /* Greet associated to the nick */
|
||||
uint32 icq; /* ICQ # associated to the nick */
|
||||
char *url; /* URL associated to the nick */
|
||||
uint16 language; /* Language selected by nickname owner (LANG_*) */
|
||||
std::vector<std::string> access; /* Access list, vector of strings */
|
||||
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 */
|
||||
MemoInfo memos;
|
||||
uint16 channelcount; /* Number of channels currently registered */
|
||||
uint16 channelcount; /* Number of channels currently registered */
|
||||
|
||||
OperType *ot;
|
||||
Oper *o;
|
||||
|
||||
/* Unsaved data */
|
||||
time_t lastmail; /* Last time this nick record got a mail */
|
||||
SList aliases; /* List of aliases */
|
||||
|
||||
/** Check whether this opertype has access to run the given command string.
|
||||
* @param cmdstr The string to check, e.g. botserv/set/private.
|
||||
* @return True if this opertype may run the specified command, false otherwise.
|
||||
*/
|
||||
virtual bool HasCommand(const std::string &cmdstr) const;
|
||||
time_t lastmail; /* Last time this nick record got a mail */
|
||||
std::list<NickAlias *> aliases; /* List of aliases */
|
||||
|
||||
/** Checks whether this account is a services oper or not.
|
||||
* @return True if this account is a services oper, false otherwise.
|
||||
*/
|
||||
virtual bool IsServicesOper() const;
|
||||
|
||||
/** Check whether this opertype has access to the given special permission.
|
||||
* @param privstr The priv to check for, e.g. users/auspex.
|
||||
* @return True if this opertype has the specified priv, false otherwise.
|
||||
*/
|
||||
virtual bool HasPriv(const std::string &privstr) const;
|
||||
|
||||
/** Add an entry to the nick's access list
|
||||
*
|
||||
* @param entry The nick!ident@host entry to add to the access list
|
||||
*
|
||||
* Adds a new entry into the access list.
|
||||
*/
|
||||
void AddAccess(const std::string &entry);
|
||||
void AddAccess(const Anope::string &entry);
|
||||
|
||||
/** Get an entry from the nick's access list by index
|
||||
*
|
||||
@@ -190,7 +182,7 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag>
|
||||
*
|
||||
* Retrieves an entry from the access list corresponding to the given index.
|
||||
*/
|
||||
std::string GetAccess(unsigned entry);
|
||||
Anope::string GetAccess(unsigned entry) const;
|
||||
|
||||
/** Find an entry in the nick's access list
|
||||
*
|
||||
@@ -199,7 +191,7 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag>
|
||||
*
|
||||
* Search for an entry within the access list.
|
||||
*/
|
||||
bool FindAccess(const std::string &entry);
|
||||
bool FindAccess(const Anope::string &entry);
|
||||
|
||||
/** Erase an entry from the nick's access list
|
||||
*
|
||||
@@ -207,12 +199,101 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag>
|
||||
*
|
||||
* Removes the specified access list entry from the access list.
|
||||
*/
|
||||
void EraseAccess(const std::string &entry);
|
||||
void EraseAccess(const Anope::string &entry);
|
||||
|
||||
/** Clears the entire nick's access list
|
||||
*
|
||||
* Deletes all the memory allocated in the access list vector and then clears the vector.
|
||||
*/
|
||||
void ClearAccess();
|
||||
|
||||
/** Add an entry to the nick's certificate list
|
||||
*
|
||||
* @param entry The fingerprint to add to the cert list
|
||||
*
|
||||
* Adds a new entry into the cert list.
|
||||
*/
|
||||
void AddCert(const Anope::string &entry);
|
||||
|
||||
/** Get an entry from the nick's cert list by index
|
||||
*
|
||||
* @param entry Index in the certificaate list vector to retrieve
|
||||
* @return The fingerprint entry of the given index if within bounds, an empty string if the vector is empty or the index is out of bounds
|
||||
*
|
||||
* Retrieves an entry from the certificate list corresponding to the given index.
|
||||
*/
|
||||
Anope::string GetCert(unsigned entry) const;
|
||||
|
||||
/** Find an entry in the nick's cert list
|
||||
*
|
||||
* @param entry The fingerprint to search for
|
||||
* @return True if the fingerprint is found in the cert list, false otherwise
|
||||
*
|
||||
* Search for an fingerprint within the cert list.
|
||||
*/
|
||||
bool FindCert(const Anope::string &entry);
|
||||
|
||||
/** Erase a fingerprint from the nick's certificate list
|
||||
*
|
||||
* @param entry The fingerprint to remove
|
||||
*
|
||||
* Removes the specified fingerprint from the cert list.
|
||||
*/
|
||||
void EraseCert(const Anope::string &entry);
|
||||
|
||||
/** Clears the entire nick's cert list
|
||||
*
|
||||
* Deletes all the memory allocated in the certificate list vector and then clears the vector.
|
||||
*/
|
||||
void ClearCert();
|
||||
|
||||
};
|
||||
|
||||
/** Timer for colliding nicks to force people off of nicknames
|
||||
*/
|
||||
class NickServCollide : public Timer
|
||||
{
|
||||
dynamic_reference<User> u;
|
||||
Anope::string nick;
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
* @param nick The nick we're colliding
|
||||
* @param delay How long to delay before kicking the user off the nick
|
||||
*/
|
||||
NickServCollide(User *user, time_t delay);
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
virtual ~NickServCollide();
|
||||
|
||||
/** Called when the delay is up
|
||||
* @param t The current time
|
||||
*/
|
||||
void Tick(time_t t);
|
||||
};
|
||||
|
||||
/** Timers for releasing nicks to be available for use
|
||||
*/
|
||||
class NickServRelease : public User, public Timer
|
||||
{
|
||||
Anope::string nick;
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
* @param na The nick
|
||||
* @param delay The delay before the nick is released
|
||||
*/
|
||||
NickServRelease(NickAlias *na, time_t delay);
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
virtual ~NickServRelease();
|
||||
|
||||
/** Called when the delay is up
|
||||
* @param t The current time
|
||||
*/
|
||||
void Tick(time_t t);
|
||||
};
|
||||
|
||||
#endif // ACCOUNT_H
|
||||
|
||||
+499
@@ -0,0 +1,499 @@
|
||||
/*
|
||||
* (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 ANOPE_H
|
||||
#define ANOPE_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include "hashcomp.h"
|
||||
|
||||
class Message;
|
||||
|
||||
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
|
||||
{
|
||||
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.
|
||||
*/
|
||||
std::string _string;
|
||||
public:
|
||||
/**
|
||||
* Extras.
|
||||
*/
|
||||
typedef std::string::iterator iterator;
|
||||
typedef std::string::const_iterator const_iterator;
|
||||
typedef std::string::reverse_iterator reverse_iterator;
|
||||
typedef std::string::const_reverse_iterator const_reverse_iterator;
|
||||
typedef std::string::size_type size_type;
|
||||
static const size_type npos = static_cast<size_type>(-1);
|
||||
|
||||
/**
|
||||
* Constructors that can take in any type of string.
|
||||
*/
|
||||
string() : _string("") { }
|
||||
string(char chr) : _string() { _string = chr; }
|
||||
string(size_type n, char chr) : _string(n, chr) { }
|
||||
string(const char *_str) : _string(_str) { }
|
||||
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) { }
|
||||
template <class InputIterator> string(InputIterator first, InputIterator last) : _string(first, last) { }
|
||||
|
||||
/**
|
||||
* Assignment operators, so any type of string can be assigned to this class.
|
||||
*/
|
||||
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; }
|
||||
|
||||
/**
|
||||
* Equality operators, to compare to any type of string.
|
||||
*/
|
||||
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); }
|
||||
|
||||
/**
|
||||
* Compound addition operators, overloaded to do concatenation.
|
||||
*/
|
||||
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; }
|
||||
|
||||
/**
|
||||
* Addition operators, overloaded to do concatenation.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
inline bool operator<(const string &_str) const { return this->_string < _str._string; }
|
||||
|
||||
/**
|
||||
* The following functions return the various types of strings.
|
||||
*/
|
||||
inline const char *c_str() const { return this->_string.c_str(); }
|
||||
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.
|
||||
*/
|
||||
inline bool empty() const { return this->_string.empty(); }
|
||||
|
||||
/**
|
||||
* Returns the string's length.
|
||||
*/
|
||||
inline size_type length() const { return this->_string.length(); }
|
||||
|
||||
/**
|
||||
* Add a char to the end of the string.
|
||||
*/
|
||||
inline void push_back(char c) { return this->_string.push_back(c); }
|
||||
|
||||
/**
|
||||
* Resizes the string content to n characters.
|
||||
*/
|
||||
inline void resize(size_type n) { return this->_string.resize(n); }
|
||||
|
||||
/**
|
||||
* Erases characters from the string.
|
||||
*/
|
||||
inline iterator erase(const iterator &i) { return this->_string.erase(i); }
|
||||
inline iterator erase(const iterator &first, const iterator &last) { return this->_string.erase(first, last); }
|
||||
inline void erase(size_type pos = 0, size_type n = std::string::npos) { this->_string.erase(pos, n); }
|
||||
|
||||
/**
|
||||
* Clears the string.
|
||||
*/
|
||||
inline void clear() { this->_string.clear(); }
|
||||
|
||||
/**
|
||||
* Find substrings of the string.
|
||||
*/
|
||||
inline size_type find(const string &_str, size_type pos = 0) const { return this->_string.find(_str._string, pos); }
|
||||
inline size_type find(char chr, size_type pos = 0) const { return this->_string.find(chr, pos); }
|
||||
inline size_type find_ci(const string &_str, size_type pos = 0) const { return ci::string(this->_string.c_str()).find(ci::string(_str._string.c_str()), pos); }
|
||||
inline size_type find_ci(char chr, size_type pos = 0) const { return ci::string(this->_string.c_str()).find(chr, pos); }
|
||||
|
||||
inline size_type rfind(const string &_str, size_type pos = npos) const { return this->_string.rfind(_str._string, pos); }
|
||||
inline size_type rfind(char chr, size_type pos = npos) const { return this->_string.rfind(chr, pos); }
|
||||
inline size_type rfind_ci(const string &_str, size_type pos = npos) const { return ci::string(this->_string.c_str()).rfind(ci::string(_str._string.c_str()), pos); }
|
||||
inline size_type rfind_ci(char chr, size_type pos = npos) const { return ci::string(this->_string.c_str()).rfind(chr, pos); }
|
||||
|
||||
inline size_type find_first_of(const string &_str, size_type pos = 0) const { return this->_string.find_first_of(_str._string, pos); }
|
||||
inline size_type find_first_of_ci(const string &_str, size_type pos = 0) const { return ci::string(this->_string.c_str()).find_first_of(ci::string(_str._string.c_str()), pos); }
|
||||
|
||||
inline size_type find_first_not_of(const string &_str, size_type pos = 0) const { return this->_string.find_first_not_of(_str._string, pos); }
|
||||
inline size_type find_first_not_of_ci(const string &_str, size_type pos = 0) const { return ci::string(this->_string.c_str()).find_first_not_of(ci::string(_str._string.c_str()), pos); }
|
||||
|
||||
inline size_type find_last_of(const string &_str, size_type pos = npos) const { return this->_string.find_last_of(_str._string, pos); }
|
||||
inline size_type find_last_of_ci(const string &_str, size_type pos = npos) const { return ci::string(this->_string.c_str()).find_last_of(ci::string(_str._string.c_str()), pos); }
|
||||
|
||||
inline size_type find_last_not_of(const string &_str, size_type pos = npos) const { return this->_string.find_last_not_of(_str._string, pos); }
|
||||
inline size_type find_last_not_of_ci(const string &_str, size_type pos = npos) const { return ci::string(this->_string.c_str()).find_last_not_of(ci::string(_str._string.c_str()), pos); }
|
||||
|
||||
/**
|
||||
* Determine if string consists of only numbers.
|
||||
*/
|
||||
inline bool is_number_only() const { return this->find_first_not_of("0123456789.-") == npos; }
|
||||
inline bool is_pos_number_only() const { return this->find_first_not_of("0123456789.") == npos; }
|
||||
|
||||
/**
|
||||
* Replace parts of the string.
|
||||
*/
|
||||
inline string replace(size_type pos, size_type n, const string &_str) { return string(this->_string.replace(pos, n, _str._string)); }
|
||||
inline string replace(size_type pos, size_type n, const string &_str, size_type pos1, size_type n1) { return string(this->_string.replace(pos, n, _str._string, pos1, n1)); }
|
||||
inline string replace(size_type pos, size_type n, size_type n1, char chr) { return string(this->_string.replace(pos, n, n1, chr)); }
|
||||
inline string replace(iterator first, iterator last, const string &_str) { return string(this->_string.replace(first, last, _str._string)); }
|
||||
inline string replace(iterator first, iterator last, size_type n, char chr) { return string(this->_string.replace(first, last, n, chr)); }
|
||||
template <class InputIterator> inline string replace(iterator first, iterator last, InputIterator f, InputIterator l) { return string(this->_string.replace(first, last, f, l)); }
|
||||
inline string replace_all_cs(const string &_orig, const string &_repl)
|
||||
{
|
||||
Anope::string new_string = *this;
|
||||
size_type pos = new_string.find(_orig), orig_length = _orig.length(), repl_length = _repl.length();
|
||||
while (pos != npos)
|
||||
{
|
||||
new_string = new_string.substr(0, pos) + _repl + new_string.substr(pos + orig_length);
|
||||
pos = new_string.find(_orig, pos + repl_length);
|
||||
}
|
||||
return new_string;
|
||||
}
|
||||
inline string replace_all_ci(const string &_orig, const string &_repl)
|
||||
{
|
||||
Anope::string new_string = *this;
|
||||
size_type pos = new_string.find_ci(_orig), orig_length = _orig.length(), repl_length = _repl.length();
|
||||
while (pos != npos)
|
||||
{
|
||||
new_string = new_string.substr(0, pos) + _repl + new_string.substr(pos + orig_length);
|
||||
pos = new_string.find_ci(_orig, pos + repl_length);
|
||||
}
|
||||
return new_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a substring of the string.
|
||||
*/
|
||||
inline string substr(size_type pos = 0, size_type n = npos) const { return string(this->_string.substr(pos, n)); }
|
||||
|
||||
/**
|
||||
* Iterators to the string.
|
||||
*/
|
||||
inline iterator begin() { return this->_string.begin(); }
|
||||
inline const_iterator begin() const { return this->_string.begin(); }
|
||||
inline iterator end() { return this->_string.end(); }
|
||||
inline const_iterator end() const { return this->_string.end(); }
|
||||
inline reverse_iterator rbegin() { return this->_string.rbegin(); }
|
||||
inline const_reverse_iterator rbegin() const { return this->_string.rbegin(); }
|
||||
inline reverse_iterator rend() { return this->_string.rend(); }
|
||||
inline const_reverse_iterator rend() const { return this->_string.rend(); }
|
||||
|
||||
/**
|
||||
* Subscript operator, to access individual characters of the string.
|
||||
*/
|
||||
inline char &operator[](size_type n) { return this->_string[n]; }
|
||||
inline const char &operator[](size_type n) const { return this->_string[n]; }
|
||||
|
||||
/**
|
||||
* 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;
|
||||
};
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &os, const string &_str) { return os << _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; }
|
||||
|
||||
static const char *const compiled = __TIME__ " " __DATE__;
|
||||
|
||||
/** 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;
|
||||
|
||||
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();
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
extern CoreExport bool Match(const Anope::string &str, const Anope::string &mask, bool case_sensitive = false);
|
||||
|
||||
/** Returns a list of pointers to message handlers
|
||||
* @param The message name as sent by the IRCd
|
||||
* @return a vector with pointers to the messagehandlers (you can bind more than one handler to a message)
|
||||
*/
|
||||
extern CoreExport std::vector<Message *> FindMessage(const string &name);
|
||||
|
||||
/** Converts a string to hex
|
||||
* @param the data to be converted
|
||||
* @return a anope::string containing the hex value
|
||||
*/
|
||||
extern CoreExport string Hex(const string &data);
|
||||
extern CoreExport string Hex(const char *data, unsigned len);
|
||||
|
||||
/** Converts a string from hex
|
||||
* @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);
|
||||
|
||||
/** Returns a sequence of data formatted as the format argument specifies.
|
||||
** After the format parameter, the function expects at least as many
|
||||
** additional arguments as specified in format.
|
||||
* @param fmt Format of the Message
|
||||
* @param ... any number of parameters
|
||||
* @return a Anope::string
|
||||
*/
|
||||
extern CoreExport string printf(const char *fmt, ...);
|
||||
|
||||
/** Return the last error, uses errno/GetLastError() to determin this
|
||||
* @return An error message
|
||||
*/
|
||||
extern CoreExport const Anope::string LastError();
|
||||
}
|
||||
|
||||
/** sepstream allows for splitting token seperated lists.
|
||||
* Each successive call to sepstream::GetToken() returns
|
||||
* the next token, until none remain, at which point the method returns
|
||||
* an empty string.
|
||||
*/
|
||||
class CoreExport sepstream
|
||||
{
|
||||
private:
|
||||
/** Original string.
|
||||
*/
|
||||
Anope::string tokens;
|
||||
/** Last position of a seperator token
|
||||
*/
|
||||
Anope::string::iterator last_starting_position;
|
||||
/** Current string position
|
||||
*/
|
||||
Anope::string::iterator n;
|
||||
/** Seperator value
|
||||
*/
|
||||
char sep;
|
||||
public:
|
||||
/** 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);
|
||||
|
||||
/** Fetch the entire remaining stream, without tokenizing
|
||||
* @return The remaining part of the stream
|
||||
*/
|
||||
virtual 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();
|
||||
};
|
||||
|
||||
/** A derived form of sepstream, which seperates on commas
|
||||
*/
|
||||
class commasepstream : public sepstream
|
||||
{
|
||||
public:
|
||||
/** Initialize with comma seperator
|
||||
*/
|
||||
commasepstream(const Anope::string &source) : sepstream(source, ',') { }
|
||||
};
|
||||
|
||||
/** A derived form of sepstream, which seperates on spaces
|
||||
*/
|
||||
class spacesepstream : public sepstream
|
||||
{
|
||||
public:
|
||||
/** Initialize with space seperator
|
||||
*/
|
||||
spacesepstream(const Anope::string &source) : sepstream(source, ' ') { }
|
||||
};
|
||||
|
||||
/** The base class that most classes in Anope inherit from
|
||||
*/
|
||||
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
|
||||
{
|
||||
protected:
|
||||
bool invalid;
|
||||
public:
|
||||
dynamic_reference_base() : invalid(false) { }
|
||||
virtual ~dynamic_reference_base() { }
|
||||
inline void Invalidate() { this->invalid = true; }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class dynamic_reference : public dynamic_reference_base
|
||||
{
|
||||
protected:
|
||||
T *ref;
|
||||
public:
|
||||
dynamic_reference(T *obj) : ref(obj)
|
||||
{
|
||||
if (ref)
|
||||
ref->AddReference(this);
|
||||
}
|
||||
|
||||
virtual ~dynamic_reference()
|
||||
{
|
||||
if (this->invalid)
|
||||
{
|
||||
this->invalid = false;
|
||||
this->ref = NULL;
|
||||
}
|
||||
else if (ref)
|
||||
ref->DelReference(this);
|
||||
}
|
||||
|
||||
virtual operator bool()
|
||||
{
|
||||
if (this->invalid)
|
||||
{
|
||||
this->invalid = false;
|
||||
this->ref = NULL;
|
||||
}
|
||||
return this->ref;
|
||||
}
|
||||
|
||||
virtual inline void operator=(T *newref)
|
||||
{
|
||||
if (this->invalid)
|
||||
{
|
||||
this->invalid = false;
|
||||
this->ref = NULL;
|
||||
}
|
||||
else if (this->ref)
|
||||
this->ref->DelReference(this);
|
||||
this->ref = newref;
|
||||
if (this->ref)
|
||||
this->ref->AddReference(this);
|
||||
}
|
||||
|
||||
virtual inline T *operator->()
|
||||
{
|
||||
return this->ref;
|
||||
}
|
||||
|
||||
virtual inline T *operator*()
|
||||
{
|
||||
return this->ref;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ANOPE_H
|
||||
+42
-34
@@ -1,55 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 Robin Burchell <w00t@inspircd.org>
|
||||
* Copyright (C) 2008-2010 Anope Team <team@anope.org>
|
||||
* Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
|
||||
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOTS_H
|
||||
#define BOTS_H
|
||||
|
||||
#include "commands.h"
|
||||
|
||||
class BotInfo;
|
||||
|
||||
extern CoreExport Anope::insensitive_map<BotInfo *> BotListByNick;
|
||||
extern CoreExport Anope::map<BotInfo *> BotListByUID;
|
||||
|
||||
/** Flags settable on a bot
|
||||
*/
|
||||
enum BotFlag
|
||||
{
|
||||
BI_BEGIN,
|
||||
|
||||
/* This bot is a core bot. NickServ, ChanServ, etc */
|
||||
BI_CORE,
|
||||
/* This bot can only be assigned by IRCops */
|
||||
BI_PRIVATE,
|
||||
/* The following flags are used to determin what bot really is what.
|
||||
* Since you *could* have ChanServ really named BotServ or something stupid,
|
||||
* this keeps track of them and allows them to be renamed in the config
|
||||
* at any time, even if they already exist in the database
|
||||
*/
|
||||
BI_CHANSERV,
|
||||
BI_BOTSERV,
|
||||
BI_HOSTSERV,
|
||||
BI_OPERSERV,
|
||||
BI_MEMOSERV,
|
||||
BI_NICKSERV,
|
||||
BI_GLOBAL,
|
||||
|
||||
BI_END
|
||||
};
|
||||
|
||||
struct CommandHash;
|
||||
static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "" };
|
||||
|
||||
class CoreExport BotInfo : public Extensible, public Flags<BotFlag>
|
||||
class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
|
||||
{
|
||||
public:
|
||||
BotInfo *next, *prev;
|
||||
|
||||
std::string uid; /* required for UID supporting servers, as opposed to the shitty struct Uid. */
|
||||
std::string nick; /* Nickname of the bot */
|
||||
std::string user; /* Its user name */
|
||||
std::string host; /* Its hostname */
|
||||
std::string real; /* Its real name */
|
||||
time_t created; /* Birth date ;) */
|
||||
int16 chancount; /* Number of channels that use the bot. */
|
||||
/* Dynamic data */
|
||||
uint32 chancount;
|
||||
time_t created; /* Birth date ;) */
|
||||
time_t lastmsg; /* Last time we said something */
|
||||
CommandHash **cmdTable;
|
||||
CommandMap Commands; /* Commands on this bot */
|
||||
|
||||
/** Create a new bot.
|
||||
* @param nick The nickname to assign to the bot.
|
||||
@@ -57,16 +45,16 @@ class CoreExport BotInfo : public Extensible, public Flags<BotFlag>
|
||||
* @param host The hostname to give the bot.
|
||||
* @param real The realname to give the bot.
|
||||
*/
|
||||
BotInfo(const std::string &nick, const std::string &user = "", const std::string &host = "", const std::string &real = "");
|
||||
BotInfo(const Anope::string &nick, const Anope::string &user = "", const Anope::string &host = "", const Anope::string &real = "");
|
||||
|
||||
/** Destroy a bot, clearing up appropriately.
|
||||
*/
|
||||
virtual ~BotInfo();
|
||||
|
||||
/** Change the nickname set on a bot.
|
||||
/** Change the nickname for the bot.
|
||||
* @param newnick The nick to change to
|
||||
*/
|
||||
void ChangeNick(const char *newnick);
|
||||
void SetNewNick(const Anope::string &newnick);
|
||||
|
||||
/** Rejoins all channels that this bot is assigned to.
|
||||
* Used on /kill, rename, etc.
|
||||
@@ -84,4 +72,24 @@ class CoreExport BotInfo : public Extensible, public Flags<BotFlag>
|
||||
* @param ci The channel registration to remove the bot from.
|
||||
*/
|
||||
void UnAssign(User *u, ChannelInfo *ci);
|
||||
|
||||
/** Join this bot to a channel
|
||||
* @param c The channel
|
||||
* @param status The status the bot should have on the channel
|
||||
*/
|
||||
void Join(Channel *c, ChannelStatus *status = NULL);
|
||||
|
||||
/** Join this bot to a channel
|
||||
* @param chname The channel name
|
||||
* @param status The status the bot should have on the channel
|
||||
*/
|
||||
void Join(const Anope::string &chname, ChannelStatus *status = NULL);
|
||||
|
||||
/** Part this bot from a channel
|
||||
* @param c The channel
|
||||
* @param reason The reason we're parting
|
||||
*/
|
||||
void Part(Channel *c, const Anope::string &reason = "");
|
||||
};
|
||||
|
||||
#endif // BOTS_H
|
||||
|
||||
+95
-96
@@ -1,24 +1,32 @@
|
||||
/* Channel support
|
||||
*
|
||||
* (C) 2008-2010 Anope Team
|
||||
* (C) 2008-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CHANNELS_H
|
||||
#define CHANNELS_H
|
||||
|
||||
typedef unordered_map_namespace::unordered_map<Anope::string, Channel *, ci::hash, std::equal_to<ci::string> > channel_map;
|
||||
extern CoreExport channel_map ChannelList;
|
||||
|
||||
struct UserData
|
||||
{
|
||||
UserData()
|
||||
{
|
||||
lastline = NULL;
|
||||
last_use = last_start = time(NULL);
|
||||
lines = times = 0;
|
||||
Clear();
|
||||
}
|
||||
|
||||
virtual ~UserData() { delete [] lastline; }
|
||||
virtual ~UserData() { }
|
||||
|
||||
void Clear()
|
||||
{
|
||||
last_use = last_start = Anope::CurTime;
|
||||
lines = times = 0;
|
||||
lastline.clear();
|
||||
}
|
||||
|
||||
/* Data validity */
|
||||
time_t last_use;
|
||||
@@ -28,7 +36,7 @@ struct UserData
|
||||
time_t last_start;
|
||||
|
||||
/* for repeat kicker */
|
||||
char *lastline;
|
||||
Anope::string lastline;
|
||||
int16 times;
|
||||
};
|
||||
|
||||
@@ -36,7 +44,7 @@ struct UserContainer
|
||||
{
|
||||
User *user;
|
||||
UserData ud;
|
||||
Flags<ChannelModeName> *Status;
|
||||
ChannelStatus *Status;
|
||||
|
||||
UserContainer(User *u) : user(u) { }
|
||||
virtual ~UserContainer() { }
|
||||
@@ -44,58 +52,59 @@ struct UserContainer
|
||||
|
||||
typedef std::list<UserContainer *> CUserList;
|
||||
|
||||
enum ChannelFlags
|
||||
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
|
||||
CH_SYNCING,
|
||||
/* Is a services log channel */
|
||||
CH_LOGCHAN
|
||||
};
|
||||
|
||||
class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3>
|
||||
{
|
||||
public:
|
||||
typedef std::multimap<ChannelModeName, Anope::string> ModeList;
|
||||
private:
|
||||
/** A map of channel modes with their parameters set on this channel
|
||||
*/
|
||||
std::map<ChannelModeName, std::string> Params;
|
||||
|
||||
/* Modes set on the channel */
|
||||
std::bitset<128> modes;
|
||||
|
||||
ModeList modes;
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
* @param name The channel name
|
||||
* @param ts The time the channel was created
|
||||
*/
|
||||
Channel(const std::string &name, time_t ts = time(NULL));
|
||||
Channel(const Anope::string &nname, time_t ts = Anope::CurTime);
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
~Channel();
|
||||
|
||||
Channel *next, *prev;
|
||||
std::string name; /* Channel name */
|
||||
ChannelInfo *ci; /* Corresponding ChannelInfo */
|
||||
time_t creation_time; /* When channel was created */
|
||||
char *topic;
|
||||
std::string topic_setter;
|
||||
time_t topic_time; /* When topic was set */
|
||||
|
||||
EList *bans;
|
||||
EList *excepts;
|
||||
EList *invites;
|
||||
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;
|
||||
|
||||
BanData *bd;
|
||||
|
||||
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? */
|
||||
int16 topic_sync; /* Is the topic in sync? */
|
||||
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*/
|
||||
|
||||
std::list<BanData *> bd;
|
||||
|
||||
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
|
||||
*/
|
||||
void Reset();
|
||||
|
||||
/** Restore the channel topic, set mlock (key), set stickied bans, etc
|
||||
*/
|
||||
@@ -122,7 +131,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
* @param cms The status mode, or NULL to represent no status
|
||||
* @return true or false
|
||||
*/
|
||||
bool HasUserStatus(User *u, ChannelModeStatus *cms);
|
||||
bool HasUserStatus(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
|
||||
@@ -130,32 +139,34 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
* @param Name The Mode name, eg CMODE_OP, CMODE_VOICE
|
||||
* @return true or false
|
||||
*/
|
||||
bool HasUserStatus(User *u, ChannelModeName Name);
|
||||
|
||||
/** See if the channel has any modes at all
|
||||
* @return true or false
|
||||
*/
|
||||
inline const bool HasModes() const { return modes.count(); }
|
||||
bool HasUserStatus(User *u, ChannelModeName Name) const;
|
||||
|
||||
/** See if a channel has a mode
|
||||
* @param Name The mode name
|
||||
* @return true or false
|
||||
* @return The number of modes set
|
||||
* @param param The optional mode param
|
||||
*/
|
||||
bool HasMode(ChannelModeName Name);
|
||||
size_t HasMode(ChannelModeName Name, const Anope::string ¶m = "");
|
||||
|
||||
/** 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);
|
||||
|
||||
/** Set a mode internally on a channel, this is not sent out to the IRCd
|
||||
* @param cm The mode
|
||||
* @param param The param
|
||||
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void SetModeInternal(ChannelMode *cm, const std::string ¶m = "", bool EnforceMLock = true);
|
||||
void SetModeInternal(ChannelMode *cm, const Anope::string ¶m = "", bool EnforceMLock = true);
|
||||
|
||||
/** Remove a mode internally on a channel, this is not sent out to the IRCd
|
||||
* @param cm The mode
|
||||
* @param param The param
|
||||
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void RemoveModeInternal(ChannelMode *cm, const std::string ¶m = "", bool EnforceMLock = true);
|
||||
void RemoveModeInternal(ChannelMode *cm, const Anope::string ¶m = "", bool EnforceMLock = true);
|
||||
|
||||
/** Set a mode on a channel
|
||||
* @param bi The client setting the modes
|
||||
@@ -163,7 +174,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
* @param param Optional param arg for the mode
|
||||
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void SetMode(BotInfo *bi, ChannelMode *cm, const std::string ¶m = "", bool EnforceMLock = true);
|
||||
void SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶m = "", bool EnforceMLock = true);
|
||||
|
||||
/**
|
||||
* Set a mode on a channel
|
||||
@@ -172,16 +183,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
* @param param Optional param arg for the mode
|
||||
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void SetMode(BotInfo *bi, ChannelModeName Name, const std::string ¶m = "", bool EnforceMLock = true);
|
||||
|
||||
/**
|
||||
* Set a mode on a channel
|
||||
* @param bi The client setting the modes
|
||||
* @param Mode The mode
|
||||
* @param param Optional param arg for the mode
|
||||
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void SetMode(BotInfo *bi, char Mode, const std::string ¶m = "", bool EnforceMLock = true);
|
||||
void SetMode(BotInfo *bi, ChannelModeName Name, const Anope::string ¶m = "", bool EnforceMLock = true);
|
||||
|
||||
/** Remove a mode from a channel
|
||||
* @param bi The client setting the modes
|
||||
@@ -189,7 +191,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
* @param param Optional param arg for the mode
|
||||
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void RemoveMode(BotInfo *bi, ChannelMode *cm, const std::string ¶m = "", bool EnforceMLock = true);
|
||||
void RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶m = "", bool EnforceMLock = true);
|
||||
|
||||
/**
|
||||
* Remove a mode from a channel
|
||||
@@ -198,47 +200,15 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
* @param param Optional param arg for the mode
|
||||
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void RemoveMode(BotInfo *bi, ChannelModeName Name, const std::string ¶m = "", bool EnforceMLock = true);
|
||||
/**
|
||||
* Remove a mode from a channel
|
||||
* @param bi The client setting the modes
|
||||
* @param Mode The mode
|
||||
* @param param Optional param arg for the mode
|
||||
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void RemoveMode(BotInfo *bi, char Mode, const std::string ¶m = "", bool EnforceMLock = true);
|
||||
|
||||
/** Clear all the modes from the channel
|
||||
* @param bi The client unsetting the modes
|
||||
*/
|
||||
void ClearModes(BotInfo *bi = NULL);
|
||||
|
||||
/** Clear all the bans from the channel
|
||||
* @param bi The client unsetting the modes
|
||||
*/
|
||||
void ClearBans(BotInfo *bi = NULL);
|
||||
|
||||
/** Clear all the excepts from the channel
|
||||
* @param bi The client unsetting the modes
|
||||
*/
|
||||
void ClearExcepts(BotInfo *bi = NULL);
|
||||
|
||||
/** Clear all the invites from the channel
|
||||
* @param bi The client unsetting the modes
|
||||
*/
|
||||
void ClearInvites(BotInfo *bi = NULL);
|
||||
void RemoveMode(BotInfo *bi, ChannelModeName Name, const Anope::string ¶m = "", bool EnforceMLock = true);
|
||||
|
||||
/** Get a param from the channel
|
||||
* @param Name The mode
|
||||
* @param Target a string to put the param into
|
||||
* @return true on success
|
||||
*/
|
||||
const bool GetParam(ChannelModeName Name, std::string &Target);
|
||||
bool GetParam(ChannelModeName Name, Anope::string &Target) const;
|
||||
|
||||
/** Check if a mode is set and has a param
|
||||
* @param Name The mode
|
||||
*/
|
||||
const bool HasParam(ChannelModeName Name);
|
||||
/** 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
|
||||
@@ -246,12 +216,19 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
*/
|
||||
void SetModes(BotInfo *bi, bool EnforceMLock, const char *cmodes, ...);
|
||||
|
||||
/** Set a string of modes internally on a channel
|
||||
* @param setter the setter (if it is a user)
|
||||
* @param mode the modes
|
||||
* @param EnforceMLock true to enforce mlock
|
||||
*/
|
||||
void SetModesInternal(User *setter, const Anope::string &mode, bool EnforceMLock = true);
|
||||
|
||||
/** 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 std::string &source, const std::string &nick, const std::string &reason);
|
||||
void KickInternal(const Anope::string &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
|
||||
@@ -260,5 +237,27 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
* @return true if the kick was scucessful, false if a module blocked the kick
|
||||
*/
|
||||
bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...);
|
||||
|
||||
/** 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
|
||||
* @return A mode string
|
||||
*/
|
||||
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 newtopic The new topic
|
||||
* @param ts The time the new topic is being set
|
||||
*/
|
||||
void ChangeTopicInternal(const Anope::string &user, const Anope::string &newtopic, time_t ts = Anope::CurTime);
|
||||
|
||||
/** Update the topic of the channel, and reset it if topiclock etc says to
|
||||
* @param user The user setting the topic
|
||||
* @param newtopic The new topic
|
||||
* @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);
|
||||
};
|
||||
|
||||
#endif // CHANNELS_H
|
||||
|
||||
+146
-14
@@ -1,28 +1,160 @@
|
||||
/* Declarations for command data.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* (C) 2003-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "modules.h"
|
||||
#ifndef COMMAND_H
|
||||
#define COMMAND_H
|
||||
|
||||
/*************************************************************************/
|
||||
#include "services.h"
|
||||
|
||||
/* Routines for looking up commands. Command lists are arrays that must be
|
||||
* terminated with a NULL name.
|
||||
class Module;
|
||||
class BotInfo;
|
||||
class Command;
|
||||
|
||||
typedef std::map<Anope::string, Command *, std::less<ci::string> > CommandMap;
|
||||
|
||||
/** The return value from commands.
|
||||
*/
|
||||
enum CommandReturn
|
||||
{
|
||||
MOD_CONT,
|
||||
MOD_STOP
|
||||
};
|
||||
|
||||
extern MDE Command *lookup_cmd(Command *list, char *name);
|
||||
extern MDE void mod_help_cmd(char *service, User *u, CommandHash *cmdTable[], const char *cmd);
|
||||
extern MDE void mod_run_cmd(const std::string &service, User *u, CommandHash *cmdTable[], const char *cmd);
|
||||
//extern MDE void do_help_limited(char *service, User * u, Command * c);
|
||||
extern CoreExport Command *FindCommand(BotInfo *bi, const Anope::string &cmd);
|
||||
extern CoreExport void mod_help_cmd(BotInfo *bi, User *u, ChannelInfo *ci, const Anope::string &cmd);
|
||||
extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, ChannelInfo *ci, const Anope::string &message);
|
||||
extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, ChannelInfo *ci, Command *c, const Anope::string &command, const Anope::string &message);
|
||||
|
||||
/*************************************************************************/
|
||||
enum CommandFlag
|
||||
{
|
||||
CFLAG_ALLOW_UNREGISTERED,
|
||||
CFLAG_ALLOW_FORBIDDEN,
|
||||
CFLAG_ALLOW_SUSPENDED,
|
||||
CFLAG_ALLOW_UNREGISTEREDCHANNEL,
|
||||
CFLAG_STRIP_CHANNEL,
|
||||
CFLAG_DISABLE_FANTASY
|
||||
};
|
||||
|
||||
const Anope::string CommandFlagStrings[] = {
|
||||
"CFLAG_ALLOW_UNREGISTERED",
|
||||
"CFLAG_ALLOW_FORBIDDEN",
|
||||
"CFLAG_ALLOW_SUSPENDED",
|
||||
"CFLAG_ALLOW_UNREGISTEREDCHANNEL",
|
||||
"CFLAG_STRIP_CHANNEL",
|
||||
"CFLAG_DISABLE_FANTASY",
|
||||
""
|
||||
};
|
||||
|
||||
/* The source for a command */
|
||||
struct CoreExport CommandSource
|
||||
{
|
||||
/* User executing the command */
|
||||
User *u;
|
||||
/* Channel (if applicable) */
|
||||
ChannelInfo *ci;
|
||||
/* 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;
|
||||
/* Whether or not this was a fantasy command */
|
||||
bool fantasy;
|
||||
|
||||
std::list<Anope::string> reply;
|
||||
|
||||
void Reply(const char *message, ...);
|
||||
void Reply(const Anope::string &message);
|
||||
|
||||
void DoReply();
|
||||
};
|
||||
|
||||
/** Every services command is a class, inheriting from Command.
|
||||
*/
|
||||
class CoreExport Command : public Flags<CommandFlag>, public Base
|
||||
{
|
||||
Anope::string desc;
|
||||
|
||||
public:
|
||||
/* Maximum paramaters accepted by this command */
|
||||
size_t MaxParams;
|
||||
/* Minimum parameters required to use this command */
|
||||
size_t MinParams;
|
||||
/* Command name */
|
||||
Anope::string name;
|
||||
/* Permission needed to use this comand */
|
||||
Anope::string permission;
|
||||
|
||||
/* Module which owns us */
|
||||
Module *module;
|
||||
/* Service this command is on */
|
||||
BotInfo *service;
|
||||
|
||||
/** Create a new command.
|
||||
* @param sname The command name
|
||||
* @param min_params The minimum number of parameters the parser will require to execute this command
|
||||
* @param max_params The maximum number of parameters the parser will create, after max_params, all will be combined into the last argument.
|
||||
* NOTE: If max_params is not set (default), there is no limit to the max number of params.
|
||||
*/
|
||||
Command(const Anope::string &sname, size_t min_params, size_t max_params = 0, const Anope::string &spermission = "");
|
||||
|
||||
virtual ~Command();
|
||||
|
||||
protected:
|
||||
void SetDesc(const Anope::string &d);
|
||||
|
||||
public:
|
||||
/** Execute this command.
|
||||
* @param source The source
|
||||
* @param params Command parameters
|
||||
*/
|
||||
virtual CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) = 0;
|
||||
|
||||
/** Called when HELP is requsted for the client this command is on.
|
||||
* @param source The source
|
||||
*/
|
||||
virtual void OnServHelp(CommandSource &source);
|
||||
|
||||
/** Requested when the user is requesting help on this command. Help on this command should be sent to the user.
|
||||
* @param source The source
|
||||
* @param subcommand The subcommand the user is requesting help on, or an empty string. (e.g. /ns help set foo bar lol gives a subcommand of "FOO BAR LOL")
|
||||
* @return true if help was provided to the user, false otherwise.
|
||||
*/
|
||||
virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand);
|
||||
|
||||
/** Requested when the user provides bad syntax to this command (not enough params, etc).
|
||||
* @param source The source
|
||||
* @param subcommand The subcommand the user tried to use
|
||||
*/
|
||||
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand);
|
||||
|
||||
/** Set which command permission (e.g. chanserv/forbid) is required for this command.
|
||||
* @param reststr The permission required to successfully execute this command
|
||||
*/
|
||||
void SetPermission(const Anope::string &reststr);
|
||||
|
||||
/** Add a subcommand to this command
|
||||
* @param creator The creator of the subcommand
|
||||
* @param c The command
|
||||
*/
|
||||
virtual bool AddSubcommand(Module *creator, Command *c);
|
||||
|
||||
/** Delete a subcommand from this command
|
||||
* @param c The command
|
||||
*/
|
||||
virtual bool DelSubcommand(Command *c);
|
||||
|
||||
/** Find a subcommand
|
||||
* @param name The subcommand name
|
||||
* @return The subcommand
|
||||
*/
|
||||
virtual Command *FindSubcommand(const Anope::string &subcommand);
|
||||
};
|
||||
|
||||
#endif // COMMANDS_H
|
||||
|
||||
+879
-29
@@ -1,40 +1,890 @@
|
||||
/* Services configuration.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
/* Note that most of the options which used to be here have been moved to
|
||||
* services.conf. */
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <deque>
|
||||
|
||||
/*************************************************************************/
|
||||
#include "anope.h"
|
||||
|
||||
/******* General configuration *******/
|
||||
/** A configuration key and value pair
|
||||
*/
|
||||
typedef std::pair<Anope::string, Anope::string> KeyVal;
|
||||
|
||||
/* Name of log file (in Services directory) */
|
||||
#define LOG_FILENAME "services.log"
|
||||
/** A list of related configuration keys and values
|
||||
*/
|
||||
typedef std::vector<KeyVal> KeyValList;
|
||||
|
||||
/******************* END OF USER-CONFIGURABLE SECTION ********************/
|
||||
/** An entire config file, built up of KeyValLists
|
||||
*/
|
||||
typedef std::multimap<Anope::string, KeyValList> ConfigDataHash;
|
||||
|
||||
/* Size of input buffer (note: this is different from BUFSIZ)
|
||||
* This must be big enough to hold at least one full IRC message, or messy
|
||||
* things will happen. */
|
||||
#define BUFSIZE 1024
|
||||
// Required forward definitions
|
||||
class ServerConfig;
|
||||
|
||||
/* Maximum amount of data from/to the network to buffer (bytes). */
|
||||
#define NET_BUFSIZE 65536
|
||||
/** Types of data in the core config
|
||||
*/
|
||||
enum ConfigDataType
|
||||
{
|
||||
DT_NOTHING, // No data
|
||||
DT_INTEGER, // Integer
|
||||
DT_UINTEGER, // Unsigned Integer
|
||||
DT_LUINTEGER, // Long Unsigned Integer
|
||||
DT_CHARPTR, // Char pointer
|
||||
DT_STRING, // Anope::string
|
||||
DT_BOOLEAN, // Boolean
|
||||
DT_HOSTNAME, // Hostname syntax
|
||||
DT_NOSPACES, // No spaces
|
||||
DT_IPADDRESS, // IP address (v4, v6)
|
||||
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_CHARPTR
|
||||
};
|
||||
|
||||
/**************************************************************************/
|
||||
/** Holds a config value, either string, integer or boolean.
|
||||
* Callback functions receive one or more of these, either on
|
||||
* their own as a reference, or in a reference to a deque of them.
|
||||
* The callback function can then alter the values of the ValueItem
|
||||
* classes to validate the settings.
|
||||
*/
|
||||
class CoreExport ValueItem
|
||||
{
|
||||
private:
|
||||
/** Actual data */
|
||||
Anope::string v;
|
||||
public:
|
||||
/** Initialize with an int */
|
||||
ValueItem(int);
|
||||
/** Initialize with a bool */
|
||||
ValueItem(bool);
|
||||
/** Initialize with a char pointer */
|
||||
ValueItem(const char *);
|
||||
/** Initialize with an std::string */
|
||||
ValueItem(const std::string &);
|
||||
/** Initialize with a ci::string */
|
||||
ValueItem(const ci::string &);
|
||||
/** Initialize with an Anope::string */
|
||||
ValueItem(const Anope::string &);
|
||||
/** Initialize with a long */
|
||||
ValueItem(long);
|
||||
/** Change value to a char pointer */
|
||||
//void Set(char *);
|
||||
/** Change value to a const char pointer */
|
||||
void Set(const char *);
|
||||
/** Change value to an std::string */
|
||||
void Set(const std::string &);
|
||||
/** Change value to a ci::string */
|
||||
void Set(const ci::string &);
|
||||
/** Change value to an Anope::string */
|
||||
void Set(const Anope::string &);
|
||||
/** Change value to an int */
|
||||
void Set(int);
|
||||
/** Get value as an int */
|
||||
int GetInteger() const;
|
||||
/** Get value as a string */
|
||||
const char *GetString() const;
|
||||
/** Get value as an Anope::string */
|
||||
inline const Anope::string &GetValue() const { return v; }
|
||||
/** Get value as a bool */
|
||||
bool GetBool() const;
|
||||
};
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
/** The base class of the container 'ValueContainer'
|
||||
* used internally by the core to hold core values.
|
||||
*/
|
||||
class ValueContainerBase
|
||||
{
|
||||
public:
|
||||
/** Constructor */
|
||||
ValueContainerBase() { }
|
||||
/** Destructor */
|
||||
virtual ~ValueContainerBase() { }
|
||||
};
|
||||
|
||||
/** ValueContainer is used to contain pointers to different
|
||||
* core values such as the server name, maximum number of
|
||||
* clients etc.
|
||||
* It is specialized to hold a data type, then pointed at
|
||||
* a value in the ServerConfig class. When the value has been
|
||||
* read and validated, the Set method is called to write the
|
||||
* value safely in a type-safe manner.
|
||||
*/
|
||||
template<typename T> class ValueContainer : public ValueContainerBase
|
||||
{
|
||||
private:
|
||||
/** Contained item */
|
||||
T val;
|
||||
public:
|
||||
/** Initialize with nothing */
|
||||
ValueContainer() : ValueContainerBase(), val(NULL) { }
|
||||
/** Initialize with a value of type T */
|
||||
ValueContainer(T Val) : ValueContainerBase(), val(Val) { }
|
||||
/** Initialize with a copy */
|
||||
ValueContainer(const ValueContainer &Val) : ValueContainerBase(), val(Val.val) { }
|
||||
ValueContainer &operator=(const ValueContainer &Val)
|
||||
{
|
||||
val = Val.val;
|
||||
return *this;
|
||||
}
|
||||
/** Change value to type T of size s */
|
||||
void Set(const T newval, size_t s)
|
||||
{
|
||||
memcpy(val, newval, s);
|
||||
}
|
||||
};
|
||||
|
||||
/** This a specific version of ValueContainer to handle character arrays specially
|
||||
*/
|
||||
template<> class ValueContainer<char **> : public ValueContainerBase
|
||||
{
|
||||
private:
|
||||
/** Contained item */
|
||||
char **val;
|
||||
public:
|
||||
/** Initialize with nothing */
|
||||
ValueContainer() : ValueContainerBase(), val(NULL) { }
|
||||
/** Initialize with a value of type T */
|
||||
ValueContainer(char **Val) : ValueContainerBase(), val(Val) { }
|
||||
/** Initialize with a copy */
|
||||
ValueContainer(const ValueContainer &Val) : ValueContainerBase(), val(Val.val) { }
|
||||
ValueContainer &operator=(const ValueContainer &Val)
|
||||
{
|
||||
val = Val.val;
|
||||
return *this;
|
||||
}
|
||||
/** Change value to type T of size s */
|
||||
void Set(const char *newval, size_t s)
|
||||
{
|
||||
if (*val)
|
||||
delete [] *val;
|
||||
if (!*newval)
|
||||
{
|
||||
*val = NULL;
|
||||
return;
|
||||
}
|
||||
*val = new char[s];
|
||||
strlcpy(*val, newval, s);
|
||||
}
|
||||
};
|
||||
|
||||
/** This a specific version of ValueContainer to handle Anope::string specially
|
||||
*/
|
||||
template<> class ValueContainer<Anope::string *> : public ValueContainerBase
|
||||
{
|
||||
private:
|
||||
/** Contained item */
|
||||
Anope::string *val;
|
||||
public:
|
||||
/** Initialize with nothing */
|
||||
ValueContainer() : ValueContainerBase(), val(NULL) { }
|
||||
/** Initialize with an std::string */
|
||||
ValueContainer(Anope::string *Val) : ValueContainerBase(), val(Val) { }
|
||||
/** Initialize with a copy */
|
||||
ValueContainer(const ValueContainer &Val) : ValueContainerBase(), val(Val.val) { }
|
||||
ValueContainer &operator=(const ValueContainer &Val)
|
||||
{
|
||||
val = Val.val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Change value to given Anope::string */
|
||||
void Set(const Anope::string &newval)
|
||||
{
|
||||
*val = newval;
|
||||
}
|
||||
/** Change value to given char pointer */
|
||||
void Set(const char *newval)
|
||||
{
|
||||
*val = newval;
|
||||
}
|
||||
};
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to a bool
|
||||
*/
|
||||
typedef ValueContainer<bool *> ValueContainerBool;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* an unsigned int
|
||||
*/
|
||||
typedef ValueContainer<unsigned *> ValueContainerUInt;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* a long unsigned int
|
||||
*/
|
||||
typedef ValueContainer<long unsigned *> ValueContainerLUInt;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* a char array.
|
||||
*/
|
||||
typedef ValueContainer<char **> ValueContainerChar;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* an int
|
||||
*/
|
||||
typedef ValueContainer<int *> ValueContainerInt;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* a time_t
|
||||
*/
|
||||
typedef ValueContainer<time_t *> ValueContainerTime;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* an Anope::string
|
||||
*/
|
||||
typedef ValueContainer<Anope::string *> ValueContainerString;
|
||||
|
||||
/** A set of ValueItems used by multi-value validator functions
|
||||
*/
|
||||
typedef std::deque<ValueItem> ValueList;
|
||||
|
||||
/** A callback for validating a single value
|
||||
*/
|
||||
typedef bool (*Validator)(ServerConfig *, const Anope::string &, const Anope::string &, ValueItem &);
|
||||
/** A callback for validating multiple value entries
|
||||
*/
|
||||
typedef bool (*MultiValidator)(ServerConfig *, const Anope::string &, const Anope::string *, ValueList &, int *);
|
||||
/** A callback indicating the end of a group of entries
|
||||
*/
|
||||
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 ValidateDefCon(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
|
||||
{
|
||||
Anope::string name;
|
||||
bool executable;
|
||||
FILE *fp;
|
||||
public:
|
||||
ConfigurationFile(const Anope::string &, bool);
|
||||
~ConfigurationFile();
|
||||
const Anope::string &GetName() const;
|
||||
|
||||
bool IsOpen() const;
|
||||
bool Open();
|
||||
void Close();
|
||||
bool End() const;
|
||||
Anope::string Read();
|
||||
};
|
||||
|
||||
/** Holds all of the core configuration items
|
||||
*/
|
||||
class CoreExport ConfigItems
|
||||
{
|
||||
public:
|
||||
/** Holds a core configuration item and its callbacks
|
||||
*/
|
||||
struct Item
|
||||
{
|
||||
/** Tag name */
|
||||
Anope::string tag;
|
||||
/** Value name */
|
||||
Anope::string value;
|
||||
/** Default, if not defined */
|
||||
Anope::string default_value;
|
||||
/** Value containers */
|
||||
ValueContainerBase *val;
|
||||
/** Data types */
|
||||
int datatype;
|
||||
/** Validation function */
|
||||
Validator validation_function;
|
||||
} *Values;
|
||||
|
||||
/** Holds a core configuration item and its callbacks
|
||||
* where there may be more than one item
|
||||
*/
|
||||
struct MultiItem
|
||||
{
|
||||
/** Tag name */
|
||||
Anope::string tag;
|
||||
/** One or more items within tag */
|
||||
Anope::string items[17];
|
||||
/** One or more defaults for items within tags */
|
||||
Anope::string items_default[17];
|
||||
/** One or more data types */
|
||||
int datatype[17];
|
||||
/** Initialization function */
|
||||
MultiNotify init_function;
|
||||
/** Validation function */
|
||||
MultiValidator validation_function;
|
||||
/** Completion function */
|
||||
MultiNotify finish_function;
|
||||
} *MultiValues;
|
||||
|
||||
ConfigItems(ServerConfig *conf);
|
||||
~ConfigItems();
|
||||
};
|
||||
|
||||
/** This class holds the bulk of the runtime configuration for Anope.
|
||||
* It allows for reading new config values, accessing configuration files,
|
||||
* and storage of the configuration data needed to run Anope.
|
||||
*/
|
||||
class CoreExport ServerConfig
|
||||
{
|
||||
private:
|
||||
/** Check that there is only one of each configuration item
|
||||
*/
|
||||
bool CheckOnce(const Anope::string &);
|
||||
public:
|
||||
/** This holds all the information in the config file,
|
||||
* it's indexed by tag name to a vector of key/values.
|
||||
*/
|
||||
ConfigDataHash config_data;
|
||||
/** Construct a new ServerConfig
|
||||
*/
|
||||
ServerConfig();
|
||||
|
||||
/** Read the entire configuration into memory
|
||||
* and initialize this class. All other methods
|
||||
* should be used only by the core.
|
||||
*/
|
||||
void Read();
|
||||
/** Load the configuration file into 'this'. With the new config parser everything is parsed into
|
||||
* tag/key/value at load-time rather than at read-value time.
|
||||
*/
|
||||
void LoadConf(ConfigurationFile &file);
|
||||
// Both these return true if the value existed or false otherwise
|
||||
/** Writes 'length' chars into 'result' as a string
|
||||
*/
|
||||
bool ConfValue(ConfigDataHash &, const Anope::string &, const Anope::string &, int, Anope::string &, bool = false);
|
||||
/** Writes 'length' chars into 'result' as a string
|
||||
*/
|
||||
bool ConfValue(ConfigDataHash &, const Anope::string &, const Anope::string &, const Anope::string &, int, Anope::string &, bool = false);
|
||||
/** Tries to convert the value to an integer and write it to 'result'
|
||||
*/
|
||||
bool ConfValueInteger(ConfigDataHash &, const Anope::string &, const Anope::string &, int, int &);
|
||||
/** Tries to convert the value to an integer and write it to 'result'
|
||||
*/
|
||||
bool ConfValueInteger(ConfigDataHash &, const Anope::string &, const Anope::string &, const Anope::string &, int, int &);
|
||||
/** Returns true if the value exists and has a true value, false otherwise
|
||||
*/
|
||||
bool ConfValueBool(ConfigDataHash &, const Anope::string &, const Anope::string &, int);
|
||||
/** Returns true if the value exists and has a true value, false otherwise
|
||||
*/
|
||||
bool ConfValueBool(ConfigDataHash &, const Anope::string &, const Anope::string &, const Anope::string &, int);
|
||||
/** Returns the number of occurences of tag in the config file
|
||||
*/
|
||||
int ConfValueEnum(const ConfigDataHash &, const Anope::string &);
|
||||
/** Returns the numbers of vars inside the index'th 'tag in the config file
|
||||
*/
|
||||
int ConfVarEnum(ConfigDataHash &, const Anope::string &, int);
|
||||
void ValidateHostname(const Anope::string &, const Anope::string &, const Anope::string &) const;
|
||||
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;
|
||||
|
||||
/** Below here is a list of variables which contain the config files values
|
||||
*/
|
||||
/* IRCd module in use */
|
||||
Anope::string IRCDModule;
|
||||
|
||||
/* Host to connect to **/
|
||||
Anope::string LocalHost;
|
||||
/* List of uplink servers to try and connect to */
|
||||
std::list<Uplink *> Uplinks;
|
||||
|
||||
/* Our server name */
|
||||
Anope::string ServerName;
|
||||
/* Our servers description */
|
||||
Anope::string ServerDesc;
|
||||
/* The username/ident of services clients */
|
||||
Anope::string ServiceUser;
|
||||
/* The hostname if services clients */
|
||||
Anope::string ServiceHost;
|
||||
|
||||
/* Name of the network were on */
|
||||
Anope::string NetworkName;
|
||||
/* The max legnth of nicks */
|
||||
unsigned NickLen;
|
||||
/* Max length of idents */
|
||||
unsigned UserLen;
|
||||
/* Max lenght of hostnames */
|
||||
unsigned HostLen;
|
||||
|
||||
/* Max length of passwords */
|
||||
unsigned PassLen;
|
||||
|
||||
/* NickServ Name */
|
||||
Anope::string s_NickServ;
|
||||
/* ChanServ Name */
|
||||
Anope::string s_ChanServ;
|
||||
/* MemoServ Name */
|
||||
Anope::string s_MemoServ;
|
||||
/* BotServ Name */
|
||||
Anope::string s_BotServ;
|
||||
/* OperServ name */
|
||||
Anope::string s_OperServ;
|
||||
/* Global name */
|
||||
Anope::string s_GlobalNoticer;
|
||||
/* NickServs realname */
|
||||
Anope::string desc_NickServ;
|
||||
/* ChanServ realname */
|
||||
Anope::string desc_ChanServ;
|
||||
/* MemoServ realname */
|
||||
Anope::string desc_MemoServ;
|
||||
/* BotServ realname */
|
||||
Anope::string desc_BotServ;
|
||||
/* OperServ realname */
|
||||
Anope::string desc_OperServ;
|
||||
/* Global realname */
|
||||
Anope::string desc_GlobalNoticer;
|
||||
|
||||
/* HostServ Name */
|
||||
Anope::string s_HostServ;
|
||||
/* HostServ realname */
|
||||
Anope::string desc_HostServ;
|
||||
|
||||
/* Filename for the PID file */
|
||||
Anope::string PIDFilename;
|
||||
/* MOTD filename */
|
||||
Anope::string MOTDFilename;
|
||||
|
||||
/* True if its ok to not be able to save backs */
|
||||
bool NoBackupOkay;
|
||||
/* Do password checking when new people register */
|
||||
bool StrictPasswords;
|
||||
/* How many times you're allowed to give a bad password before being killed */
|
||||
unsigned BadPassLimit;
|
||||
/* How long before bad passwords are forgotten */
|
||||
time_t BadPassTimeout;
|
||||
/* Delay between automatic database updates */
|
||||
time_t UpdateTimeout;
|
||||
/* Delay between checks for expired nicks and channels */
|
||||
time_t ExpireTimeout;
|
||||
/* How long to wait for something from the uplink, this is passed to select() */
|
||||
time_t ReadTimeout;
|
||||
/* How often to send program errors */
|
||||
time_t WarningTimeout;
|
||||
/* How long to process things such as timers to see if there is anything to calll */
|
||||
time_t TimeoutCheck;
|
||||
/* Number of days backups are kept */
|
||||
int KeepBackups;
|
||||
/* Forbidding requires a reason */
|
||||
bool ForceForbidReason;
|
||||
/* Services should use privmsgs instead of notices */
|
||||
bool UsePrivmsg;
|
||||
/* Services only respond to full PRIVMSG client@services.server.name messages */
|
||||
bool UseStrictPrivMsg;
|
||||
/* This is not a configurable option.
|
||||
* Config::Config will set it depending on the value of UseStrictPrivMsg */
|
||||
Anope::string UseStrictPrivMsgString;
|
||||
/* Number of seconds between consecutive uses of the REGISTER command
|
||||
* Not to be confused with NSRegDelay */
|
||||
unsigned NickRegDelay;
|
||||
/* Max number if news items allowed in the list */
|
||||
unsigned NewsCount;
|
||||
/* Default mlock modes */
|
||||
Anope::string MLock;
|
||||
/* Unmlockable modes */
|
||||
Anope::string NoMLock;
|
||||
/* Default botmodes on channels, defaults to ao */
|
||||
Anope::string BotModes;
|
||||
/* THe actual modes */
|
||||
ChannelStatus BotModeList;
|
||||
/* How many times to try and reconnect to the uplink before giving up */
|
||||
unsigned MaxRetries;
|
||||
/* How long to wait between connection attempts */
|
||||
int RetryWait;
|
||||
/* If services should hide unprivileged commands */
|
||||
bool HidePrivilegedCommands;
|
||||
|
||||
/* A vector of our logfile options */
|
||||
std::vector<LogInfo *> LogInfos;
|
||||
|
||||
/* Services can use email */
|
||||
bool UseMail;
|
||||
/* Path to the sendmail executable */
|
||||
Anope::string SendMailPath;
|
||||
/* Address to send from */
|
||||
Anope::string SendFrom;
|
||||
/* Only opers can have services send mail */
|
||||
bool RestrictMail;
|
||||
/* Delay between sending mail */
|
||||
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;
|
||||
|
||||
/* Prefix of guest nicks when a user gets forced off of a nick */
|
||||
Anope::string NSGuestNickPrefix;
|
||||
/* Allow users to set kill immed on */
|
||||
bool NSAllowKillImmed;
|
||||
/* Don't allow nicks to use /ns group to regroup nicks */
|
||||
bool NSNoGroupChange;
|
||||
/* Default flags for newly registered nicks */
|
||||
Flags<NickCoreFlag, NI_END> NSDefFlags;
|
||||
/* All languages Anope is aware about */
|
||||
Anope::string Languages;
|
||||
/* Default language used by services */
|
||||
Anope::string NSDefLanguage;
|
||||
/* Users must be connected this long before they can register
|
||||
* Not to be confused with NickRegDelay */
|
||||
time_t NSRegDelay;
|
||||
/* Time before the registering mail will be resent */
|
||||
time_t NSResendDelay;
|
||||
/* How long before nicks expire */
|
||||
time_t NSExpire;
|
||||
/* How long before suspended nicks expire */
|
||||
time_t NSSuspendExpire;
|
||||
/* How long before forbidden nicks expire */
|
||||
time_t NSForbidExpire;
|
||||
/* Time before unconfirmed nicks expire */
|
||||
time_t NSUnconfirmedExpire;
|
||||
/* Force email when registering */
|
||||
bool NSForceEmail;
|
||||
/* Force users to validate new email addresses */
|
||||
bool NSConfirmEmailChanges;
|
||||
/* Max number of nicks in a group */
|
||||
unsigned NSMaxAliases;
|
||||
/* Max number of allowed strings on the access list */
|
||||
unsigned NSAccessMax;
|
||||
/* Enforcer client user name */
|
||||
Anope::string NSEnforcerUser;
|
||||
/* Enforcer client hostname */
|
||||
Anope::string NSEnforcerHost;
|
||||
/* How long before recovered nicks are released */
|
||||
time_t NSReleaseTimeout;
|
||||
/* /nickserv list is oper only */
|
||||
bool NSListOpersOnly;
|
||||
/* Max number of entries that can be returned from the list command */
|
||||
unsigned NSListMax;
|
||||
/* Only allow usermode +a etc on real services admins */
|
||||
bool NSSecureAdmins;
|
||||
/* Services opers must be /operd on the ircd aswell */
|
||||
bool NSStrictPrivileges;
|
||||
/* Use email to verify new users registering */
|
||||
bool NSEmailReg;
|
||||
/* Set the proper channel modes on users when they identify */
|
||||
bool NSModeOnID;
|
||||
/* Add the users hostnask their access list when they register */
|
||||
bool NSAddAccessOnReg;
|
||||
/* Maximum number of channels on AJoin */
|
||||
unsigned AJoinMax;
|
||||
|
||||
/* Default flags for newly registered channels */
|
||||
Flags<ChannelInfoFlag, CI_END> CSDefFlags;
|
||||
/* Max number of channels a user can own */
|
||||
unsigned CSMaxReg;
|
||||
/* Time before a channel expires */
|
||||
time_t CSExpire;
|
||||
/* How long before suspended channels expire */
|
||||
time_t CSSuspendExpire;
|
||||
/* How long before forbidden channels expire */
|
||||
time_t CSForbidExpire;
|
||||
/* Default ban type to use for channels */
|
||||
int CSDefBantype;
|
||||
/* Max number of entries allowed on channel access lists */
|
||||
unsigned CSAccessMax;
|
||||
/* Max number of entries allowed on autokick lists */
|
||||
unsigned CSAutokickMax;
|
||||
/* Default autokick reason */
|
||||
Anope::string CSAutokickReason;
|
||||
/* Time ChanServ should stay in the channel to hold it to keep users from getting in */
|
||||
time_t CSInhabit;
|
||||
/* ChanServ's LIST command is oper only */
|
||||
bool CSListOpersOnly;
|
||||
/* Max number of entries allowed to be returned from the LIST command */
|
||||
unsigned CSListMax;
|
||||
/* true to make ChanServ oper only */
|
||||
bool CSOpersOnly;
|
||||
|
||||
/* Max number of memos allowed */
|
||||
unsigned MSMaxMemos;
|
||||
/* Time you must wait between sending memos */
|
||||
time_t MSSendDelay;
|
||||
/* Notify all of the aliases of the core the memo was sent to */
|
||||
bool MSNotifyAll;
|
||||
/* Who can use memos reciepts */
|
||||
unsigned MSMemoReceipt;
|
||||
|
||||
/* Defai;t BotServ flags */
|
||||
Flags<BotServFlag> 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 */
|
||||
unsigned BSMinUsers;
|
||||
/* Max number of words allowed on the badwordslist */
|
||||
unsigned BSBadWordsMax;
|
||||
/* BotServ bot only joins if it would normally allowed to, abides by bans etc */
|
||||
bool BSSmartJoin;
|
||||
/* Dont tell users what badword they used */
|
||||
bool BSGentleBWReason;
|
||||
/* Case sensitive badwords matching */
|
||||
bool BSCaseSensitive;
|
||||
/* Char to use for the fantasy char, eg ! */
|
||||
Anope::string BSFantasyCharacter;
|
||||
|
||||
/* Only show /stats o to opers */
|
||||
bool HideStatsO;
|
||||
/* Send out a global when services shut down or restart */
|
||||
bool GlobalOnCycle;
|
||||
/* Don't include the opers name in globals */
|
||||
bool AnonymousGlobal;
|
||||
/* Dont allow users to register nicks with oper names in them */
|
||||
bool RestrictOperNicks;
|
||||
/* Message to send when shutting down */
|
||||
Anope::string GlobalOnCycleMessage;
|
||||
/* Message to send when starting up */
|
||||
Anope::string GlobalOnCycleUP;
|
||||
/* Super admin is allowed */
|
||||
bool SuperAdmin;
|
||||
/* Default expiry time for akills */
|
||||
time_t AutokillExpiry;
|
||||
/* Default expiry time for chan kills */
|
||||
time_t ChankillExpiry;
|
||||
/* Default expiry time for SNLine Expire */
|
||||
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;
|
||||
|
||||
/* Limit sessions */
|
||||
bool LimitSessions;
|
||||
/* The default session limit */
|
||||
unsigned DefSessionLimit;
|
||||
/* How long before exceptions expire */
|
||||
time_t ExceptionExpiry;
|
||||
/* How many times to kill before adding an KILL */
|
||||
unsigned MaxSessionKill;
|
||||
/* Max limit that can be used for exceptions */
|
||||
unsigned MaxSessionLimit;
|
||||
/* How long session akills should last */
|
||||
time_t SessionAutoKillExpiry;
|
||||
/* Reason to use for session kills */
|
||||
Anope::string SessionLimitExceeded;
|
||||
/* Optional second reason */
|
||||
Anope::string SessionLimitDetailsLoc;
|
||||
/* OperServ requires you to be an operator */
|
||||
bool OSOpersOnly;
|
||||
|
||||
/* List of modules to autoload */
|
||||
std::list<Anope::string> ModulesAutoLoad;
|
||||
/* Encryption modules */
|
||||
std::list<Anope::string> EncModuleList;
|
||||
/* Database modules */
|
||||
std::list<Anope::string> DBModuleList;
|
||||
/* HostServ Core Modules */
|
||||
std::list<Anope::string> HostServCoreModules;
|
||||
/* MemoServ Core Modules */
|
||||
std::list<Anope::string> MemoServCoreModules;
|
||||
/* BotServ Core Modules */
|
||||
std::list<Anope::string> BotServCoreModules;
|
||||
/* OperServ Core Modules */
|
||||
std::list<Anope::string> OperServCoreModules;
|
||||
/* NickServ Core Modules */
|
||||
std::list<Anope::string> NickServCoreModules;
|
||||
/* ChanServ Core Modules */
|
||||
std::list<Anope::string> ChanServCoreModules;
|
||||
|
||||
/* Default defcon level */
|
||||
int DefConLevel;
|
||||
/* Timeout before defcon is reset */
|
||||
time_t DefConTimeOut;
|
||||
/* Session limiit to use when using defcon */
|
||||
unsigned DefConSessionLimit;
|
||||
/* How long to add akills for defcon */
|
||||
time_t DefConAKILL;
|
||||
/* Chan modes for defcon */
|
||||
Anope::string DefConChanModes;
|
||||
/* Should we global on defcon */
|
||||
bool GlobalOnDefcon;
|
||||
/* Should we send DefconMessage aswell? */
|
||||
bool GlobalOnDefconMore;
|
||||
/* Message to send when defcon is off */
|
||||
Anope::string DefConOffMessage;
|
||||
/* Message to send when defcon is on*/
|
||||
Anope::string DefconMessage;
|
||||
/* Reason to akill clients for defcon */
|
||||
Anope::string DefConAkillReason;
|
||||
|
||||
/* The socket engine in use */
|
||||
Anope::string SocketEngine;
|
||||
|
||||
/* User keys to use for generating random hashes for pass codes etc */
|
||||
unsigned long UserKey1;
|
||||
unsigned long UserKey2;
|
||||
unsigned long UserKey3;
|
||||
|
||||
/* Numeric */
|
||||
Anope::string Numeric;
|
||||
/* Array of ulined servers */
|
||||
std::list<Anope::string> Ulines;
|
||||
|
||||
/* List of available opertypes */
|
||||
std::list<OperType *> MyOperTypes;
|
||||
/* List of pairs of opers and their opertype from the config */
|
||||
std::vector<Oper *> Opers;
|
||||
};
|
||||
|
||||
/** 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 ConfigException : public CoreException
|
||||
{
|
||||
public:
|
||||
/** Default constructor, just uses the error mesage 'Config threw an exception'.
|
||||
*/
|
||||
ConfigException() : CoreException("Config threw an exception", "Config Parser") { }
|
||||
/** This constructor can be used to specify an error message before throwing.
|
||||
*/
|
||||
ConfigException(const Anope::string &message) : CoreException(message, "Config Parser") { }
|
||||
/** 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 ~ConfigException() throw() { }
|
||||
};
|
||||
|
||||
#define CONF_NO_ERROR 0x000000
|
||||
#define CONF_NOT_A_NUMBER 0x000010
|
||||
#define CONF_INT_NEGATIVE 0x000080
|
||||
#define CONF_VALUE_NOT_FOUND 0x000100
|
||||
#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
|
||||
* 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.
|
||||
*/
|
||||
class CoreExport ConfigReader
|
||||
{
|
||||
protected:
|
||||
/** True if an error occured reading the config file
|
||||
*/
|
||||
bool readerror;
|
||||
/** Error code
|
||||
*/
|
||||
long error;
|
||||
public:
|
||||
/** Default constructor.
|
||||
* This constructor initialises the ConfigReader class to read the configuration file(s).
|
||||
*/
|
||||
ConfigReader();
|
||||
/** Overloaded constructor.
|
||||
* This constructor initialises the ConfigReader class to read a user-specified config file
|
||||
*/
|
||||
ConfigReader(const Anope::string &);
|
||||
/** Default destructor.
|
||||
* This method destroys the ConfigReader class.
|
||||
*/
|
||||
~ConfigReader();
|
||||
/** Retrieves a value from the config file.
|
||||
* This method retrieves a value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve.
|
||||
*/
|
||||
Anope::string ReadValue(const Anope::string &, const Anope::string &, int, bool = false);
|
||||
/** Retrieves a value from the config file.
|
||||
* This method retrieves a value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. If the
|
||||
* tag is not found the default value is returned instead.
|
||||
*/
|
||||
Anope::string ReadValue(const Anope::string &, const Anope::string &, const Anope::string &, int, bool = false);
|
||||
/** Retrieves a boolean value from the config file.
|
||||
* This method retrieves a boolean value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. The values "1", "yes"
|
||||
* and "true" in the config file count as true to ReadFlag, and any other value counts as false.
|
||||
*/
|
||||
bool ReadFlag(const Anope::string &, const Anope::string &, int);
|
||||
/** Retrieves a boolean value from the config file.
|
||||
* This method retrieves a boolean value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. The values "1", "yes"
|
||||
* and "true" in the config file count as true to ReadFlag, and any other value counts as false.
|
||||
* If the tag is not found, the default value is used instead.
|
||||
*/
|
||||
bool ReadFlag(const Anope::string &, const Anope::string &, const Anope::string &, int);
|
||||
/** Retrieves an integer value from the config file.
|
||||
* This method retrieves an integer value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. Any invalid integer
|
||||
* values in the tag will cause the objects error value to be set, and any call to GetError() will
|
||||
* return CONF_INVALID_NUMBER to be returned. need_positive is set if the number must be non-negative.
|
||||
* If a negative number is placed into a tag which is specified positive, 0 will be returned and GetError()
|
||||
* will return CONF_INT_NEGATIVE. Note that need_positive is not suitable to get an unsigned int - you
|
||||
* should cast the result to achieve that effect.
|
||||
*/
|
||||
int ReadInteger(const Anope::string &, const Anope::string &, int, bool);
|
||||
/** Retrieves an integer value from the config file.
|
||||
* This method retrieves an integer value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. Any invalid integer
|
||||
* values in the tag will cause the objects error value to be set, and any call to GetError() will
|
||||
* return CONF_INVALID_NUMBER to be returned. needs_unsigned is set if the number must be unsigned.
|
||||
* If a signed number is placed into a tag which is specified unsigned, 0 will be returned and GetError()
|
||||
* will return CONF_NOT_UNSIGNED. If the tag is not found, the default value is used instead.
|
||||
*/
|
||||
int ReadInteger(const Anope::string &, const Anope::string &, const Anope::string &, int, bool);
|
||||
/** Returns the last error to occur.
|
||||
* Valid errors can be found by looking in modules.h. Any nonzero value indicates an error condition.
|
||||
* A call to GetError() resets the error flag back to 0.
|
||||
*/
|
||||
long GetError();
|
||||
/** Counts the number of times a given tag appears in the config file.
|
||||
* This method counts the number of times a tag appears in a config file, for use where
|
||||
* there are several tags of the same kind, e.g. with opers and connect types. It can be
|
||||
* used with the index value of ConfigReader::ReadValue to loop through all copies of a
|
||||
* multiple instance tag.
|
||||
*/
|
||||
int Enumerate(const Anope::string &) const;
|
||||
/** Returns true if a config file is valid.
|
||||
* This method is partially implemented and will only return false if the config
|
||||
* file does not exist or could not be opened.
|
||||
*/
|
||||
bool Verify();
|
||||
/** Returns the number of items within a tag.
|
||||
* For example if the tag was <test tag="blah" data="foo"> then this
|
||||
* function would return 2. Spaces and newlines both qualify as valid seperators
|
||||
* between values.
|
||||
*/
|
||||
int EnumerateValues(const Anope::string &, int);
|
||||
};
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
@@ -1,903 +0,0 @@
|
||||
#ifndef _CONFIGREADER_H_
|
||||
#define _CONFIGREADER_H_
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <deque>
|
||||
|
||||
/** A configuration key and value pair
|
||||
*/
|
||||
typedef std::pair<std::string, std::string> KeyVal;
|
||||
|
||||
/** A list of related configuration keys and values
|
||||
*/
|
||||
typedef std::vector<KeyVal> KeyValList;
|
||||
|
||||
/** An entire config file, built up of KeyValLists
|
||||
*/
|
||||
typedef std::multimap<std::string, KeyValList> ConfigDataHash;
|
||||
|
||||
// Required forward definitions
|
||||
class ServerConfig;
|
||||
|
||||
/** Types of data in the core config
|
||||
*/
|
||||
enum ConfigDataType {
|
||||
DT_NOTHING, // No data
|
||||
DT_INTEGER, // Integer
|
||||
DT_UINTEGER, // Unsigned Integer
|
||||
DT_LUINTEGER, // Long Unsigned Integer
|
||||
DT_CHARPTR, // Char pointer
|
||||
DT_STRING, // std::string
|
||||
DT_BOOLEAN, // Boolean
|
||||
DT_HOSTNAME, // Hostname syntax
|
||||
DT_NOSPACES, // No spaces
|
||||
DT_IPADDRESS, // IP address (v4, v6)
|
||||
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_CHARPTR
|
||||
};
|
||||
|
||||
/** Holds a config value, either string, integer or boolean.
|
||||
* Callback functions receive one or more of these, either on
|
||||
* their own as a reference, or in a reference to a deque of them.
|
||||
* The callback function can then alter the values of the ValueItem
|
||||
* classes to validate the settings.
|
||||
*/
|
||||
class ValueItem
|
||||
{
|
||||
/** Actual data */
|
||||
std::string v;
|
||||
public:
|
||||
/** Initialize with an int */
|
||||
ValueItem(int);
|
||||
/** Initialize with a bool */
|
||||
ValueItem(bool);
|
||||
/** Initialize with a char pointer */
|
||||
ValueItem(const char *);
|
||||
/** Initialize with an std::string */
|
||||
ValueItem(const std::string &);
|
||||
/** Initialize with a long */
|
||||
ValueItem(long);
|
||||
/** Change value to a char pointer */
|
||||
//void Set(char *);
|
||||
/** Change value to a const char pointer */
|
||||
void Set(const char *);
|
||||
/** Change value to an std::string */
|
||||
void Set(const std::string &);
|
||||
/** Change value to an int */
|
||||
void Set(int);
|
||||
/** Get value as an int */
|
||||
int GetInteger();
|
||||
/** Get value as a string */
|
||||
const char *GetString() const;
|
||||
/** Get value as a string */
|
||||
inline const std::string &GetValue() const { return v; }
|
||||
/** Get value as a bool */
|
||||
bool GetBool();
|
||||
};
|
||||
|
||||
/** The base class of the container 'ValueContainer'
|
||||
* used internally by the core to hold core values.
|
||||
*/
|
||||
class ValueContainerBase
|
||||
{
|
||||
public:
|
||||
/** Constructor */
|
||||
ValueContainerBase() { }
|
||||
/** Destructor */
|
||||
virtual ~ValueContainerBase() { }
|
||||
};
|
||||
|
||||
/** ValueContainer is used to contain pointers to different
|
||||
* core values such as the server name, maximum number of
|
||||
* clients etc.
|
||||
* It is specialized to hold a data type, then pointed at
|
||||
* a value in the ServerConfig class. When the value has been
|
||||
* read and validated, the Set method is called to write the
|
||||
* value safely in a type-safe manner.
|
||||
*/
|
||||
template<typename T> class ValueContainer : public ValueContainerBase
|
||||
{
|
||||
/** Contained item */
|
||||
T val;
|
||||
public:
|
||||
/** Initialize with nothing */
|
||||
ValueContainer() : ValueContainerBase(), val(NULL) { }
|
||||
/** Initialize with a value of type T */
|
||||
ValueContainer(T Val) : ValueContainerBase(), val(Val) { }
|
||||
/** Initialize with a copy */
|
||||
ValueContainer(const ValueContainer &Val) : ValueContainerBase(), val(Val.val) { }
|
||||
ValueContainer &operator=(const ValueContainer &Val)
|
||||
{
|
||||
val = Val.val;
|
||||
return *this;
|
||||
}
|
||||
/** Change value to type T of size s */
|
||||
void Set(const T newval, size_t s)
|
||||
{
|
||||
memcpy(val, newval, s);
|
||||
}
|
||||
};
|
||||
|
||||
/** This a specific version of ValueContainer to handle character arrays specially
|
||||
*/
|
||||
template<> class ValueContainer<char **> : public ValueContainerBase
|
||||
{
|
||||
/** Contained item */
|
||||
char **val;
|
||||
public:
|
||||
/** Initialize with nothing */
|
||||
ValueContainer() : ValueContainerBase(), val(NULL) { }
|
||||
/** Initialize with a value of type T */
|
||||
ValueContainer(char **Val) : ValueContainerBase(), val(Val) { }
|
||||
/** Initialize with a copy */
|
||||
ValueContainer(const ValueContainer &Val) : ValueContainerBase(), val(Val.val) { }
|
||||
ValueContainer &operator=(const ValueContainer &Val)
|
||||
{
|
||||
val = Val.val;
|
||||
return *this;
|
||||
}
|
||||
/** Change value to type T of size s */
|
||||
void Set(const char *newval, size_t s)
|
||||
{
|
||||
if (*val) delete [] *val;
|
||||
if (!*newval) {
|
||||
*val = NULL;
|
||||
return;
|
||||
}
|
||||
*val = new char[s];
|
||||
strlcpy(*val, newval, s);
|
||||
}
|
||||
};
|
||||
|
||||
/** This a specific version of ValueContainer to handle std::string specially
|
||||
*/
|
||||
template<> class ValueContainer<std::string *> : public ValueContainerBase
|
||||
{
|
||||
/** Contained item */
|
||||
std::string *val;
|
||||
public:
|
||||
/** Initialize with nothing */
|
||||
ValueContainer() : ValueContainerBase(), val(NULL) { }
|
||||
/** Initialize with an std::string */
|
||||
ValueContainer(std::string *Val) : ValueContainerBase(), val(Val) { }
|
||||
/** Initialize with a copy */
|
||||
ValueContainer(const ValueContainer &Val) : ValueContainerBase(), val(Val.val) { }
|
||||
ValueContainer &operator=(const ValueContainer &Val)
|
||||
{
|
||||
val = Val.val;
|
||||
return *this;
|
||||
}
|
||||
/** Change value to given std::string */
|
||||
void Set(const std::string &newval)
|
||||
{
|
||||
*val = newval;
|
||||
}
|
||||
/** Change value to given char pointer */
|
||||
void Set(const char *newval)
|
||||
{
|
||||
*val = newval;
|
||||
}
|
||||
};
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to a bool
|
||||
*/
|
||||
typedef ValueContainer<bool *> ValueContainerBool;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* an unsigned int
|
||||
*/
|
||||
typedef ValueContainer<unsigned *> ValueContainerUInt;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* a long unsigned int
|
||||
*/
|
||||
typedef ValueContainer<long unsigned *> ValueContainerLUInt;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* a char array.
|
||||
*/
|
||||
typedef ValueContainer<char **> ValueContainerChar;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* an int
|
||||
*/
|
||||
typedef ValueContainer<int *> ValueContainerInt;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* a time_t
|
||||
*/
|
||||
typedef ValueContainer<time_t *> ValueContainerTime;
|
||||
|
||||
/** A specialization of ValueContainer to hold a pointer to
|
||||
* an std::string
|
||||
*/
|
||||
typedef ValueContainer<std::string *> ValueContainerString;
|
||||
|
||||
/** A set of ValueItems used by multi-value validator functions
|
||||
*/
|
||||
typedef std::deque<ValueItem> ValueList;
|
||||
|
||||
/** A callback for validating a single value
|
||||
*/
|
||||
typedef bool (*Validator)(ServerConfig *, const char *, const char *, ValueItem &);
|
||||
/** A callback for validating multiple value entries
|
||||
*/
|
||||
typedef bool (*MultiValidator)(ServerConfig *, const char *, const char **, ValueList &, int *, bool);
|
||||
/** A callback indicating the end of a group of entries
|
||||
*/
|
||||
typedef bool (*MultiNotify)(ServerConfig *, const char *, bool);
|
||||
|
||||
/** Holds a core configuration item and its callbacks
|
||||
*/
|
||||
struct InitialConfig
|
||||
{
|
||||
/** Tag name */
|
||||
const char *tag;
|
||||
/** Value name */
|
||||
const char *value;
|
||||
/** Default, if not defined */
|
||||
const char *default_value;
|
||||
/** Value containers */
|
||||
ValueContainerBase *val;
|
||||
/** Data types */
|
||||
int datatype;
|
||||
/** Validation function */
|
||||
Validator validation_function;
|
||||
};
|
||||
|
||||
/** Holds a core configuration item and its callbacks
|
||||
* where there may be more than one item
|
||||
*/
|
||||
struct MultiConfig
|
||||
{
|
||||
/** Tag name */
|
||||
const char *tag;
|
||||
/** One or more items within tag */
|
||||
const char *items[17];
|
||||
/** One or more defaults for items within tags */
|
||||
const char *items_default[17];
|
||||
/** One or more data types */
|
||||
int datatype[17];
|
||||
/** Initialization function */
|
||||
MultiNotify init_function;
|
||||
/** Validation function */
|
||||
MultiValidator validation_function;
|
||||
/** Completion function */
|
||||
MultiNotify finish_function;
|
||||
};
|
||||
|
||||
/** This class holds the bulk of the runtime configuration for the ircd.
|
||||
* It allows for reading new config values, accessing configuration files,
|
||||
* and storage of the configuration data needed to run the ircd, such as
|
||||
* the servername, connect classes, /ADMIN data, MOTDs and filenames etc.
|
||||
*/
|
||||
class ServerConfig
|
||||
{
|
||||
private:
|
||||
/** This variable holds the names of all
|
||||
* files included from the main one. This
|
||||
* is used to make sure that no files are
|
||||
* recursively included.
|
||||
*/
|
||||
std::vector<std::string> include_stack;
|
||||
/** Check that there is only one of each configuration item
|
||||
*/
|
||||
bool CheckOnce(const char *);
|
||||
public:
|
||||
std::ostringstream errstr;
|
||||
ConfigDataHash newconfig;
|
||||
/** This holds all the information in the config file,
|
||||
* it's indexed by tag name to a vector of key/values.
|
||||
*/
|
||||
ConfigDataHash config_data;
|
||||
/** Construct a new ServerConfig
|
||||
*/
|
||||
ServerConfig();
|
||||
/** Clears the include stack in preperation for a Read() call.
|
||||
*/
|
||||
void ClearStack();
|
||||
/** Read the entire configuration into memory
|
||||
* and initialize this class. All other methods
|
||||
* should be used only by the core.
|
||||
*/
|
||||
int Read(bool);
|
||||
/** Report a configuration error given in errormessage.
|
||||
* @param bail If this is set to true, the error is sent to the console, and the program exits
|
||||
* @param connection If this is set to a non-null value, and bail is false, the errors are spooled to
|
||||
* this connection as SNOTICEs.
|
||||
* If the parameter is NULL, the messages are spooled to all connections via WriteOpers as SNOTICEs.
|
||||
*/
|
||||
void ReportConfigError(const std::string &, bool);
|
||||
/** Load 'filename' into 'target', with the new config parser everything is parsed into
|
||||
* tag/key/value at load-time rather than at read-value time.
|
||||
*/
|
||||
bool LoadConf(ConfigDataHash &, const char *, std::ostringstream &);
|
||||
/** Load 'filename' into 'target', with the new config parser everything is parsed into
|
||||
* tag/key/value at load-time rather than at read-value time.
|
||||
*/
|
||||
bool LoadConf(ConfigDataHash &, const std::string &, std::ostringstream &);
|
||||
// Both these return true if the value existed or false otherwise
|
||||
/** Writes 'length' chars into 'result' as a string
|
||||
*/
|
||||
bool ConfValue(ConfigDataHash &, const char *, const char *, int, char *, int, bool = false);
|
||||
/** Writes 'length' chars into 'result' as a string
|
||||
*/
|
||||
bool ConfValue(ConfigDataHash &, const char *, const char *, const char *, int, char *, int, bool = false);
|
||||
/** Writes 'length' chars into 'result' as a string
|
||||
*/
|
||||
bool ConfValue(ConfigDataHash &, const std::string &, const std::string &, int, std::string &, bool = false);
|
||||
/** Writes 'length' chars into 'result' as a string
|
||||
*/
|
||||
bool ConfValue(ConfigDataHash &, const std::string &, const std::string &, const std::string &, int, std::string &, bool = false);
|
||||
/** Tries to convert the value to an integer and write it to 'result'
|
||||
*/
|
||||
bool ConfValueInteger(ConfigDataHash &, const char *, const char *, int, int &);
|
||||
/** Tries to convert the value to an integer and write it to 'result'
|
||||
*/
|
||||
bool ConfValueInteger(ConfigDataHash &, const char *, const char *, const char *, int, int &);
|
||||
/** Tries to convert the value to an integer and write it to 'result'
|
||||
*/
|
||||
bool ConfValueInteger(ConfigDataHash &, const std::string &, const std::string &, int, int &);
|
||||
/** Tries to convert the value to an integer and write it to 'result'
|
||||
*/
|
||||
bool ConfValueInteger(ConfigDataHash &, const std::string &, const std::string &, const std::string &, int, int &);
|
||||
/** Returns true if the value exists and has a true value, false otherwise
|
||||
*/
|
||||
bool ConfValueBool(ConfigDataHash &, const char *, const char *, int);
|
||||
/** Returns true if the value exists and has a true value, false otherwise
|
||||
*/
|
||||
bool ConfValueBool(ConfigDataHash &, const char *, const char *, const char *, int);
|
||||
/** Returns true if the value exists and has a true value, false otherwise
|
||||
*/
|
||||
bool ConfValueBool(ConfigDataHash &, const std::string &, const std::string &, int);
|
||||
/** Returns true if the value exists and has a true value, false otherwise
|
||||
*/
|
||||
bool ConfValueBool(ConfigDataHash &, const std::string &, const std::string &, const std::string &, int);
|
||||
/** Returns the number of occurences of tag in the config file
|
||||
*/
|
||||
int ConfValueEnum(ConfigDataHash &, const char *);
|
||||
/** Returns the number of occurences of tag in the config file
|
||||
*/
|
||||
int ConfValueEnum(ConfigDataHash &, const std::string &);
|
||||
/** Returns the numbers of vars inside the index'th 'tag in the config file
|
||||
*/
|
||||
int ConfVarEnum(ConfigDataHash &, const char *, int);
|
||||
/** Returns the numbers of vars inside the index'th 'tag in the config file
|
||||
*/
|
||||
int ConfVarEnum(ConfigDataHash &, const std::string &, int);
|
||||
void ValidateHostname(const char *, const std::string &, const std::string &);
|
||||
void ValidateIP(const char *p, const std::string &, const std::string &, bool);
|
||||
void ValidateNoSpaces(const char *, const std::string &, const std::string &);
|
||||
|
||||
|
||||
|
||||
/** Below here is a list of variables which contain the config files values
|
||||
*/
|
||||
/* IRCd module in use */
|
||||
char *IRCDModule;
|
||||
|
||||
/* Host to connect to **/
|
||||
char *LocalHost;
|
||||
/* List of uplink servers to try and connect to */
|
||||
std::list<Uplink *> Uplinks;
|
||||
|
||||
/* Our server name */
|
||||
char *ServerName;
|
||||
/* Our servers description */
|
||||
char *ServerDesc;
|
||||
/* The username/ident of services clients */
|
||||
char *ServiceUser;
|
||||
/* The hostname if services clients */
|
||||
char *ServiceHost;
|
||||
|
||||
/* Help channel, ops here get usermode +h **/
|
||||
char *HelpChannel;
|
||||
/* Log channel */
|
||||
char *LogChannel;
|
||||
/* Name of the network were on */
|
||||
char *NetworkName;
|
||||
/* The max legnth of nicks */
|
||||
unsigned NickLen;
|
||||
/* Max length of idents */
|
||||
unsigned UserLen;
|
||||
/* Max lenght of hostnames */
|
||||
unsigned HostLen;
|
||||
|
||||
/* Max length of passwords */
|
||||
unsigned PassLen;
|
||||
|
||||
/* NickServ Name */
|
||||
char *s_NickServ;
|
||||
/* ChanServ Name */
|
||||
char *s_ChanServ;
|
||||
/* MemoServ Name */
|
||||
char *s_MemoServ;
|
||||
/* BotServ Name */
|
||||
char *s_BotServ;
|
||||
/* OperServ name */
|
||||
char *s_OperServ;
|
||||
/* Global name */
|
||||
char *s_GlobalNoticer;
|
||||
/* NickServs realname */
|
||||
char *desc_NickServ;
|
||||
/* ChanServ realname */
|
||||
char *desc_ChanServ;
|
||||
/* MemoServ relname */
|
||||
char *desc_MemoServ;
|
||||
/* BotServ realname */
|
||||
char *desc_BotServ;
|
||||
/* OperServ realname */
|
||||
char *desc_OperServ;
|
||||
/* Global realname */
|
||||
char *desc_GlobalNoticer;
|
||||
|
||||
/* HostServ Name */
|
||||
char *s_HostServ;
|
||||
/* HostServ realname */
|
||||
char *desc_HostServ;
|
||||
|
||||
/* Filename for the PID file */
|
||||
char *PIDFilename;
|
||||
/* MOTD filename */
|
||||
char *MOTDFilename;
|
||||
|
||||
/* True if its ok to not be able to save backs */
|
||||
bool NoBackupOkay;
|
||||
/* Do password checking when new people register */
|
||||
bool StrictPasswords;
|
||||
/* How many times you're allowed to give a bad password before being killed */
|
||||
unsigned BadPassLimit;
|
||||
/* How long before bad passwords are forgotten */
|
||||
time_t BadPassTimeout;
|
||||
/* Delay between automatic database updates */
|
||||
time_t UpdateTimeout;
|
||||
/* Delay between checks for expired nicks and channels */
|
||||
time_t ExpireTimeout;
|
||||
/* How long to wait for something from the uplink, this is passed to select() */
|
||||
time_t ReadTimeout;
|
||||
/* How often to send program errors */
|
||||
time_t WarningTimeout;
|
||||
/* How long to process things such as timers to see if there is anything to calll */
|
||||
time_t TimeoutCheck;
|
||||
/* Num of days logfiles are kept */
|
||||
int KeepLogs;
|
||||
/* Number of days backups are kept */
|
||||
int KeepBackups;
|
||||
/* Forbidding requires a reason */
|
||||
bool ForceForbidReason;
|
||||
/* Services should use privmsgs instead of notices */
|
||||
bool UsePrivmsg;
|
||||
/* Services only respond to full PRIVMSG client@services.server.name messages */
|
||||
bool UseStrictPrivMsg;
|
||||
/* Dump a core file if we crash */
|
||||
bool DumpCore;
|
||||
/* Log users connecting/existing/changing nicks */
|
||||
bool LogUsers;
|
||||
/* Number of seconds between consecutive uses of the REGISTER command
|
||||
* Not to be confused with NSRegDelay */
|
||||
unsigned NickRegDelay;
|
||||
/* Max number if news items allowed in the list */
|
||||
unsigned NewsCount;
|
||||
/* Default mlock modes */
|
||||
std::string MLock;
|
||||
/* Default botmodes on channels, defaults to ao */
|
||||
std::string BotModes;
|
||||
/* How many times to try and reconnect to the uplink before giving up */
|
||||
unsigned MaxRetries;
|
||||
/* How long to wait between connection attempts */
|
||||
int RetryWait;
|
||||
|
||||
/* Services can use email */
|
||||
bool UseMail;
|
||||
/* Path to the sendmail executable */
|
||||
char *SendMailPath;
|
||||
/* Address to send from */
|
||||
char *SendFrom;
|
||||
/* Only opers can have services send mail */
|
||||
bool RestrictMail;
|
||||
/* Delay between sending mail */
|
||||
time_t MailDelay;
|
||||
/* Don't quote the To: address */
|
||||
bool DontQuoteAddresses;
|
||||
|
||||
/* Prefix of guest nicks when a user gets forced off of a nick */
|
||||
char *NSGuestNickPrefix;
|
||||
/* Allow users to set kill immed on */
|
||||
bool NSAllowKillImmed;
|
||||
/* Don't allow nicks to use /ns group to regroup nicks */
|
||||
bool NSNoGroupChange;
|
||||
/* Default flags for newly registered nicks */
|
||||
Flags<NickCoreFlag> NSDefFlags;
|
||||
/* Default language used by services */
|
||||
unsigned NSDefLanguage;
|
||||
/* Users must be connected this long before they can register
|
||||
* Not to be confused with NickRegDelay */
|
||||
time_t NSRegDelay;
|
||||
/* Time before the registering mail will be resent */
|
||||
time_t NSResendDelay;
|
||||
/* How long before nicks expir */
|
||||
time_t NSExpire;
|
||||
/* Time before NickRequests expire */
|
||||
time_t NSRExpire;
|
||||
/* Force email when registering */
|
||||
bool NSForceEmail;
|
||||
/* Max number of nicks in a group */
|
||||
int NSMaxAliases;
|
||||
/* Max number of allowed strings on the access list */
|
||||
unsigned NSAccessMax;
|
||||
/* Enforcer client user name */
|
||||
char *NSEnforcerUser;
|
||||
/* Enforcer client hostname */
|
||||
char *NSEnforcerHost;
|
||||
/* How long before recovered nicks are released */
|
||||
time_t NSReleaseTimeout;
|
||||
/* /nickserv list is oper only */
|
||||
bool NSListOpersOnly;
|
||||
/* Max number of entries that can be returned from the list command */
|
||||
unsigned NSListMax;
|
||||
/* Only allow usermode +a etc on real services admins */
|
||||
bool NSSecureAdmins;
|
||||
/* Services opers must be /operd on the ircd aswell */
|
||||
bool NSStrictPrivileges;
|
||||
/* Use email to verify new users registering */
|
||||
bool NSEmailReg;
|
||||
/* Set the proper channel modes on users when they identify */
|
||||
bool NSModeOnID;
|
||||
/* Add the users hostnask their access list when they register */
|
||||
bool NSAddAccessOnReg;
|
||||
|
||||
/* Default flags for newly registered channels */
|
||||
Flags<ChannelInfoFlag> CSDefFlags;
|
||||
/* Max number of channels a user can own */
|
||||
unsigned CSMaxReg;
|
||||
/* Time before a channel expires */
|
||||
time_t CSExpire;
|
||||
/* Default ban type to use for channels */
|
||||
int CSDefBantype;
|
||||
/* Max number of entries allowed on channel access lists */
|
||||
unsigned CSAccessMax;
|
||||
/* Max number of entries allowed on autokick lists */
|
||||
unsigned CSAutokickMax;
|
||||
/* Default autokick reason */
|
||||
char *CSAutokickReason;
|
||||
/* Time ChanServ should stay in the channel to hold it to keep users from getting in */
|
||||
time_t CSInhabit;
|
||||
/* ChanServ's LIST command is oper only */
|
||||
bool CSListOpersOnly;
|
||||
/* Max number of entries allowed to be returned from the LIST command */
|
||||
unsigned CSListMax;
|
||||
/* true to make ChanServ oper only */
|
||||
bool CSOpersOnly;
|
||||
|
||||
/* Max number of memos allowed */
|
||||
unsigned MSMaxMemos;
|
||||
/* Time you must wait between sending memos */
|
||||
time_t MSSendDelay;
|
||||
/* Notify all of the aliases of the core the memo was sent to */
|
||||
bool MSNotifyAll;
|
||||
/* Who can use memos reciepts */
|
||||
unsigned MSMemoReceipt;
|
||||
|
||||
/* Defai;t BotServ flags */
|
||||
Flags<BotServFlag> 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 */
|
||||
unsigned BSMinUsers;
|
||||
/* Max number of words allowed on the badwordslist */
|
||||
unsigned BSBadWordsMax;
|
||||
/* BotServ bot only joins if it would normally allowed to, abides by bans etc */
|
||||
bool BSSmartJoin;
|
||||
/* Dont tell users what badword they used */
|
||||
bool BSGentleBWReason;
|
||||
/* Case sensitive badwords matching */
|
||||
bool BSCaseSensitive;
|
||||
/* Char to use for the fantasy char, eg ! */
|
||||
char *BSFantasyCharacter;
|
||||
|
||||
/* Only show /stats o to opers */
|
||||
bool HideStatsO;
|
||||
/* Send out a global when services shut down or restart */
|
||||
bool GlobalOnCycle;
|
||||
/* Don't include the opers name in globals */
|
||||
bool AnonymousGlobal;
|
||||
/* Dont allow users to register nicks with oper names in them */
|
||||
bool RestrictOperNicks;
|
||||
/* Message to send when shutting down */
|
||||
char *GlobalOnCycleMessage;
|
||||
/* Message to send when starting up */
|
||||
char *GlobalOnCycleUP;
|
||||
/* Super admin is allowed */
|
||||
bool SuperAdmin;
|
||||
/* Log things said through ACT/SAY */
|
||||
bool LogBot;
|
||||
/* Log when new user max is reached */
|
||||
bool LogMaxUsers;
|
||||
/* Default expiry time for akills */
|
||||
time_t AutokillExpiry;
|
||||
/* Default expiry time for chan kills */
|
||||
time_t ChankillExpiry;
|
||||
/* Default expiry time for SGLine Expire */
|
||||
time_t SGLineExpiry;
|
||||
/* 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 SGline */
|
||||
bool KillonSGline;
|
||||
/* 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 someone uses the GLOBAL command */
|
||||
bool WallOSGlobal;
|
||||
/* Send a WALLOPS/GLOBOPS when someone uses the MODE command */
|
||||
bool WallOSMode;
|
||||
/* Send a WALLOPS/GLOBOPS when someone uses the CLEARMODES command */
|
||||
bool WallOSClearmodes;
|
||||
/* Send a WALLOPS/GLOBOPS when someone uses the KICK command */
|
||||
bool WallOSKick;
|
||||
/* Send a WALLOPS/GLOBOPS when someone uses the AKILL command */
|
||||
bool WallOSAkill;
|
||||
/* Send a WALLOPS/GLOBOPS when someone uses the SGLINE command */
|
||||
bool WallOSSGLine;
|
||||
/* Send a WALLOPS/GLOBOPS when someone uses the SQLINE command */
|
||||
bool WallOSSQLine;
|
||||
/* Send a WALLOPS/GLOBOPS when someone uses the SZLINE command */
|
||||
bool WallOSSZLine;
|
||||
/* Send a WALLOPS/GLOBOPS when someone uses the NOOP command */
|
||||
bool WallOSNoOp;
|
||||
/* Send a WALLOPS/GLOBOPS when when someone uses the JUPE command */
|
||||
bool WallOSJupe;
|
||||
/* Send a WALLOPS/GLOBOPS when an akill expires */
|
||||
bool WallAkillExpire;
|
||||
/* Send a WALLOPS/GLOBOPS when SGLines expire */
|
||||
bool WallSGLineExpire;
|
||||
/* 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;
|
||||
/* Send a WALLOPS/GLOBOPS when DROP is used */
|
||||
bool WallDrop;
|
||||
/* Send a WALLOPS/GLOBOPS when FORBID is used */
|
||||
bool WallForbid;
|
||||
/* Send a WALLOPS/GLOBOPS when GETPASS is used */
|
||||
bool WallGetpass;
|
||||
/* Send a WALLOPS/GLOBOPS when SETPASS is used */
|
||||
bool WallSetpass;
|
||||
/* Add the akillers nick to the akill reason */
|
||||
bool AddAkiller;
|
||||
|
||||
/* Limit sessions */
|
||||
bool LimitSessions;
|
||||
/* The default session limit */
|
||||
unsigned DefSessionLimit;
|
||||
/* How long before exceptions expire */
|
||||
time_t ExceptionExpiry;
|
||||
/* How many times to kill before adding an KILL */
|
||||
int MaxSessionKill;
|
||||
/* Max limit that can be used for exceptions */
|
||||
unsigned MaxSessionLimit;
|
||||
/* How long session akills should last */
|
||||
time_t SessionAutoKillExpiry;
|
||||
/* Reason to use for session kills */
|
||||
char *SessionLimitExceeded;
|
||||
/* Optional second reason */
|
||||
char *SessionLimitDetailsLoc;
|
||||
/* OperServ requires you to be an operator */
|
||||
bool OSOpersOnly;
|
||||
|
||||
/* List of modules to autoload */
|
||||
std::list<std::string> ModulesAutoLoad;
|
||||
/* Encryption modules */
|
||||
std::list<std::string> EncModuleList;
|
||||
/* Database modules */
|
||||
std::list<std::string> DBModuleList;
|
||||
/* HostServ Core Modules */
|
||||
std::list<std::string> HostServCoreModules;
|
||||
/* MemoServ Core Modules */
|
||||
std::list<std::string> MemoServCoreModules;
|
||||
/* BotServ Core Modules */
|
||||
std::list<std::string> BotServCoreModules;
|
||||
/* OperServ Core Modules */
|
||||
std::list<std::string> OperServCoreModules;
|
||||
/* NickServ Core Modules */
|
||||
std::list<std::string> NickServCoreModules;
|
||||
/* ChanServ Core Modules */
|
||||
std::list<std::string> ChanServCoreModules;
|
||||
|
||||
/* Default defcon level */
|
||||
int DefConLevel;
|
||||
/* Timeout before defcon is reset */
|
||||
time_t DefConTimeOut;
|
||||
/* Session limiit to use when using defcon */
|
||||
int DefConSessionLimit;
|
||||
/* How long to add akills for defcon */
|
||||
time_t DefConAKILL;
|
||||
/* Chan modes for defcon */
|
||||
char *DefConChanModes;
|
||||
/* Should we global on defcon */
|
||||
bool GlobalOnDefcon;
|
||||
/* Should we send DefconMessage aswell? */
|
||||
bool GlobalOnDefconMore;
|
||||
/* Message to send when defcon is off */
|
||||
char *DefConOffMessage;
|
||||
/* Message to send when defcon is on*/
|
||||
char *DefconMessage;
|
||||
/* Reason to akill clients for defcon */
|
||||
char *DefConAkillReason;
|
||||
|
||||
/* User keys to use for generating random hashes for pass codes etc */
|
||||
long unsigned int UserKey1;
|
||||
long unsigned int UserKey2;
|
||||
long unsigned int UserKey3;
|
||||
|
||||
/* Numeric */
|
||||
char *Numeric;
|
||||
/* Array of ulined servers */
|
||||
char **Ulines;
|
||||
/* Number of ulines */
|
||||
int NumUlines;
|
||||
|
||||
/* List of available opertypes */
|
||||
std::list<OperType *> MyOperTypes;
|
||||
/* List of pairs of opers and their opertype from the config */
|
||||
std::list<std::pair<std::string, std::string> > Opers;
|
||||
};
|
||||
|
||||
/** 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 ConfigException : public CoreException
|
||||
{
|
||||
public:
|
||||
/** Default constructor, just uses the error mesage 'Config threw an exception'.
|
||||
*/
|
||||
ConfigException() : CoreException("Config threw an exception", "Config Parser") {}
|
||||
/** This constructor can be used to specify an error message before throwing.
|
||||
*/
|
||||
ConfigException(const std::string &message) : CoreException(message, "Config Parser") {}
|
||||
/** 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 ~ConfigException() throw() { }
|
||||
};
|
||||
|
||||
#define CONF_NO_ERROR 0x000000
|
||||
#define CONF_NOT_A_NUMBER 0x000010
|
||||
#define CONF_INT_NEGATIVE 0x000080
|
||||
#define CONF_VALUE_NOT_FOUND 0x000100
|
||||
#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
|
||||
* 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.
|
||||
*/
|
||||
class CoreExport ConfigReader
|
||||
{
|
||||
protected:
|
||||
/** The contents of the configuration file
|
||||
* This protected member should never be accessed by a module (and cannot be accessed unless the
|
||||
* core is changed). It will contain a pointer to the configuration file data with unneeded data
|
||||
* (such as comments) stripped from it.
|
||||
*/
|
||||
ConfigDataHash *data;
|
||||
/** Used to store errors
|
||||
*/
|
||||
std::ostringstream *errorlog;
|
||||
/** If we're using our own config data hash or not
|
||||
*/
|
||||
bool privatehash;
|
||||
/** True if an error occured reading the config file
|
||||
*/
|
||||
bool readerror;
|
||||
/** Error code
|
||||
*/
|
||||
long error;
|
||||
public:
|
||||
/** Default constructor.
|
||||
* This constructor initialises the ConfigReader class to read services.conf.
|
||||
*/
|
||||
ConfigReader();
|
||||
/** Overloaded constructor.
|
||||
* This constructor initialises the ConfigReader class to read a user-specified config file
|
||||
*/
|
||||
ConfigReader(const std::string &);
|
||||
/** Default destructor.
|
||||
* This method destroys the ConfigReader class.
|
||||
*/
|
||||
~ConfigReader();
|
||||
/** Retrieves a value from the config file.
|
||||
* This method retrieves a value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve.
|
||||
*/
|
||||
std::string ReadValue(const std::string &, const std::string &, int, bool = false);
|
||||
/** Retrieves a value from the config file.
|
||||
* This method retrieves a value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. If the
|
||||
* tag is not found the default value is returned instead.
|
||||
*/
|
||||
std::string ReadValue(const std::string &, const std::string &, const std::string &, int, bool = false);
|
||||
/** Retrieves a boolean value from the config file.
|
||||
* This method retrieves a boolean value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. The values "1", "yes"
|
||||
* and "true" in the config file count as true to ReadFlag, and any other value counts as false.
|
||||
*/
|
||||
bool ReadFlag(const std::string &, const std::string &, int);
|
||||
/** Retrieves a boolean value from the config file.
|
||||
* This method retrieves a boolean value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. The values "1", "yes"
|
||||
* and "true" in the config file count as true to ReadFlag, and any other value counts as false.
|
||||
* If the tag is not found, the default value is used instead.
|
||||
*/
|
||||
bool ReadFlag(const std::string &, const std::string &, const std::string &, int);
|
||||
/** Retrieves an integer value from the config file.
|
||||
* This method retrieves an integer value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. Any invalid integer
|
||||
* values in the tag will cause the objects error value to be set, and any call to GetError() will
|
||||
* return CONF_INVALID_NUMBER to be returned. need_positive is set if the number must be non-negative.
|
||||
* If a negative number is placed into a tag which is specified positive, 0 will be returned and GetError()
|
||||
* will return CONF_INT_NEGATIVE. Note that need_positive is not suitable to get an unsigned int - you
|
||||
* should cast the result to achieve that effect.
|
||||
*/
|
||||
int ReadInteger(const std::string &, const std::string &, int, bool);
|
||||
/** Retrieves an integer value from the config file.
|
||||
* This method retrieves an integer value from the config file. Where multiple copies of the tag
|
||||
* exist in the config file, index indicates which of the values to retrieve. Any invalid integer
|
||||
* values in the tag will cause the objects error value to be set, and any call to GetError() will
|
||||
* return CONF_INVALID_NUMBER to be returned. needs_unsigned is set if the number must be unsigned.
|
||||
* If a signed number is placed into a tag which is specified unsigned, 0 will be returned and GetError()
|
||||
* will return CONF_NOT_UNSIGNED. If the tag is not found, the default value is used instead.
|
||||
*/
|
||||
int ReadInteger(const std::string &, const std::string &, const std::string &, int, bool);
|
||||
/** Returns the last error to occur.
|
||||
* Valid errors can be found by looking in modules.h. Any nonzero value indicates an error condition.
|
||||
* A call to GetError() resets the error flag back to 0.
|
||||
*/
|
||||
long GetError();
|
||||
/** Counts the number of times a given tag appears in the config file.
|
||||
* This method counts the number of times a tag appears in a config file, for use where
|
||||
* there are several tags of the same kind, e.g. with opers and connect types. It can be
|
||||
* used with the index value of ConfigReader::ReadValue to loop through all copies of a
|
||||
* multiple instance tag.
|
||||
*/
|
||||
int Enumerate(const std::string &);
|
||||
/** Returns true if a config file is valid.
|
||||
* This method is partially implemented and will only return false if the config
|
||||
* file does not exist or could not be opened.
|
||||
*/
|
||||
bool Verify();
|
||||
/** Dumps the list of errors in a config file to an output location. If bail is true,
|
||||
* then the program will abort. If bail is false and user points to a valid user
|
||||
* record, the error report will be spooled to the given user by means of NOTICE.
|
||||
* if bool is false AND user is false, the error report will be spooled to all opers
|
||||
* by means of a NOTICE to all opers.
|
||||
*/
|
||||
void DumpErrors(bool);
|
||||
/** Returns the number of items within a tag.
|
||||
* For example if the tag was <test tag="blah" data="foo"> then this
|
||||
* function would return 2. Spaces and newlines both qualify as valid seperators
|
||||
* between values.
|
||||
*/
|
||||
int EnumerateValues(const std::string &, int);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
/* Set default values for any constants that should be in include files but
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef NAME_MAX
|
||||
# define NAME_MAX 255
|
||||
#endif
|
||||
|
||||
#ifndef BUFSIZ
|
||||
# define BUFSIZ 256
|
||||
#else
|
||||
# if BUFSIZ < 256
|
||||
# define BUFSIZ 256
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Length of an array: */
|
||||
#define lenof(a) (sizeof(a) / sizeof(*(a)))
|
||||
|
||||
/* 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
|
||||
|
||||
/*************************************************************************/
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
#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;
|
||||
};
|
||||
|
||||
/** The socket used to talk to the nameserver, uses UDP
|
||||
*/
|
||||
class DNSSocket : public ConnectionSocket
|
||||
{
|
||||
private:
|
||||
int SendTo(const unsigned char *buf, size_t len) const;
|
||||
int RecvFrom(char *buf, size_t size, sockaddrs &addrs) const;
|
||||
|
||||
public:
|
||||
DNSSocket();
|
||||
virtual ~DNSSocket();
|
||||
|
||||
bool ProcessRead();
|
||||
|
||||
bool ProcessWrite();
|
||||
};
|
||||
|
||||
/** DNS manager, manages the connection and all requests
|
||||
*/
|
||||
class CoreExport DNSManager : public Timer
|
||||
{
|
||||
std::multimap<Anope::string, DNSRecord *> cache;
|
||||
public:
|
||||
DNSSocket *sock;
|
||||
|
||||
std::deque<DNSPacket *> packets;
|
||||
std::map<short, DNSRequest *> requests;
|
||||
|
||||
static const int DNSPort = 53;
|
||||
|
||||
DNSManager();
|
||||
|
||||
~DNSManager();
|
||||
|
||||
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
|
||||
|
||||
+38
-47
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2008-2010 Anope Team <team@anope.org>
|
||||
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EXTENSIBLE_H
|
||||
#define EXTENSIBLE_H
|
||||
|
||||
#include "hashcomp.h"
|
||||
|
||||
/** Dummy base class we use to cast everything to/from
|
||||
*/
|
||||
class ExtensibleItemBase
|
||||
@@ -28,7 +28,7 @@ template<typename T> class ExtensibleItemRegular : public ExtensibleItemBase
|
||||
public:
|
||||
ExtensibleItemRegular(T item) : Item(item) { }
|
||||
virtual ~ExtensibleItemRegular() { }
|
||||
T GetItem() const { return Item; }
|
||||
T &GetItem() { return Item; }
|
||||
};
|
||||
|
||||
/** Class used to represent an extensible item that holds a pointer
|
||||
@@ -41,7 +41,7 @@ template<typename T> class ExtensibleItemPointer : public ExtensibleItemBase
|
||||
public:
|
||||
ExtensibleItemPointer(T *item) : Item(item) { }
|
||||
virtual ~ExtensibleItemPointer() { delete Item; }
|
||||
T *GetItem() const { return Item; }
|
||||
T *GetItem() { return Item; }
|
||||
};
|
||||
|
||||
/** Class used to represent an extensible item that holds a pointer to an arrray
|
||||
@@ -54,28 +54,27 @@ template<typename T> class ExtensibleItemPointerArray : public ExtensibleItemBas
|
||||
public:
|
||||
ExtensibleItemPointerArray(T *item) : Item(item) { }
|
||||
virtual ~ExtensibleItemPointerArray() { delete [] Item; }
|
||||
T *GetItem() const { return Item; }
|
||||
T *GetItem() { return Item; }
|
||||
};
|
||||
|
||||
class CoreExport Extensible
|
||||
class CoreExport Extensible : public Base
|
||||
{
|
||||
private:
|
||||
std::map<std::string, ExtensibleItemBase *> Extension_Items;
|
||||
typedef std::map<Anope::string, ExtensibleItemBase *> extensible_map;
|
||||
extensible_map Extension_Items;
|
||||
|
||||
public:
|
||||
/** Default constructor, does nothing
|
||||
/** Default constructor, does nothing
|
||||
*/
|
||||
Extensible() { }
|
||||
Extensible() { }
|
||||
|
||||
/** Default destructor, deletes all of the extensible items in this object
|
||||
* then clears the map
|
||||
*/
|
||||
virtual ~Extensible()
|
||||
{
|
||||
for (std::map<std::string, ExtensibleItemBase *>::iterator it = Extension_Items.begin(); it != Extension_Items.end(); ++it)
|
||||
{
|
||||
for (extensible_map::iterator it = Extension_Items.begin(), it_end = Extension_Items.end(); it != it_end; ++it)
|
||||
delete it->second;
|
||||
}
|
||||
Extension_Items.clear();
|
||||
}
|
||||
|
||||
@@ -90,12 +89,10 @@ class CoreExport Extensible
|
||||
*
|
||||
* @return Returns true on success, false if otherwise
|
||||
*/
|
||||
bool Extend(const std::string &key, ExtensibleItemBase *p)
|
||||
void Extend(const Anope::string &key, ExtensibleItemBase *p)
|
||||
{
|
||||
bool Ret = this->Extension_Items.insert(std::make_pair(key, p)).second;
|
||||
if (!Ret)
|
||||
delete p;
|
||||
return Ret;
|
||||
this->Shrink(key);
|
||||
this->Extension_Items.insert(std::make_pair(key, p));
|
||||
}
|
||||
|
||||
/** Extend an Extensible class.
|
||||
@@ -109,13 +106,9 @@ class CoreExport Extensible
|
||||
*
|
||||
* @return Returns true on success, false if otherwise
|
||||
*/
|
||||
bool Extend(const std::string &key)
|
||||
void Extend(const Anope::string &key)
|
||||
{
|
||||
/* This will only add an item if it doesnt already exist,
|
||||
* the return value is a std::pair of an iterator to the
|
||||
* element, and a bool saying if it was actually inserted.
|
||||
*/
|
||||
return this->Extend(key, new ExtensibleItemRegular<char *>(NULL));
|
||||
this->Extend(key, new ExtensibleItemPointer<char *>(NULL));
|
||||
}
|
||||
|
||||
/** Shrink an Extensible class.
|
||||
@@ -126,9 +119,9 @@ class CoreExport Extensible
|
||||
* you provide a nonexistent key (case is important) then the function will return false.
|
||||
* @return Returns true on success.
|
||||
*/
|
||||
bool Shrink(const std::string &key)
|
||||
bool Shrink(const Anope::string &key)
|
||||
{
|
||||
std::map<std::string, ExtensibleItemBase *>::iterator it = this->Extension_Items.find(key);
|
||||
extensible_map::iterator it = this->Extension_Items.find(key);
|
||||
if (it != this->Extension_Items.end())
|
||||
{
|
||||
delete it->second;
|
||||
@@ -148,13 +141,13 @@ class CoreExport Extensible
|
||||
* @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 std::string &key, T &p)
|
||||
template<typename T> bool GetExtRegular(const Anope::string &key, T &p)
|
||||
{
|
||||
std::map<std::string, ExtensibleItemBase *>::iterator it = this->Extension_Items.find(key);
|
||||
extensible_map::iterator it = this->Extension_Items.find(key);
|
||||
|
||||
if (it != this->Extension_Items.end())
|
||||
{
|
||||
p = dynamic_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
|
||||
p = debug_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -162,18 +155,18 @@ class CoreExport Extensible
|
||||
}
|
||||
|
||||
/** 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 std::string &key, T *&p)
|
||||
template<typename T> bool GetExtPointer(const Anope::string &key, T *&p)
|
||||
{
|
||||
std::map<std::string, ExtensibleItemBase *>::iterator it = this->Extension_Items.find(key);
|
||||
extensible_map::iterator it = this->Extension_Items.find(key);
|
||||
|
||||
if (it != this->Extension_Items.end())
|
||||
{
|
||||
p = dynamic_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
|
||||
p = debug_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -187,13 +180,13 @@ class CoreExport Extensible
|
||||
* @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 std::string &key, T *&p)
|
||||
template<typename T> bool GetExtArray(const Anope::string &key, T *&p)
|
||||
{
|
||||
std::map<std::string, ExtensibleItemBase *>::iterator it = this->Extension_Items.find(key);
|
||||
extensible_map::iterator it = this->Extension_Items.find(key);
|
||||
|
||||
if (it != this->Extension_Items.end())
|
||||
{
|
||||
p = dynamic_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
|
||||
p = debug_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -210,9 +203,9 @@ class CoreExport Extensible
|
||||
* the 'data' field and is probably only useful in conjunction with the single-parameter
|
||||
* version of Extend().
|
||||
*/
|
||||
bool GetExt(const std::string &key)
|
||||
bool GetExt(const Anope::string &key)
|
||||
{
|
||||
return (this->Extension_Items.find(key) != this->Extension_Items.end());
|
||||
return this->Extension_Items.find(key) != this->Extension_Items.end();
|
||||
}
|
||||
|
||||
/** Get a list of all extension items names.
|
||||
@@ -220,13 +213,11 @@ class CoreExport Extensible
|
||||
* @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<std::string> &list)
|
||||
void GetExtList(std::deque<Anope::string> &list)
|
||||
{
|
||||
for (std::map<std::string, ExtensibleItemBase *>::iterator i = Extension_Items.begin(); i != Extension_Items.end(); ++i)
|
||||
{
|
||||
list.push_back(i->first);
|
||||
}
|
||||
for (extensible_map::iterator it = Extension_Items.begin(), it_end = Extension_Items.end(); it != it_end; ++it)
|
||||
list.push_back(it->first);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // EXTENSIBLE_H
|
||||
|
||||
+172
-413
@@ -1,15 +1,12 @@
|
||||
/* Prototypes and external variable declarations.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* (C) 2003-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EXTERN_H
|
||||
@@ -18,159 +15,109 @@
|
||||
#define E extern CoreExport
|
||||
#define EI extern DllExport
|
||||
|
||||
#include "slist.h"
|
||||
#include "hashcomp.h"
|
||||
|
||||
E void ModuleRunTimeDirCleanUp();
|
||||
|
||||
|
||||
E char *uplink;
|
||||
|
||||
/* IRC Variables */
|
||||
|
||||
E IRCDVar *ircd;
|
||||
E int UseTSMODE; /* hack to get around bahamut clones that don't send TSMODE */
|
||||
E IRCDProto *ircdproto;
|
||||
E IRCdMessage *ircdmessage;
|
||||
|
||||
/**** actions.c ****/
|
||||
|
||||
E void kill_user(const std::string &source, const std::string &user, const std::string &reason);
|
||||
E void kill_user(const Anope::string &source, User *user, const Anope::string &reason);
|
||||
E bool bad_password(User *u);
|
||||
E void sqline(const std::string &mask, const std::string &reason);
|
||||
E void common_unban(ChannelInfo *ci, const std::string &nick);
|
||||
E void common_unban(ChannelInfo *ci, User *u, bool full = false);
|
||||
|
||||
E BotInfo *BotServ;
|
||||
E BotInfo *ChanServ;
|
||||
E BotInfo *Global;
|
||||
E BotInfo *HostServ;
|
||||
E BotInfo *MemoServ;
|
||||
E BotInfo *NickServ;
|
||||
E BotInfo *OperServ;
|
||||
|
||||
/**** botserv.c ****/
|
||||
|
||||
E BotInfo *botlists[256];
|
||||
E int nbots;
|
||||
E void get_botserv_stats(long *nrec, long *memuse);
|
||||
E void bs_init();
|
||||
E void botserv(User *u, char *buf);
|
||||
E void botmsgs(User *u, BotInfo *bi, char *buf);
|
||||
E void botchanmsgs(User *u, ChannelInfo *ci, char *buf);
|
||||
E BotInfo *findbot(const std::string &nick);
|
||||
E void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf);
|
||||
E BotInfo *findbot(const Anope::string &nick);
|
||||
|
||||
/** Finds a pseudoclient, given a UID. Useful for TS6 protocol modules.
|
||||
* @param uid The UID to search for
|
||||
* @return The pseudoclient structure, or NULL if one could not be found
|
||||
*/
|
||||
E void bot_join(ChannelInfo *ci);
|
||||
E char *normalizeBuffer(const char *);
|
||||
E void insert_bot(BotInfo * bi);
|
||||
E Anope::string normalizeBuffer(const Anope::string &);
|
||||
|
||||
E void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick, const char *reason);
|
||||
E void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick, const char *reason);
|
||||
E void bot_raw_mode(User * requester, ChannelInfo * ci, const char *mode, char *nick);
|
||||
E void check_ban(ChannelInfo *ci, User *u, int ttbtype);
|
||||
E void bot_kick(ChannelInfo *ci, User *u, const char *message, ...);
|
||||
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 *chanlist[1024];
|
||||
|
||||
E void get_channel_stats(long *nrec, long *memuse);
|
||||
E Channel *findchan(const char *chan);
|
||||
E Channel *firstchan();
|
||||
E Channel *nextchan();
|
||||
|
||||
E void ChanSetInternalModes(Channel *c, int ac, const char **av);
|
||||
E Channel *findchan(const Anope::string &chan);
|
||||
|
||||
E User *nc_on_chan(Channel * c, NickCore * nc);
|
||||
E User *nc_on_chan(Channel *c, const NickCore *nc);
|
||||
|
||||
E char *chan_get_modes(Channel * chan, int complete, int plus);
|
||||
E Anope::string get_xop_level(int level);
|
||||
|
||||
E int get_access_level(ChannelInfo * ci, NickAlias * na);
|
||||
E const char *get_xop_level(int level);
|
||||
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 MassChannelModes(BotInfo *bi, const Anope::string &modes);
|
||||
|
||||
E void do_cmode(const char *source, int ac, const char **av);
|
||||
E void do_join(const char *source, int ac, const char **av);
|
||||
E void do_kick(const std::string &source, int ac, const char **av);
|
||||
E void do_part(const char *source, int ac, const char **av);
|
||||
E void do_topic(const char *source, int ac, const char **av);
|
||||
E void MassChannelModes(BotInfo *bi, const std::string &modes);
|
||||
E void chan_set_correct_modes(User *user, Channel *c, int give_modes);
|
||||
|
||||
E void chan_set_correct_modes(User * user, Channel * c, int give_modes);
|
||||
E void restore_unsynced_topics();
|
||||
|
||||
E Entry *entry_create(char *mask);
|
||||
E Entry *entry_add(EList *list, const char *mask);
|
||||
E void entry_delete(EList *list, Entry *e);
|
||||
E EList *list_create();
|
||||
E int entry_match(Entry *e, const ci::string &nick, const ci::string &user, const ci::string &host, uint32 ip);
|
||||
E int entry_match_mask(Entry *e, const char *mask, uint32 ip);
|
||||
E Entry *elist_match(EList *list, const char *nick, const char *user, const char *host, uint32 ip);
|
||||
E Entry *elist_match_mask(EList *list, const char *mask, uint32 ip);
|
||||
E Entry *elist_match_user(EList *list, User *u);
|
||||
E Entry *elist_find_mask(EList *list, const char *mask);
|
||||
E long get_memuse(EList *list);
|
||||
|
||||
|
||||
#define whosends(ci) ((!(ci) || !((ci)->botflags.HasFlag(BS_SYMBIOSIS)) || !(ci)->bi || !(ci)->c || (ci)->c->users.size() < Config.BSMinUsers) ? findbot(Config.s_ChanServ) : (ci)->bi)
|
||||
inline BotInfo *whosends(ChannelInfo *ci)
|
||||
{
|
||||
if (!ci || !ci->bi || !ci->c || !ci->botflags.HasFlag(BS_SYMBIOSIS) || !ci->c->FindUser(ci->bi))
|
||||
return ChanServ ? ChanServ : NickServ;
|
||||
return ci->bi;
|
||||
}
|
||||
|
||||
/**** chanserv.c ****/
|
||||
|
||||
E ChannelInfo *chanlists[256];
|
||||
E LevelInfo levelinfo[];
|
||||
|
||||
E void get_chanserv_stats(long *nrec, long *memuse);
|
||||
|
||||
E void alpha_insert_chan(ChannelInfo * ci);
|
||||
E void reset_levels(ChannelInfo * ci);
|
||||
E void reset_levels(ChannelInfo *ci);
|
||||
E void cs_init();
|
||||
E void chanserv(User * u, char *buf);
|
||||
E void expire_chans();
|
||||
E void cs_remove_nick(const NickCore * nc);
|
||||
E void cs_remove_nick(NickCore *nc);
|
||||
|
||||
E void check_modes(Channel * c);
|
||||
E int check_valid_admin(User * user, Channel * chan, int servermode);
|
||||
E int check_valid_op(User * user, Channel * chan, int servermode);
|
||||
E int check_should_op(User * user, char *chan);
|
||||
E int check_should_voice(User * user, char *chan);
|
||||
E int check_should_halfop(User * user, char *chan);
|
||||
E int check_should_owner(User * user, char *chan);
|
||||
E int check_should_protect(User * user, char *chan);
|
||||
E void record_topic(const char *chan);
|
||||
E void restore_topic(const char *chan);
|
||||
E int check_topiclock(Channel * c, time_t topic_time);
|
||||
E void check_modes(Channel *c);
|
||||
E int check_valid_admin(User *user, Channel *chan, int servermode);
|
||||
E int check_valid_op(User *user, Channel *chan, int servermode);
|
||||
|
||||
E ChannelInfo *cs_findchan(const std::string &chan);
|
||||
E int check_access(User * user, ChannelInfo * ci, int what);
|
||||
E ChannelInfo *cs_findchan(const Anope::string &chan);
|
||||
E int check_access(User *user, ChannelInfo *ci, int what);
|
||||
E bool IsFounder(User *user, ChannelInfo *ci);
|
||||
E bool IsRealFounder(User *user, ChannelInfo *ci);
|
||||
E int get_access(User *user, ChannelInfo *ci);
|
||||
E void update_cs_lastseen(User * user, ChannelInfo * ci);
|
||||
E int get_idealban(ChannelInfo * ci, User * u, char *ret, int retlen);
|
||||
E AutoKick *is_stuck(ChannelInfo * ci, const char *mask);
|
||||
E void stick_mask(ChannelInfo * ci, AutoKick * akick);
|
||||
E void stick_all(ChannelInfo * ci);
|
||||
E void update_cs_lastseen(User *user, ChannelInfo *ci);
|
||||
E int get_idealban(ChannelInfo *ci, User *u, Anope::string &ret);
|
||||
|
||||
E int levelinfo_maxwidth;
|
||||
E char *get_mlock_modes(ChannelInfo * ci, int complete);
|
||||
|
||||
/**** compat.c ****/
|
||||
|
||||
#if !HAVE_STRICMP && !HAVE_STRCASECMP
|
||||
E int stricmp(const char *s1, const char *s2);
|
||||
E int strnicmp(const char *s1, const char *s2, size_t len);
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
char *sockstrerror(int error);
|
||||
#endif
|
||||
E Anope::string get_mlock_modes(ChannelInfo *ci, int complete);
|
||||
|
||||
/**** config.c ****/
|
||||
|
||||
E std::string services_conf;
|
||||
E ServerConfig Config;
|
||||
E int read_config(int reload);
|
||||
E ConfigurationFile services_conf;
|
||||
E ServerConfig *Config;
|
||||
|
||||
/* hostserv.c */
|
||||
E void do_on_id(User *u);
|
||||
E void hostserv(User *u, char *buf);
|
||||
E void HostServSyncVhosts(NickAlias *na);
|
||||
|
||||
/**** encrypt.c ****/
|
||||
E int enc_encrypt(const std::string &src, std::string &dest);
|
||||
E int enc_encrypt_in_place(std::string &buf);
|
||||
E int enc_decrypt(const std::string &src, std::string &dest);
|
||||
E int enc_check_password(std::string &plaintext, std::string &password);
|
||||
E int enc_encrypt(const Anope::string &src, Anope::string &dest);
|
||||
E int enc_decrypt(const Anope::string &src, Anope::string &dest);
|
||||
|
||||
/**** hostserv.c ****/
|
||||
E void get_hostserv_stats(long *nrec, long *memuse);
|
||||
@@ -178,154 +125,127 @@ E void hostserv_init();
|
||||
|
||||
/**** init.c ****/
|
||||
|
||||
E void introduce_user(const std::string &user);
|
||||
E bool GetCommandLineArgument(const std::string &name, char shortname = 0);
|
||||
E bool GetCommandLineArgument(const std::string &name, char shortname, std::string ¶m);
|
||||
E int init_primary(int ac, char **av);
|
||||
E int init_secondary(int ac, char **av);
|
||||
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 ¶m);
|
||||
E void Init(int ac, char **av);
|
||||
E Uplink *uplink_server;
|
||||
|
||||
/**** ircd.c ****/
|
||||
E void pmodule_ircd_proto(IRCDProto *);
|
||||
E void pmodule_ircd_var(IRCDVar * ircdvar);
|
||||
E void pmodule_ircd_version(const char *version);
|
||||
E void pmodule_ircd_useTSMode(int use);
|
||||
E void pmodule_ircd_var(IRCDVar *ircdvar);
|
||||
E void pmodule_ircd_message(IRCdMessage *message);
|
||||
|
||||
/**** language.c ****/
|
||||
/**** language.cpp ****/
|
||||
E std::vector<Anope::string> languages;
|
||||
E void InitLanguages();
|
||||
E const Anope::string GetString(NickCore *nc, const char *string);
|
||||
E const Anope::string GetString(const Anope::string &domain, const Anope::string &lang, const char *string);
|
||||
E void PushLanguage(const Anope::string &, Anope::string);
|
||||
E void PopLanguage();
|
||||
E const char *anope_gettext(const char *string);
|
||||
E void SyntaxError(CommandSource &source, const Anope::string &command, const Anope::string &message);
|
||||
|
||||
E char **langtexts[NUM_LANGS];
|
||||
E char *langnames[NUM_LANGS];
|
||||
E int langlist[NUM_LANGS];
|
||||
|
||||
E void lang_init();
|
||||
E int strftime_lang(char *buf, int size, User * u, int format, struct tm *tm);
|
||||
E void syntax_error(char *service, User * u, const char *command, int msgnum);
|
||||
E const char *getstring(NickAlias *na, int index);
|
||||
E const char *getstring(NickCore *nc, int index);
|
||||
E const char *getstring(User *nc, int index);
|
||||
E const char *getstring(int index);
|
||||
|
||||
|
||||
/**** log.c ****/
|
||||
|
||||
E int open_log();
|
||||
E void close_log();
|
||||
E void log_perror(const char *fmt, ...) FORMAT(printf,1,2);
|
||||
E void fatal(const char *fmt, ...) FORMAT(printf,1,2);
|
||||
E void fatal_perror(const char *fmt, ...) FORMAT(printf,1,2);
|
||||
|
||||
/**** mail.c ****/
|
||||
|
||||
E MailInfo *MailBegin(User *u, NickCore *nc, char *subject, char *service);
|
||||
E MailInfo *MailRegBegin(User *u, NickRequest *nr, char *subject, char *service);
|
||||
E MailInfo *MailMemoBegin(NickCore * nc);
|
||||
E void MailEnd(MailInfo *mail);
|
||||
E void MailReset(User *u, NickCore *nc);
|
||||
E int MailValidate(const char *email);
|
||||
/*** logger.cpp ***/
|
||||
E void InitLogChannels(ServerConfig *);
|
||||
|
||||
/**** main.c ****/
|
||||
|
||||
E const char version_number[];
|
||||
E const char version_number_dotted[];
|
||||
E const char version_build[];
|
||||
E char *version_protocol;
|
||||
E const char version_flags[];
|
||||
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 std::string services_dir;
|
||||
E std::string log_filename;
|
||||
E int debug;
|
||||
E int readonly;
|
||||
E bool LogChan;
|
||||
E int nofork;
|
||||
E int forceload;
|
||||
E int nothird;
|
||||
E int noexpire;
|
||||
E int protocoldebug;
|
||||
|
||||
E int is44;
|
||||
E int quitting;
|
||||
E int shutting_down;
|
||||
E const char *quitmsg;
|
||||
E int save_data;
|
||||
E int got_alarm;
|
||||
E bool quitting;
|
||||
E bool shutting_down;
|
||||
E Anope::string quitmsg;
|
||||
E bool save_data;
|
||||
E time_t start_time;
|
||||
|
||||
E Socket *UplinkSock;
|
||||
E ConnectionSocket *UplinkSock;
|
||||
|
||||
E void save_databases();
|
||||
E void expire_all();
|
||||
E void sighandler(int signum);
|
||||
E void do_restart_services();
|
||||
|
||||
/**** memory.c ****/
|
||||
/* The socket to our uplink */
|
||||
class CoreExport UplinkSocket : public ConnectionSocket
|
||||
{
|
||||
public:
|
||||
UplinkSocket(bool ipv6 = false);
|
||||
|
||||
E void *smalloc(long size);
|
||||
E void *scalloc(long elsize, long els);
|
||||
E void *srealloc(void *oldptr, long newsize);
|
||||
E char *sstrdup(const char *s);
|
||||
virtual ~UplinkSocket();
|
||||
|
||||
bool Read(const Anope::string &buf);
|
||||
};
|
||||
|
||||
/**** memoserv.c ****/
|
||||
|
||||
E void ms_init();
|
||||
E void memoserv(User * u, char *buf);
|
||||
E void check_memos(User * u);
|
||||
E MemoInfo *getmemoinfo(const char *name, int *ischan, int *isforbid);
|
||||
E void memo_send(User * u, const char *name, const char *text, int z);
|
||||
E int delmemo(MemoInfo * mi, int num);
|
||||
E void rsend_notify(CommandSource &source, Memo *m, const Anope::string &chan);
|
||||
E void check_memos(User *u);
|
||||
E MemoInfo *getmemoinfo(const Anope::string &name, bool &ischan, bool &isforbid);
|
||||
E void memo_send(CommandSource &source, const Anope::string &name, const Anope::string &text, int z);
|
||||
|
||||
/**** messages.c ****/
|
||||
/**** messages.cpp ****/
|
||||
|
||||
E int m_nickcoll(const char *user);
|
||||
E int m_away(const char *source, const char *msg);
|
||||
E int m_kill(const std::string &nick, const char *msg);
|
||||
E int m_motd(const char *source);
|
||||
E int m_privmsg(const char *source, const std::string &receiver, const char *msg);
|
||||
E int m_stats(const char *source, int ac, const char **av);
|
||||
E int m_whois(const char *source, const char *who);
|
||||
E int m_time(const char *source, int ac, const char **av);
|
||||
E int m_version(const char *source, int ac, const char **av);
|
||||
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 char *strscpy(char *d, const char *s, size_t len);
|
||||
#ifndef HAVE_STRLCPY
|
||||
E size_t strlcpy(char *, const char *, size_t);
|
||||
#endif
|
||||
#ifndef HAVE_STRLCAT
|
||||
E size_t strlcat(char *, const char *, size_t);
|
||||
#endif
|
||||
E const char *stristr(const char *s1, const char *s2);
|
||||
E char *strnrepl(char *s, int32 size, const char *old, const char *nstr);
|
||||
E const char *merge_args(int argc, char **argv);
|
||||
E const char *merge_args(int argc, const char **argv);
|
||||
|
||||
E time_t dotime(const char *s);
|
||||
E const char *duration(NickCore *nc, char *buf, int bufsize, time_t seconds);
|
||||
E const char *expire_left(NickCore *nc, char *buf, int len, time_t expires);
|
||||
E int doValidHost(const char *host, int type);
|
||||
E time_t dotime(const Anope::string &s);
|
||||
E Anope::string duration(time_t seconds);
|
||||
E Anope::string expire_left(NickCore *nc, time_t expires);
|
||||
E Anope::string do_strftime(const time_t &t);
|
||||
E bool doValidHost(const Anope::string &host, int type);
|
||||
|
||||
typedef int (*range_callback_t) (User * u, int num, va_list args);
|
||||
E int process_numlist(const char *numstr, int *count_ret,
|
||||
range_callback_t callback, User * u, ...);
|
||||
E bool isValidHost(const Anope::string &host, int type);
|
||||
E bool isvalidchar(char c);
|
||||
|
||||
E int isValidHost(const char *host, int type);
|
||||
E int isvalidchar(const char c);
|
||||
|
||||
E char *myStrGetToken(const char *str, const char dilim, int token_number);
|
||||
E char *myStrGetOnlyToken(const char *str, const char dilim,
|
||||
int token_number);
|
||||
E char *myStrSubString(const char *src, int start, int end);
|
||||
E char *myStrGetTokenRemainder(const char *str, const char dilim,
|
||||
int token_number);
|
||||
E char *stripModePrefix(const char *str);
|
||||
E int myNumToken(const char *str, const char dilim);
|
||||
E void doCleanBuffer(char *str);
|
||||
E void EnforceQlinedNick(const std::string &nick, const char *killer);
|
||||
E int nickIsServices(const char *nick, int bot);
|
||||
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 void EnforceQlinedNick(const Anope::string &nick, const Anope::string &killer);
|
||||
E bool nickIsServices(const Anope::string &nick, bool bot);
|
||||
|
||||
E void add_entropy_userkeys();
|
||||
E void rand_init();
|
||||
@@ -335,257 +255,96 @@ E uint32 getrandom32();
|
||||
|
||||
E char *str_signed(unsigned char *str);
|
||||
|
||||
E void ntoa(struct in_addr addr, char *ipaddr, int len);
|
||||
E std::list<Anope::string> BuildStringList(const Anope::string &, char = ' ');
|
||||
E std::vector<Anope::string> BuildStringVector(const Anope::string &, char = ' ');
|
||||
|
||||
E std::list<std::string> BuildStringList(const std::string &);
|
||||
E std::list<ci::string> BuildStringList(const ci::string &);
|
||||
E std::vector<std::string> BuildStringVector(const std::string &);
|
||||
|
||||
E void binary_to_hex(unsigned char *bin, char *hex, int length);
|
||||
|
||||
E uint32 cidr_to_netmask(uint16 cidr);
|
||||
E uint16 netmask_to_cidr(uint32 mask);
|
||||
|
||||
E int str_is_wildcard(const char *str);
|
||||
E int str_is_pure_wildcard(const char *str);
|
||||
|
||||
E uint32 str_is_ip(char *str);
|
||||
E int str_is_cidr(char *str, uint32 * ip, uint32 * mask, char **host);
|
||||
E bool str_is_wildcard(const Anope::string &str);
|
||||
E bool str_is_pure_wildcard(const Anope::string &str);
|
||||
|
||||
/**** modes.cpp ****/
|
||||
/* Number of generic modes we support */
|
||||
E unsigned GenericChannelModes, GenericUserModes;
|
||||
E std::bitset<128> DefMLockOn;
|
||||
E std::bitset<128> DefMLockOff;
|
||||
E std::map<ChannelModeName, std::string> DefMLockParams;
|
||||
/* Modes to set on bots when they join the channel */
|
||||
E std::list<ChannelModeStatus *> BotModes;
|
||||
E void SetDefaultMLock();
|
||||
|
||||
/**** modules.c ****/
|
||||
E void modules_unload_all(bool unload_proto); /* Read warnings near function source */
|
||||
E std::multimap<ChannelModeName, ModeLock> def_mode_locks;
|
||||
E void SetDefaultMLock(ServerConfig *config);
|
||||
|
||||
/**** nickserv.c ****/
|
||||
|
||||
E NickAlias *nalists[1024];
|
||||
E NickCore *nclists[1024];
|
||||
E NickRequest *nrlists[1024];
|
||||
E NickRequest *findrequestnick(const char *nick);
|
||||
E void insert_requestnick(NickRequest * nr);
|
||||
E void alpha_insert_alias(NickAlias * na);
|
||||
E void insert_core(NickCore * nc);
|
||||
E void get_aliases_stats(long *nrec, long *memuse);
|
||||
E void get_core_stats(long *nrec, long *memuse);
|
||||
E void change_core_display(NickCore * nc);
|
||||
E void change_core_display(NickCore * nc, const char *newdisplay);
|
||||
E int do_setmodes(User * u);
|
||||
E void get_aliases_stats(long &count, long &mem);
|
||||
E void get_core_stats(long &count, long &mem);
|
||||
E void change_core_display(NickCore *nc);
|
||||
E void change_core_display(NickCore *nc, const Anope::string &newdisplay);
|
||||
E int do_setmodes(User *u);
|
||||
|
||||
E void ns_init();
|
||||
E void nickserv(User * u, char *buf);
|
||||
E int validate_user(User * u);
|
||||
E int validate_user(User *u);
|
||||
E void expire_nicks();
|
||||
E void expire_requests();
|
||||
E NickAlias *findnick(const char *nick);
|
||||
E NickAlias *findnick(const std::string &nick);
|
||||
E NickCore *findcore(const char *nick);
|
||||
E bool is_on_access(User *u, NickCore *nc);
|
||||
|
||||
/**** operserv.c ****/
|
||||
|
||||
E SList akills, sglines, sqlines, szlines;
|
||||
|
||||
E int DefConModesSet;
|
||||
E Flags<ChannelModeName> DefConModesOn;
|
||||
E Flags<ChannelModeName> DefConModesOff;
|
||||
E std::map<ChannelModeName, std::string> DefConModesOnParams;
|
||||
E bool SetDefConParam(ChannelModeName, std::string &);
|
||||
E bool GetDefConParam(ChannelModeName, std::string *);
|
||||
E void UnsetDefConParam(ChannelModeName);
|
||||
|
||||
E void operserv(User *u, char *buf);
|
||||
E void os_init();
|
||||
|
||||
E int add_akill(User *u, const char *mask, const char *by, const time_t expires, const char *reason);
|
||||
E int check_akill(const char *nick, const char *username, const char *host, const char *vhost, const char *ip);
|
||||
E void expire_akills();
|
||||
E void oper_global(char *nick, const char *fmt, ...);
|
||||
|
||||
E int add_sgline(User *u, const char *mask, const char *by, time_t expires, const char *reason);
|
||||
E int check_sgline(const char *nick, const char *realname);
|
||||
E void expire_sglines();
|
||||
|
||||
E int add_sqline(User *u, const char *mask, const char *by, time_t expires, const char *reason);
|
||||
E int check_sqline(const char *nick, int nick_change);
|
||||
E void expire_sqlines();
|
||||
E int check_chan_sqline(const char *chan);
|
||||
|
||||
E int add_szline(User * u, const char *mask, const char *by,
|
||||
time_t expires, const char *reason);
|
||||
E void expire_szlines();
|
||||
E int check_szline(const char *nick, char *ip);
|
||||
|
||||
E Server *server_global(Server * s, char *msg);
|
||||
|
||||
E std::vector<NewsItem *> News;
|
||||
|
||||
E bool CheckDefCon(DefconLevel Level);
|
||||
E bool CheckDefCon(int level, DefconLevel Level);
|
||||
E void AddDefCon(int level, DefconLevel Level);
|
||||
E void DelDefCon(int level, DefconLevel Level);
|
||||
E std::vector<std::bitset<32> > DefCon;
|
||||
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 int allow_ignore;
|
||||
E IgnoreData *ignore;
|
||||
|
||||
E void add_ignore(const char *nick, time_t delta);
|
||||
E IgnoreData *get_ignore(const char *nick);
|
||||
E int delete_ignore(const char *nick);
|
||||
E int clear_ignores();
|
||||
|
||||
E int split_buf(char *buf, const char ***argv, int colon_special);
|
||||
E void process(const std::string &buf);
|
||||
E void process(const Anope::string &buf);
|
||||
|
||||
/**** send.c ****/
|
||||
|
||||
E void send_cmd(const char *source, const char *fmt, ...) FORMAT(printf,2,3);
|
||||
E void send_cmd(const std::string &source, const char *fmt, ...) FORMAT(printf,2,3);
|
||||
E void send_cmd(const Anope::string &source, const char *fmt, ...) FORMAT(printf, 2, 3);
|
||||
|
||||
E void notice_server(char *source, Server * s, const char *fmt, ...)
|
||||
FORMAT(printf,3,4);
|
||||
|
||||
E void notice_list(const char *source, const char *dest, char **text); // MARK_DEPRECATED;
|
||||
E void notice_lang(const std::string &source, User *dest, int message, ...); // MARK_DEPRECATED;
|
||||
E void notice_help(const char *source, User *dest, int message, ...); // MARK_DEPRECATED;
|
||||
|
||||
|
||||
/**** servers.c ****/
|
||||
|
||||
E Server *servlist;
|
||||
E Server *me_server;
|
||||
E Server *serv_uplink;
|
||||
E Flags<CapabType> Capab;
|
||||
E CapabInfo Capab_Info[];
|
||||
|
||||
E Server *first_server(ServerFlag flag);
|
||||
E Server *next_server(ServerFlag flag);
|
||||
|
||||
E void CapabParse(int ac, const char **av);
|
||||
E int is_ulined(const char *server);
|
||||
E int is_sync(Server *server);
|
||||
|
||||
E Server *new_server(Server * uplink, const char *name, const char *desc, ServerFlag flag, const std::string &suid);
|
||||
|
||||
E Server *findserver(Server *s, const char *name);
|
||||
|
||||
E void do_server(const char *source, const char *servername, const char *hops, const char *descript, const std::string &numeric);
|
||||
E void do_squit(const char *source, int ac, const char **av);
|
||||
E int anope_check_sync(const char *name);
|
||||
|
||||
E void finish_sync(Server *serv, int sync_links);
|
||||
|
||||
E void ts6_uid_init();
|
||||
E void ts6_uid_increment(unsigned int slot);
|
||||
E const char *ts6_uid_retrieve();
|
||||
|
||||
E const char *ts6_sid_retrieve();
|
||||
E void notice_server(const Anope::string &source, const Server *s, const char *fmt, ...) FORMAT(printf, 3, 4);
|
||||
|
||||
/**** sessions.c ****/
|
||||
|
||||
E Exception *exceptions;
|
||||
E int16 nexceptions;
|
||||
E std::vector<Exception *> exceptions;
|
||||
|
||||
E Session *sessionlist[1024];
|
||||
E int32 nsessions;
|
||||
E void get_session_stats(long &count, long &mem);
|
||||
E void get_exception_stats(long &count, long &mem);
|
||||
|
||||
E void get_session_stats(long *nrec, long *memuse);
|
||||
E void get_exception_stats(long *nrec, long *memuse);
|
||||
|
||||
E int add_session(const char *nick, const char *host, char *hostip);
|
||||
E void del_session(const char *host);
|
||||
E void add_session(User *u);
|
||||
E void del_session(User *u);
|
||||
|
||||
E void expire_exceptions();
|
||||
|
||||
E Session *findsession(const char *host);
|
||||
E Session *findsession(const Anope::string &host);
|
||||
|
||||
E Exception *find_host_exception(const char *host);
|
||||
E Exception *find_hostip_exception(const char *host, const char *hostip);
|
||||
E int exception_add(User * u, const char *mask, const int limit,
|
||||
const char *reason, const char *who,
|
||||
const time_t expires);
|
||||
|
||||
/**** slist.c ****/
|
||||
E int slist_add(SList *slist, void *item);
|
||||
E void slist_clear(SList *slist, int free);
|
||||
E int slist_delete(SList *slist, int index);
|
||||
E int slist_delete_range(SList *slist, const char *range, slist_delcheckcb_t cb, ...);
|
||||
E int slist_enum(SList *slist, const char *range, slist_enumcb_t cb, ...);
|
||||
E int slist_full(SList *slist);
|
||||
E int slist_indexof(SList *slist, void *item);
|
||||
E void slist_init(SList *slist);
|
||||
E void slist_pack(SList *slist);
|
||||
E int slist_remove(SList *slist, void *item);
|
||||
E int slist_setcapacity(SList *slist, int16 capacity);
|
||||
E Exception *find_host_exception(const Anope::string &host);
|
||||
E Exception *find_hostip_exception(const Anope::string &host, const Anope::string &hostip);
|
||||
E int exception_add(User *u, const Anope::string &mask, unsigned limit, const Anope::string &reason, const Anope::string &who, time_t expires);
|
||||
|
||||
/**** sockets.cpp ****/
|
||||
E SocketEngine socketEngine;
|
||||
|
||||
E SocketEngineBase *SocketEngine;
|
||||
E int32 TotalRead;
|
||||
E int32 TotalWritten;
|
||||
E SocketIO normalSocketIO;
|
||||
|
||||
/**** users.c ****/
|
||||
|
||||
E User *userlist[1024];
|
||||
|
||||
E int32 opcnt;
|
||||
E uint32 maxusercnt, usercnt;
|
||||
E time_t maxusertime;
|
||||
|
||||
E void get_user_stats(long *nusers, long *memuse);
|
||||
E User *finduser(const std::string &nick);
|
||||
E User *firstuser();
|
||||
E User *nextuser();
|
||||
E void get_user_stats(long &count, long &mem);
|
||||
|
||||
E User *find_byuid(const std::string &uid);
|
||||
E User *first_uid();
|
||||
E User *next_uid();
|
||||
E Server *findserver_uid(Server * s, const char *name);
|
||||
E char *TS6SID;
|
||||
E char *TS6UPLINK;
|
||||
E User *finduser(const Anope::string &nick);
|
||||
|
||||
E User *do_nick(const char *source, const char *nick, const char *username, const char *host,
|
||||
const char *server, const char *realname, time_t ts, uint32 ip, const char *vhost, const char *uid);
|
||||
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 char *source, int ac, const char **av);
|
||||
E void do_quit(const char *source, int ac, const char **av);
|
||||
E void do_kill(const std::string &source, const std::string &reason);
|
||||
E void do_umode(const Anope::string &user, const Anope::string &modes);
|
||||
E void do_kill(User *user, const Anope::string &reason);
|
||||
|
||||
E int is_oper(User * user);
|
||||
E int is_protected(User * user);
|
||||
E bool matches_list(Channel *c, User *user, ChannelModeName mode);
|
||||
E bool is_excepted_mask(ChannelInfo *ci, const Anope::string &mask);
|
||||
|
||||
E int is_excepted(ChannelInfo * ci, User * user);
|
||||
E int is_excepted_mask(ChannelInfo * ci, const char *mask);
|
||||
|
||||
E int match_usermask(const char *mask, User * user);
|
||||
E char *create_mask(User * u);
|
||||
|
||||
E void UserSetInternalModes(User *user, int ac, const char **av);
|
||||
E Anope::string create_mask(User *u);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
E const char *base64enc(long i);
|
||||
E long base64dec(const char *b64);
|
||||
E long base64dects(const char *ts);
|
||||
E int b64_encode(const char *src, size_t srclength, char *target, size_t targsize);
|
||||
E int b64_decode(const char *src, char *target, size_t targsize);
|
||||
E const char *encode_ip(unsigned char *ip);
|
||||
E int decode_ip(const char *buf);
|
||||
|
||||
E char *host_resolve(char *host);
|
||||
E void b64_encode(const Anope::string &src, Anope::string &target);
|
||||
E void b64_decode(const Anope::string &src, Anope::string &target);
|
||||
|
||||
#ifdef _WIN32
|
||||
E char *GetWindowsVersion() ;
|
||||
E int SupportedWindowsVersion();
|
||||
E Anope::string GetWindowsVersion();
|
||||
E bool SupportedWindowsVersion();
|
||||
#endif
|
||||
|
||||
#endif /* EXTERN_H */
|
||||
#endif /* EXTERN_H */
|
||||
|
||||
+144
-113
@@ -1,21 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2010 InspIRCd Development Team
|
||||
* Copyright (C) 2009-2010 Anope Team <team@anope.org>
|
||||
* Copyright (C) 2002-2011 InspIRCd Development Team
|
||||
* Copyright (C) 2009-2011 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.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HASHCOMP_H_
|
||||
#define _HASHCOMP_H_
|
||||
#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
|
||||
#else
|
||||
# define CoreExport
|
||||
# define DllExport
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
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
|
||||
|
||||
/*******************************************************
|
||||
* This file contains classes and templates that deal
|
||||
* with the comparison and hashing of 'irc strings'.
|
||||
@@ -31,9 +76,6 @@
|
||||
* aware of irc::string.
|
||||
*******************************************************/
|
||||
|
||||
#ifndef LOWERMAP
|
||||
#define LOWERMAP
|
||||
|
||||
/** A mapping of uppercase to lowercase, including scandinavian
|
||||
* 'oddities' as specified by RFC1459, e.g. { -> [, and | -> \
|
||||
*/
|
||||
@@ -73,8 +115,6 @@ unsigned const char ascii_case_insensitive_map[256] = {
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 /* 240-255 */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/** The irc namespace contains a number of helper classes.
|
||||
*/
|
||||
namespace irc
|
||||
@@ -127,6 +167,23 @@ namespace irc
|
||||
/** 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
|
||||
{
|
||||
/* 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 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;
|
||||
};
|
||||
}
|
||||
|
||||
/** The ci namespace contains a number of helper classes.
|
||||
@@ -181,16 +238,88 @@ namespace ci
|
||||
/** This typedef declares ci::string based upon ci_char_traits.
|
||||
*/
|
||||
typedef std::basic_string<char, ci_char_traits, std::allocator<char> > string;
|
||||
|
||||
/** Used to hash ci::strings for unordered_map
|
||||
*/
|
||||
struct CoreExport hash
|
||||
{
|
||||
/* 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
|
||||
* @return true if s1 < s2, else false
|
||||
*/
|
||||
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::ostream &operator<<(std::ostream &os, const irc::string &str) { return os << std::string(str.c_str()); }
|
||||
|
||||
/** Operator >> for irc::string
|
||||
*/
|
||||
inline std::istream &operator>>(std::istream &is, irc::string &str)
|
||||
@@ -201,10 +330,6 @@ inline std::istream &operator>>(std::istream &is, irc::string &str)
|
||||
return is;
|
||||
}
|
||||
|
||||
/** Operator << for ci::string
|
||||
*/
|
||||
inline std::ostream &operator<<(std::ostream &os, const ci::string &str) { return os << std::string(str.c_str()); }
|
||||
|
||||
/** Operator >> for ci::string
|
||||
*/
|
||||
inline std::istream &operator>>(std::istream &is, ci::string &str)
|
||||
@@ -377,98 +502,4 @@ inline bool operator!=(const ci::string &leftval, const irc::string &rightval)
|
||||
return !(leftval.c_str() == rightval);
|
||||
}
|
||||
|
||||
/** Assign an irc::string to a std::string.
|
||||
*/
|
||||
//inline std::string assign(const irc::string &other) { return other.c_str(); }
|
||||
|
||||
/** Assign a std::string to an irc::string.
|
||||
*/
|
||||
//inline irc::string assign(const std::string &other) { return other.c_str(); }
|
||||
|
||||
/** Assign an ci::string to a std::string.
|
||||
*/
|
||||
//inline std::string assign(const ci::string &other) { return other.c_str(); }
|
||||
|
||||
/** Assign a std::string to an ci::string.
|
||||
*/
|
||||
//inline ci::string assign(const std::string &other) { return other.c_str(); }
|
||||
|
||||
/** Assign an irc::string to a ci::string.
|
||||
*/
|
||||
//inline ci::string assign(const irc::string &other) { return other.c_str(); }
|
||||
|
||||
/** Assign a ci::string to an irc::string.
|
||||
*/
|
||||
//inline irc::string assign(const ci::string &other) { return other.c_str(); }
|
||||
|
||||
/** sepstream allows for splitting token seperated lists.
|
||||
* Each successive call to sepstream::GetToken() returns
|
||||
* the next token, until none remain, at which point the method returns
|
||||
* an empty string.
|
||||
*/
|
||||
class CoreExport sepstream
|
||||
{
|
||||
private:
|
||||
/** Original string.
|
||||
*/
|
||||
std::string tokens;
|
||||
/** Last position of a seperator token
|
||||
*/
|
||||
std::string::iterator last_starting_position;
|
||||
/** Current string position
|
||||
*/
|
||||
std::string::iterator n;
|
||||
/** Seperator value
|
||||
*/
|
||||
char sep;
|
||||
public:
|
||||
/** Create a sepstream and fill it with the provided data
|
||||
*/
|
||||
sepstream(const std::string &source, char seperator);
|
||||
sepstream(const ci::string &source, char seperator);
|
||||
sepstream(const char *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(std::string &token);
|
||||
virtual bool GetToken(ci::string &token);
|
||||
|
||||
/** Fetch the entire remaining stream, without tokenizing
|
||||
* @return The remaining part of the stream
|
||||
*/
|
||||
virtual const std::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();
|
||||
};
|
||||
|
||||
/** A derived form of sepstream, which seperates on commas
|
||||
*/
|
||||
class commasepstream : public sepstream
|
||||
{
|
||||
public:
|
||||
/** Initialize with comma seperator
|
||||
*/
|
||||
commasepstream(const std::string &source) : sepstream(source, ',') { }
|
||||
commasepstream(const ci::string &source) : sepstream(source, ',') { }
|
||||
commasepstream(const char *source) : sepstream(source, ',') { }
|
||||
};
|
||||
|
||||
/** A derived form of sepstream, which seperates on spaces
|
||||
*/
|
||||
class spacesepstream : public sepstream
|
||||
{
|
||||
public:
|
||||
/** Initialize with space seperator
|
||||
*/
|
||||
spacesepstream(const std::string &source) : sepstream(source, ' ') { }
|
||||
spacesepstream(const ci::string &source) : sepstream(source, ' ') { }
|
||||
spacesepstream(const char *source) : sepstream(source, ' ') { }
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // HASHCOMP_H
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/* Commonly used language strings
|
||||
*
|
||||
* (C) 2008-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#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."
|
||||
#define USERHOST_MASK_TOO_WIDE "%s coverage is too wide; Please use a more specific mask."
|
||||
#define READ_ONLY_MODE "Services are in read-only mode!"
|
||||
#define PASSWORD_INCORRECT "Password incorrect."
|
||||
#define ACCESS_DENIED "Access denied."
|
||||
#define MORE_OBSCURE_PASSWORD "Please try again with a more obscure password. Passwords should be at least five characters long, should not be something easily guessed (e.g. your real name or your nick), and cannot contain the space or tab characters."
|
||||
#define PASSWORD_TOO_LONG "Your password is too long. Please try again with a shorter password."
|
||||
#define NICK_NOT_REGISTERED "Your nick isn't registered."
|
||||
#define NICK_X_NOT_REGISTERED "Nick \002%s\002 isn't registered."
|
||||
#define NICK_X_NOT_IN_USE "Nick \002%s\002 isn't currently in use."
|
||||
#define NICK_X_NOT_ON_CHAN "\002%s\002 is not currently on channel %s."
|
||||
#define NICK_X_FORBIDDEN "Nick \002%s\002 may not be registered or used."
|
||||
#define NICK_X_FORBIDDEN_OPER "Nick \002%s\002 has been forbidden by %s:\n" \
|
||||
"%s"
|
||||
#define NICK_X_SUSPENDED "Nick %s is currently suspended."
|
||||
#define CHAN_X_NOT_REGISTERED "Channel \002%s\002 isn't registered."
|
||||
#define CHAN_X_NOT_IN_USE "Channel \002%s\002 doesn't exist."
|
||||
#define CHAN_X_FORBIDDEN "Channel \002%s\002 may not be registered or used."
|
||||
#define CHAN_X_FORBIDDEN_OPER "Channel \002%s\002 has been forbidden by %s:\n" \
|
||||
"%s"
|
||||
#define NICK_IDENTIFY_REQUIRED "Password authentication required for that command.\n" \
|
||||
"Retry after typing \002%s%s IDENTIFY \037password\037\002."
|
||||
#define MAIL_X_INVALID "\002%s\002 is not a valid e-mail address."
|
||||
#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."
|
||||
#define NICK_IS_REGISTERED "This nick is owned by someone else. Please choose another.\n" \
|
||||
"(If this is your nick, type \002%s%s IDENTIFY \037password\037\002.)"
|
||||
#define NICK_IS_SECURE "This nickname is registered and protected. If it is your\n" \
|
||||
"nick, type \002%s%s IDENTIFY \037password\037\002. Otherwise,\n" \
|
||||
"please choose a different nick."
|
||||
#define FORCENICKCHANGE_NOW "This nickname has been registered; you may not use it."
|
||||
#define NICK_CANNOT_BE_REGISTERED "Nickname \002%s\002 may not be registered."
|
||||
#define NICK_ALREADY_REGISTERED "Nickname \002%s\002 is already registered!"
|
||||
#define NICK_SET_SYNTAX "SET \037option\037 \037parameters\037"
|
||||
#define NICK_SET_DISABLED "Sorry, nickname option setting is temporarily disabled."
|
||||
#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_SASET_SYNTAX "SASET \037nickname\037 \037option\037 \037parameters\037"
|
||||
#define NICK_SASET_DISPLAY_INVALID "The new display for \002%s\002 MUST be a nickname of the nickname group!"
|
||||
#define NICK_SASET_PASSWORD_FAILED "Sorry, couldn't change password for \002%s\002."
|
||||
#define NICK_SASET_PASSWORD_CHANGED "Password for \002%s\002 changed."
|
||||
#define NICK_SASET_PASSWORD_CHANGED_TO "Password for \002%s\002 changed to \002%s\002."
|
||||
#define NICK_INFO_OPTIONS " Options: %s"
|
||||
#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"
|
||||
#define NICK_CONFIRM_INVALID "Invalid passcode has been entered, please check the e-mail again, and retry"
|
||||
#define CHAN_NOT_ALLOWED_TO_JOIN "You are not permitted to be on this channel."
|
||||
#define CHAN_X_INVALID "Channel %s is not a valid channel."
|
||||
#define CHAN_REACHED_CHANNEL_LIMIT "Sorry, you have already reached your limit of \002%d\002 channels."
|
||||
#define CHAN_EXCEEDED_CHANNEL_LIMIT "Sorry, you have already exceeded your limit of \002%d\002 channels."
|
||||
#define CHAN_SYMBOL_REQUIRED "Please use the symbol of \002#\002 when attempting to register"
|
||||
#define CHAN_SASET_SYNTAX "SASET \002channel\002 \037option\037 \037parameters\037"
|
||||
#define CHAN_SET_SYNTAX "SET \037channel\037 \037option\037 \037parameters\037"
|
||||
#define CHAN_SET_DISABLED "Sorry, channel option setting is temporarily disabled."
|
||||
#define CHAN_SETTING_CHANGED "%s for %s set to %s."
|
||||
#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_XOP_FORMAT " %3d %s %s\n" \
|
||||
" by %s, last seen %s"
|
||||
#define CHAN_ACCESS_VIEW_AXS_FORMAT " %3d %4d %s\n" \
|
||||
" by %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" \
|
||||
"Type \002%s%s READ %d\002 to read it."
|
||||
#define MEMO_HAVE_NO_MEMOS "You have no memos."
|
||||
#define MEMO_X_HAS_NO_MEMOS "%s has no memos."
|
||||
#define MEMO_SEND_SYNTAX "SEND {\037nick\037 | \037channel\037} \037memo-text\037"
|
||||
#define MEMO_SEND_DISABLED "Sorry, memo sending is temporarily disabled."
|
||||
#define MEMO_HAVE_NO_NEW_MEMOS "You have no new memos."
|
||||
#define MEMO_X_HAS_NO_NEW_MEMOS "%s has no new memos."
|
||||
#define BOT_DOES_NOT_EXIST "Bot \002%s\002 does not exist."
|
||||
#define BOT_NOT_ASSIGNED "You must assign a bot to the channel before using this command.\n" \
|
||||
"Type %s%s HELP ASSIGN for more information."
|
||||
#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."
|
||||
#define HOST_SET_IDENTTOOLONG "Error! The Ident is too long, please use an ident shorter than %d characters."
|
||||
#define HOST_NOT_ASSIGNED "Please contact an Operator to get a vhost assigned to this nick."
|
||||
#define HOST_NO_VIDENT "Your IRCD does not support vIdent's, if this is incorrect, please report this as a possible bug"
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
enum LogType
|
||||
{
|
||||
LOG_ADMIN,
|
||||
LOG_OVERRIDE,
|
||||
LOG_COMMAND,
|
||||
LOG_SERVER,
|
||||
LOG_CHANNEL,
|
||||
LOG_USER,
|
||||
LOG_NORMAL,
|
||||
LOG_TERMINAL,
|
||||
LOG_RAWIO,
|
||||
LOG_DEBUG,
|
||||
LOG_DEBUG_2,
|
||||
LOG_DEBUG_3,
|
||||
LOG_DEBUG_4
|
||||
};
|
||||
|
||||
struct LogFile
|
||||
{
|
||||
Anope::string filename;
|
||||
|
||||
public:
|
||||
std::ofstream stream;
|
||||
|
||||
LogFile(const Anope::string &name);
|
||||
Anope::string GetName() const;
|
||||
};
|
||||
|
||||
class CoreExport Log
|
||||
{
|
||||
public:
|
||||
BotInfo *bi;
|
||||
LogType Type;
|
||||
Anope::string Category;
|
||||
std::list<Anope::string> Sources;
|
||||
|
||||
std::stringstream buf;
|
||||
|
||||
Log(LogType type = LOG_NORMAL, const Anope::string &category = "", BotInfo *bi = Global);
|
||||
|
||||
/* LOG_COMMAND/OVERRIDE/ADMIN */
|
||||
Log(LogType type, User *u, Command *c, ChannelInfo *ci = NULL);
|
||||
|
||||
/* LOG_CHANNEL */
|
||||
Log(User *u, Channel *c, const Anope::string &category = "");
|
||||
|
||||
/* LOG_USER */
|
||||
explicit Log(User *u, const Anope::string &category = "");
|
||||
|
||||
/* LOG_SERVER */
|
||||
Log(Server *s, const Anope::string &category = "");
|
||||
|
||||
Log(BotInfo *b, const Anope::string &category = "");
|
||||
|
||||
~Log();
|
||||
|
||||
template<typename T> Log &operator<<(T val)
|
||||
{
|
||||
this->buf << val;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
LogInfo(int logage, bool inhabit, bool rawio, bool debug);
|
||||
|
||||
~LogInfo();
|
||||
|
||||
void AddType(std::list<Anope::string> &list, const Anope::string &type);
|
||||
|
||||
bool HasType(std::list<Anope::string> &list, const Anope::string &type) const;
|
||||
|
||||
std::list<Anope::string> &GetList(LogType type);
|
||||
|
||||
bool HasType(LogType Type);
|
||||
|
||||
void ProcessMessage(const Log *l);
|
||||
};
|
||||
|
||||
#endif // LOGGER_H
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef MAIL_H
|
||||
#define MAIL_H
|
||||
|
||||
#include "anope.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
|
||||
{
|
||||
private:
|
||||
Anope::string MailTo;
|
||||
Anope::string Addr;
|
||||
Anope::string Subject;
|
||||
Anope::string Message;
|
||||
bool DontQuoteAddresses;
|
||||
|
||||
bool Success;
|
||||
public:
|
||||
MailThread(const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
|
||||
|
||||
~MailThread();
|
||||
|
||||
void Run();
|
||||
};
|
||||
|
||||
#endif // MAIL_H
|
||||
@@ -1,23 +0,0 @@
|
||||
/* Declarations of IRC message structures, variables, and functions.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************************************************/
|
||||
#include "modules.h"
|
||||
|
||||
extern Message messages[];
|
||||
extern void moduleAddMsgs();
|
||||
extern Message *find_message(const char *name);
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
+160
-196
@@ -1,30 +1,41 @@
|
||||
/* Mode support
|
||||
*
|
||||
* Copyright (C) 2008-2010 Adam <Adam@anope.org>
|
||||
* Copyright (C) 2008-2010 Anope Team <team@anope.org>
|
||||
* Copyright (C) 2008-2011 Adam <Adam@anope.org>
|
||||
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#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_WHOIS, UMODE_ADMIN, UMODE_DEAF,
|
||||
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_CALLERID, UMODE_COMMONCHANS,
|
||||
UMODE_HIDDEN, UMODE_STRIPCOLOR,
|
||||
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
|
||||
@@ -37,6 +48,7 @@ enum ChannelModeName
|
||||
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,
|
||||
@@ -49,6 +61,29 @@ enum ChannelModeName
|
||||
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",
|
||||
|
||||
""
|
||||
};
|
||||
|
||||
|
||||
/** The different types of modes
|
||||
*/
|
||||
enum ModeType
|
||||
@@ -75,10 +110,10 @@ enum ModeClass
|
||||
|
||||
/** This class is the basis of all modes in Anope
|
||||
*/
|
||||
class CoreExport Mode
|
||||
class CoreExport Mode : public Base
|
||||
{
|
||||
public:
|
||||
/* Class of mode this is */
|
||||
public:
|
||||
/* Class of mode this is */
|
||||
ModeClass Class;
|
||||
/* Mode char for this */
|
||||
char ModeChar;
|
||||
@@ -101,8 +136,7 @@ class CoreExport Mode
|
||||
*/
|
||||
class CoreExport UserMode : public Mode
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
/* Mode name */
|
||||
UserModeName Name;
|
||||
|
||||
@@ -115,9 +149,13 @@ class CoreExport UserMode : public Mode
|
||||
/** Default destructor
|
||||
*/
|
||||
virtual ~UserMode();
|
||||
|
||||
/** Returns the mode name as a string
|
||||
*/
|
||||
const Anope::string NameAsString();
|
||||
};
|
||||
|
||||
class UserModeParam : public UserMode
|
||||
class CoreExport UserModeParam : public UserMode
|
||||
{
|
||||
public:
|
||||
/** Default constructor
|
||||
@@ -130,15 +168,14 @@ class UserModeParam : public UserMode
|
||||
* @param value The param
|
||||
* @return true or false
|
||||
*/
|
||||
virtual bool IsValid(const std::string &value) { return true; }
|
||||
virtual bool IsValid(const Anope::string &value) const { return true; }
|
||||
};
|
||||
|
||||
/** This class is a channel mode, all channel modes use this/inherit from this
|
||||
*/
|
||||
class CoreExport ChannelMode : public Mode
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
/* Mode name */
|
||||
ChannelModeName Name;
|
||||
|
||||
@@ -156,7 +193,11 @@ class CoreExport ChannelMode : public Mode
|
||||
* NOTE: User CAN be NULL, this is for checking if it can be locked with defcon
|
||||
* @param u The user, or NULL
|
||||
*/
|
||||
virtual bool CanSet(User *u) { return true; }
|
||||
bool CanSet(User *u) const;
|
||||
|
||||
/** Returns the mode name as a string
|
||||
*/
|
||||
const Anope::string NameAsString();
|
||||
};
|
||||
|
||||
|
||||
@@ -164,8 +205,7 @@ class CoreExport ChannelMode : public Mode
|
||||
*/
|
||||
class CoreExport ChannelModeList : public ChannelMode
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
* @param mName The mode name
|
||||
* @param modeChar The mode char
|
||||
@@ -180,28 +220,34 @@ class CoreExport ChannelModeList : public ChannelMode
|
||||
* @param mask The mask
|
||||
* @return true for yes, false for no
|
||||
*/
|
||||
virtual bool IsValid(const std::string &mask) { return true; }
|
||||
virtual bool IsValid(const Anope::string &mask) const { return true; }
|
||||
|
||||
/** Add the mask to the channel, this should be overridden
|
||||
/** Checks if mask affects user
|
||||
* Should only be used for extbans or other weird ircd-specific things.
|
||||
* @param u The user
|
||||
* @param e The entry to match against
|
||||
* @return true on match
|
||||
*/
|
||||
virtual bool Matches(User *u, const Entry *e) { return false; }
|
||||
|
||||
/** Called when a mask is added to a channel
|
||||
* @param chan The channel
|
||||
* @param mask The mask
|
||||
*/
|
||||
virtual void AddMask(Channel *chan, const char *mask) { }
|
||||
virtual void OnAdd(Channel *chan, const Anope::string &mask) { }
|
||||
|
||||
/** Delete the mask from the channel, this should be overridden
|
||||
/** Called when a mask is removed from a channel
|
||||
* @param chan The channel
|
||||
* @param mask The mask
|
||||
*/
|
||||
virtual void DelMask(Channel *chan, const char *mask) { }
|
||||
|
||||
virtual void OnDel(Channel *chan, const Anope::string &mask) { }
|
||||
};
|
||||
|
||||
/** This is a mode with a paramater, eg +k/l. These modes should use/inherit from this
|
||||
*/
|
||||
class CoreExport ChannelModeParam : public ChannelMode
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
* @param mName The mode name
|
||||
* @param modeChar The mode char
|
||||
@@ -220,14 +266,14 @@ class CoreExport ChannelModeParam : public ChannelMode
|
||||
* @param value The param
|
||||
* @return true for yes, false for no
|
||||
*/
|
||||
virtual bool IsValid(const std::string &value) { return true; }
|
||||
virtual bool IsValid(const Anope::string &value) const { return true; }
|
||||
};
|
||||
|
||||
/** This is a mode that is a channel status, eg +v/h/o/a/q.
|
||||
*/
|
||||
class CoreExport ChannelModeStatus : public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* The symbol, eg @ % + */
|
||||
char Symbol;
|
||||
|
||||
@@ -247,57 +293,20 @@ class CoreExport ChannelModeStatus : public ChannelMode
|
||||
*/
|
||||
class CoreExport ChannelModeBan : public ChannelModeList
|
||||
{
|
||||
public:
|
||||
ChannelModeBan(char modeChar) : ChannelModeList(CMODE_BAN, modeChar) { }
|
||||
public:
|
||||
ChannelModeBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { }
|
||||
|
||||
void AddMask(Channel *chan, const char *mask);
|
||||
|
||||
void DelMask(Channel *chan, const char *mask);
|
||||
void OnAdd(Channel *chan, const Anope::string &mask);
|
||||
};
|
||||
|
||||
/** Channel mode +e
|
||||
*/
|
||||
class CoreExport ChannelModeExcept : public ChannelModeList
|
||||
{
|
||||
public:
|
||||
ChannelModeExcept(char modeChar) : ChannelModeList(CMODE_EXCEPT, modeChar) { }
|
||||
|
||||
void AddMask(Channel *chan, const char *mask);
|
||||
|
||||
void DelMask(Channel *chan, const char *mask);
|
||||
};
|
||||
|
||||
/** Channel mode +I
|
||||
*/
|
||||
class CoreExport ChannelModeInvite : public ChannelModeList
|
||||
{
|
||||
public:
|
||||
ChannelModeInvite(char modeChar) : ChannelModeList(CMODE_INVITEOVERRIDE, modeChar) { }
|
||||
|
||||
void AddMask(Channel *chan, const char *mask);
|
||||
|
||||
void DelMask(Channel *chan, const char *mask);
|
||||
};
|
||||
|
||||
|
||||
/** Channel mode +k (key)
|
||||
*/
|
||||
class CoreExport ChannelModeKey : public ChannelModeParam
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChannelModeKey(char modeChar) : ChannelModeParam(CMODE_KEY, modeChar) { }
|
||||
|
||||
bool IsValid(const std::string &value);
|
||||
};
|
||||
|
||||
/** Channel mode +f (flood)
|
||||
*/
|
||||
class ChannelModeFlood : public ChannelModeParam
|
||||
{
|
||||
public:
|
||||
ChannelModeFlood(char modeChar, bool minusNoArg = false) : ChannelModeParam(CMODE_FLOOD, modeChar, minusNoArg) { }
|
||||
|
||||
bool IsValid(const std::string &value);
|
||||
bool IsValid(const Anope::string &value) const;
|
||||
};
|
||||
|
||||
/** This class is used for channel mode +A (Admin only)
|
||||
@@ -305,11 +314,11 @@ class ChannelModeFlood : public ChannelModeParam
|
||||
*/
|
||||
class CoreExport ChannelModeAdmin : public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChannelModeAdmin(char modeChar) : ChannelMode(CMODE_ADMINONLY, modeChar) { }
|
||||
|
||||
/* Opers only */
|
||||
bool CanSet(User *u);
|
||||
bool CanSet(User *u) const;
|
||||
};
|
||||
|
||||
/** This class is used for channel mode +O (Opers only)
|
||||
@@ -317,23 +326,23 @@ class CoreExport ChannelModeAdmin : public ChannelMode
|
||||
*/
|
||||
class CoreExport ChannelModeOper : public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChannelModeOper(char modeChar) : ChannelMode(CMODE_OPERONLY, modeChar) { }
|
||||
|
||||
/* Opers only */
|
||||
bool CanSet(User *u);
|
||||
bool CanSet(User *u) const;
|
||||
};
|
||||
|
||||
|
||||
/** This class is used for channel mode +r (registered channel)
|
||||
* No one may mlock r
|
||||
*/
|
||||
class CoreExport ChannelModeRegistered : public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChannelModeRegistered(char modeChar) : ChannelMode(CMODE_REGISTERED, modeChar) { }
|
||||
|
||||
/* No one mlocks +r */
|
||||
bool CanSet(User *u);
|
||||
bool CanSet(User *u) const;
|
||||
};
|
||||
|
||||
enum StackerType
|
||||
@@ -345,21 +354,21 @@ enum StackerType
|
||||
class StackerInfo
|
||||
{
|
||||
public:
|
||||
/* Modes to be added */
|
||||
std::list<std::pair<void *, std::string> > AddModes;
|
||||
/* Modes to be added */
|
||||
std::list<std::pair<Base *, Anope::string> > AddModes;
|
||||
/* Modes to be deleted */
|
||||
std::list<std::pair<void *, std::string> > DelModes;
|
||||
std::list<std::pair<Base *, Anope::string> > DelModes;
|
||||
/* The type of object this stacker info is for */
|
||||
StackerType Type;
|
||||
/* Bot this is sent from */
|
||||
BotInfo *bi;
|
||||
|
||||
/** Add a mode to this object
|
||||
* @param Mode The mode
|
||||
* @param mode The mode
|
||||
* @param Set true if setting, false if unsetting
|
||||
* @param Param The param for the mode
|
||||
*/
|
||||
void AddMode(void *Mode, bool Set, const std::string &Param);
|
||||
void AddMode(Mode *mode, bool Set, const Anope::string &Param);
|
||||
};
|
||||
|
||||
/** This is mode manager
|
||||
@@ -370,105 +379,90 @@ class StackerInfo
|
||||
*/
|
||||
class CoreExport ModeManager
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
/* List of pairs of user/channels and their stacker info */
|
||||
static std::list<std::pair<void *, StackerInfo *> > StackerObjects;
|
||||
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(void *Item);
|
||||
static StackerInfo *GetInfo(Base *Item);
|
||||
|
||||
/** 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
|
||||
* @return a list of strings
|
||||
*/
|
||||
static std::list<std::string> BuildModeStrings(StackerInfo *info);
|
||||
|
||||
/** Add a mode to the stacker, internal use only
|
||||
* @param bi The client to set the modes from
|
||||
* @param u The user
|
||||
* @param um The user mode
|
||||
* @param Set Adding or removing?
|
||||
* @param Param A param, if there is one
|
||||
*/
|
||||
static void StackerAddInternal(BotInfo *bi, User *u, UserMode *um, bool Set, const std::string &Param);
|
||||
|
||||
/** Add a mode to the stacker, internal use only
|
||||
* @param bi The client to set the modes from
|
||||
* @param c The channel
|
||||
* @param cm The channel mode
|
||||
* @param Set Adding or removing?
|
||||
* @param Param A param, if there is one
|
||||
*/
|
||||
static void StackerAddInternal(BotInfo *bi, Channel *c, ChannelMode *cm, bool Set, const std::string &Param);
|
||||
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 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, void *Object, void *Mode, bool Set, const std::string &Param, StackerType Type);
|
||||
static void StackerAddInternal(BotInfo *bi, Base *Object, Mode *mode, bool Set, const Anope::string &Param, StackerType Type);
|
||||
|
||||
public:
|
||||
/* User modes */
|
||||
static std::map<char, UserMode *> UserModesByChar;
|
||||
static std::map<UserModeName, UserMode *> UserModesByName;
|
||||
/* Channel modes */
|
||||
static std::map<char, ChannelMode *> ChannelModesByChar;
|
||||
static std::map<ChannelModeName, ChannelMode *> ChannelModesByName;
|
||||
/* Although there are two different maps for UserModes and ChannelModes
|
||||
* the pointers in each are the same. This is used to increase
|
||||
* efficiency.
|
||||
*/
|
||||
/* List of all modes Anope knows about */
|
||||
static std::list<Mode *> Modes;
|
||||
public:
|
||||
/* List of all modes Anope knows about */
|
||||
static std::vector<ChannelMode *> ChannelModes;
|
||||
static std::vector<UserMode *> UserModes;
|
||||
|
||||
/** Add a user mode to Anope
|
||||
* @param um A UserMode or UserMode derived class
|
||||
* @return true on success, false on error
|
||||
*/
|
||||
static bool AddUserMode(UserMode *um);
|
||||
/** Add a user mode to Anope
|
||||
* @param um A UserMode or UserMode derived class
|
||||
* @return true on success, false on error
|
||||
*/
|
||||
static bool AddUserMode(UserMode *um);
|
||||
|
||||
/** Add a channel mode to Anope
|
||||
* @param cm A ChannelMode or ChannelMode derived class
|
||||
* @return true on success, false on error
|
||||
*/
|
||||
static bool AddChannelMode(ChannelMode *cm);
|
||||
/** Add a channel mode to Anope
|
||||
* @param cm A ChannelMode or ChannelMode derived class
|
||||
* @return true on success, false on error
|
||||
*/
|
||||
static bool AddChannelMode(ChannelMode *cm);
|
||||
|
||||
/** Find a channel mode
|
||||
* @param Mode The mode
|
||||
* @return The mode class
|
||||
*/
|
||||
static ChannelMode *FindChannelModeByChar(char Mode);
|
||||
/** Find a channel mode
|
||||
* @param Mode The mode
|
||||
* @return The mode class
|
||||
*/
|
||||
static ChannelMode *FindChannelModeByChar(char Mode);
|
||||
|
||||
/** Find a user mode
|
||||
* @param Mode The mode
|
||||
* @return The mode class
|
||||
*/
|
||||
static UserMode *FindUserModeByChar(char Mode);
|
||||
/** Find a user mode
|
||||
* @param Mode The mode
|
||||
* @return The mode class
|
||||
*/
|
||||
static UserMode *FindUserModeByChar(char Mode);
|
||||
|
||||
/** Find a channel mode
|
||||
* @param Mode The modename
|
||||
* @return The mode class
|
||||
*/
|
||||
static ChannelMode *FindChannelModeByName(ChannelModeName Name);
|
||||
/** Find a channel mode
|
||||
* @param Mode The modename
|
||||
* @return The mode class
|
||||
*/
|
||||
static ChannelMode *FindChannelModeByName(ChannelModeName Name);
|
||||
|
||||
/** Find a user mode
|
||||
* @param Mode The modename
|
||||
* @return The mode class
|
||||
*/
|
||||
static UserMode *FindUserModeByName(UserModeName Name);
|
||||
/** Find a user mode
|
||||
* @param Mode The modename
|
||||
* @return The mode class
|
||||
*/
|
||||
static UserMode *FindUserModeByName(UserModeName Name);
|
||||
|
||||
/** Gets the channel mode char for a symbol (eg + returns v)
|
||||
* @param Value The symbol
|
||||
* @return The char
|
||||
*/
|
||||
static char GetStatusChar(char Value);
|
||||
/** Find channel mode by string
|
||||
* @param name The mode name
|
||||
* @return The mode
|
||||
*/
|
||||
static ChannelMode *FindChannelModeByString(const Anope::string &name);
|
||||
|
||||
/** Find user mode by string
|
||||
* @param name The mode name
|
||||
* @return The mode
|
||||
*/
|
||||
static UserMode *FindUserModeByString(const Anope::string &name);
|
||||
|
||||
/** Gets the channel mode char for a symbol (eg + returns v)
|
||||
* @param Value The symbol
|
||||
* @return The char
|
||||
*/
|
||||
static char GetStatusChar(char Value);
|
||||
|
||||
/** Add a mode to the stacker to be set on a channel
|
||||
* @param bi The client to set the modes from
|
||||
@@ -477,25 +471,7 @@ class CoreExport ModeManager
|
||||
* @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 std::string &Param = "");
|
||||
|
||||
/** 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 Name The channel mode name
|
||||
* @param Set true for setting, false for removing
|
||||
* @param Param The param, if there is one
|
||||
*/
|
||||
static void StackerAdd(BotInfo *bi, Channel *c, ChannelModeName Name, bool Set, const std::string &Param = "");
|
||||
|
||||
/** 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 Mode The mode char
|
||||
* @param Set true for setting, false for removing
|
||||
* @param Param The param, if there is one
|
||||
*/
|
||||
static void StackerAdd(BotInfo *bi, Channel *c, const char Mode, bool Set, const std::string &Param = "");
|
||||
static void StackerAdd(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
|
||||
@@ -504,28 +480,16 @@ class CoreExport ModeManager
|
||||
* @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 std::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 Name The user mode name
|
||||
* @param Set true for setting, false for removing
|
||||
* @param Param The param, if there is one
|
||||
*/
|
||||
static void StackerAdd(BotInfo *bi, User *u, UserModeName Name, bool Set, const std::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 Mode The mode to be set
|
||||
* @param Set true for setting, false for removing
|
||||
* @param Param The param, if there is one
|
||||
*/
|
||||
static void StackerAdd(BotInfo *bi, User *u, const char Mode, bool Set, const std::string &Param = "");
|
||||
static void StackerAdd(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
|
||||
*/
|
||||
static void StackerDel(Base *b);
|
||||
};
|
||||
|
||||
#endif // MODES_H
|
||||
|
||||
+1
-4
@@ -3,9 +3,6 @@
|
||||
|
||||
#include "services.h"
|
||||
#include "commands.h"
|
||||
#include "language.h"
|
||||
#include "modules.h"
|
||||
#include "version.h"
|
||||
|
||||
#endif
|
||||
|
||||
#endif // MODULE_H
|
||||
|
||||
+408
-456
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,250 @@
|
||||
/* OperServ support
|
||||
*
|
||||
* (C) 2008-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef OPERSERV_H
|
||||
#define OPERSERV_H
|
||||
|
||||
extern CoreExport std::vector<NewsItem *> News;
|
||||
extern CoreExport std::vector<std::bitset<32> > DefCon;
|
||||
extern CoreExport bool DefConModesSet;
|
||||
extern CoreExport Flags<ChannelModeName, CMODE_END * 2> DefConModesOn;
|
||||
extern CoreExport Flags<ChannelModeName, CMODE_END * 2> DefConModesOff;
|
||||
extern CoreExport std::map<ChannelModeName, Anope::string> DefConModesOnParams;
|
||||
|
||||
class XLineManager;
|
||||
extern CoreExport XLineManager *SGLine;
|
||||
extern CoreExport XLineManager *SZLine;
|
||||
extern CoreExport XLineManager *SQLine;
|
||||
extern CoreExport XLineManager *SNLine;
|
||||
|
||||
extern CoreExport bool SetDefConParam(ChannelModeName, const Anope::string &);
|
||||
extern CoreExport bool GetDefConParam(ChannelModeName, Anope::string &);
|
||||
extern CoreExport void UnsetDefConParam(ChannelModeName);
|
||||
extern CoreExport bool CheckDefCon(DefconLevel Level);
|
||||
extern CoreExport bool CheckDefCon(int level, DefconLevel Level);
|
||||
extern CoreExport void AddDefCon(int level, DefconLevel Level);
|
||||
extern CoreExport void DelDefCon(int level, DefconLevel Level);
|
||||
|
||||
extern CoreExport void os_init();
|
||||
|
||||
extern CoreExport void oper_global(const Anope::string &nick, const char *fmt, ...);
|
||||
extern CoreExport void server_global(const Server *s, const Anope::string &message);
|
||||
|
||||
enum XLineType
|
||||
{
|
||||
X_SNLINE,
|
||||
X_SQLINE,
|
||||
X_SZLINE
|
||||
};
|
||||
|
||||
class CoreExport XLine
|
||||
{
|
||||
public:
|
||||
Anope::string Mask;
|
||||
Anope::string By;
|
||||
time_t Created;
|
||||
time_t Expires;
|
||||
Anope::string Reason;
|
||||
|
||||
XLine(const Anope::string &mask, const Anope::string &reason = "");
|
||||
|
||||
XLine(const Anope::string &mask, const Anope::string &by, const time_t expires, const Anope::string &reason);
|
||||
|
||||
Anope::string GetNick() const;
|
||||
Anope::string GetUser() const;
|
||||
Anope::string GetHost() const;
|
||||
};
|
||||
|
||||
class CoreExport XLineManager
|
||||
{
|
||||
private:
|
||||
/* List of XLine managers we check users against in XLineManager::CheckAll */
|
||||
static std::list<XLineManager *> XLineManagers;
|
||||
|
||||
protected:
|
||||
/* List of XLines in this XLineManager */
|
||||
std::vector<XLine *> XLines;
|
||||
public:
|
||||
/** Constructor
|
||||
*/
|
||||
XLineManager();
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
virtual ~XLineManager();
|
||||
|
||||
/** 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
|
||||
* matches an entry on both of the XLineManagers, they would be akilled.
|
||||
* @param xlm THe XLineManager
|
||||
*/
|
||||
static void RegisterXLineManager(XLineManager *xlm);
|
||||
|
||||
/** Unregister a XLineManager
|
||||
* @param xlm The XLineManager
|
||||
*/
|
||||
static void UnregisterXLineManager(XLineManager *xlm);
|
||||
|
||||
/** Check a user against all known XLineManagers
|
||||
* 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);
|
||||
|
||||
/** Get the number of XLines in this XLineManager
|
||||
* @return The number of XLines
|
||||
*/
|
||||
size_t GetCount() const;
|
||||
|
||||
/** Get the XLine vector
|
||||
* @return The vector
|
||||
*/
|
||||
const std::vector<XLine *> &GetList() const;
|
||||
|
||||
/** Add an entry to this XLineManager
|
||||
* @param x The entry
|
||||
*/
|
||||
void AddXLine(XLine *x);
|
||||
|
||||
/** Delete an entry from this XLineManager
|
||||
* @param x The entry
|
||||
* @return true if the entry was found and deleted, else false
|
||||
*/
|
||||
bool DelXLine(XLine *x);
|
||||
|
||||
/** Gets an entry by index
|
||||
* @param index The index
|
||||
* @return The XLine, or NULL if the index is out of bounds
|
||||
*/
|
||||
XLine *GetEntry(unsigned index);
|
||||
|
||||
/** Clear the XLine vector
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
/** Add an entry to this XLine Manager
|
||||
* @param bi The bot error replies should be sent from
|
||||
* @param u The user adding the XLine
|
||||
* @param mask The mask of the XLine
|
||||
* @param expires When this should expire
|
||||
* @param reaosn The reason
|
||||
* @return A pointer to the XLine
|
||||
*/
|
||||
virtual XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, 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 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*
|
||||
*/
|
||||
std::pair<int, XLine *> CanAdd(const Anope::string &mask, time_t expires);
|
||||
|
||||
/** 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);
|
||||
|
||||
/** 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()
|
||||
*/
|
||||
virtual XLine *Check(User *u);
|
||||
|
||||
/** 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);
|
||||
|
||||
/** Called when an XLine expires
|
||||
* @param x The xline
|
||||
*/
|
||||
virtual void OnExpire(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;
|
||||
};
|
||||
|
||||
/* This is for AKILLS */
|
||||
class SGLineManager : public XLineManager
|
||||
{
|
||||
public:
|
||||
XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
|
||||
|
||||
void Del(XLine *x);
|
||||
|
||||
void OnMatch(User *u, XLine *x);
|
||||
|
||||
void OnExpire(XLine *x);
|
||||
|
||||
void Send(User *u, XLine *x);
|
||||
};
|
||||
|
||||
class SNLineManager : public XLineManager
|
||||
{
|
||||
public:
|
||||
XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
|
||||
|
||||
void Del(XLine *x);
|
||||
|
||||
void OnMatch(User *u, XLine *x);
|
||||
|
||||
void OnExpire(XLine *x);
|
||||
|
||||
void Send(User *u, XLine *x);
|
||||
|
||||
XLine *Check(User *u);
|
||||
};
|
||||
|
||||
class SQLineManager : public XLineManager
|
||||
{
|
||||
public:
|
||||
XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
|
||||
|
||||
void Del(XLine *x);
|
||||
|
||||
void OnMatch(User *u, XLine *x);
|
||||
|
||||
void OnExpire(XLine *x);
|
||||
|
||||
void Send(User *u, XLine *x);
|
||||
|
||||
static bool Check(Channel *c);
|
||||
};
|
||||
|
||||
class SZLineManager : public XLineManager
|
||||
{
|
||||
public:
|
||||
XLine *Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason);
|
||||
|
||||
void Del(XLine *x);
|
||||
|
||||
void OnMatch(User *u, XLine *x);
|
||||
|
||||
void OnExpire(XLine *x);
|
||||
|
||||
void Send(User *u, XLine *x);
|
||||
};
|
||||
|
||||
#endif // OPERSERV_H
|
||||
+80
-35
@@ -1,66 +1,111 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 Robin Burchell <w00t@inspircd.org>
|
||||
* Copyright (C) 2008-2010 Anope Team <team@anope.org>
|
||||
* Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
|
||||
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OPERTYPE_H
|
||||
#define OPERTYPE_H
|
||||
|
||||
#include "hashcomp.h"
|
||||
|
||||
class OperType;
|
||||
|
||||
struct Oper
|
||||
{
|
||||
Anope::string name;
|
||||
Anope::string password;
|
||||
Anope::string certfp;
|
||||
OperType *ot;
|
||||
|
||||
Oper(const Anope::string &n, const Anope::string &p, const Anope::string &c, OperType *o) :
|
||||
name(n), password(p), certfp(c), ot(o) { }
|
||||
|
||||
/** Find an oper block by name
|
||||
* @param name The name
|
||||
* @return the oper block
|
||||
*/
|
||||
static Oper *Find(const Anope::string &name);
|
||||
};
|
||||
|
||||
class CoreExport OperType
|
||||
{
|
||||
private:
|
||||
/** The name of this opertype, e.g. "sra".
|
||||
*/
|
||||
ci::string name;
|
||||
*/
|
||||
Anope::string name;
|
||||
|
||||
/** Privs that this opertype may use, e.g. 'users/auspex'.
|
||||
* This *must* be std::list, see commands comment for details.
|
||||
*/
|
||||
std::list<std::string> privs;
|
||||
* This *must* be std::list, see commands comment for details.
|
||||
*/
|
||||
std::list<Anope::string> privs;
|
||||
|
||||
/** Commands this user may execute, e.g:
|
||||
* botserv/set/ *, botserv/set/private, botserv/ *
|
||||
* et cetera.
|
||||
*
|
||||
* This *must* be std::list, not std::map, because
|
||||
* we support full globbing here. This shouldn't be a problem
|
||||
* as we don't invoke it often.
|
||||
*/
|
||||
std::list<std::string> commands;
|
||||
* botserv/set/ *, botserv/set/private, botserv/ *
|
||||
* et cetera.
|
||||
*
|
||||
* This *must* be std::list, not std::map, because
|
||||
* we support full globbing here. This shouldn't be a problem
|
||||
* as we don't invoke it often.
|
||||
*/
|
||||
std::list<Anope::string> commands;
|
||||
|
||||
/** Set of opertypes we inherit from
|
||||
*/
|
||||
std::set<OperType *> inheritances;
|
||||
public:
|
||||
/** Find an oper type by name
|
||||
* @param name The name
|
||||
* @return The oper type
|
||||
*/
|
||||
static OperType *Find(const Anope::string &name);
|
||||
|
||||
/** Create a new opertype of the given name.
|
||||
* @param nname The opertype name, e.g. "sra".
|
||||
*/
|
||||
OperType(const ci::string &nname);
|
||||
OperType(const Anope::string &nname);
|
||||
|
||||
/** Check whether this opertype has access to run the given command string.
|
||||
* @param cmdstr The string to check, e.g. botserv/set/private.
|
||||
* @return True if this opertype may run the specified command, false otherwise.
|
||||
*/
|
||||
bool HasCommand(const std::string &cmdstr) const;
|
||||
* @param cmdstr The string to check, e.g. botserv/set/private.
|
||||
* @return True if this opertype may run the specified command, false otherwise.
|
||||
*/
|
||||
bool HasCommand(const Anope::string &cmdstr) const;
|
||||
|
||||
/** Check whether this opertype has access to the given special permission.
|
||||
* @param privstr The priv to check for, e.g. users/auspex.
|
||||
* @return True if this opertype has the specified priv, false otherwise.
|
||||
*/
|
||||
bool HasPriv(const std::string &privstr) const;
|
||||
* @param privstr The priv to check for, e.g. users/auspex.
|
||||
* @return True if this opertype has the specified priv, false otherwise.
|
||||
*/
|
||||
bool HasPriv(const Anope::string &privstr) const;
|
||||
|
||||
/** Add the specified command to this opertype.
|
||||
* @param cmdstr The command mask to grant this opertype access to, e.g: nickserv/ *, chanserv/set/ *, botserv/set/private.
|
||||
*/
|
||||
void AddCommand(const std::string &cmdstr);
|
||||
* @param cmdstr The command mask to grant this opertype access to, e.g: nickserv/ *, chanserv/set/ *, botserv/set/private.
|
||||
*/
|
||||
void AddCommand(const Anope::string &cmdstr);
|
||||
|
||||
/** Add the specified priv mask to this opertype.
|
||||
* @param privstr The specified mask of privs to grant this opertype access to, e.g. users/auspex, users/ *, etc.
|
||||
*/
|
||||
void AddPriv(const std::string &privstr);
|
||||
* @param privstr The specified mask of privs to grant this opertype access to, e.g. users/auspex, users/ *, etc.
|
||||
*/
|
||||
void AddPriv(const Anope::string &privstr);
|
||||
|
||||
/** Returns the name of this opertype.
|
||||
*/
|
||||
const ci::string &GetName() const;
|
||||
const Anope::string &GetName() const;
|
||||
|
||||
/** Make this opertype inherit commands and privs from another opertype
|
||||
* @param ot The opertype to inherit from
|
||||
*/
|
||||
void Inherits(OperType *ot);
|
||||
|
||||
/** Gets the icommands for this opertype
|
||||
* @return A list of commands
|
||||
*/
|
||||
const std::list<Anope::string> &GetCommands() const;
|
||||
|
||||
/** Gets the privileges for this opertype
|
||||
* @return A list of privileges
|
||||
*/
|
||||
const std::list<Anope::string> &GetPrivs() const;
|
||||
};
|
||||
|
||||
#endif // OPERTYPE_H
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/* Include extra includes needed by most/all pseudo-clients.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "commands.h"
|
||||
#include "language.h"
|
||||
#include "timers.h"
|
||||
#include "slist.h"
|
||||
+187
-74
@@ -1,14 +1,17 @@
|
||||
/* Modular support
|
||||
*
|
||||
* (C) 2008-2010 Anope Team
|
||||
* (C) 2008-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef REGCHANNEL_H
|
||||
#define REGCHANNEL_H
|
||||
|
||||
typedef unordered_map_namespace::unordered_map<Anope::string, ChannelInfo *, ci::hash, std::equal_to<ci::string> > registered_channel_map;
|
||||
extern CoreExport registered_channel_map RegisteredChannelList;
|
||||
|
||||
/** Flags used for the ChannelInfo class
|
||||
*/
|
||||
enum ChannelInfoFlag
|
||||
@@ -59,53 +62,108 @@ enum ChannelInfoFlag
|
||||
CI_END
|
||||
};
|
||||
|
||||
class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
|
||||
const Anope::string ChannelInfoFlagStrings[] = {
|
||||
"BEGIN", "INHABIT", "KEEPTOPIC", "SECUREOPS", "PRIVATE", "TOPICLOCK", "RESTRICTED",
|
||||
"PEACE", "SECURE", "FORBIDDEN", "NO_EXPIRE", "MEMO_HARDMAX", "OPNOTICE", "SECUREFOUNDER",
|
||||
"SIGNKICK", "SIGNKICK_LEVEL", "XOP", "SUSPENDED", "PERSIST", ""
|
||||
};
|
||||
|
||||
class CoreExport ChanAccess
|
||||
{
|
||||
Anope::string mask; /* Mask of the access entry */
|
||||
public:
|
||||
int16 level;
|
||||
NickCore *nc; /* NC of the entry, if the entry is a valid nickcore */
|
||||
time_t last_seen;
|
||||
Anope::string creator;
|
||||
|
||||
ChanAccess(const Anope::string &umask);
|
||||
const Anope::string &GetMask();
|
||||
};
|
||||
|
||||
/** Flags for auto kick
|
||||
*/
|
||||
enum AutoKickFlag
|
||||
{
|
||||
/* Is by nick core, not mask */
|
||||
AK_ISNICK
|
||||
};
|
||||
|
||||
const Anope::string AutoKickFlagString[] = { "AK_ISNICK", "" };
|
||||
|
||||
/* AutoKick data. */
|
||||
class AutoKick : public Flags<AutoKickFlag>
|
||||
{
|
||||
public:
|
||||
AutoKick() : Flags<AutoKickFlag>(AutoKickFlagString) { }
|
||||
/* Only one of these can be in use */
|
||||
Anope::string mask;
|
||||
NickCore *nc;
|
||||
|
||||
Anope::string reason;
|
||||
Anope::string creator;
|
||||
time_t addtime;
|
||||
time_t last_used;
|
||||
};
|
||||
|
||||
struct ModeLock
|
||||
{
|
||||
bool set;
|
||||
ChannelModeName 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) { }
|
||||
};
|
||||
|
||||
class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, CI_END>
|
||||
{
|
||||
private:
|
||||
std::map<ChannelModeName, std::string> Params; /* Map of parameters by mode name for mlock */
|
||||
std::vector<ChanAccess *> access; /* List of authorized users */
|
||||
std::vector<AutoKick *> akick; /* List of users to kickban */
|
||||
std::vector<BadWord *> badwords; /* List of badwords */
|
||||
std::bitset<128> mlock_on; /* Modes mlocked on */
|
||||
std::bitset<128> mlock_off; /* Modes mlocked off */
|
||||
typedef std::multimap<ChannelModeName, ModeLock> ModeList;
|
||||
private:
|
||||
std::vector<ChanAccess *> access; /* List of authorized users */
|
||||
std::vector<AutoKick *> akick; /* List of users to kickban */
|
||||
std::vector<BadWord *> badwords; /* List of badwords */
|
||||
ModeList mode_locks;
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
* @param chname The channel name
|
||||
*/
|
||||
ChannelInfo(const std::string &chname);
|
||||
ChannelInfo(const Anope::string &chname);
|
||||
|
||||
/** Copy constructor
|
||||
* @param ci The ChannelInfo to copy settings to
|
||||
*/
|
||||
ChannelInfo(ChannelInfo *ci);
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
~ChannelInfo();
|
||||
|
||||
ChannelInfo *next, *prev;
|
||||
std::string name; /* Channel name */
|
||||
Anope::string name; /* Channel name */
|
||||
NickCore *founder;
|
||||
NickCore *successor; /* Who gets the channel if the founder
|
||||
* nick is dropped or expires */
|
||||
char *desc;
|
||||
char *url;
|
||||
char *email;
|
||||
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;
|
||||
char *last_topic; /* Last topic on the channel */
|
||||
std::string last_topic_setter; /* Who set the last topic */
|
||||
time_t last_topic_time; /* When the last topic was set */
|
||||
|
||||
char *forbidby;
|
||||
char *forbidreason;
|
||||
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 */
|
||||
|
||||
// These two should be using extensible
|
||||
Anope::string forbidby;
|
||||
Anope::string forbidreason;
|
||||
|
||||
int16 bantype;
|
||||
int16 *levels; /* Access levels for commands */
|
||||
|
||||
char *entry_message; /* Notice sent on entering channel */
|
||||
int16 *levels; /* Access levels for commands */
|
||||
|
||||
MemoInfo memos;
|
||||
|
||||
Channel *c; /* Pointer to channel record (if *
|
||||
* channel is currently in use) */
|
||||
Channel *c; /* Pointer to channel record (if channel is currently in use) */
|
||||
|
||||
/* For BotServ */
|
||||
|
||||
@@ -119,14 +177,15 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
|
||||
|
||||
/** Add an entry to the channel access list
|
||||
*
|
||||
* @param nc The NickCore of the user that the access entry should be tied to
|
||||
* @param mask The mask of the access entry
|
||||
* @param level The channel access level the user has on the channel
|
||||
* @param creator The user who added the access
|
||||
* @param last_seen When the user was last seen within the channel
|
||||
* @return The new access class
|
||||
*
|
||||
* Creates a new access list entry and inserts it into the access list.
|
||||
*/
|
||||
void AddAccess(NickCore *nc, int16 level, const std::string &creator, int32 last_seen = 0);
|
||||
ChanAccess *AddAccess(const Anope::string &mask, int16 level, const Anope::string &creator, int32 last_seen = 0);
|
||||
|
||||
/** Get an entry from the channel access list by index
|
||||
*
|
||||
@@ -137,20 +196,41 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
|
||||
*/
|
||||
ChanAccess *GetAccess(unsigned index);
|
||||
|
||||
/** Get an entry from the channel access list by User
|
||||
*
|
||||
* @param u The User to find within the access list vector
|
||||
* @param level Optional channel access level to compare the access entries to
|
||||
* @return A ChanAccess struct corresponding to the User, or NULL if not found
|
||||
*
|
||||
* Retrieves an entry from the access list that matches the given User, optionally also matching a certain level.
|
||||
*/
|
||||
ChanAccess *GetAccess(User *u, int16 level = 0);
|
||||
|
||||
/** Get an entry from the channel access list by NickCore
|
||||
*
|
||||
* @param nc The NickCore to find within the access list vector
|
||||
* @param u The NickCore to find within the access list vector
|
||||
* @param level Optional channel access level to compare the access entries to
|
||||
* @return A ChanAccess struct corresponding to the NickCore, or NULL if not found
|
||||
*
|
||||
* Retrieves an entry from the access list that matches the given NickCore, optionally also matching a certain level.
|
||||
*/
|
||||
ChanAccess *GetAccess(NickCore *nc, int16 level = 0);
|
||||
|
||||
/** Get an entry from the channel access list by mask
|
||||
*
|
||||
* @param u The mask to find within the access list vector
|
||||
* @param level Optional channel access level to compare the access entries to
|
||||
* @param wildcard True to match using wildcards
|
||||
* @return A ChanAccess struct corresponding to the mask, or NULL if not found
|
||||
*
|
||||
* Retrieves an entry from the access list that matches the given mask, optionally also matching a certain level.
|
||||
*/
|
||||
ChanAccess *GetAccess(const Anope::string &mask, int16 level = 0, bool wildcard = true);
|
||||
|
||||
/** Get the size of the accss vector for this channel
|
||||
* @return The access vector size
|
||||
*/
|
||||
const unsigned GetAccessCount() const;
|
||||
unsigned GetAccessCount() const;
|
||||
|
||||
/** Erase an entry from the channel access list
|
||||
*
|
||||
@@ -160,11 +240,13 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
|
||||
*/
|
||||
void EraseAccess(unsigned index);
|
||||
|
||||
/** Cleans the channel access list
|
||||
/** Erase an entry from the channel access list
|
||||
*
|
||||
* Cleans up the access list so it no longer contains entries no longer in use.
|
||||
* @param taccess The access to remove
|
||||
*
|
||||
* Clears the memory used by the given access entry and removes it from the vector.
|
||||
*/
|
||||
void CleanAccess();
|
||||
void EraseAccess(ChanAccess *taccess);
|
||||
|
||||
/** Clear the entire channel access list
|
||||
*
|
||||
@@ -179,7 +261,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 std::string &user, NickCore *akicknc, const std::string &reason, time_t t = time(NULL), 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
|
||||
@@ -188,7 +270,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 std::string &user, const std::string &mask, const std::string &reason, time_t t = time(NULL), 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
|
||||
@@ -199,27 +281,23 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
|
||||
/** Get the size of the akick vector for this channel
|
||||
* @return The akick vector size
|
||||
*/
|
||||
const unsigned GetAkickCount() const;
|
||||
unsigned GetAkickCount() const;
|
||||
|
||||
/** Erase an entry from the channel akick list
|
||||
* @param akick The akick
|
||||
* @param index The index of the akick
|
||||
*/
|
||||
void EraseAkick(AutoKick *akick);
|
||||
void EraseAkick(unsigned index);
|
||||
|
||||
/** Clear the whole akick list
|
||||
*/
|
||||
void ClearAkick();
|
||||
|
||||
/** Clean all of the nonused entries from the akick list
|
||||
*/
|
||||
void CleanAkick();
|
||||
|
||||
/** Add a badword to the badword list
|
||||
* @param word The badword
|
||||
* @param type The type (SINGLE START END)
|
||||
* @return The badword
|
||||
*/
|
||||
BadWord *AddBadWord(const std::string &word, BadWordType type);
|
||||
BadWord *AddBadWord(const Anope::string &word, BadWordType type);
|
||||
|
||||
/** Get a badword structure by index
|
||||
* @param index The index
|
||||
@@ -230,71 +308,106 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
|
||||
/** Get how many badwords are on this channel
|
||||
* @return The number of badwords in the vector
|
||||
*/
|
||||
const unsigned GetBadWordCount() const;
|
||||
unsigned GetBadWordCount() const;
|
||||
|
||||
/** Remove a badword
|
||||
* @param badword The badword
|
||||
* @param index The index of the badword
|
||||
*/
|
||||
void EraseBadWord(BadWord *badword);
|
||||
void EraseBadWord(unsigned index);
|
||||
|
||||
/** Clear all badwords from the channel
|
||||
*/
|
||||
void ClearBadWords();
|
||||
|
||||
/** Clean all of the nonused entries from the badwords list
|
||||
/** 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 CleanBadWords();
|
||||
void LoadMLock();
|
||||
|
||||
/** Check if a mode is mlocked
|
||||
* @param Name The mode
|
||||
* @param mode The mode
|
||||
* @param An optional param
|
||||
* @param status True to check mlock on, false for mlock off
|
||||
* @return true on success, false on fail
|
||||
*/
|
||||
const bool HasMLock(ChannelModeName Name, bool status);
|
||||
bool HasMLock(ChannelMode *mode, const Anope::string ¶m, bool status) const;
|
||||
|
||||
/** Set a mlock
|
||||
* @param Name The mode
|
||||
* @param mode The mode
|
||||
* @param status True for mlock on, false for mlock off
|
||||
* @param param An optional param arg for + mlocked modes
|
||||
* @param setter Who is setting the mlock
|
||||
* @param created When the mlock was created
|
||||
* @return true on success, false on failure (module blocking)
|
||||
*/
|
||||
bool SetMLock(ChannelModeName Name, bool status, const std::string param = "");
|
||||
bool SetMLock(ChannelMode *mode, bool status, const Anope::string ¶m = "", Anope::string setter = "", time_t created = Anope::CurTime);
|
||||
|
||||
/** Remove a mlock
|
||||
* @param Name The mode
|
||||
* @return true on success, false on failure (module blcoking)
|
||||
* @param mode The mode
|
||||
* @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(ChannelModeName Name);
|
||||
bool RemoveMLock(ChannelMode *mode, const Anope::string ¶m = "");
|
||||
|
||||
/** Clear all mlocks on the channel
|
||||
*/
|
||||
void ClearMLock();
|
||||
|
||||
/** Get the number of mlocked modes for this channel
|
||||
* @param status true for mlock on, false for mlock off
|
||||
* @return The number of mlocked modes
|
||||
/** Get all of the mlocks for this channel
|
||||
* @return The mlocks
|
||||
*/
|
||||
const size_t GetMLockCount(bool status) const;
|
||||
const std::multimap<ChannelModeName, ModeLock> &GetMLock() const;
|
||||
|
||||
/** 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 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
|
||||
*/
|
||||
const bool GetParam(ChannelModeName Name, std::string &Target);
|
||||
std::pair<ModeList::iterator, ModeList::iterator> GetModeList(ChannelModeName Name);
|
||||
|
||||
/** Check if a mode is set and has a param
|
||||
* @param Name The mode
|
||||
/** Get details for a specific mlock
|
||||
* @param mname The mode name
|
||||
* @param An optional param to match with
|
||||
* @return The MLock, if any
|
||||
*/
|
||||
const bool HasParam(ChannelModeName Name);
|
||||
|
||||
/** Clear all the params from the channel
|
||||
*/
|
||||
void ClearParams();
|
||||
ModeLock *GetMLock(ChannelModeName mname, const Anope::string ¶m = "");
|
||||
|
||||
/** Check whether a user is permitted to be on this channel
|
||||
* @param u The user
|
||||
* @return true if they are allowed, false if they aren't and were kicked
|
||||
*/
|
||||
bool CheckKick(User *user);
|
||||
|
||||
/** Check the channel topic
|
||||
* If topic lock is enabled will change the topic back, else it records
|
||||
* 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();
|
||||
};
|
||||
|
||||
/** A timer used to keep the BotServ bot/ChanServ in the channel
|
||||
* after kicking the last user in a channel
|
||||
*/
|
||||
class 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);
|
||||
};
|
||||
|
||||
|
||||
#endif // REGCHANNEL_H
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
#ifndef SERVERS_H
|
||||
#define SERVERS_H
|
||||
|
||||
/* Anope */
|
||||
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 char *ts6_uid_retrieve();
|
||||
extern CoreExport const char *ts6_sid_retrieve();
|
||||
|
||||
/* Types of capab
|
||||
*/
|
||||
enum CapabType
|
||||
{
|
||||
CAPAB_BEGIN,
|
||||
|
||||
CAPAB_NOQUIT,
|
||||
CAPAB_TSMODE,
|
||||
CAPAB_UNCONNECT,
|
||||
CAPAB_QS,
|
||||
|
||||
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", "" };
|
||||
|
||||
/** Class representing a server
|
||||
*/
|
||||
class CoreExport Server : public Flags<ServerFlag>
|
||||
{
|
||||
private:
|
||||
/* Server name */
|
||||
Anope::string Name;
|
||||
/* Hops between services and server */
|
||||
unsigned int Hops;
|
||||
/* Server description */
|
||||
Anope::string Description;
|
||||
/* Server ID */
|
||||
Anope::string SID;
|
||||
/* Links for this server */
|
||||
std::vector<Server *> Links;
|
||||
/* Uplink for this server */
|
||||
Server *UplinkServer;
|
||||
|
||||
/* Reason this server was quit */
|
||||
Anope::string QReason;
|
||||
|
||||
public:
|
||||
/** Constructor
|
||||
* @param uplink The uplink this server is from, is only NULL when creating Me
|
||||
* @param name The server name
|
||||
* @param hops Hops from services server
|
||||
* @param description Server rdescription
|
||||
* @param sid Server sid/numeric
|
||||
* @param flag An optional server flag
|
||||
*/
|
||||
Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid, ServerFlag flag = SERVER_NONE);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~Server();
|
||||
|
||||
/** Delete this server with a reason
|
||||
* @param reason The reason
|
||||
*/
|
||||
void Delete(const Anope::string &reason);
|
||||
|
||||
/** Get the name for this server
|
||||
* @return The name
|
||||
*/
|
||||
const Anope::string &GetName() const;
|
||||
|
||||
/** Get the number of hops this server is from services
|
||||
* @return Number of hops
|
||||
*/
|
||||
unsigned GetHops() const;
|
||||
|
||||
/** Set the server description
|
||||
* @param desc The new description
|
||||
*/
|
||||
void SetDescription(const Anope::string &desc);
|
||||
|
||||
/** Get the server description
|
||||
* @return The server description
|
||||
*/
|
||||
const Anope::string &GetDescription() const;
|
||||
|
||||
/** Get the server numeric/SID
|
||||
* @return The numeric/SID
|
||||
*/
|
||||
const Anope::string &GetSID() const;
|
||||
|
||||
/** Get the list of links this server has, or NULL if it has none
|
||||
* @return A list of servers
|
||||
*/
|
||||
const std::vector<Server *> &GetLinks() const;
|
||||
|
||||
/** Get the uplink server for this server, if this is our uplink will be Me
|
||||
* @return The servers uplink
|
||||
*/
|
||||
Server *GetUplink();
|
||||
|
||||
/** Adds a link to this server
|
||||
* @param s The linking server
|
||||
*/
|
||||
void AddLink(Server *s);
|
||||
|
||||
/** Delinks a server from this server
|
||||
* @param s The server
|
||||
*/
|
||||
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)
|
||||
*/
|
||||
void Sync(bool SyncLinks);
|
||||
|
||||
/** Check if this server is synced
|
||||
* @return true or false
|
||||
*/
|
||||
bool IsSynced() const;
|
||||
|
||||
/** Check if this server is ULined
|
||||
* @return true or false
|
||||
*/
|
||||
bool IsULined() const;
|
||||
|
||||
/** 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
|
||||
* @return The server
|
||||
*/
|
||||
static Server *Find(const Anope::string &name, Server *s = NULL);
|
||||
};
|
||||
|
||||
#endif // SERVERS_H
|
||||
+541
-726
File diff suppressed because it is too large
Load Diff
@@ -1,50 +0,0 @@
|
||||
/* Header for Services list handler.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SLIST_H
|
||||
#define SLIST_H
|
||||
|
||||
typedef struct slist_ SList;
|
||||
typedef struct slistopts_ SListOpts;
|
||||
|
||||
struct slist_ {
|
||||
void **list;
|
||||
|
||||
int16 count; /* Total entries of the list */
|
||||
int16 capacity; /* Capacity of the list */
|
||||
int16 limit; /* Maximum possible entries on the list */
|
||||
|
||||
SListOpts *opts;
|
||||
};
|
||||
|
||||
struct slistopts_ {
|
||||
int32 flags; /* Flags for the list. See below. */
|
||||
|
||||
int (*compareitem) (SList *slist, void *item1, void *item2); /* Called to compare two items */
|
||||
int (*isequal) (SList *slist, void *item1, void *item2); /* Called by slist_indexof. item1 can be an arbitrary pointer. */
|
||||
void (*freeitem) (SList *slist, void *item); /* Called when an item is removed */
|
||||
};
|
||||
|
||||
#define SLIST_DEFAULT_LIMIT 32767
|
||||
|
||||
#define SLISTF_NODUP 0x00000001 /* No duplicates in the list. */
|
||||
#define SLISTF_SORT 0x00000002 /* Automatically sort the list. Used with compareitem member. */
|
||||
|
||||
/* Note that number is the index in the array + 1 */
|
||||
typedef int (*slist_enumcb_t) (SList *slist, int number, void *item, va_list args);
|
||||
/* Callback to know whether we can delete the entry. */
|
||||
typedef int (*slist_delcheckcb_t) (SList *slist, void *item, va_list args);
|
||||
|
||||
#endif /* SLIST_H */
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
*
|
||||
* (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 SOCKETENGINE_H
|
||||
#define SOCKETENGINE_H
|
||||
|
||||
class CoreExport SocketEngineBase
|
||||
{
|
||||
public:
|
||||
#ifdef _WIN32
|
||||
/* Windows crap */
|
||||
WSADATA wsa;
|
||||
#endif
|
||||
/* Map of sockets */
|
||||
std::map<int, Socket *> Sockets;
|
||||
|
||||
/** Default constructor
|
||||
*/
|
||||
SocketEngineBase();
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
virtual ~SocketEngineBase();
|
||||
|
||||
/** Add a socket to the internal list
|
||||
* @param s The socket
|
||||
*/
|
||||
virtual void AddSocket(Socket *s) { }
|
||||
|
||||
/** Delete a socket from the internal list
|
||||
* @param s The socket
|
||||
*/
|
||||
virtual void DelSocket(Socket *s) { }
|
||||
|
||||
/** Mark a socket as writeable
|
||||
* @param s The socket
|
||||
*/
|
||||
virtual void MarkWritable(Socket *s) { }
|
||||
|
||||
/** Unmark a socket as writeable
|
||||
* @param s The socket
|
||||
*/
|
||||
virtual void ClearWritable(Socket *s) { }
|
||||
|
||||
/** Read from sockets and do things
|
||||
*/
|
||||
virtual void Process() { }
|
||||
};
|
||||
|
||||
#endif // SOCKETENGINE_H
|
||||
+295
-90
@@ -1,32 +1,104 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2004-2010 Anope Team
|
||||
* (C) 2003-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef SOCKETS_H
|
||||
#define SOCKETS_H
|
||||
|
||||
#include "anope.h"
|
||||
|
||||
#define NET_BUFSIZE 65535
|
||||
|
||||
#ifdef _WIN32
|
||||
#define CloseSocket closesocket
|
||||
# define CloseSocket closesocket
|
||||
#else
|
||||
#define CloseSocket close
|
||||
# define CloseSocket close
|
||||
#endif
|
||||
|
||||
/** A sockaddr union used to combine IPv4 and IPv6 sockaddrs
|
||||
*/
|
||||
union CoreExport sockaddrs
|
||||
{
|
||||
sockaddr sa;
|
||||
sockaddr_in sa4;
|
||||
sockaddr_in6 sa6;
|
||||
|
||||
/** Construct the object, sets everything to 0
|
||||
*/
|
||||
sockaddrs();
|
||||
|
||||
/** Memset the object to 0
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/** Get the size of the sockaddr we represent
|
||||
* @return The size
|
||||
*/
|
||||
size_t size() const;
|
||||
|
||||
/** Get the port represented by this addr
|
||||
* @return The port, or -1 on fail
|
||||
*/
|
||||
int port() const;
|
||||
|
||||
/** Get the address represented by this addr
|
||||
* @return The address
|
||||
*/
|
||||
Anope::string addr() const;
|
||||
|
||||
/** Check if this sockaddr has data in it
|
||||
*/
|
||||
bool operator()() const;
|
||||
|
||||
/** Compares with sockaddr with another. Compares address type, port, and address
|
||||
* @return true if they are the same
|
||||
*/
|
||||
bool operator==(const sockaddrs &other) const;
|
||||
/* The same as above but not */
|
||||
inline bool operator!=(const sockaddrs &other) const { return !(*this == other); }
|
||||
|
||||
/** The equivalent of inet_pton
|
||||
* @param type AF_INET or AF_INET6
|
||||
* @param address The address to place in the sockaddr structures
|
||||
* @param pport An option port to include in the sockaddr structures
|
||||
* @throws A socket exception if given invalid IPs
|
||||
*/
|
||||
void pton(int type, const Anope::string &address, int pport = 0);
|
||||
|
||||
/** The equivalent of inet_ntop
|
||||
* @param type AF_INET or AF_INET6
|
||||
* @param address The in_addr or in_addr6 structure
|
||||
* @throws A socket exception if given an invalid structure
|
||||
*/
|
||||
void ntop(int type, const void *src);
|
||||
};
|
||||
|
||||
class CoreExport cidr
|
||||
{
|
||||
sockaddrs addr;
|
||||
Anope::string cidr_ip;
|
||||
unsigned char cidr_len;
|
||||
public:
|
||||
cidr(const Anope::string &ip);
|
||||
cidr(const Anope::string &ip, unsigned char len);
|
||||
Anope::string mask() const;
|
||||
bool match(sockaddrs &other);
|
||||
};
|
||||
|
||||
class SocketException : public CoreException
|
||||
{
|
||||
public:
|
||||
/** Default constructor for socket exceptions
|
||||
/** Default constructor for socket exceptions
|
||||
* @param message Error message
|
||||
*/
|
||||
SocketException(const std::string &message) : CoreException(message) { }
|
||||
SocketException(const Anope::string &message) : CoreException(message) { }
|
||||
|
||||
/** Default destructor
|
||||
* @throws Nothing
|
||||
@@ -34,89 +106,177 @@ class SocketException : public CoreException
|
||||
virtual ~SocketException() throw() { }
|
||||
};
|
||||
|
||||
class CoreExport Socket
|
||||
enum SocketType
|
||||
{
|
||||
private:
|
||||
/** Read from the socket
|
||||
* @param buf Buffer to read to
|
||||
SOCKTYPE_BASE,
|
||||
SOCKTYPE_BUFFERED,
|
||||
SOCKTYPE_CONNECTION,
|
||||
SOCKTYPE_CLIENT,
|
||||
SOCKTYPE_LISTEN
|
||||
};
|
||||
|
||||
enum SocketFlag
|
||||
{
|
||||
SF_DEAD,
|
||||
SF_WRITABLE
|
||||
};
|
||||
|
||||
static const Anope::string SocketFlagStrings[] = { "SF_DEAD", "SF_WRITABLE", "" };
|
||||
|
||||
class Socket;
|
||||
class ClientSocket;
|
||||
class ListenSocket;
|
||||
class ConnectionSocket;
|
||||
|
||||
class CoreExport SocketIO
|
||||
{
|
||||
public:
|
||||
/** Receive something from the buffer
|
||||
* @param s The socket
|
||||
* @param buf The buf to read to
|
||||
* @param sz How much to read
|
||||
* @return Number of bytes recieved
|
||||
* @return Number of bytes received
|
||||
*/
|
||||
virtual int RecvInternal(char *buf, size_t sz) const;
|
||||
virtual int Recv(Socket *s, char *buf, size_t sz) const;
|
||||
|
||||
/** Write to the socket
|
||||
/** Write something to the socket
|
||||
* @param s The socket
|
||||
* @param buf What to write
|
||||
* @return Number of bytes sent, -1 on error
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
virtual int SendInternal(const std::string &buf) const;
|
||||
virtual int Send(Socket *s, const Anope::string &buf) const;
|
||||
|
||||
/** Accept a connection from a socket
|
||||
* @param s The socket
|
||||
*/
|
||||
virtual void Accept(ListenSocket *s);
|
||||
|
||||
/** Connect the socket
|
||||
* @param s THe socket
|
||||
* @param target IP to connect to
|
||||
* @param port to connect to
|
||||
* @param bindip IP to bind to, if any
|
||||
*/
|
||||
virtual void Connect(ConnectionSocket *s, const Anope::string &target, int port, const Anope::string &bindip = "");
|
||||
|
||||
/** Called when the socket is destructing
|
||||
*/
|
||||
virtual void Destroy() { }
|
||||
};
|
||||
|
||||
class CoreExport Socket : public Flags<SocketFlag, 2>
|
||||
{
|
||||
protected:
|
||||
/* Socket FD */
|
||||
int Sock;
|
||||
/* Host this socket is connected to */
|
||||
std::string TargetHost;
|
||||
/* Port we're connected to */
|
||||
int Port;
|
||||
/* IP this socket is bound to */
|
||||
std::string BindHost;
|
||||
/* Is this an IPv6 socket? */
|
||||
bool IPv6;
|
||||
|
||||
/* Messages to be written to the socket */
|
||||
std::string WriteBuffer;
|
||||
/* Part of a message not totally yet recieved */
|
||||
std::string extrabuf;
|
||||
/* How much data was recieved from the socket */
|
||||
size_t RecvLen;
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
* @param nTargetHost Hostname to connect to
|
||||
* @param nPort Port to connect to
|
||||
* @param nBindHos Host to bind to when connecting
|
||||
* @param nIPv6 true to use IPv6
|
||||
/* I/O functions used for this socket */
|
||||
SocketIO *IO;
|
||||
|
||||
/* Type this socket is */
|
||||
SocketType Type;
|
||||
|
||||
/** Empty constructor, used for things such as the pipe socket
|
||||
*/
|
||||
Socket(const std::string &nTargetHost, int nPort, const std::string &nBindHost = "", bool nIPv6 = false);
|
||||
Socket();
|
||||
|
||||
/** Default constructor
|
||||
* @param sock The socket to use, 0 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);
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
virtual ~Socket();
|
||||
|
||||
/** Get the socket FD for this socket
|
||||
* @return The fd
|
||||
* @return the fd
|
||||
*/
|
||||
virtual int GetSock() const;
|
||||
int GetFD() const;
|
||||
|
||||
/** Check if this socket is IPv6
|
||||
* @return true or false
|
||||
*/
|
||||
bool IsIPv6() const;
|
||||
|
||||
/** Called when there is something to be read from thie socket
|
||||
* @return true on success, false to kill this socket
|
||||
/** Mark a socket as blockig
|
||||
* @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();
|
||||
|
||||
/** Called when there is something to be received for this socket
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
virtual bool ProcessRead();
|
||||
|
||||
/** Called when this socket becomes writeable
|
||||
/** Called when the socket is ready to be written to
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
virtual bool ProcessWrite();
|
||||
|
||||
/** Called when there is an error on this socket
|
||||
/** Called when there is an error for this socket
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
virtual void ProcessError();
|
||||
};
|
||||
|
||||
/** Called with a message recieved from the socket
|
||||
* @param buf The message
|
||||
* @return true on success, false to kill this socket
|
||||
class CoreExport BufferedSocket : public Socket
|
||||
{
|
||||
protected:
|
||||
/* Things to be written to the socket */
|
||||
std::string WriteBuffer;
|
||||
/* Part of a message sent from the server, but not totally received */
|
||||
std::string extrabuf;
|
||||
/* How much data was received from this socket */
|
||||
size_t RecvLen;
|
||||
|
||||
public:
|
||||
/** Blank constructor
|
||||
*/
|
||||
virtual bool Read(const std::string &buf);
|
||||
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();
|
||||
|
||||
/** Called when the socket is ready to be written to
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
bool ProcessWrite();
|
||||
|
||||
/** Called with a line received from the socket
|
||||
* @param buf The line
|
||||
* @return true to continue reading, false to drop the socket
|
||||
*/
|
||||
virtual bool Read(const Anope::string &buf);
|
||||
|
||||
/** Write to the socket
|
||||
* @param message The message to write
|
||||
*/
|
||||
* @param message The message
|
||||
*/
|
||||
void Write(const char *message, ...);
|
||||
void Write(std::string &message);
|
||||
void Write(const Anope::string &message);
|
||||
|
||||
/** Get the length of the read buffer
|
||||
* @return The length of the read buffer
|
||||
@@ -129,57 +289,102 @@ class CoreExport Socket
|
||||
size_t WriteBufferLen() const;
|
||||
};
|
||||
|
||||
class CoreExport SocketEngine
|
||||
class CoreExport ListenSocket : public Socket
|
||||
{
|
||||
private:
|
||||
/* List of sockets that need to be deleted */
|
||||
std::set<Socket *> OldSockets;
|
||||
/* FDs to read */
|
||||
fd_set ReadFDs;
|
||||
/* FDs that want writing */
|
||||
fd_set WriteFDs;
|
||||
/* Max FD */
|
||||
int MaxFD;
|
||||
protected:
|
||||
/* Sockaddrs for bindip/port */
|
||||
sockaddrs listenaddrs;
|
||||
|
||||
/** Unmark a socket as writeable
|
||||
* @param s The socket
|
||||
*/
|
||||
void ClearWriteable(Socket *s);
|
||||
public:
|
||||
/* Set of sockets */
|
||||
std::set<Socket *> Sockets;
|
||||
|
||||
/** Constructor
|
||||
* @param bindip The IP to bind to
|
||||
* @param port The port to listen on
|
||||
* @param ipv6 true for ipv6
|
||||
*/
|
||||
SocketEngine();
|
||||
ListenSocket(const Anope::string &bindip, int port, bool ipv6);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
virtual ~SocketEngine();
|
||||
virtual ~ListenSocket();
|
||||
|
||||
/** Add a socket to the socket engine
|
||||
* @param s The socket
|
||||
/** Process what has come in from the connection
|
||||
* @return false to destory this socket
|
||||
*/
|
||||
void AddSocket(Socket *s);
|
||||
bool ProcessRead();
|
||||
|
||||
/** Delete a socket from the socket engine
|
||||
* @param s The socket
|
||||
/** Called when a connection is accepted
|
||||
* @param fd The FD for the new connection
|
||||
* @param addr The sockaddr for where the connection came from
|
||||
* @return The new socket
|
||||
*/
|
||||
void DelSocket(Socket *s);
|
||||
|
||||
/** Mark a socket as wanting to be written to
|
||||
* @param s The socket
|
||||
*/
|
||||
void MarkWriteable(Socket *s);
|
||||
|
||||
/** Called to iterate through each socket and check for activity
|
||||
*/
|
||||
void Process();
|
||||
|
||||
/** Get the last socket error
|
||||
* @return The error
|
||||
*/
|
||||
const std::string GetError() const;
|
||||
virtual ClientSocket *OnAccept(int fd, const sockaddrs &addr);
|
||||
};
|
||||
|
||||
#endif
|
||||
class CoreExport ConnectionSocket : public BufferedSocket
|
||||
{
|
||||
public:
|
||||
/* Sockaddrs for bindip (if there is one) */
|
||||
sockaddrs bindaddr;
|
||||
/* Sockaddrs for connection ip/port */
|
||||
sockaddrs conaddr;
|
||||
|
||||
/** Constructor
|
||||
* @param ipv6 true to use IPv6
|
||||
* @param type The socket type, defaults to SOCK_STREAM
|
||||
*/
|
||||
ConnectionSocket(bool ipv6 = false, int type = SOCK_STREAM);
|
||||
|
||||
/** Connect the socket
|
||||
* @param TargetHost The target host to connect to
|
||||
* @param Port The target port to connect to
|
||||
* @param BindHost The host to bind to for connecting
|
||||
*/
|
||||
void Connect(const Anope::string &TargetHost, int Port, const Anope::string &BindHost = "");
|
||||
};
|
||||
|
||||
class CoreExport ClientSocket : public BufferedSocket
|
||||
{
|
||||
public:
|
||||
/* Listen socket this connection came from */
|
||||
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);
|
||||
};
|
||||
|
||||
class CoreExport Pipe : public BufferedSocket
|
||||
{
|
||||
public:
|
||||
/** The FD of the write pipe (if this isn't evenfd)
|
||||
* this->Sock is the readfd
|
||||
*/
|
||||
int WritePipe;
|
||||
|
||||
/** Constructor
|
||||
*/
|
||||
Pipe();
|
||||
|
||||
/** Called when data is to be read
|
||||
*/
|
||||
bool ProcessRead();
|
||||
|
||||
/** Function that calls OnNotify
|
||||
*/
|
||||
bool Read(const Anope::string &);
|
||||
|
||||
/** Called when this pipe needs to be woken up
|
||||
*/
|
||||
void Notify();
|
||||
|
||||
/** Should be overloaded to do something useful
|
||||
*/
|
||||
virtual void OnNotify();
|
||||
};
|
||||
|
||||
#endif // SOCKET_H
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
#ifndef _SYSCONF_H_
|
||||
#define _SYSCONF_H_
|
||||
|
||||
#cmakedefine DEBUG_BUILD
|
||||
|
||||
#cmakedefine DEFUMASK @DEFUMASK@
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
#cmakedefine HAVE_STDDEF_H 1
|
||||
#cmakedefine HAVE_BACKTRACE 1
|
||||
#cmakedefine HAVE_GETHOSTBYNAME 1
|
||||
#cmakedefine HAVE_GETTIMEOFDAY 1
|
||||
#cmakedefine HAVE_SETGRENT 1
|
||||
#cmakedefine HAVE_STRCASECMP 1
|
||||
#cmakedefine HAVE_STRICMP 1
|
||||
#cmakedefine HAVE_STRINGS_H 1
|
||||
#cmakedefine HAVE_STRLCAT 1
|
||||
#cmakedefine HAVE_STRLCPY 1
|
||||
#cmakedefine HAVE_SYS_SELECT_H 1
|
||||
#cmakedefine HAVE_UMASK 1
|
||||
#cmakedefine HAVE_EVENTFD 1
|
||||
#cmakedefine GETTEXT_FOUND 1
|
||||
#cmakedefine RUNGROUP "@RUNGROUP@"
|
||||
#cmakedefine SERVICES_BIN "@SERVICES_BIN@"
|
||||
|
||||
#cmakedefine HAVE_UINT8_T 1
|
||||
#cmakedefine HAVE_U_INT8_T 1
|
||||
@@ -101,9 +101,6 @@ typedef unsigned long uint32;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef MSVCPP
|
||||
# define snprintf _snprintf
|
||||
# endif
|
||||
# define popen _popen
|
||||
# define pclose _pclose
|
||||
# define ftruncate _chsize
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
#ifndef _SYSCONF_H_
|
||||
#define _SYSCONF_H_
|
||||
|
||||
#undef DEFUMASK
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
#undef HAVE_STDINT_H
|
||||
#undef HAVE_STDDEF_H
|
||||
#undef HAVE_BACKTRACE
|
||||
#undef HAVE_GETHOSTBYNAME
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
#undef HAVE_SETGRENT
|
||||
#undef HAVE_STRCASECMP
|
||||
#undef HAVE_STRICMP
|
||||
#undef HAVE_STRINGS_H
|
||||
#undef HAVE_STRLCAT
|
||||
#undef HAVE_STRLCPY
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
#undef HAVE_UMASK
|
||||
#undef RUNGROUP
|
||||
#define SERVICES_BIN "services"
|
||||
|
||||
#undef HAVE_UINT8_T
|
||||
#undef HAVE_U_INT8_T
|
||||
#undef HAVE_INT16_T
|
||||
#undef HAVE_UINT16_T
|
||||
#undef HAVE_U_INT16_T
|
||||
#undef HAVE_INT32_T
|
||||
#undef HAVE_UINT32_T
|
||||
#undef HAVE_U_INT32_T
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#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
|
||||
# ifdef MSVCPP
|
||||
# define snprintf _snprintf
|
||||
# endif
|
||||
# define popen _popen
|
||||
# define pclose _pclose
|
||||
# define ftruncate _chsize
|
||||
# ifdef MSVCPP
|
||||
# define PATH_MAX MAX_PATH
|
||||
# endif
|
||||
# define MAXPATHLEN MAX_PATH
|
||||
# define bzero(buf, size) memset(buf, 0, size)
|
||||
# ifdef MSVCPP
|
||||
# define strcasecmp stricmp
|
||||
# endif
|
||||
# define sleep(x) Sleep(x * 1000)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,138 @@
|
||||
#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
|
||||
|
||||
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
|
||||
{
|
||||
private:
|
||||
/* Set to true to tell the thread to finish and we are waiting for it */
|
||||
bool exit;
|
||||
|
||||
public:
|
||||
/* Handle for this thread */
|
||||
ThreadHandle Handle;
|
||||
|
||||
/** Threads constructor
|
||||
*/
|
||||
Thread();
|
||||
|
||||
/** Threads destructor
|
||||
*/
|
||||
virtual ~Thread();
|
||||
|
||||
/** Join to the thread, sets the exit state to true
|
||||
*/
|
||||
void Join();
|
||||
|
||||
/** Sets the exit state as true informing the thread we want it to shut down
|
||||
*/
|
||||
void SetExitState();
|
||||
|
||||
/** Exit the thread. Note that the thread still must be joined to free resources!
|
||||
*/
|
||||
void Exit();
|
||||
|
||||
/** 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
|
||||
*/
|
||||
virtual void Run();
|
||||
};
|
||||
|
||||
class CoreExport Mutex
|
||||
{
|
||||
protected:
|
||||
/* A mutex, used to keep threads in sync */
|
||||
MutexHandle mutex;
|
||||
|
||||
public:
|
||||
/** Constructor
|
||||
*/
|
||||
Mutex();
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~Mutex();
|
||||
|
||||
/** Attempt to lock the mutex, will hang until a lock can be achieved
|
||||
*/
|
||||
void Lock();
|
||||
|
||||
/** Unlock the mutex, it must be locked first
|
||||
*/
|
||||
void Unlock();
|
||||
|
||||
/** Attempt to lock the mutex, will return true on success and false on fail
|
||||
* Does not block
|
||||
* @return true or false
|
||||
*/
|
||||
bool TryLock();
|
||||
};
|
||||
|
||||
class CoreExport Condition : public Mutex
|
||||
{
|
||||
private:
|
||||
/* A condition */
|
||||
CondHandle cond;
|
||||
|
||||
public:
|
||||
/** Constructor
|
||||
*/
|
||||
Condition();
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
~Condition();
|
||||
|
||||
/** Called to wakeup the waiter
|
||||
*/
|
||||
void Wakeup();
|
||||
|
||||
/** Called to wait for a Wakeup() call
|
||||
*/
|
||||
void Wait();
|
||||
};
|
||||
|
||||
#endif // THREADENGINE_H
|
||||
+85
-88
@@ -1,14 +1,11 @@
|
||||
/* Timer include stuff.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* (C) 2003-2011 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef TIMERS_H
|
||||
@@ -22,64 +19,64 @@
|
||||
|
||||
class CoreExport Timer : public Extensible
|
||||
{
|
||||
private:
|
||||
/** The time this was created
|
||||
*/
|
||||
time_t settime;
|
||||
|
||||
/** The triggering time
|
||||
*/
|
||||
time_t trigger;
|
||||
|
||||
/** Numer of seconds between triggers
|
||||
*/
|
||||
long secs;
|
||||
|
||||
/** True if this is a repeating timer
|
||||
*/
|
||||
bool repeat;
|
||||
|
||||
public:
|
||||
/** Default 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 = time(NULL), bool repeating = false);
|
||||
|
||||
/** Default destructor, removes the timer from the list
|
||||
*/
|
||||
virtual ~Timer();
|
||||
|
||||
/** Set the trigger time to a new value
|
||||
* @param t The new time
|
||||
*/
|
||||
void SetTimer(time_t t);
|
||||
|
||||
/** Retrieve the triggering time
|
||||
* @return The trigger time
|
||||
*/
|
||||
const time_t GetTimer();
|
||||
|
||||
/** Returns true if the timer is set to repeat
|
||||
* @return Returns true if the timer is set to repeat
|
||||
*/
|
||||
const bool GetRepeat();
|
||||
|
||||
/** Returns the interval between ticks
|
||||
* @return The interval
|
||||
*/
|
||||
const long GetSecs();
|
||||
|
||||
/** Returns the time this timer was created
|
||||
* @return The time this timer was created
|
||||
*/
|
||||
const time_t GetSetTime();
|
||||
|
||||
/** Called when the timer ticks
|
||||
* This should be overridden with something useful
|
||||
*/
|
||||
virtual void Tick(time_t ctime) = 0;
|
||||
private:
|
||||
/** The time this was created
|
||||
*/
|
||||
time_t settime;
|
||||
|
||||
/** The triggering time
|
||||
*/
|
||||
time_t trigger;
|
||||
|
||||
/** Numer of seconds between triggers
|
||||
*/
|
||||
long secs;
|
||||
|
||||
/** True if this is a repeating timer
|
||||
*/
|
||||
bool repeat;
|
||||
|
||||
public:
|
||||
/** Default 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
|
||||
*/
|
||||
virtual ~Timer();
|
||||
|
||||
/** Set the trigger time to a new value
|
||||
* @param t The new time
|
||||
*/
|
||||
void SetTimer(time_t t);
|
||||
|
||||
/** Retrieve the triggering time
|
||||
* @return The trigger time
|
||||
*/
|
||||
time_t GetTimer() const;
|
||||
|
||||
/** Returns true if the timer is set to repeat
|
||||
* @return Returns true if the timer is set to repeat
|
||||
*/
|
||||
bool GetRepeat() const;
|
||||
|
||||
/** Returns the interval between ticks
|
||||
* @return The interval
|
||||
*/
|
||||
long GetSecs() const;
|
||||
|
||||
/** Returns the time this timer was created
|
||||
* @return The time this timer was created
|
||||
*/
|
||||
time_t GetSetTime() const;
|
||||
|
||||
/** Called when the timer ticks
|
||||
* This should be overridden with something useful
|
||||
*/
|
||||
virtual void Tick(time_t ctime) = 0;
|
||||
};
|
||||
|
||||
/** This class manages sets of Timers, and triggers them at their defined times.
|
||||
@@ -88,29 +85,29 @@ class CoreExport Timer : public Extensible
|
||||
*/
|
||||
class CoreExport TimerManager : public Extensible
|
||||
{
|
||||
protected:
|
||||
/** A list of timers
|
||||
*/
|
||||
static std::vector<Timer *> Timers;
|
||||
public:
|
||||
/** Add a timer to the list
|
||||
* @param T A Timer derived class to add
|
||||
*/
|
||||
static void AddTimer(Timer *T);
|
||||
|
||||
/** Deletes a timer
|
||||
* @param T A Timer derived class to delete
|
||||
*/
|
||||
static void DelTimer(Timer *T);
|
||||
|
||||
/** Tick all pending timers
|
||||
* @param ctime The current time
|
||||
*/
|
||||
static void TickTimers(time_t ctime = time(NULL));
|
||||
|
||||
/** Compares two timers
|
||||
*/
|
||||
static bool TimerComparison(Timer *one, Timer *two);
|
||||
protected:
|
||||
/** A list of timers
|
||||
*/
|
||||
static std::vector<Timer *> Timers;
|
||||
public:
|
||||
/** Add a timer to the list
|
||||
* @param T A Timer derived class to add
|
||||
*/
|
||||
static void AddTimer(Timer *T);
|
||||
|
||||
/** Deletes a timer
|
||||
* @param T A Timer derived class to delete
|
||||
*/
|
||||
static void DelTimer(Timer *T);
|
||||
|
||||
/** Tick all pending timers
|
||||
* @param ctime The current time
|
||||
*/
|
||||
static void TickTimers(time_t ctime = Anope::CurTime);
|
||||
|
||||
/** Compares two timers
|
||||
*/
|
||||
static bool TimerComparison(Timer *one, Timer *two);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // TIMERS_H
|
||||
|
||||
+112
-86
@@ -1,18 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 Robin Burchell <w00t@inspircd.org>
|
||||
* Copyright (C) 2008-2010 Anope Team <team@anope.org>
|
||||
* Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
|
||||
* Copyright (C) 2008-2011 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef USERS_H
|
||||
#define USERS_H
|
||||
|
||||
extern CoreExport Anope::insensitive_map<User *> UserListByNick;
|
||||
extern CoreExport Anope::map<User *> UserListByUID;
|
||||
|
||||
class CoreExport ChannelStatus : public Flags<ChannelModeName, CMODE_END * 2>
|
||||
{
|
||||
public:
|
||||
ChannelStatus();
|
||||
Anope::string BuildCharPrefixList() const;
|
||||
Anope::string BuildModePrefixList() const;
|
||||
};
|
||||
|
||||
struct ChannelContainer
|
||||
{
|
||||
Channel *chan;
|
||||
Flags<ChannelModeName> *Status;
|
||||
ChannelStatus *Status;
|
||||
|
||||
ChannelContainer(Channel *c) : chan(c) { }
|
||||
virtual ~ChannelContainer() { }
|
||||
@@ -24,125 +34,129 @@ typedef std::list<ChannelContainer *> UChannelList;
|
||||
class CoreExport User : public Extensible
|
||||
{
|
||||
protected:
|
||||
std::string vident;
|
||||
std::string ident;
|
||||
std::string uid;
|
||||
bool OnAccess; /* If the user is on the access list of the nick theyre on */
|
||||
std::bitset<128> modes; /* Bitset of mode names the user has set on them */
|
||||
std::map<UserModeName, std::string> Params; /* Map of user modes and the params this user has */
|
||||
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 */
|
||||
|
||||
public: // XXX: exposing a tiny bit too much
|
||||
User *next, *prev;
|
||||
Anope::string nick; /* User's current nick */
|
||||
|
||||
std::string nick; /* User's current 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? */
|
||||
|
||||
char *host; /* User's real hostname */
|
||||
char *hostip; /* User's IP number */
|
||||
char *vhost; /* User's virtual hostname */
|
||||
std::string chost; /* User's cloaked hostname */
|
||||
char *realname; /* Realname */
|
||||
Server *server; /* Server user is connected to */
|
||||
time_t timestamp; /* Timestamp of the nick */
|
||||
time_t my_signon; /* When did _we_ see the user? */
|
||||
|
||||
int isSuperAdmin; /* is SuperAdmin on or off? */
|
||||
int isSuperAdmin; /* is SuperAdmin on or off? */
|
||||
|
||||
/* Channels the user is in */
|
||||
UChannelList chans;
|
||||
|
||||
unsigned short invalid_pw_count; /* # of invalid password attempts */
|
||||
time_t invalid_pw_time; /* Time of last invalid password */
|
||||
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 */
|
||||
|
||||
time_t lastnickreg; /* Last time NS REGISTER cmd used */
|
||||
time_t lastmail; /* Last time this user sent a mail */
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/** Create a new user object, initialising necessary fields and
|
||||
* adds it to the hash
|
||||
*
|
||||
* @param nick The nickname of the user.
|
||||
* @param uid The unique identifier of the user.
|
||||
* @param snick The nickname of the user.
|
||||
* @param sident The username of the user
|
||||
* @param shost The hostname of the user
|
||||
* @param suid The unique identifier of the user.
|
||||
*/
|
||||
User(const std::string &nick, const std::string &uid);
|
||||
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &suid);
|
||||
|
||||
/** Destroy a user.
|
||||
*/
|
||||
~User();
|
||||
virtual ~User();
|
||||
|
||||
/** Update the nickname of a user record accordingly, should be
|
||||
* called from ircd protocol.
|
||||
*/
|
||||
virtual void SetNewNick(const std::string &newnick);
|
||||
void SetNewNick(const Anope::string &newnick);
|
||||
|
||||
/** Update the displayed (vhost) of a user record.
|
||||
* This is used (if set) instead of real host.
|
||||
* @param host The new displayed host to give the user.
|
||||
*/
|
||||
void SetDisplayedHost(const std::string &host);
|
||||
void SetDisplayedHost(const Anope::string &host);
|
||||
|
||||
/** Get the displayed vhost of a user record.
|
||||
* @return The displayed vhost of the user, where ircd-supported, or the user's real host.
|
||||
*/
|
||||
const std::string GetDisplayedHost() const;
|
||||
const Anope::string &GetDisplayedHost() const;
|
||||
|
||||
/** Update the cloaked host of a user
|
||||
* @param host The cloaked host
|
||||
*/
|
||||
void SetCloakedHost(const std::string &newhost);
|
||||
void SetCloakedHost(const Anope::string &newhost);
|
||||
|
||||
/** Get the cloaked host of a user
|
||||
* @return The cloaked host
|
||||
*/
|
||||
const std::string &GetCloakedHost() const;
|
||||
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.
|
||||
* @return The UID of the user.
|
||||
*/
|
||||
const std::string &GetUID() const;
|
||||
const Anope::string &GetUID() const;
|
||||
|
||||
/** Update the displayed ident (username) of a user record.
|
||||
* @param ident The new ident to give this user.
|
||||
*/
|
||||
void SetVIdent(const std::string &ident);
|
||||
void SetVIdent(const Anope::string &ident);
|
||||
|
||||
/** Get the displayed ident (username) of this user.
|
||||
* @return The displayed ident of this user.
|
||||
*/
|
||||
const std::string &GetVIdent() const;
|
||||
const Anope::string &GetVIdent() const;
|
||||
|
||||
/** Update the real ident (username) of a user record.
|
||||
* @param ident The new ident to give this user.
|
||||
* NOTE: Where possible, you should use the Get/SetVIdent() equivilants.
|
||||
*/
|
||||
void SetIdent(const std::string &ident);
|
||||
void SetIdent(const Anope::string &ident);
|
||||
|
||||
/** Get the real ident (username) of this user.
|
||||
* @return The displayed ident of this user.
|
||||
* NOTE: Where possible, you should use the Get/SetVIdent() equivilants.
|
||||
*/
|
||||
const std::string &GetIdent() const;
|
||||
const Anope::string &GetIdent() const;
|
||||
|
||||
/** Get the full mask ( nick!ident@realhost ) of a user
|
||||
*/
|
||||
const std::string GetMask();
|
||||
Anope::string GetMask() const;
|
||||
|
||||
/** Get the full display mask (nick!vident@vhost/chost)
|
||||
*/
|
||||
Anope::string GetDisplayedMask() const;
|
||||
|
||||
/** Updates the realname of the user record.
|
||||
*/
|
||||
void SetRealname(const std::string &realname);
|
||||
void SetRealname(const Anope::string &realname);
|
||||
|
||||
/**
|
||||
* Send a message (notice or privmsg, depending on settings) to a user
|
||||
* @param source Sender nick
|
||||
* @param source Sender
|
||||
* @param fmt Format of the Message
|
||||
* @param ... any number of parameters
|
||||
*/
|
||||
virtual void SendMessage(const std::string &source, const char *fmt, ...);
|
||||
virtual void SendMessage(const std::string &source, const std::string &msg);
|
||||
void SendMessage(BotInfo *source, const char *fmt, ...);
|
||||
virtual void SendMessage(BotInfo *source, Anope::string msg);
|
||||
|
||||
/** Collide a nick
|
||||
* See the comment in users.cpp
|
||||
@@ -150,16 +164,12 @@ class CoreExport User : public Extensible
|
||||
*/
|
||||
void Collide(NickAlias *na);
|
||||
|
||||
/** Check if the user should become identified because
|
||||
* their svid matches the one stored in their nickcore
|
||||
* @param svid Services id
|
||||
/** Identify the user to the Nick
|
||||
* updates last_seen, logs the user in,
|
||||
* send messages, checks for mails, set vhost and more
|
||||
* @param the NickAlias
|
||||
*/
|
||||
void CheckAuthenticationToken(const char *svid);
|
||||
|
||||
/** Auto identify the user to the given accountname.
|
||||
* @param account Display nick of account
|
||||
*/
|
||||
void AutoID(const std::string &account);
|
||||
void Identify(NickAlias *na);
|
||||
|
||||
/** Login the user to a NickCore
|
||||
* @param core The account the user is useing
|
||||
@@ -171,36 +181,54 @@ class CoreExport User : public Extensible
|
||||
void Logout();
|
||||
|
||||
/** Get the account the user is logged in using
|
||||
* @reurn The account or NULL
|
||||
* @return The account or NULL
|
||||
*/
|
||||
virtual NickCore *Account() const;
|
||||
virtual NickCore *Account();
|
||||
|
||||
/** 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
|
||||
* @return true or false
|
||||
*/
|
||||
virtual const bool IsIdentified(bool CheckNick = false) const;
|
||||
virtual bool IsIdentified(bool CheckNick = false);
|
||||
|
||||
/** 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
|
||||
* @return true or false
|
||||
*/
|
||||
virtual const bool IsRecognized() const;
|
||||
virtual bool IsRecognized(bool CheckSecure = false);
|
||||
|
||||
/** Check if the user is a services oper
|
||||
* @return true if they are an oper
|
||||
*/
|
||||
bool IsServicesOper();
|
||||
|
||||
/** Check whether this user has access to run the given command string.
|
||||
* @param cmdstr The string to check, e.g. botserv/set/private.
|
||||
* @return True if this user may run the specified command, false otherwise.
|
||||
*/
|
||||
bool HasCommand(const Anope::string &cmdstr);
|
||||
|
||||
/** Check whether this user has access to the given special permission.
|
||||
* @param privstr The priv to check for, e.g. users/auspex.
|
||||
* @return True if this user has the specified priv, false otherwise.
|
||||
*/
|
||||
bool HasPriv(const Anope::string &privstr);
|
||||
|
||||
/** Update the last usermask stored for a user, and check to see if they are recognized
|
||||
*/
|
||||
void UpdateHost();
|
||||
|
||||
/** Check if the user has a mode
|
||||
* @param Name Mode name
|
||||
* @return true or false
|
||||
*/
|
||||
const bool HasMode(UserModeName Name) const;
|
||||
/** Check if the user has a mode
|
||||
* @param Name Mode name
|
||||
* @return true or false
|
||||
*/
|
||||
bool HasMode(UserModeName 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 std::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
|
||||
@@ -212,21 +240,14 @@ class CoreExport User : public Extensible
|
||||
* @param um The user mode
|
||||
* @param Param Optional param for the mode
|
||||
*/
|
||||
void SetMode(BotInfo *bi, UserMode *um, const std::string &Param = "");
|
||||
void SetMode(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 Param Optional param for the mode
|
||||
*/
|
||||
void SetMode(BotInfo *bi, UserModeName Name, const std::string &Param = "");
|
||||
|
||||
/* Set a mode on the user
|
||||
* @param bi The client setting the mode
|
||||
* @param ModeChar The mode char
|
||||
* @param param Optional param for the mode
|
||||
*/
|
||||
void SetMode(BotInfo *bi, char ModeChar, const std::string &Param = "");
|
||||
void SetMode(BotInfo *bi, UserModeName Name, const Anope::string &Param = "");
|
||||
|
||||
/** Remove a mode on the user
|
||||
* @param bi The client setting the mode
|
||||
@@ -240,17 +261,16 @@ class CoreExport User : public Extensible
|
||||
*/
|
||||
void RemoveMode(BotInfo *bi, UserModeName Name);
|
||||
|
||||
/** Remove a mode from the user
|
||||
* @param bi The client setting the mode
|
||||
* @param ModeChar The mode char
|
||||
*/
|
||||
void RemoveMode(BotInfo *bi, char ModeChar);
|
||||
|
||||
/** Set a string of modes on a user
|
||||
* @param bi The client setting the mode
|
||||
* @param modes The modes
|
||||
* @param bi The client setting the modes
|
||||
* @param umodes The modes
|
||||
*/
|
||||
void SetModes(BotInfo *bi, const char *modes, ...);
|
||||
void SetModes(BotInfo *bi, const char *umodes, ...);
|
||||
|
||||
/** Set a string of modes on a user internally
|
||||
* @param umodes The modes
|
||||
*/
|
||||
void SetModesInternal(const char *umodes, ...);
|
||||
|
||||
/** Find the channel container for Channel c that the user is on
|
||||
* This is preferred over using FindUser in Channel, as there are usually more users in a channel
|
||||
@@ -258,6 +278,12 @@ class CoreExport User : public Extensible
|
||||
* @param c The channel
|
||||
* @return The channel container, or NULL
|
||||
*/
|
||||
ChannelContainer *FindChannel(Channel *c);
|
||||
ChannelContainer *FindChannel(const Channel *c);
|
||||
|
||||
/** Check if the user is protected from kicks and negative mode changes
|
||||
* @return true or false
|
||||
*/
|
||||
bool IsProtected() const;
|
||||
};
|
||||
|
||||
#endif // USERS_H
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/* Build bumper
|
||||
*
|
||||
* (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.
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
std::cout << "Syntax: " << argv[0] << " <src/version.sh> <version.h>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::fstream fd;
|
||||
|
||||
fd.clear();
|
||||
fd.open(argv[1], std::ios::in);
|
||||
if (!fd.is_open())
|
||||
{
|
||||
std::cout << "Error: Unable to open src/version.sh for reading: " << argv[1] << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string filebuf;
|
||||
std::list<std::pair<std::string, std::string> > versions;
|
||||
while (getline(fd, filebuf))
|
||||
{
|
||||
if (!filebuf.find("VERSION_"))
|
||||
{
|
||||
size_t eq = filebuf.find('=');
|
||||
|
||||
std::string type = filebuf.substr(8, 5);
|
||||
std::string value = filebuf.substr(eq + 2, filebuf.length() - eq - 3);
|
||||
versions.push_back(std::make_pair(type, value));
|
||||
}
|
||||
}
|
||||
|
||||
fd.close();
|
||||
|
||||
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"))
|
||||
{
|
||||
size_t tab = filebuf.find(' ');
|
||||
|
||||
int ibuild = atoi(filebuf.substr(tab + 1).c_str()) + 1;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "#define BUILD " << ibuild;
|
||||
build = ss.str();
|
||||
}
|
||||
}
|
||||
|
||||
fd.close();
|
||||
}
|
||||
|
||||
fd.clear();
|
||||
fd.open(argv[2], std::ios::out);
|
||||
|
||||
if (!fd.is_open())
|
||||
{
|
||||
std::cout << "Error: Unable to include/version.h for writing: " << argv[2] << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
fd << "/* This file is automatically generated by version.cpp - do not edit it! */" << std::endl;
|
||||
|
||||
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;
|
||||
else
|
||||
fd << "#define VERSION_" << it->first << " " << it->second << std::endl;
|
||||
}
|
||||
|
||||
fd << version_build << std::endl;
|
||||
fd << build << std::endl;
|
||||
|
||||
fd.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Build version string and increment Services build number.
|
||||
#
|
||||
|
||||
if [ $# -lt 2 ] ; then
|
||||
echo "Syntax: $0 <version.log> <version.h>"
|
||||
exit 1
|
||||
fi
|
||||
# Grab version information from the version control file.
|
||||
CTRL="$1"
|
||||
if [ -f $CTRL ] ; then
|
||||
. $CTRL
|
||||
else
|
||||
echo "Error: Unable to find control file: $CTRL"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_EXTRA} (${VERSION_BUILD})"
|
||||
VERSIONDOTTED="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_EXTRA}.${VERSION_BUILD}"
|
||||
|
||||
VERSIONH="$2"
|
||||
if [ -f $VERSIONH ] ; then
|
||||
BUILD=`fgrep '#define BUILD' $VERSIONH | cut -f2 -d\"`
|
||||
BUILD=`expr $BUILD + 1 2>/dev/null`
|
||||
else
|
||||
BUILD=1
|
||||
fi
|
||||
if [ ! "$BUILD" ] ; then
|
||||
BUILD=1
|
||||
fi
|
||||
cat >$VERSIONH <<EOF
|
||||
/* Version information for Services.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and CREDITS for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* This file is auto-generated by version.sh
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#define VERSION_MAJOR $VERSION_MAJOR
|
||||
#define VERSION_MINOR $VERSION_MINOR
|
||||
#define VERSION_PATCH $VERSION_PATCH
|
||||
#define VERSION_EXTRA "$VERSION_EXTRA"
|
||||
#define VERSION_BUILD $VERSION_BUILD
|
||||
|
||||
#define BUILD "$BUILD"
|
||||
#define VERSION_STRING "$VERSION"
|
||||
#define VERSION_STRING_DOTTED "$VERSIONDOTTED"
|
||||
|
||||
#if defined(_WIN32)
|
||||
# if _MSC_VER >= 1400
|
||||
# define VER_OS "W"
|
||||
# else
|
||||
# define VER_OS "w"
|
||||
# endif
|
||||
#else
|
||||
# define VER_OS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
EOF
|
||||
|
||||
@@ -1,238 +0,0 @@
|
||||
/* version file handler for win32.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* Written by Dominick Meglio <codemastr@unrealircd.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/* Needed due to Windows lack of a decent interpreter */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <cstdlib>
|
||||
#include <cctype>
|
||||
|
||||
long version_major, version_minor, version_patch, version_build, build;
|
||||
char *version_extra = NULL;
|
||||
char version[1024];
|
||||
char version_dotted[1024];
|
||||
|
||||
|
||||
void load_ctrl(FILE *);
|
||||
long get_value(char *);
|
||||
char *get_value_str(char *);
|
||||
char *strip(char *);
|
||||
void parse_version(FILE *);
|
||||
void write_version(FILE *, const char *);
|
||||
void parse_line(FILE *, char *);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 4) {
|
||||
fprintf(stderr, "Syntax: %s <version.log> <version.sh> <version.h>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
FILE *fd = fopen(argv[1], "r");
|
||||
|
||||
|
||||
if (!fd) {
|
||||
fprintf(stderr, "Error: Unable to find control file: %s\n", argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
load_ctrl(fd);
|
||||
fclose(fd);
|
||||
|
||||
_snprintf(version, 1024, "%ld.%ld.%ld%s (%ld)", version_major, version_minor,
|
||||
version_patch, (version_extra ? version_extra : ""), version_build);
|
||||
|
||||
_snprintf(version_dotted, 1024, "%ld.%ld.%ld%s.%ld", version_major, version_minor,
|
||||
version_patch, (version_extra ? version_extra : ""), version_build);
|
||||
|
||||
fd = fopen(argv[3], "r");
|
||||
|
||||
if (fd) {
|
||||
parse_version(fd);
|
||||
fclose(fd);
|
||||
} else
|
||||
build = 1;
|
||||
|
||||
|
||||
fd = fopen(argv[3], "w");
|
||||
write_version(fd, argv[2]);
|
||||
fclose(fd);
|
||||
|
||||
if (version_extra)
|
||||
free(version_extra);
|
||||
}
|
||||
|
||||
void load_ctrl(FILE * fd)
|
||||
{
|
||||
char buf[512];
|
||||
while (fgets(buf, 511, fd)) {
|
||||
char *var;
|
||||
|
||||
strip(buf);
|
||||
|
||||
var = strtok(buf, "=");
|
||||
if (!var)
|
||||
continue;
|
||||
if (!strcmp(var, "VERSION_MAJOR"))
|
||||
version_major = get_value(strtok(NULL, ""));
|
||||
else if (!strcmp(var, "VERSION_MINOR"))
|
||||
version_minor = get_value(strtok(NULL, ""));
|
||||
else if (!strcmp(var, "VERSION_PATCH"))
|
||||
version_patch = get_value(strtok(NULL, ""));
|
||||
else if (!strcmp(var, "VERSION_BUILD"))
|
||||
version_build = get_value(strtok(NULL, ""));
|
||||
else if (!strcmp(var, "VERSION_EXTRA"))
|
||||
version_extra = get_value_str(strtok(NULL, ""));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
char *strip(char *str)
|
||||
{
|
||||
char *c;
|
||||
if ((c = strchr(str, '\n')))
|
||||
*c = 0;
|
||||
if ((c = strchr(str, '\r')))
|
||||
*c = 0;
|
||||
return str;
|
||||
}
|
||||
|
||||
long get_value(char *string)
|
||||
{
|
||||
// XXX : if the fields in version.log are empty strtok returns a double quote, dont try to atol it then
|
||||
if (string[1] != '"')
|
||||
return atol(get_value_str(string));
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *get_value_str(char *string)
|
||||
{
|
||||
int len;
|
||||
char *newstr;
|
||||
|
||||
if (*string == '"')
|
||||
string++;
|
||||
|
||||
len = strlen(string);
|
||||
|
||||
if (string[len - 1] == '"')
|
||||
string[len - 1] = 0;
|
||||
if (!*string)
|
||||
return NULL;
|
||||
newstr = (char *)malloc(len + 1);
|
||||
strcpy(newstr, string);
|
||||
return newstr;
|
||||
//return strdup(string);
|
||||
}
|
||||
|
||||
void parse_version(FILE * fd)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
while (fgets(buf, 1023, fd)) {
|
||||
char *para1;
|
||||
|
||||
strip(buf);
|
||||
para1 = strtok(buf, " \t");
|
||||
|
||||
if (!para1)
|
||||
continue;
|
||||
|
||||
if (!strcmp(para1, "#define")) {
|
||||
char *para2 = strtok(NULL, " \t");
|
||||
|
||||
if (!para2)
|
||||
continue;
|
||||
|
||||
if (!strcmp(para2, "BUILD")) {
|
||||
char *value = strtok(NULL, "");
|
||||
build = get_value(value);
|
||||
build++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
build = 1;
|
||||
}
|
||||
|
||||
void write_version(FILE * fd, const char *input)
|
||||
{
|
||||
FILE *fdin = fopen(input, "r");
|
||||
char buf[1024];
|
||||
short until_eof = 0;
|
||||
|
||||
while (fgets(buf, 1023, fdin)) {
|
||||
strip(buf);
|
||||
|
||||
if (until_eof)
|
||||
{
|
||||
if (!strcmp(buf, "EOF"))
|
||||
break;
|
||||
else
|
||||
parse_line(fd, buf);
|
||||
}
|
||||
|
||||
if (!strcmp(buf, "cat >$VERSIONH <<EOF"))
|
||||
until_eof = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void parse_line(FILE * fd, char *line)
|
||||
{
|
||||
char *c;
|
||||
for (c = line; *c; c++) {
|
||||
/* It's a variable, find out which */
|
||||
if (*c == '$') {
|
||||
char *var, *varbegin;
|
||||
|
||||
if (*(c + 1))
|
||||
c++;
|
||||
else
|
||||
continue;
|
||||
for (var = varbegin = c; var; var++) {
|
||||
if (!isalnum(*var) && *var != '_')
|
||||
break;
|
||||
}
|
||||
if (var != varbegin) {
|
||||
char tmp = *var;
|
||||
|
||||
*var = 0;
|
||||
if (!strcmp(varbegin, "VERSION_MAJOR"))
|
||||
fprintf(fd, "%ld", version_major);
|
||||
else if (!strcmp(varbegin, "VERSION_MINOR"))
|
||||
fprintf(fd, "%ld", version_minor);
|
||||
else if (!strcmp(varbegin, "VERSION_PATCH"))
|
||||
fprintf(fd, "%ld", version_patch);
|
||||
else if (!strcmp(varbegin, "VERSION_EXTRA")) {
|
||||
if (version_extra)
|
||||
fprintf(fd, "%s", version_extra);
|
||||
} else if (!strcmp(varbegin, "VERSION_BUILD"))
|
||||
fprintf(fd, "%ld", version_build);
|
||||
else if (!strcmp(varbegin, "BUILD"))
|
||||
fprintf(fd, "%ld", build);
|
||||
else if (!strcmp(varbegin, "VERSION"))
|
||||
fprintf(fd, "%s", version);
|
||||
else if (!strcmp(varbegin, "VERSIONDOTTED"))
|
||||
fprintf(fd, "%s", version_dotted);
|
||||
if (tmp) fputc(tmp, fd);
|
||||
}
|
||||
c = var;
|
||||
} else
|
||||
fputc(*c, fd);
|
||||
}
|
||||
/* We only need \n here - we didn't open the file as binary -GD */
|
||||
fprintf(fd, "\n");
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SRC= ; DEST= ; MODE= ; USER= ; GROUP= ; export SRC DEST MODE USER GROUP
|
||||
while [ $# -gt 0 ] ; do
|
||||
case $1 in
|
||||
-m) MODE=$2; shift; shift;;
|
||||
-u) USER=$2; shift; shift;;
|
||||
-g) GROUP=$2; shift; shift;;
|
||||
-c) shift;;
|
||||
*) SRC="$DEST"; DEST="$1"; shift;;
|
||||
esac
|
||||
done
|
||||
if [ ! "$DEST" ] ; then
|
||||
echo >&2 "Usage: $0 [-c] [-m mode] [-u user] [-g group] source dest"
|
||||
exit 1
|
||||
fi
|
||||
if [ -d "$DEST" ] ; then
|
||||
DEST="$DEST/$SRC"
|
||||
fi
|
||||
/bin/cp -p "$SRC" "$DEST"
|
||||
if [ "$MODE" ] ; then
|
||||
/bin/chmod $MODE "$DEST"
|
||||
fi
|
||||
if [ "$USER" ] ; then
|
||||
/bin/chown "$USER" "$DEST"
|
||||
fi
|
||||
if [ "$GROUP" ] ; then
|
||||
/bin/chgrp "$GROUP" "$DEST"
|
||||
fi
|
||||
-310
@@ -1,310 +0,0 @@
|
||||
//
|
||||
// install.js - Windows Configuration
|
||||
//
|
||||
// (C) 2003-2010 Anope Team
|
||||
// Contact us at team@anope.org
|
||||
//
|
||||
// This program is free but copyrighted software; see the file COPYING for
|
||||
// details.
|
||||
//
|
||||
// Based on the original code of Epona by Lara.
|
||||
// Based on the original code of Services by Andy Church.
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
var anopeVersion = "Unknown";
|
||||
var vMaj, vMin, vPat, vBuild, vExtra;
|
||||
|
||||
var installerResponses = new Array();
|
||||
|
||||
var installerQuestions = [
|
||||
{
|
||||
'question' : [
|
||||
'In what directory do you want Anope to be installed?'
|
||||
],
|
||||
'short' : 'Install directory:',
|
||||
'default_answer' : '',
|
||||
'store_answer' : function(answer) {
|
||||
if (!answer)
|
||||
{
|
||||
WScript.Echo("You must give a directory!\n");
|
||||
return false;
|
||||
}
|
||||
if (!fso.FolderExists(answer))
|
||||
{
|
||||
if (fso.FileExists(answer))
|
||||
{
|
||||
WScript.Echo(answer + " exists, but is not a directory!\n");
|
||||
return false;
|
||||
}
|
||||
WScript.Echo(answer + " does not exist. Create it ([yes]/no)?\n");
|
||||
var inputValue = InstallerInput().toLowerCase();
|
||||
if (!inputValue)
|
||||
inputValue = 'yes';
|
||||
if (inputValue != 'no')
|
||||
fso.CreateFolder(answer);
|
||||
}
|
||||
else if (fso.FileExists(answer + '\\include\\services.h'))
|
||||
{
|
||||
WScript.Echo("You cannot use the Anope source directory as a target directory.\n");
|
||||
return false;
|
||||
}
|
||||
installerResponses['Install Directory'] = answer.replace(/\\/g, '/');
|
||||
return true;
|
||||
},
|
||||
'cmake_argument' : function() {
|
||||
return '-DINSTDIR:STRING="' + installerResponses['Install Directory'] + '"';
|
||||
}
|
||||
},
|
||||
{
|
||||
'question' : [
|
||||
'Would you like to build using NMake instead of using Visual Studio?',
|
||||
'NOTE: If you decide to use NMake, you must be in an environment where',
|
||||
' NMake can function, such as the Visual Studio command line.',
|
||||
' If you say yes to this while not in an environment that can run',
|
||||
' NMake, it can cause the CMake configuration to enter an endless',
|
||||
' loop.'
|
||||
],
|
||||
'short' : 'Use NMake?',
|
||||
'options' : [
|
||||
'yes',
|
||||
'no'
|
||||
],
|
||||
'default_answer' : 'no',
|
||||
'store_answer' : function(answer) {
|
||||
installerResponses['Use NMake'] = answer;
|
||||
return true;
|
||||
},
|
||||
'cmake_argument' : function() {
|
||||
if (installerResponses['Use NMake'] == 'yes')
|
||||
return '-G"NMake Makefiles"';
|
||||
else
|
||||
return '';
|
||||
}
|
||||
},
|
||||
{
|
||||
'question' : [
|
||||
'Would you like to build a debug version of Anope?'
|
||||
],
|
||||
'short' : 'Build debug?',
|
||||
'options' : [
|
||||
'yes',
|
||||
'no'
|
||||
],
|
||||
'default_answer' : 'no',
|
||||
'store_answer' : function(answer) {
|
||||
installerResponses['Debug'] = answer;
|
||||
return true;
|
||||
},
|
||||
'cmake_argument' : function() {
|
||||
if (installerResponses['Debug'] == 'msvc')
|
||||
return '';
|
||||
else if (installerResponses['Debug'] == 'yes')
|
||||
return '-DCMAKE_BUILD_TYPE:STRING=DEBUG';
|
||||
else
|
||||
return '-DCMAKE_BUILD_TYPE:STRING=RELEASE';
|
||||
}
|
||||
},
|
||||
{
|
||||
'question' : [
|
||||
'Are you using Visual Studio 2008? If you are, you need to answer yes',
|
||||
'to this question, otherwise CMake will not function properly.'
|
||||
],
|
||||
'short' : 'Using Visual Studio 2008?',
|
||||
'options' : [
|
||||
'yes',
|
||||
'no'
|
||||
],
|
||||
'default_answer' : 'no',
|
||||
'store_answer' : function(answer) {
|
||||
installerResponses['Visual Studio 2008'] = answer;
|
||||
return true;
|
||||
},
|
||||
'cmake_argument' : function() {
|
||||
if (installerResponses['Visual Studio 2008'] == 'yes')
|
||||
return '-G"Visual Studio 9 2008"';
|
||||
else
|
||||
return '';
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
var bannerReplacements = [
|
||||
{
|
||||
'findtext' : /CURVER/g,
|
||||
'replacement' : function() { FindAnopeVersion(); return anopeVersion; }
|
||||
},
|
||||
{
|
||||
'findtext' : / For more options type SOURCE_DIR\/Config --help/g,
|
||||
'replacement' : function() { return ''; }
|
||||
}
|
||||
];
|
||||
|
||||
var ScriptPath = WScript.ScriptFullName.substr(0, WScript.ScriptFullName.length - WScript.ScriptName.length);
|
||||
|
||||
var fso = WScript.CreateObject('Scripting.FileSystemObject');
|
||||
var x, y, z;
|
||||
|
||||
if (fso.FileExists(ScriptPath + '.BANNER'))
|
||||
{
|
||||
var bannerStream = fso.OpenTextFile(ScriptPath + '.BANNER');
|
||||
var bannerText = bannerStream.ReadAll();
|
||||
bannerStream.close();
|
||||
|
||||
for (x in bannerReplacements)
|
||||
{
|
||||
var thisReplacement = bannerReplacements[x];
|
||||
bannerText = bannerText.replace(thisReplacement['findtext'], thisReplacement['replacement']);
|
||||
}
|
||||
|
||||
WScript.Echo(bannerText + "\n");
|
||||
}
|
||||
else
|
||||
WScript.Echo("ERROR: Cannot find banner file!\n");
|
||||
|
||||
WScript.Echo('Press Enter to Begin...');
|
||||
InstallerInput();
|
||||
WScript.Echo('');
|
||||
|
||||
for (x in installerQuestions)
|
||||
{
|
||||
var thisQuestion = installerQuestions[x];
|
||||
var validResponse = false;
|
||||
var validOpts = new Array();
|
||||
if (thisQuestion.short == 'Build debug?' && installerResponses['Use NMake'] == 'no')
|
||||
{
|
||||
installerResponses['Debug'] = 'msvc';
|
||||
continue;
|
||||
}
|
||||
if (thisQuestion.short == 'Using Visual Studio 2008?' && installerResponses['Debug'] != 'msvc')
|
||||
{
|
||||
installerResponses['Visual Studio 2008'] = 'no';
|
||||
continue;
|
||||
}
|
||||
while (!validResponse)
|
||||
{
|
||||
for (y in thisQuestion.question)
|
||||
{
|
||||
var qLine = thisQuestion.question[y];
|
||||
WScript.Echo(qLine);
|
||||
}
|
||||
WScript.Echo('');
|
||||
var choiceLine = '';
|
||||
if (thisQuestion.options)
|
||||
{
|
||||
for (y in thisQuestion.options)
|
||||
{
|
||||
choiceLine += thisQuestion.options[y] + ', ';
|
||||
validOpts[thisQuestion.options[y]] = true;
|
||||
}
|
||||
choiceLine = choiceLine.substring(0, choiceLine.length - 2);
|
||||
WScript.Echo('Available Options: ' + choiceLine);
|
||||
}
|
||||
if (thisQuestion.default_answer)
|
||||
WScript.Echo('Default Answer: ' + thisQuestion.default_answer + "\n");
|
||||
WScript.Echo(thisQuestion.short);
|
||||
var inputValue = InstallerInput().toLowerCase();
|
||||
if (!inputValue)
|
||||
inputValue = thisQuestion.default_answer;
|
||||
if (choiceLine && !validOpts[inputValue])
|
||||
WScript.Echo("ERROR: Invalid option '" + inputValue + "'\n");
|
||||
else if (thisQuestion.store_answer(inputValue))
|
||||
validResponse = true;
|
||||
}
|
||||
WScript.Echo('');
|
||||
}
|
||||
|
||||
WScript.Echo("\nAnope will be compiled with the following options:\n");
|
||||
for (x in installerResponses)
|
||||
{
|
||||
var thisResponse = installerResponses[x];
|
||||
WScript.Echo("\t" + x + ":\t\t[" + thisResponse.toUpperCase() + "]");
|
||||
}
|
||||
WScript.Echo("\tAnope Version:\t\t\t" + anopeVersion);
|
||||
WScript.Echo("\nTo continue, please press Enter...");
|
||||
InstallerInput();
|
||||
|
||||
var cmake = 'cmake';
|
||||
for (x in installerQuestions)
|
||||
{
|
||||
var thisQuestion = installerQuestions[x];
|
||||
cmake += ' ' + thisQuestion.cmake_argument();
|
||||
}
|
||||
var fixedScriptPath = ScriptPath.replace(/\\/g, '/');
|
||||
cmake += ' "' + fixedScriptPath + '"';
|
||||
WScript.Echo(cmake + "\n");
|
||||
|
||||
var shell = WScript.CreateObject('WScript.Shell');
|
||||
var cmake_shell = shell.exec('%comspec% /c ' + cmake);
|
||||
while (!cmake_shell.Status)
|
||||
{
|
||||
if (!cmake_shell.StdOut.AtEndOfStream)
|
||||
WScript.Echo(cmake_shell.StdOut.ReadLine());
|
||||
else if (!cmake_shell.StdErr.AtEndOfStream)
|
||||
WScript.Echo(cmake_shell.StdErr.ReadLine());
|
||||
}
|
||||
|
||||
if (cmake_shell.ExitCode == 0)
|
||||
{
|
||||
if (installerResponses['Use NMake'] == 'yes') WScript.Echo("\nTo compile Anope, run 'nmake'. To install, run 'nmake install'.\n");
|
||||
else WScript.Echo("\nTo compile Anope, open Anope.sln and build the solution. To install,\ndo a build on the INSTALL project.\n");
|
||||
WScript.Echo("If you update Anope, you should run this script again to ensure\nall available options are set.\n");
|
||||
}
|
||||
else
|
||||
WScript.Echo("\nThere was an error attempting to run CMake! Check the above error message,\nand contact the Anope team if you are unsure how to proceed.\n");
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// Functions
|
||||
|
||||
function FindAnopeVersion() {
|
||||
if (!fso.FileExists(ScriptPath + 'version.log'))
|
||||
{
|
||||
anopeVersion = 'Unknown';
|
||||
return;
|
||||
}
|
||||
|
||||
var versionLog = fso.OpenTextFile(ScriptPath + 'version.log');
|
||||
while (!versionLog.atEndOfStream)
|
||||
{
|
||||
var versionLine = versionLog.readline();
|
||||
var thisMatch = versionLine.replace('\n', '');
|
||||
while (thisMatch.match(/\"/g))
|
||||
thisMatch = thisMatch.replace('"', '');
|
||||
versionLine = thisMatch;
|
||||
if (versionLine.match(/VERSION_MAJOR=/g))
|
||||
{
|
||||
vMaj = versionLine.replace('VERSION_MAJOR=', '');
|
||||
continue;
|
||||
}
|
||||
if (versionLine.match(/VERSION_MINOR=/g))
|
||||
{
|
||||
vMin = versionLine.replace('VERSION_MINOR=', '');
|
||||
continue;
|
||||
}
|
||||
if (versionLine.match(/VERSION_PATCH=/g))
|
||||
{
|
||||
vPat = versionLine.replace('VERSION_PATCH=', '');
|
||||
continue;
|
||||
}
|
||||
if (versionLine.match(/VERSION_EXTRA=/g))
|
||||
{
|
||||
vExtra = versionLine.replace('VERSION_EXTRA=', '');
|
||||
continue;
|
||||
}
|
||||
if (versionLine.match(/VERSION_BUILD=/g))
|
||||
{
|
||||
vBuild = versionLine.replace('VERSION_BUILD=', '');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
versionLog.close();
|
||||
anopeVersion = vMaj + '.' + vMin + '.' + vPat + '.' + vBuild + vExtra;
|
||||
return;
|
||||
}
|
||||
|
||||
function InstallerInput() {
|
||||
var input = WScript.StdIn.Readline();
|
||||
return input;
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
# Set the source file for langcomp to use C++ as well as set it's compile flags
|
||||
set_source_files_properties(langcomp.c PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
# Generate langcomp and set it's linker flags
|
||||
add_executable(langcomp langcomp.c)
|
||||
set_target_properties(langcomp PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
|
||||
# Get the location of the binary to use later
|
||||
get_target_property(langcomp_BINARY langcomp LOCATION)
|
||||
# Add the executable to the list of files for CPack to ignore
|
||||
file(RELATIVE_PATH langcomp_BINARY_RELATIVE ${Anope_BINARY_DIR} ${langcomp_BINARY})
|
||||
add_to_cpack_ignored_files("${langcomp_BINARY_RELATIVE}$" TRUE)
|
||||
|
||||
# Determine if langtool should be built
|
||||
if(MSVC)
|
||||
set(BUILD_LANGTOOL TRUE)
|
||||
else(MSVC)
|
||||
if(NOT GREP OR NOT PERL)
|
||||
set(BUILD_LANGTOOL TRUE)
|
||||
else(NOT GREP OR NOT PERL)
|
||||
set(BUILD_LANGTOOL FALSE)
|
||||
endif(NOT GREP OR NOT PERL)
|
||||
endif(MSVC)
|
||||
|
||||
# If grep or perl don't exist on the system, build langtool to generate index and language.h
|
||||
if(BUILD_LANGTOOL)
|
||||
# Set the source file for langtool to use C++ as well as set it's compile flags
|
||||
set_source_files_properties(langtool.c PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
# Generate langtool and set it's linker flags
|
||||
add_executable(langtool langtool.c)
|
||||
set_target_properties(langtool PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
|
||||
# Get the location of the binary to use later)
|
||||
get_target_property(langtool_BINARY langtool LOCATION)
|
||||
# Add the executable to the list of files for CPack to ignore
|
||||
file(RELATIVE_PATH langtool_BINARY_RELATIVE ${Anope_BINARY_DIR} ${langtool_BINARY})
|
||||
add_to_cpack_ignored_files("${langtool_BINARY_RELATIVE}$" TRUE)
|
||||
endif(BUILD_LANGTOOL)
|
||||
|
||||
# If grep exists (and we aren't using Visual Studio, it hates this), use it to generate the index file
|
||||
if(NOT MSVC AND GREP)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/index
|
||||
COMMAND ${GREP} '^[A-Z]' ${CMAKE_CURRENT_SOURCE_DIR}/en_us.l > ${CMAKE_CURRENT_BINARY_DIR}/index
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/en_us.l
|
||||
)
|
||||
# Otherwise, use langtool to generate the index file
|
||||
else(NOT MSVC AND GREP)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/index
|
||||
COMMAND ${langtool_BINARY} index ${CMAKE_CURRENT_SOURCE_DIR}/en_us.l ${CMAKE_CURRENT_BINARY_DIR}/index
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/en_us.l DEPENDS langtool
|
||||
)
|
||||
endif(NOT MSVC AND GREP)
|
||||
# Add the index file to the list of files for CPack to ignore
|
||||
file(RELATIVE_PATH index_RELATIVE ${Anope_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/index)
|
||||
add_to_cpack_ignored_files("${index_RELATIVE}$")
|
||||
|
||||
# Find all the *.l files within the current source directory, and sort the list
|
||||
file(GLOB LANG_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.l")
|
||||
sort_list(LANG_SRCS)
|
||||
|
||||
# Iterate through the language files
|
||||
foreach(LANG_L ${LANG_SRCS})
|
||||
# Convert the language file's extension to have no extension
|
||||
STRING(REGEX REPLACE "\\.l$" "" LANG ${LANG_L})
|
||||
# Add the language file to the list of compiled language files
|
||||
append_to_list(LANGS ${CMAKE_CURRENT_BINARY_DIR}/${LANG})
|
||||
# Generate a compiled language file using langcomp, as well as having a dependency on the index file being generated
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${LANG}
|
||||
COMMAND ${langcomp_BINARY} ${CMAKE_CURRENT_SOURCE_DIR}/${LANG_L} ${CMAKE_CURRENT_BINARY_DIR}/${LANG}
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${LANG_L} DEPENDS langcomp ${CMAKE_CURRENT_BINARY_DIR}/index
|
||||
)
|
||||
# Add the language file to the list of files for CPack to ignore
|
||||
file(RELATIVE_PATH LANG_RELATIVE ${Anope_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${LANG})
|
||||
add_to_cpack_ignored_files("${LANG_RELATIVE}$")
|
||||
endforeach(LANG_L)
|
||||
|
||||
# If perl exists (and we aren't using Visual Studio, it hates this), use it to generate language.h
|
||||
if(NOT MSVC AND PERL)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/language.h
|
||||
COMMAND ${PERL} -e < ${CMAKE_CURRENT_BINARY_DIR}/index > ${CMAKE_CURRENT_BINARY_DIR}/language.h 'print STDERR \"Generating language.h... \"\; $$i=0\; while \(<>\) { chop\; printf \"\#define %-32s %d\\n\", $$_, $$i++\; } print \"\\n\#define NUM_STRINGS $$i\\n\"\; print STDERR \"$$i strings\\n\"\;'
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/index
|
||||
)
|
||||
# Otherwise, use langtool to generate language.h
|
||||
else(NOT MSVC AND PERL)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/language.h
|
||||
COMMAND ${langtool_BINARY} language.h ${CMAKE_CURRENT_BINARY_DIR}/index ${CMAKE_CURRENT_BINARY_DIR}/language.h
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/index DEPENDS langtool
|
||||
)
|
||||
endif(NOT MSVC AND PERL)
|
||||
# Add language.h to the list of files for CPack to ignore
|
||||
add_to_cpack_ignored_files("language.h$" TRUE)
|
||||
|
||||
# Add a custom target to depend on the language files and language.h
|
||||
add_custom_target(language DEPENDS ${LANGS} ${CMAKE_CURRENT_BINARY_DIR}/language.h)
|
||||
|
||||
# If RUNGROUP was set, make the permissions be to have owner read/write as well as group read/write
|
||||
if(RUNGROUP)
|
||||
set(PERMS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE)
|
||||
# Otherwise, only make the permissions be owner read/write
|
||||
else(RUNGROUP)
|
||||
set(PERMS OWNER_READ OWNER_WRITE)
|
||||
endif(RUNGROUP)
|
||||
# Set the language files to be installed to the languages directory under the data directory
|
||||
install(FILES ${LANGS}
|
||||
DESTINATION data/languages
|
||||
PERMISSIONS ${PERMS}
|
||||
)
|
||||
|
||||
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the languages directory
|
||||
if(NOT WIN32)
|
||||
if(RUNGROUP)
|
||||
install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\${CMAKE_INSTALL_PREFIX}/data/languages\")")
|
||||
else(RUNGROUP)
|
||||
install(CODE "execute_process(COMMAND ${CHMOD} 0700 \"\${CMAKE_INSTALL_PREFIX}/data/languages\")")
|
||||
endif(RUNGROUP)
|
||||
endif(NOT WIN32)
|
||||
@@ -1,82 +0,0 @@
|
||||
# Makefile for language module
|
||||
|
||||
MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \
|
||||
'LDFLAGS=${LDFLAGS}' 'INSTDIR=${INSTDIR}' 'INSTALL=${INSTALL}' \
|
||||
'INCLUDEDIR=${INCLUDEDIR}' 'RM=${RM}' 'CP=${CP}' \
|
||||
'TOUCH=${TOUCH}' 'SHELL=${SHELL}' \
|
||||
'RUNGROUP=${RUNGROUP}' 'MAKEBIN=${MAKEBIN}'
|
||||
|
||||
LANGOBJS = cat de en_us es fr gr hun it nl pl pt ru tr
|
||||
LANGSRCS = cat.l de.l en_us.l es.l fr.l gr.l hun.l it.l nl.l pl.l pt.l ru.l tr.l
|
||||
|
||||
LANGCOMP = ./langcomp
|
||||
#LANGCOMP = ./langcomp -w
|
||||
|
||||
|
||||
all: $(LANGOBJS)
|
||||
|
||||
distclean: clean spotless
|
||||
|
||||
install: all
|
||||
test -d $(INSTDIR)/data/languages || mkdir $(INSTDIR)/data/languages
|
||||
@if [ "$(RUNGROUP)" ] ; then \
|
||||
echo chgrp -R $(RUNGROUP) $(INSTDIR)/data/languages ; \
|
||||
chgrp -R $(RUNGROUP) $(INSTDIR)/data/languages ; \
|
||||
echo chmod -R g+rw $(INSTDIR)/data/languages ; \
|
||||
chmod -R g+rw $(INSTDIR)/data/languages ; \
|
||||
$(CP) $(LANGOBJS) $(INSTDIR)/data/languages ; \
|
||||
echo chgrp -R $(RUNGROUP) $(INSTDIR)/data/languages ; \
|
||||
chgrp -R $(RUNGROUP) $(INSTDIR)/data/languages/* ; \
|
||||
echo chmod -R g+rw $(INSTDIR)/data/languages/* ; \
|
||||
chmod -R g+rw $(INSTDIR)/data/languages/* ; \
|
||||
fi
|
||||
@if [ ! "$(RUNGROUP)" ] ; then \
|
||||
chmod 700 $(INSTDIR)/data/languages/ ; \
|
||||
$(CP) $(LANGOBJS) $(INSTDIR)/data/languages ; \
|
||||
chmod 600 $(INSTDIR)/data/languages/* ; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
rm -f $(LANGOBJS) langcomp language.h
|
||||
|
||||
spotless: clean
|
||||
rm -f index
|
||||
|
||||
|
||||
cat: cat.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
de: de.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
en_us: en_us.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
es: es.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
fr: fr.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
gr: gr.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
hun: hun.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
it: it.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
nl: nl.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
pl: pl.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
pt: pt.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
ru: ru.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
tr: tr.l langcomp index
|
||||
@./langcomp $@.l $@
|
||||
|
||||
langcomp: langcomp.c
|
||||
$(MAKEBIN) $(CC) $(CFLAGS) langcomp.c -o $@
|
||||
|
||||
|
||||
language.h: index Makefile
|
||||
@perl -e <index >$@ 'print STDERR "Generating language.h... "; $$i=0; while (<>) { chop; printf "#define %-32s %d\n", $$_, $$i++; } print "\n#define NUM_STRINGS $$i\n"; print STDERR "$$i strings\n";'
|
||||
@cp language.h ../include
|
||||
|
||||
index: en_us.l
|
||||
@grep '^[A-Z]' en_us.l >index
|
||||
-6667
File diff suppressed because it is too large
Load Diff
-6338
File diff suppressed because it is too large
Load Diff
-6439
File diff suppressed because it is too large
Load Diff
-264
@@ -1,264 +0,0 @@
|
||||
/* Compiler for language definition files.
|
||||
*
|
||||
* (C) 2003-2010 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.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* A language definition file contains all strings which Services sends to
|
||||
* users in a particular language. A language file may contain comments
|
||||
* (lines beginning with "#") and blank lines. All other lines must adhere
|
||||
* to the following format:
|
||||
*
|
||||
* Each string definition begins with the C name of a message (as defined
|
||||
* in the file "index"--see below). This must be alone on a line, preceded
|
||||
* and followed by no blank space. Following this line are zero or more
|
||||
* lines of text; each line of text must begin with exactly one tab
|
||||
* character, which is discarded. Newlines are retained in the strings,
|
||||
* except the last newline in the text, which is discarded. A message with
|
||||
* no text is replaced by a null pointer in the array (not an empty
|
||||
* string).
|
||||
*
|
||||
* All messages in the program are listed, one per line, in the "index"
|
||||
* file. No comments or blank lines are permitted in that file. The index
|
||||
* file can be generated from a language file with a command like:
|
||||
* grep '^[A-Z]' en_us.l >index
|
||||
*
|
||||
* This program takes one parameter, the name of the language file. It
|
||||
* generates a compiled language file whose name is created by removing any
|
||||
* extension on the source file on the input filename.
|
||||
*
|
||||
* You may also pass a "-w" option to print warnings for missing strings.
|
||||
*
|
||||
* This program isn't very flexible, because it doesn't need to be, but
|
||||
* anyone who wants to try making it more flexible is welcome to.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#undef getline
|
||||
|
||||
int numstrings = 0; /* Number of strings we should have */
|
||||
char **stringnames; /* Names of the strings (from index file) */
|
||||
char **strings; /* Strings we have loaded */
|
||||
|
||||
int linenum = 0; /* Current line number in input file */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
char *anopeStrDup(const char *src);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Read the index file and load numstrings and stringnames. Return -1 on
|
||||
* error, 0 on success. */
|
||||
|
||||
int read_index_file()
|
||||
{
|
||||
FILE *f;
|
||||
char buf[256];
|
||||
int i;
|
||||
|
||||
if (!(f = fopen("index", "rb"))) {
|
||||
perror("fopen(index)");
|
||||
return -1;
|
||||
}
|
||||
while (fgets(buf, sizeof(buf), f))
|
||||
numstrings++;
|
||||
if (!(stringnames = static_cast<char **>(calloc(sizeof(char *), numstrings)))) {
|
||||
perror("calloc(stringnames)");
|
||||
return -1;
|
||||
}
|
||||
if (!(strings = static_cast<char **>(calloc(sizeof(char *), numstrings)))) {
|
||||
perror("calloc(strings)");
|
||||
return -1;
|
||||
}
|
||||
fseek(f, 0, SEEK_SET);
|
||||
i = 0;
|
||||
while (fgets(buf, sizeof(buf), f)) {
|
||||
if (buf[strlen(buf) - 1] == '\n')
|
||||
buf[strlen(buf) -1] = '\0';
|
||||
if (!(stringnames[i++] = anopeStrDup(buf))) {
|
||||
perror("strdup()");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Return the index of a string name in stringnames, or -1 if not found. */
|
||||
|
||||
int stringnum(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numstrings; i++) {
|
||||
if (strcmp(stringnames[i], name) == 0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Read a non-comment, non-blank line from the input file. Return NULL at
|
||||
* end of file. */
|
||||
|
||||
char *ano_getline(FILE *f)
|
||||
{
|
||||
static char buf[1024];
|
||||
char *s;
|
||||
|
||||
do {
|
||||
if (!(fgets(buf, sizeof(buf), f)))
|
||||
return NULL;
|
||||
linenum++;
|
||||
} while (*buf == '#' || *buf == '\n');
|
||||
s = buf + strlen(buf) - 1;
|
||||
if (*s == '\n')
|
||||
*s = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Write a 32-bit value to a file in big-endian order. */
|
||||
|
||||
int fput32(int val, FILE *f)
|
||||
{
|
||||
if (fputc(val >> 24, f) < 0 ||
|
||||
fputc(val >> 16, f) < 0 ||
|
||||
fputc(val >> 8, f) < 0 ||
|
||||
fputc(val, f) < 0
|
||||
) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
char *anopeStrDup(const char *src)
|
||||
{
|
||||
char *ret=NULL;
|
||||
if (src) {
|
||||
if ((ret = static_cast<char *>(malloc(strlen(src) + 1)))) {
|
||||
strcpy(ret,src);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
char *filename = NULL, *outfile;
|
||||
FILE *in, *out;
|
||||
int warn = 0;
|
||||
int retval = 0;
|
||||
int curstring = -2, i;
|
||||
char *line;
|
||||
int pos;
|
||||
int maxerr = 50; /* Max errors before we bail out */
|
||||
|
||||
if (ac >= 3 && strcmp(av[1], "-w") == 0) {
|
||||
warn = 1;
|
||||
av[1] = av[2];
|
||||
av[2] = av[3];
|
||||
ac--;
|
||||
}
|
||||
if (ac != 3) {
|
||||
fprintf(stderr, "Usage: %s [-w] <lang-file> <out-file>\n", av[0]);
|
||||
return 1;
|
||||
}
|
||||
filename = av[1];
|
||||
outfile = av[2];
|
||||
|
||||
if (read_index_file() < 0)
|
||||
return 1;
|
||||
if (!(in = fopen(filename, "rb"))) {
|
||||
perror(filename);
|
||||
return 1;
|
||||
}
|
||||
if (!(out = fopen(outfile, "wb"))) {
|
||||
perror(outfile);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (maxerr > 0 && (line = ano_getline(in)) != NULL) {
|
||||
if (*line == '\t') {
|
||||
if (curstring == -2) {
|
||||
fprintf(stderr, "%s:%d: Junk at beginning of file\n", filename, linenum);
|
||||
retval = 1;
|
||||
} else if (curstring >= 0) {
|
||||
line++;
|
||||
i = strings[curstring] ? strlen(strings[curstring]) : 0;
|
||||
if (!(strings[curstring] = static_cast<char *>(realloc(strings[curstring], i + strlen(line) + 2)))) {
|
||||
fprintf(stderr, "%s:%d: Out of memory!\n", filename, linenum);
|
||||
return 2;
|
||||
}
|
||||
snprintf(strings[curstring] + i, strlen(line) + 2, "%s\n", line);
|
||||
}
|
||||
} else {
|
||||
if ((curstring = stringnum(line)) < 0) {
|
||||
fprintf(stderr, "%s:%d: Unknown string name `%s'\n", filename, linenum, line);
|
||||
retval = 1;
|
||||
maxerr--;
|
||||
} else if (strings[curstring]) {
|
||||
fprintf(stderr, "%s:%d: Duplicate occurrence of string `%s'\n", filename, linenum, line);
|
||||
retval = 1;
|
||||
maxerr--;
|
||||
} else {
|
||||
if (!(strings[curstring] = static_cast<char *>(malloc(1)))) {
|
||||
fprintf(stderr, "%s:%d: Out of memory!\n", filename, linenum);
|
||||
return 2;
|
||||
}
|
||||
*strings[curstring] = '\0';
|
||||
}
|
||||
|
||||
if (maxerr == 0)
|
||||
fprintf(stderr, "%s:%d: Too many errors!\n", filename, linenum);
|
||||
}
|
||||
}
|
||||
|
||||
fput32(numstrings, out);
|
||||
pos = numstrings * 8 + 4;
|
||||
for (i = 0; i < numstrings; i++) {
|
||||
int len = strings[i] && *strings[i] ? strlen(strings[i]) - 1 : 0;
|
||||
fput32(pos, out);
|
||||
fput32(len, out);
|
||||
pos += len;
|
||||
}
|
||||
for (i = 0; i < numstrings; i++) {
|
||||
if (strings[i]) {
|
||||
if (*strings[i])
|
||||
strings[i][strlen(strings[i])-1] = '\0'; /* kill last \n */
|
||||
if (*strings[i])
|
||||
fputs(strings[i], out);
|
||||
} else if (warn) {
|
||||
fprintf(stderr, "%s: String `%s' missing\n", filename, stringnames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -1,76 +0,0 @@
|
||||
/* Language stuff generator for win32.
|
||||
*
|
||||
* (C) 2003-2010 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for furhter details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* Written by Dominick Meglio <codemastr@unrealircd.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <cstdlib>
|
||||
#include <cctype>
|
||||
|
||||
char *strip(char *str)
|
||||
{
|
||||
char *c;
|
||||
if ((c = strchr(str,'\n')))
|
||||
*c = 0;
|
||||
if ((c = strchr(str,'\r')))
|
||||
*c = 0;
|
||||
return str;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 4)
|
||||
exit(1);
|
||||
|
||||
/* Build the index file */
|
||||
if (!strcmp(argv[1], "index"))
|
||||
{
|
||||
FILE *fd = fopen(argv[2], "rb");
|
||||
FILE *fdout = fopen(argv[3], "wb");
|
||||
char buf[1024];
|
||||
if (!fd || !fdout)
|
||||
exit(2);
|
||||
|
||||
while (fgets(buf, 1023, fd))
|
||||
{
|
||||
if (isupper(*buf))
|
||||
fprintf(fdout, "%s", buf);
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fdout);
|
||||
}
|
||||
/* Build the language.h file */
|
||||
else if (!strcmp(argv[1], "language.h"))
|
||||
{
|
||||
FILE *fd = fopen(argv[2], "r");
|
||||
FILE *fdout = fopen(argv[3], "w");
|
||||
char buf[1024];
|
||||
int i = 0;
|
||||
|
||||
if (!fd || !fdout)
|
||||
exit(2);
|
||||
|
||||
fprintf(stderr, "Generating language.h... ");
|
||||
|
||||
while (fgets(buf, 1023, fd)) {
|
||||
fprintf(fdout, "#define %-32s %d\n", strip(buf), i++);
|
||||
}
|
||||
|
||||
fprintf(fdout, "#define NUM_STRINGS %d\n", i);
|
||||
fprintf(stderr, "%d strings\n", i);
|
||||
fclose(fd);
|
||||
fclose(fdout);
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user