Various fixes
- fflags no longer says things were modified on account "*" when they weren't - don't give an autowarning on kick anymore; if an op is kicking chances are they'll be giving their own warning anyway - attempt to make a backup copy of the database before migrating to new schema
This commit is contained in:
parent
e83e6caac3
commit
454afca1b3
@ -700,6 +700,12 @@ def _upgrade():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def _migrate():
|
def _migrate():
|
||||||
|
# try to make a backup copy of the database
|
||||||
|
import shutil
|
||||||
|
try:
|
||||||
|
shutil.copyfile("data.sqlite3", "data.sqlite3.bak")
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
dn = os.path.dirname(__file__)
|
dn = os.path.dirname(__file__)
|
||||||
conn = _conn()
|
conn = _conn()
|
||||||
with conn, open(os.path.join(dn, "db.sql"), "rt") as f1, open(os.path.join(dn, "migrate.sql"), "rt") as f2:
|
with conn, open(os.path.join(dn, "db.sql"), "rt") as f1, open(os.path.join(dn, "migrate.sql"), "rt") as f2:
|
||||||
|
@ -3863,7 +3863,7 @@ def leave(cli, what, nick, why=""):
|
|||||||
msg = (messages["leave_death"] + "{2}").format(nick, var.get_reveal_role(nick), population)
|
msg = (messages["leave_death"] + "{2}").format(nick, var.get_reveal_role(nick), population)
|
||||||
else:
|
else:
|
||||||
msg = (messages["leave_death_no_reveal"] + "{1}").format(nick, population)
|
msg = (messages["leave_death_no_reveal"] + "{1}").format(nick, population)
|
||||||
add_warning(nick, var.LEAVE_PENALTY, botconfig.NICK, messages["leave_warning"], expires=var.LEAVE_EXPIRY)
|
# kick used to give stasis, now it does not; the op that performed the kick should add their own warning
|
||||||
cli.msg(botconfig.CHANNEL, msg)
|
cli.msg(botconfig.CHANNEL, msg)
|
||||||
var.SPECTATING_WOLFCHAT.discard(nick)
|
var.SPECTATING_WOLFCHAT.discard(nick)
|
||||||
var.SPECTATING_DEADCHAT.discard(nick)
|
var.SPECTATING_DEADCHAT.discard(nick)
|
||||||
@ -8729,7 +8729,7 @@ def fflags(cli, nick, chan, rest):
|
|||||||
elif len(params) == 1:
|
elif len(params) == 1:
|
||||||
# display access for the given user
|
# display access for the given user
|
||||||
acc, hm = parse_warning_target(params[0])
|
acc, hm = parse_warning_target(params[0])
|
||||||
if acc is not None:
|
if acc is not None and acc != "*":
|
||||||
if not var.FLAGS_ACCS[acc]:
|
if not var.FLAGS_ACCS[acc]:
|
||||||
msg = messages["no_access_account"].format(acc)
|
msg = messages["no_access_account"].format(acc)
|
||||||
else:
|
else:
|
||||||
@ -8754,7 +8754,7 @@ def fflags(cli, nick, chan, rest):
|
|||||||
return
|
return
|
||||||
tpl_flags = "".join(sorted(tpl_flags))
|
tpl_flags = "".join(sorted(tpl_flags))
|
||||||
db.set_access(acc, hm, tid=tpl_id)
|
db.set_access(acc, hm, tid=tpl_id)
|
||||||
if acc is not None:
|
if acc is not None and acc != "*":
|
||||||
reply(cli, nick, chan, messages["access_set_account"].format(acc, tpl_flags))
|
reply(cli, nick, chan, messages["access_set_account"].format(acc, tpl_flags))
|
||||||
else:
|
else:
|
||||||
reply(cli, nick, chan, messages["access_set_host"].format(hm, tpl_flags))
|
reply(cli, nick, chan, messages["access_set_host"].format(hm, tpl_flags))
|
||||||
@ -8789,7 +8789,7 @@ def fflags(cli, nick, chan, rest):
|
|||||||
reply(cli, nick, chan, messages["access_set_host"].format(hm, flags))
|
reply(cli, nick, chan, messages["access_set_host"].format(hm, flags))
|
||||||
else:
|
else:
|
||||||
db.set_access(acc, hm, flags=None)
|
db.set_access(acc, hm, flags=None)
|
||||||
if acc is not None:
|
if acc is not None and acc != "*":
|
||||||
reply(cli, nick, chan, messages["access_deleted_account"].format(acc))
|
reply(cli, nick, chan, messages["access_deleted_account"].format(acc))
|
||||||
else:
|
else:
|
||||||
reply(cli, nick, chan, messages["access_deleted_host"].format(hm))
|
reply(cli, nick, chan, messages["access_deleted_host"].format(hm))
|
||||||
|
Loading…
Reference in New Issue
Block a user