summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-11 02:47:05 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-11 02:47:05 +0000
commit86e43f1f144cfd04b039a844959af1f7aec3e6da (patch)
treec5d5fb8b025d7066365afbf0d1e274e2bb5265cb
parent9d37cf1d5afeaa054f31e0df85275521410bde61 (diff)
Added support for permanent channels. This supports both permanent channel modes and the ability to have BotServ bots stay in the channel to keep it open.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2638 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes.lang7
-rw-r--r--TODO4
-rw-r--r--data/example.conf1
-rw-r--r--include/regchannel.h6
-rw-r--r--lang/cat.l36
-rw-r--r--lang/de.l36
-rw-r--r--lang/en_us.l38
-rw-r--r--lang/es.l36
-rw-r--r--lang/fr.l36
-rw-r--r--lang/gr.l36
-rw-r--r--lang/hun.l36
-rw-r--r--lang/it.l36
-rw-r--r--lang/nl.l36
-rw-r--r--lang/pl.l37
-rw-r--r--lang/pt.l36
-rw-r--r--lang/ru.l36
-rw-r--r--lang/tr.l36
-rw-r--r--src/bots.cpp9
-rw-r--r--src/channels.c41
-rw-r--r--src/config.c1
-rw-r--r--src/core/bs_unassign.c8
-rw-r--r--src/core/cs_info.c1
-rw-r--r--src/core/cs_register.c10
-rw-r--r--src/core/cs_set.c82
24 files changed, 629 insertions, 12 deletions
diff --git a/Changes.lang b/Changes.lang
index 1fd39adbc..8dba08c5e 100644
--- a/Changes.lang
+++ b/Changes.lang
@@ -23,12 +23,19 @@ Anope Version 1.9.2
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
*** Mod Strings:
CHAN_HELP_SET
CHAN_REGISTER_SYNTAX
CHAN_ACCESS_SYNTAX
CHAN_HELP_ACCESS
+ CHAN_HELP_SET
*** Del Strings:
CHAN_PASSWORD_IS
diff --git a/TODO b/TODO
index 2423c8c7c..d410a3b17 100644
--- a/TODO
+++ b/TODO
@@ -26,6 +26,7 @@ Legend:
[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..
[ ] Docs directory cleanup
+[x] Fix permanent channels support properly
Future
------
@@ -35,8 +36,7 @@ Future
[ ] Requires a rejig of how Alias vs Core works
[ ] Language charset stuff, including collation (1.9.1? phoenix?)
[ ] Add support for +k, +q, etc type umodes
-[ ] Fix permanent channels support properly. This will require removing do_sjoin().
- [ ] burn do_sjoin with fire
+[ ] burn do_sjoin with fire
[ ] 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
[ ] add overridden form of SendGlobops accepting BotInfo
diff --git a/data/example.conf b/data/example.conf
index 8e21845ba..9f1aba99c 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -916,6 +916,7 @@ chanserv
* level or superior to the target
* - topiclock: Disallow the topic to be changed except with ChanServ's TOPIC command
* - xop: Enable use of the xOP system
+ * - persist: Keep the channel open at all times
*
* This directive is optional, if left blank, the options will default to keetopic, secure, securefounder,
* and signkick. If you really want no defaults, use "none" by itself as the option.
diff --git a/include/regchannel.h b/include/regchannel.h
index 710437374..c094ac2af 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -49,6 +49,12 @@ enum ChannelInfoFlag
CI_XOP,
/* Channel is suspended */
CI_SUSPENDED,
+ /* Channel still exists when emptied, this can be caused by setting a perm
+ * channel mode (+P on InspIRCd) or /cs set #chan persist on.
+ * This keeps the service bot in the channel regardless if a +P type mode
+ * is set or not
+ */
+ CI_PERSIST,
CI_END
};
diff --git a/lang/cat.l b/lang/cat.l
index 7622f759c..c3d89784d 100644
--- a/lang/cat.l
+++ b/lang/cat.l
@@ -1229,6 +1229,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
xOP lists system for %s is now OFF.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET canal NOEXPIRE {ON | OFF}
@@ -1603,6 +1611,8 @@ CHAN_INFO_OPT_TOPICLOCK
Lock de tòpic
CHAN_INFO_OPT_XOP
Sistema de llistes xOP
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
Cap
CHAN_INFO_MODE_LOCK
@@ -2142,6 +2152,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN canal
BOT_UNASSIGN_UNASSIGNED
Ja no hi ha un bot assignat a %s.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4295,6 +4307,7 @@ CHAN_HELP_SET
TOPICLOCK El topic sols pot ser canviat amb
TOPIC
XOP Canvia el sistema de privilegis d'usuari
+ PERSIST Set the channel as permanent
Escriu %R%S HELP opció per més informació
sobre una opció en particular.
@@ -4500,6 +4513,29 @@ CHAN_HELP_SET_XOP
Canviar de llistes xOP al sistema de llistes d'accés no causa cap
problema.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Sintàxi: SET canal OPNOTICE {ON | OFF}
diff --git a/lang/de.l b/lang/de.l
index f1c0e06e5..7bd2cb3b1 100644
--- a/lang/de.l
+++ b/lang/de.l
@@ -1248,6 +1248,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
XOP System für %s ist jetzt OFF.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET channel NOEXPIRE {ON | OFF}
@@ -1610,6 +1618,8 @@ CHAN_INFO_OPT_TOPICLOCK
Topic-Sperre
CHAN_INFO_OPT_XOP
xOP Listen-System
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
Keine
CHAN_INFO_MODE_LOCK
@@ -2122,6 +2132,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN channel
BOT_UNASSIGN_UNASSIGNED
Der Bot von %s wurde entfernt.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4332,6 +4344,7 @@ CHAN_HELP_SET
OPNOTICE Sendet eine Notice wenn Op/Deop-Befehl
benutzt werden
XOP Schaltet das Listen System ein oder aus
+ PERSIST Set the channel as permanent
Tippe %R%S HELP Option für weitere Informationen
zu einem bestimmten Befehl.
@@ -4539,6 +4552,29 @@ CHAN_HELP_SET_XOP
Der Wechsel vom xOP System zum Access System fuktioniert
jedoch fehlerfrei.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Syntax: SET Channel OPNOTICE {ON | OFF}
diff --git a/lang/en_us.l b/lang/en_us.l
index e13805bf3..01ec81cdb 100644
--- a/lang/en_us.l
+++ b/lang/en_us.l
@@ -1204,6 +1204,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
xOP lists system for %s is now OFF.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET channel NOEXPIRE {ON | OFF}
@@ -1572,6 +1580,8 @@ CHAN_INFO_OPT_TOPICLOCK
Topic Lock
CHAN_INFO_OPT_XOP
xOP lists system
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
None
CHAN_INFO_MODE_LOCK
@@ -2078,7 +2088,9 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN chan
BOT_UNASSIGN_UNASSIGNED
There is no bot assigned to %s anymore.
-
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
+
# INFO responses
BOT_INFO_SYNTAX
INFO {chan | nick}
@@ -4134,6 +4146,7 @@ CHAN_HELP_SET
SIGNKICK Sign kicks that are done with KICK command
TOPICLOCK Topic can only be changed with TOPIC
XOP Toggle the user privilege system
+ PERSIST Set the channel as permanent
Type %R%S HELP SET option for more information on a
particular option.
@@ -4329,6 +4342,29 @@ CHAN_HELP_SET_XOP
Switching from xOP lists system to access list system
causes no problem though.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Syntax: SET channel OPNOTICE {ON | OFF}
diff --git a/lang/es.l b/lang/es.l
index 086483bd3..def1b880a 100644
--- a/lang/es.l
+++ b/lang/es.l
@@ -1227,6 +1227,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
El sistema de listas xOP para %s esta ahora Apagado.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET canal NOEXPIRE {ON | OFF}
@@ -1601,6 +1609,8 @@ CHAN_INFO_OPT_TOPICLOCK
Lock de topic
CHAN_INFO_OPT_XOP
Sistema de listas xOP
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
Ninguno
CHAN_INFO_MODE_LOCK
@@ -2113,6 +2123,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN canal
BOT_UNASSIGN_UNASSIGNED
Ya no hay un bot asignado a %s.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4267,6 +4279,7 @@ CHAN_HELP_SET
TOPIC
XOP Cambia el sistema de privilegios de
usuario
+ PERSIST Set the channel as permanent
Tipea %R%S HELP opcion para mayor informacion
acerca de una opcion en particular.
@@ -4472,6 +4485,29 @@ CHAN_HELP_SET_XOP
Cambiar de listas xOP al sistema de listas de acceso no causa
problema alguno.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Sintaxis: SET canal OPNOTICE {ON | OFF}
diff --git a/lang/fr.l b/lang/fr.l
index 6b3df809d..882e41e95 100644
--- a/lang/fr.l
+++ b/lang/fr.l
@@ -1240,6 +1240,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
Le système de xOP est maintenant INACTIF sur %s.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET canal NOEXPIRE {ON | OFF}
@@ -1613,6 +1621,8 @@ CHAN_INFO_OPT_TOPICLOCK
Verrouillage du topic
CHAN_INFO_OPT_XOP
Système de listes de xOPs
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
Aucune
CHAN_INFO_MODE_LOCK
@@ -2154,6 +2164,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN canal
BOT_UNASSIGN_UNASSIGNED
Il n'y a plus de bot attribué à %s.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4328,6 +4340,7 @@ CHAN_HELP_SET
TOPICLOCK Le topic peut uniquement être changé avec
TOPIC
XOP Change le système de privilèges utilisateurs
+ PERSIST Set the channel as permanent
Tapez %R%S HELP SET option pour plus d'informations sur
une option particulière.
@@ -4532,6 +4545,29 @@ CHAN_HELP_SET_XOP
Passer du système de listes de xOPs au système de liste
d'accès ne pose aucun problème par contre.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Syntaxe: SET canal OPNOTICE {ON | OFF}
diff --git a/lang/gr.l b/lang/gr.l
index 3dee9b58e..34f6264a1 100644
--- a/lang/gr.l
+++ b/lang/gr.l
@@ -1225,6 +1225,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
xOP lists system for %s is now OFF.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET channel NOEXPIRE {ON | OFF}
@@ -1605,6 +1613,8 @@ CHAN_INFO_OPT_TOPICLOCK
Êëåßäùìá ôïõ Topic
CHAN_INFO_OPT_XOP
xOP ëßóôá óõóôÞìáôïò
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
ÊáíÝíá
CHAN_INFO_MODE_LOCK
@@ -2144,6 +2154,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN chan
BOT_UNASSIGN_UNASSIGNED
Äåí õðÜñ÷åé bot ðïõ íá åßíáé óôï %s ôþñá ðéá.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4279,6 +4291,7 @@ CHAN_HELP_SET
SIGNKICK Åìöáí. kicks ôá ïðïßá ãßíïíôáé ìå ôçí åíôïëÞ KICK
TOPICLOCK Ôï Topic ìðïñåß íá áëëÜîåé ìå ôçí åíôïëÞ TOPIC
XOP Áí åßíáé ON äïõëåýåé ìå AOP/SOP,áí åßíáé off ìå access
+ PERSIST Set the channel as permanent
ÃñÜøå %R%S HELP åðéëïãÞ ãéá ðåñéóóüôåñåò ðëçñïöïñßåò
ãéá ôçí êÜèå åíôïëÞ.
@@ -4469,6 +4482,29 @@ CHAN_HELP_SET_XOP
Áí áðü xOP system ôï ãõñßóåôå óå access system
äåí èá õðÜñîåé êáíÝíá ðñüâëçìá.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Óýíôáîç: SET êáíÜëé OPNOTICE {ON | OFF}
diff --git a/lang/hun.l b/lang/hun.l
index 0c0578382..08f5ec3d2 100644
--- a/lang/hun.l
+++ b/lang/hun.l
@@ -1216,6 +1216,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
xOP lists system for %s is now OFF.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE válaszok
CHAN_SET_NOEXPIRE_SYNTAX
SET #szoba NOEXPIRE {ON | OFF}
@@ -1599,6 +1607,8 @@ CHAN_INFO_OPT_TOPICLOCK
Témaváltás lezárása
CHAN_INFO_OPT_XOP
xOP lista rendszer
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
Nincs
CHAN_INFO_MODE_LOCK
@@ -2118,6 +2128,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN #szoba
BOT_UNASSIGN_UNASSIGNED
Nincsen bot kijelölve %s szobában többet.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO válaszok
BOT_INFO_SYNTAX
@@ -4204,6 +4216,7 @@ CHAN_HELP_SET
SIGNKICK Sign kickek, melyek a KICK paranccsal történnek
TOPICLOCK Témaváltás letiltása
XOP Xop (Sop, Aop, Hop, Vop) lista rendszer bekapcsolása
+ PERSIST Set the channel as permanent
Írd be: %R%S HELP SET opció bõvebb információért az
adott opcióról.
@@ -4387,6 +4400,29 @@ CHAN_HELP_SET_XOP
Az xOP lista rendszerrõl az access lista rendszerre való
áttérés nem okoz gondot.
+
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
CHAN_HELP_SET_OPNOTICE
Syntax: SET #szoba OPNOTICE {ON | OFF}
diff --git a/lang/it.l b/lang/it.l
index 330177cab..21810875b 100644
--- a/lang/it.l
+++ b/lang/it.l
@@ -1208,6 +1208,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
Il sistema di liste xOP per %s è ora DISATTIVATO.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET canale NOEXPIRE {ON | OFF}
@@ -1575,6 +1583,8 @@ CHAN_INFO_OPT_TOPICLOCK
Blocco del topic
CHAN_INFO_OPT_XOP
Liste xOP
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
Nessno
CHAN_INFO_MODE_LOCK
@@ -2082,6 +2092,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN canale
BOT_UNASSIGN_UNASSIGNED
Non c'è più nessun bot assegnato a %s.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4158,6 +4170,7 @@ CHAN_HELP_SET
TOPICLOCK Imposta il blocco del topic (modificabile solo
attraverso il comando TOPIC)
XOP Seleziona il sistema di privilegi utilizzato
+ PERSIST Set the channel as permanent
Digita %R%S HELP option per ottenere maggiori
informazioni su un comando specifico.
@@ -4364,6 +4377,29 @@ CHAN_HELP_SET_XOP
Al contrario, passare dalle liste xOP alle liste di accesso
non causa nessun problema.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Sintassi: SET canale OPNOTICE {ON | OFF}
diff --git a/lang/nl.l b/lang/nl.l
index c1d20d08f..56a469377 100644
--- a/lang/nl.l
+++ b/lang/nl.l
@@ -1224,6 +1224,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
xOP lists system for %s is now OFF.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET kanaal NOEXPIRE {ON | OFF}
@@ -1592,6 +1600,8 @@ CHAN_INFO_OPT_TOPICLOCK
Topicslot
CHAN_INFO_OPT_XOP
xOP lijsten systeem
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
Geen
CHAN_INFO_MODE_LOCK
@@ -2128,6 +2138,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN kanaal
BOT_UNASSIGN_UNASSIGNED
Er is geen bot meer toegewezen aan %s.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4239,6 +4251,7 @@ CHAN_HELP_SET
KICK commando
TOPICLOCK Topic kan alleen veranderd worden met TOPIC
XOP Schakel het gebruikersprivilegesysteem om
+ PERSIST Set the channel as permanent
Type %R%S HELP option voor meer informatie over een
specifieke optie.
@@ -4443,6 +4456,29 @@ CHAN_HELP_SET_XOP
Het overschakelen van xOP lijsten naar het toegangslijsten
systeem brengt echter geen problemen met zich mee.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Gebruik: SET kanaal OPNOTICE {ON | OFF}
diff --git a/lang/pl.l b/lang/pl.l
index 58f3eaa2a..5a5065dc9 100644
--- a/lang/pl.l
+++ b/lang/pl.l
@@ -1569,6 +1569,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
System list xOP na kanale %s zosta³ wy³±czony.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET kana³ NOEXPIRE {ON | OFF}
@@ -2084,6 +2092,9 @@ CHAN_INFO_OPT_TOPICLOCK
CHAN_INFO_OPT_XOP
XOP
+CHAN_INFO_OPT_PERSIST
+ Persistant
+
CHAN_INFO_OPT_NONE
Brak
@@ -2757,6 +2768,9 @@ BOT_UNASSIGN_SYNTAX
BOT_UNASSIGN_UNASSIGNED
Nie ma ¿adnych botów przydzielonych do %s.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
+
# INFO responses
BOT_INFO_SYNTAX
INFO {kana³ | nick}
@@ -5248,6 +5262,7 @@ CHAN_HELP_SET
TOPICLOCK Ogranicza mo¿liwo¶æ zmiany tematu
XOP W³±cza system uprawnieñ xOP
(u¿ycie komend SOP, AOP, HOP, VOP)
+ PERSIST Set the channel as permanent
Aby uzyskaæ wiêcej informacji o danej opcji wpisz:
%R%S HELP SET opcja
@@ -5445,7 +5460,29 @@ CHAN_HELP_SET_XOP
system XOP, je¶li definicje poziomów dostêpu dla
kana³u zosta³y wcze¶niej zmodyfikowane przy pomocy
polecenia LEVELS.
+
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
CHAN_HELP_SET_OPNOTICE
Sk³adnia: SET kana³ OPNOTICE {ON | OFF}
diff --git a/lang/pt.l b/lang/pt.l
index 1643c07fc..0a34f05a7 100644
--- a/lang/pt.l
+++ b/lang/pt.l
@@ -1225,6 +1225,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
Sistema de acesso xOP para %s está agora DESATIVADO.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET canal NOEXPIRE {ON | OFF}
@@ -1593,6 +1601,8 @@ CHAN_INFO_OPT_TOPICLOCK
Trava de tópico
CHAN_INFO_OPT_XOP
Sistema de acesso xOP
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
Nenhuma
CHAN_INFO_MODE_LOCK
@@ -2100,6 +2110,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN canal
BOT_UNASSIGN_UNASSIGNED
Não possui mais nenhum bot associado ao canal %s.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4159,6 +4171,7 @@ CHAN_HELP_SET
SIGNKICK Assinatura dos kicks feitos pelo comando KICK
OPNOTICE Envia uma notice quando os comandos OP/DEOP são usados
XOP Altera o sistema de privilégio de usuário
+ PERSIST Set the channel as permanent
Digite %R%S HELP SET opção para maiores informações
sobre uma opção em particular.
@@ -4358,6 +4371,29 @@ CHAN_HELP_SET_XOP
Entretanto, mudar do sistema de listas xOP para sistema de lista
de acesso não causa problemas.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Sintaxe: SET canal OPNOTICE {ON | OFF}
diff --git a/lang/ru.l b/lang/ru.l
index 69c343440..7db0aa1dc 100644
--- a/lang/ru.l
+++ b/lang/ru.l
@@ -1205,6 +1205,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
Ñèñòåìà ïðèâåëåãèé xOP äëÿ êàíàëà %s îòêëþ÷åíà.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET #êàíàë NOEXPIRE {ON | OFF}
@@ -1573,6 +1581,8 @@ CHAN_INFO_OPT_TOPICLOCK
Áëîêèðîâêà òîïèêà
CHAN_INFO_OPT_XOP
Ñèñòåìà ïðèâåëåãèé xOP
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
îòñóòñòâóþò
CHAN_INFO_MODE_LOCK
@@ -2077,6 +2087,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN #êàíàë
BOT_UNASSIGN_UNASSIGNED
Áîò ñ êàíàëà %s óñïåøíî óäàëåí.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4221,6 +4233,7 @@ CHAN_HELP_SET
SIGNKICK íàñòðîéêà ðåæèìà "ïîäïèñàííûõ êèêîâ"
TOPICLOCK áëîêèðîâêà òîïèêà êàíàëà îò èçìåíåíèé åãî êåì-ëèáî
XOP íàñòðîéêà ñèñòåìû ïðèâèëåãèé êàíàëà
+ PERSIST Set the channel as permanent
Äëÿ áîëåå ïîäðîáíîé èíôîðìàöèè î êàêîé-ëèáî êîíêðåòíîé îïöèè, ñì.
ñïðàâêó ïî %R%S HELP îïöèÿ
@@ -4433,6 +4446,29 @@ CHAN_HELP_SET_XOP
Ïåðåêëþ÷åíèå èç ñèñòåìû xOP â ñèñòåìó ACCESS îáû÷íî ïðîõîäèò áåç
êàêèõ-ëèáî ïðîáëåì.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Ñèíòàêñèñ: SET #êàíàë OPNOTICE {ON | OFF}
diff --git a/lang/tr.l b/lang/tr.l
index 25380abe9..5b7c4ac73 100644
--- a/lang/tr.l
+++ b/lang/tr.l
@@ -1232,6 +1232,14 @@ CHAN_SET_XOP_ON
CHAN_SET_XOP_OFF
xOP lists system for %s is now OFF.
+# SET PERSISTANT responces
+CHAN_SET_PERSIST_SYNTAX
+ SET channel PERSISTS {ON | OFF}
+CHAN_SET_PERSIST_ON
+ Channel %s is now persistant.
+CHAN_SET_PERSIST_OFF
+ Channel %s is no longer persistant.
+
# SET NOEXPIRE responses
CHAN_SET_NOEXPIRE_SYNTAX
SET kanaladý NOEXPIRE {ON | OFF}
@@ -1600,6 +1608,8 @@ CHAN_INFO_OPT_TOPICLOCK
Topic kilidi
CHAN_INFO_OPT_XOP
xOP sistemi
+CHAN_INFO_OPT_PERSIST
+ Persistant
CHAN_INFO_OPT_NONE
YOK
CHAN_INFO_MODE_LOCK
@@ -2139,6 +2149,8 @@ BOT_UNASSIGN_SYNTAX
UNASSIGN kanaladý
BOT_UNASSIGN_UNASSIGNED
%s kanalýndan bot çýkarýldý.
+BOT_UNASSIGN_PERSISTANT_CHAN
+ You can not unassign bots while persist is set on the channel.
# INFO responses
BOT_INFO_SYNTAX
@@ -4268,6 +4280,7 @@ CHAN_HELP_SET
OPNOTICE OP/DEOP komutlarý kullanýldýðýnda mesaj yollar
PEACE kritik komutlarin kullanilmasini engeller
XOP Ayricalik sistemleri arasinda geçisi saglar
+ PERSIST Set the channel as permanent
Belirli bir özellik hakkýnda daha fazla bilgi için
@@ -4462,6 +4475,29 @@ CHAN_HELP_SET_XOP
Bunlarin disinda xOP sisteminden access sistemine geçmek
bir problem çikarmaz.
+CHAN_HELP_SET_PERSIST
+ Syntax: SET channel PERSIST {ON | OFF}
+
+ Enables or disables the persistant channel setting.
+ When persistant is set, the service bot will remain
+ in the channel when it has emptied of users.
+
+ If your IRCd does not a permanent (persistant) channel
+ mode you must have a service bot in your channel to
+ set persist on, and it can not be unassigned while persist
+ is on.
+
+ If this network does not have BotServ enabled and does
+ not have a permanent channel mode, ChanServ will
+ join your channel when you set persist on (and leave when
+ it has been set off).
+
+ If your IRCd has a permanent (persistant) channel mode
+ and is is set or unset (for any reason, including MLOCK),
+ persist is automatically set and unset for the channel aswell.
+ Additionally, services will set or unset this mode when you
+ set persist on or off.
+
CHAN_HELP_SET_OPNOTICE
Kullanýmý: SET kanaladý OPNOTICE {ON | OFF}
diff --git a/src/bots.cpp b/src/bots.cpp
index 8a4198b74..6d7728a93 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -164,8 +164,13 @@ void BotInfo::UnAssign(User *u, ChannelInfo *ci)
if (MOD_RESULT == EVENT_STOP)
return;
- if (u && ci->c && ci->c->usercount >= BSMinUsers)
- ircdproto->SendPart(ci->bi, ci->name, "UNASSIGN from %s", u->nick);
+ if (ci->c && ci->c->usercount >= BSMinUsers)
+ {
+ if (u)
+ ircdproto->SendPart(ci->bi, ci->name, "UNASSIGN from %s", u->nick);
+ else
+ ircdproto->SendPart(ci->bi, ci->name, "");
+ }
ci->bi->chancount--;
ci->bi = NULL;
diff --git a/src/channels.c b/src/channels.c
index 9bd3abdc3..919628358 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -39,6 +39,13 @@ bool Channel::HasMode(ChannelModeName Name)
void Channel::SetMode(ChannelModeName Name)
{
modes[(size_t)Name] = true;
+
+ /* Channel mode +P or so was set, mark this channel as persistant */
+ if (Name == CMODE_PERM && ci)
+ {
+ ci->SetFlag(CI_PERSIST);
+ }
+
FOREACH_MOD(I_OnChannelModeSet, OnChannelModeSet(this, Name));
}
@@ -63,6 +70,16 @@ void Channel::SetMode(char Mode)
void Channel::RemoveMode(ChannelModeName Name)
{
modes[(size_t)Name] = false;
+
+ if (Name == CMODE_PERM && ci)
+ {
+ ci->UnsetFlag(CI_PERSIST);
+ if (s_BotServ && ci->bi && usercount == BSMinUsers - 1)
+ ircdproto->SendPart(ci->bi, name, NULL);
+ if (!users)
+ chan_delete(this);
+ }
+
FOREACH_MOD(I_OnChannelModeUnset, OnChannelModeUnset(this, Name));
}
@@ -323,9 +340,12 @@ void chan_deluser(User * user, Channel * c)
delete u;
c->usercount--;
- if (s_BotServ && c->ci && c->ci->bi && c->usercount == BSMinUsers - 1) {
+ /* Channel is persistant, it shouldn't be deleted and the service bot should stay */
+ if (c->ci && c->ci->HasFlag(CI_PERSIST))
+ return;
+
+ if (s_BotServ && c->ci && c->ci->bi && c->usercount == BSMinUsers - 1)
ircdproto->SendPart(c->ci->bi, c->name, NULL);
- }
if (!c->users)
chan_delete(c);
@@ -1819,10 +1839,15 @@ void chan_adduser2(User * user, Channel * c)
* and the ignored user dosnt just leave, the bot will never
* make it into the channel, leaving the channel botless even for
* legit users - Rob
+ * But don't join the bot if the channel is persistant - Adam
**/
- if (s_BotServ && c->ci && c->ci->bi) {
+ if (s_BotServ && c->ci && c->ci->bi && !c->ci->HasFlag(CI_PERSIST))
+ {
if (c->usercount == BSMinUsers)
bot_join(c->ci);
+ }
+ if (s_BotServ && c->ci && c->ci->bi)
+ {
if (c->usercount >= BSMinUsers && (c->ci->botflags.HasFlag(BS_GREET))
&& user->nc && user->nc->greet
&& check_access(user, c->ci, CA_GREET)) {
@@ -1884,6 +1909,16 @@ Channel *chan_create(const char *chan, time_t ts)
restore_topic(chan);
}
+ /* A channel set as persistant when it was not created has just
+ * been created, mark it as persistant
+ */
+ ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM);
+ if (cm && c->ci && c->ci->HasFlag(CI_PERSIST) && !c->HasMode(CMODE_PERM))
+ {
+ ircdproto->SendMode(whosends(c->ci), c->name, "+%c", cm->ModeChar);
+ c->SetMode(CMODE_PERM);
+ }
+
FOREACH_MOD(I_OnChannelCreate, OnChannelCreate(c));
return c;
diff --git a/src/config.c b/src/config.c
index 03f1fde24..e531dafa1 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1848,6 +1848,7 @@ int read_config(int reload)
else if (option == "opnotice") CSDefFlags.SetFlag(CI_OPNOTICE);
else if (option == "xop") CSDefFlags.SetFlag(CI_XOP);
else if (option == "peace") CSDefFlags.SetFlag(CI_PEACE);
+ else if (option == "persist") CSDefFlags.SetFlag(CI_PERSIST);
}
}
diff --git a/src/core/bs_unassign.c b/src/core/bs_unassign.c
index 6b8a89eba..25a5c2ada 100644
--- a/src/core/bs_unassign.c
+++ b/src/core/bs_unassign.c
@@ -15,8 +15,6 @@
#include "module.h"
-int do_unassign(User * u);
-
class CommandBSUnassign : public Command
{
public:
@@ -28,6 +26,7 @@ class CommandBSUnassign : public Command
{
const char *chan = params[0].c_str();
ChannelInfo *ci = cs_findchan(chan);
+ ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM);
if (readonly)
notice_lang(s_BotServ, u, BOT_ASSIGN_READONLY);
@@ -35,7 +34,10 @@ class CommandBSUnassign : public Command
notice_lang(s_BotServ, u, ACCESS_DENIED);
else if (!ci->bi)
notice_help(s_BotServ, u, BOT_NOT_ASSIGNED);
- else {
+ else if (ci->HasFlag(CI_PERSIST) && !cm)
+ notice_help(s_BotServ, u, BOT_UNASSIGN_PERSISTANT_CHAN);
+ else
+ {
ci->bi->UnAssign(u, ci);
notice_lang(s_BotServ, u, BOT_UNASSIGN_UNASSIGNED, ci->name);
}
diff --git a/src/core/cs_info.c b/src/core/cs_info.c
index 52699b515..6d89ada02 100644
--- a/src/core/cs_info.c
+++ b/src/core/cs_info.c
@@ -118,6 +118,7 @@ class CommandCSInfo : public Command
CheckOptStr(optbuf, CI_SIGNKICK_LEVEL, getstring(u, CHAN_INFO_OPT_SIGNKICK), ci, u->nc);
CheckOptStr(optbuf, CI_TOPICLOCK, getstring(u, CHAN_INFO_OPT_TOPICLOCK), ci, u->nc);
CheckOptStr(optbuf, CI_XOP, getstring(u, CHAN_INFO_OPT_XOP), ci, u->nc);
+ CheckOptStr(optbuf, CI_PERSIST, getstring(u, CHAN_INFO_OPT_PERSIST), ci, u->nc);
notice_lang(s_ChanServ, u, CHAN_INFO_OPTIONS, optbuf.empty() ? getstring(u, CHAN_INFO_OPT_NONE) : optbuf.c_str());
notice_lang(s_ChanServ, u, CHAN_INFO_MODE_LOCK, get_mlock_modes(ci, 1));
diff --git a/src/core/cs_register.c b/src/core/cs_register.c
index e6ccde8cf..0ea7e58dc 100644
--- a/src/core/cs_register.c
+++ b/src/core/cs_register.c
@@ -86,6 +86,16 @@ class CommandCSRegister : public Command
else if ((cm = ModeManager::FindChannelModeByName(CMODE_PROTECT)))
ircdproto->SendMode(findbot(s_ChanServ), chan, "+%c %s", cm->ModeChar, u->nick);
+ /* Mark the channel as persistant */
+ if (c->HasMode(CMODE_PERM))
+ ci->SetFlag(CI_PERSIST);
+ /* Persist may be in def cflags, set it here */
+ else if (ci->HasFlag(CI_PERSIST) && (cm = ModeManager::FindChannelModeByName(CMODE_PERM)))
+ {
+ ircdproto->SendMode(whosends(ci), chan, "+%c", cm->ModeChar);
+ ci->SetFlag(CI_PERSIST);
+ }
+
FOREACH_MOD(I_OnChanRegistered, OnChanRegistered(ci));
}
return MOD_CONT;
diff --git a/src/core/cs_set.c b/src/core/cs_set.c
index 48eef2ba9..96c8ae35c 100644
--- a/src/core/cs_set.c
+++ b/src/core/cs_set.c
@@ -498,6 +498,82 @@ class CommandCSSet : public Command
return MOD_CONT;
}
+ CommandReturn DoSetPersist(User *u, ChannelInfo *ci, const char *param)
+ {
+ ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM);
+
+ if (!stricmp(param, "ON"))
+ {
+ if (!ci->HasFlag(CI_PERSIST))
+ {
+ ci->SetFlag(CI_PERSIST);
+
+ /* Channel doesn't exist, create it internally */
+ if (!ci->c)
+ {
+ chan_create(ci->name, time(NULL));
+ if (ci->bi)
+ bot_join(ci);
+ }
+
+ /* No botserv bot, no channel mode */
+ if (!ci->bi && !cm)
+ {
+ /* Give them ChanServ
+ * Yes, this works fine with no s_BotServ
+ */
+ findbot(s_ChanServ)->Assign(NULL, ci);
+ }
+
+ /* Set the perm mode */
+ if (cm && ci->c && !ci->c->HasMode(CMODE_PERM))
+ {
+ ci->c->SetMode(CMODE_PERM);
+ ircdproto->SendMode(whosends(ci), ci->c->name, "+%c", cm->ModeChar);
+ }
+ }
+
+ notice_lang(s_ChanServ, u, CHAN_SET_PERSIST_ON, ci->name);
+ }
+ else if (!stricmp(param, "OFF"))
+ {
+ if (ci->HasFlag(CI_PERSIST))
+ {
+ ci->UnsetFlag(CI_PERSIST);
+
+ /* Unset perm mode */
+ if (ci->c && ci->c->HasMode(CMODE_PERM))
+ {
+ ircdproto->SendMode(whosends(ci), ci->c->name, "-%c", cm->ModeChar);
+ ci->c->RemoveMode(CMODE_PERM);
+ }
+ /* Persist is set off... remove the bot and delete the channel if its empty */
+ else if (ci->c)
+ {
+ if (s_BotServ && ci->bi && ci->c->usercount == BSMinUsers - 1)
+ ircdproto->SendPart(ci->bi, ci->c->name, NULL);
+ if (!ci->c->users)
+ chan_delete(ci->c);
+
+ /* No channel mode, no BotServ, but using ChanServ as the botserv bot
+ * which was assigned when persist was set on
+ */
+ if (!cm && !s_BotServ && ci->bi)
+ {
+ /* Unassign bot */
+ findbot(s_ChanServ)->UnAssign(NULL, ci);
+ }
+ }
+ }
+
+ notice_lang(s_ChanServ, u, CHAN_SET_PERSIST_OFF, ci->name);
+ }
+ else
+ syntax_error(s_ChanServ, u, "SET PERSIST", CHAN_SET_PERSIST_SYNTAX);
+
+ return MOD_CONT;
+ }
+
CommandReturn DoSetNoExpire(User * u, ChannelInfo * ci, const char *param)
{
if (!u->nc->HasCommand("chanserv/set/noexpire"))
@@ -593,7 +669,9 @@ class CommandCSSet : public Command
}
} else if (cmd == "PEACE") {
DoSetPeace(u, ci, param);
- } else if (cmd == "NOEXPIRE") {
+ } else if (cmd == "PERSIST")
+ DoSetPersist(u, ci, param);
+ else if (cmd == "NOEXPIRE") {
DoSetNoExpire(u, ci, param);
} else {
notice_lang(s_ChanServ, u, CHAN_SET_UNKNOWN_OPTION, cmd.c_str());
@@ -648,6 +726,8 @@ class CommandCSSet : public Command
notice_help(s_ChanServ, u, CHAN_HELP_SET_XOP);
else if (subcommand == "PEACE")
notice_help(s_ChanServ, u, CHAN_HELP_SET_PEACE);
+ else if (subcommand == "PERSIST")
+ notice_help(s_ChanServ, u, CHAN_HELP_SET_PERSIST);
else if (subcommand == "NOEXPIRE")
notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP_SET_NOEXPIRE);
else