Browse Source

dictionary: Remove the save event

We save at the point we change something instead
Will Storey 8 years ago
parent
commit
4e8f88bd79
1 changed files with 3 additions and 8 deletions
  1. 3 8
      dictionary.tcl

+ 3 - 8
dictionary.tcl

@@ -68,9 +68,8 @@ namespace eval dictionary {
   # This is for throttling term outputs.
   variable flood [dict create]
 
-  bind pubm -|- "*"          ::[namespace current]::public
-  bind pubm -|- "*"          ::[namespace current]::publearn
-  bind evnt -|- "save"       ::[namespace current]::save
+  bind pubm -|- "*" ::dictionary::public
+  bind pubm -|- "*" ::dictionary::publearn
 
   setudef flag dictionary
 }
@@ -184,6 +183,7 @@ proc ::dictionary::publearn {nick host hand chan argv} {
     set def [dict get $terms $term def]
     dict unset terms $term
     ::dictionary::save
+
     putserv "PRIVMSG $chan :I forgot `$term'. (It was `$def'.)"
     return
   }
@@ -421,10 +421,5 @@ proc ::dictionary::write_db {} {
   close $fp
 }
 
-# Handle save events. Write out our data files.
-proc ::dictionary::save {args} {
-  ::dictionary::write_db
-}
-
 set ::dictionary::count [::dictionary::load]
 putlog "dictionary.tcl loaded. $::dictionary::count term(s)."