diff tj.tcl @ 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 319c2e73860c
children b7e3a47ed072
line wrap: on
line diff
--- 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