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:
skizzerz 2016-06-26 12:37:22 -05:00
parent e83e6caac3
commit 454afca1b3
2 changed files with 10 additions and 4 deletions

View File

@ -700,6 +700,12 @@ def _upgrade():
pass
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__)
conn = _conn()
with conn, open(os.path.join(dn, "db.sql"), "rt") as f1, open(os.path.join(dn, "migrate.sql"), "rt") as f2:

View File

@ -3863,7 +3863,7 @@ def leave(cli, what, nick, why=""):
msg = (messages["leave_death"] + "{2}").format(nick, var.get_reveal_role(nick), population)
else:
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)
var.SPECTATING_WOLFCHAT.discard(nick)
var.SPECTATING_DEADCHAT.discard(nick)
@ -8729,7 +8729,7 @@ def fflags(cli, nick, chan, rest):
elif len(params) == 1:
# display access for the given user
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]:
msg = messages["no_access_account"].format(acc)
else:
@ -8754,7 +8754,7 @@ def fflags(cli, nick, chan, rest):
return
tpl_flags = "".join(sorted(tpl_flags))
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))
else:
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))
else:
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))
else:
reply(cli, nick, chan, messages["access_deleted_host"].format(hm))