Hash Protection

By Korvin on Feb 20, 2009

just load and theoretically it should keep your hash files safe.

To use discretion in which hashes get saved, type /hashsaver
:::::
as you may or may not know, hashes get deleted on restart.. but since they are soooo darn useful, this script saves them

Tested: works perfectly =]

on *:exit:h.save
on *:start:h.load
alias h.save {
  $iif(!$isdir("Hash Saver"),mkdir "Hash Saver")
  %i = $hget(0)
  while %i { if (!$readini("hash saver/allow.ini",disallow,$hget(%i))) { hsave $hget(%i) $qt($+(hash saver/,$hget(%i),.hsv)) | write "hash saver/hashes.txt" $hget(%i) } | dec %i }
}
alias h.load {
  $iif(!$isdir("Hash Saver"),mkdir "Hash Saver")
  var %f = "hash saver/hashes.txt", %i = $lines(%f)
  while %i { if (!$readini("hash saver/allow.ini",disallow,$read("hash saver/hashes.txt",%i))) { $iif(!$hget($read("hash saver/hashes.txt",%i),hmake $read("hash saver/hashes.txt",%i)) | hload $read(%f,%i) $qt($+(hash saver/,$read("hash saver/hashes.txt",%i),.hsv)) } | dec %i }
}
alias Hashsaver dialog $iif($dialog(h.dialog),-mr,-xmr) h.dialog h.dialog
dialog H.dialog {
  title "Hash Saver"
  size -1 -1 256 158
  option dbu
  list 1, 3 7 124 138, sort size vsbar
  text "Save", 2, 3 -1 123 8, center
  list 3, 128 7 124 138, sort size vsbar
  text "Don't Save", 4, 128 -1 123 8, center
  button "Ok", 5, 53 145 37 12, default flat ok cancel
  button "Reload", 6, 90 145 37 12, default flat
  button "Clear", 7, 128 145 37 12, default flat
  button "Cancel", 8, 165 145 37 12, default flat cancel
  menu "File", 9
  item "Ok", 11, 9, ok
  item "Close", 13, 9, cancel
  item break, 14, 9
  item "Reload", 10, 9
  item "Clear", 12, 9
}
alias h.reload {
  did -r h.dialog 1,3
  %i = $hget(0)
  while %i { did -a h.dialog $iif($readini("hash saver/allow.ini",disallow,$hget(%i)),3,1) $hget(%i) | dec %i }
}
alias h.clear { remini "hash saver/allow.ini" disallow | h.reload }
on *:dialog:h.dialog:*:*: { 
  if ($devent == dclick) {
    if ($did == 1) { writeini "hash saver/allow.ini" disallow $did(1).seltext $ | h.reload }
    if ($did == 3) { remini "hash saver/allow.ini" disallow $did(3).seltext | h.reload }
  }
  if ($devent == init) { h.reload }
  if ($devent == sclick) {
    if ($did == 6 || $did == 10) { h.reload }
    if ($did == 7 || $did == 12) { h.clear } 
    if ($did == 5 || $did == 11 || $did == 13) { dialog -x h.dialog h.dialog }
    if ($did == 8) { h.clear | dialog -x h.dialog h.dialog }
  }
}

Comments

Sign in to comment.
InSuRedByMaFia   -  Dec 06, 2010

LoVE ThiS 10/10

 Respond  
Korvin   -  Feb 22, 2009

ty kirby =p

 Respond  
Kirby   -  Feb 22, 2009

ROFL, I didn't know that hash tables were erased when you restart until today!
Anyways, good work Korvin.
9.0 + 1 like.

 Respond  
dashh   -  Feb 22, 2009

ok man.

I say that because, a safe hash is a thing like u dont modify or write any hash table.

like a fopen comand with text files.

 Respond  
Korvin   -  Feb 21, 2009

not really, it saves youre hash files when you close mirc, and reloads them when you open it.

 Respond  
dashh   -  Feb 21, 2009

This like a backup, not a safe hash xD
but nice work man.

 Respond  
Korvin   -  Feb 20, 2009

dont worry about it i just realized. i if'ed the entire while statement, no dec or anything.

fixed now... if you have a diff version with the dialog, update immediately..

 Respond  
Korvin   -  Feb 20, 2009

done =]

 Respond  
Aucun50   -  Feb 20, 2009

Yes please! That would make it all tie together

 Respond  
Korvin   -  Feb 20, 2009

thanks =] should i add a manager?

 Respond  
Aucun50   -  Feb 20, 2009

Nice this could come in handy

 Respond  
PuNkTuReD   -  Feb 20, 2009

lol yea but have you updated yet Cheiron, cos i added that nt long after u pointed it out lmao

 Respond  
Cheiron   -  Feb 20, 2009

yeah i found that out Korvin about hash data being lost on restarts with the script PunkTuReD and i been working on hehe...

 Respond  
PuNkTuReD   -  Feb 20, 2009

sweet snippet 10/10

 Respond  
Korvin   -  Feb 20, 2009

thank you=]

 Respond  
SumWon   -  Feb 20, 2009

Simple script, but great idea! I love it. Keep it up =D.

 Respond  
Korvin   -  Feb 20, 2009

=]

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.