Mercurial > hg > egg-tcls
changeset 628:eaf766018133
tj: If user deletes his or her default TJ ID, re-set the default to global default.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 11 Feb 2021 10:44:46 +0200 |
parents | f0b998b1716d |
children | 62cf145b67f8 |
files | config.tj.example tj.tcl |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/config.tj.example Thu Feb 11 10:44:18 2021 +0200 +++ b/config.tj.example Thu Feb 11 10:44:46 2021 +0200 @@ -83,7 +83,7 @@ "err_unknown_user" "en tunne käyttäjää @1@" "default_set" "@nick@:n vakio-id asetettu: '@1@'." - + "default_reset" "@nick@:n vakio-id TJ poistettu, vakio vaihdettu takaisin '@2@'." "items_deleted" "@nick@:n TJ '@1@' poistettu." "list_item" "#@1@/@2@: @3@ : \002@4@\002 / @5@"
--- a/tj.tcl Thu Feb 11 10:44:18 2021 +0200 +++ b/tj.tcl Thu Feb 11 10:44:46 2021 +0200 @@ -452,6 +452,14 @@ tj_msg $upublic $unick $uchan "items_deleted" [list $uid $nitems] + # Check if we deleted the default ID + set udefid [tj_get_default_id $uhand] + if {[string tolower $uid] == [string tolower $udefid]} { + setuser $uhand XTRA "tj_default_id" $tj_default_id + + tj_msg $upublic $unick $uchan "default_reset" [list $uid $tj_default_id] + } + } elseif {[tj_cmd_match "default" $rcmd]} { # !tj default #<id> # Check for #id prefix