mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2006
Posts: 9
R
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2006
Posts: 9
Hello again. I need some more help. I got the script where I can block the DCC send if I already have the file. But now, how can I block a DCC send if I want wildcards in it. For example:

John sends me 8bobdvd05.gif

I want to block *bobdvd* since it's in my blacklist.

How can I do that? Thank you!

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Could you post the code that you're currently using to block the send if you already have the file? Probably be easier for me (or someone else) to modify what you currently have so that it works with wildcards, than to write up something new.

Joined: Feb 2006
Posts: 9
R
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2006
Posts: 9
Here it is. However, I perfer to have a seperate blocklist ini file for wildcards. Thanks!

Code:
CTCP *:DCC SEND *:?:{
  .set %BadFile $3
  .IgnoreFile
}
alias IgnoreFile {
  if ($readini(BadFile.ini,FileList,%BadFile) != $null) {
    .dcc reject
    .msg $nick File:12 $nopath($filename) rejected because I have it...
}
  else {
    .creq
  }

}

Joined: Feb 2006
Posts: 9
R
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2006
Posts: 9
Anyone?

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
$readini doesn't let you check for wildcarded items so you're going to have to loop with $ini(BadFile.ini,FileList,N) where N is a variable that increases with each loop. Something like this:

Code:
var %i = 1
while ($ini(BadFile.ini,FileList,%i)) {
  if ($+(*,$v1,*) iswm %BadFile) {
    .dcc reject
    return
  }
  inc %i
}
.sreq

Joined: Feb 2006
Posts: 9
R
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2006
Posts: 9
Quote:
$readini doesn't let you check for wildcarded items so you're going to have to loop with $ini(BadFile.ini,FileList,N) where N is a variable that increases with each loop. Something like this:

Code:
var %i = 1
while ($ini(BadFile.ini,FileList,%i)) {
  if ($+(*,$v1,*) iswm %BadFile) {
    .dcc reject
    return
  }
  inc %i
}
.sreq


Thanks. I'll give it a try. Any others w/ any other ideas? TIA!

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Here's a suggestion that uses a hash table, which will allow searching with a wildcard.
Code:
 CTCP *:DCC SEND *:?:{
  .set %BadFile $3
  .IgnoreFile
}
alias IgnoreFile {
  if $hfind(BadFile,$+(*,$3,*),0,w).data {
    .dcc reject
    .msg $nick File:12 $nopath($filename) rejected because I have it...
  }
  else {
    .creq
  }
}
on *:start:{
  if !$hget(Badfile) { .hmake BadFile 10 }
  if $exists(BadFile.ini) { .hload -i BadFile BadFile.ini Filelist }
}
 


If you make use of this method, you might want to change the code that you're using to write the badfiles to the ini file, so that they get added to the hash table instead. Once you've done that (if you do), then I also recommend adding the following code
Code:
 on *:exit:{ .hsave -oi BadFile BadFile.ini Filelist }
on *:disconnect:{ .hsave -oi BadFile BadFile.ini Filelist }
 


If you go with this, and need help modifying the code that writes the information, post that code and I'll review it and post the code with the required alterations.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
CTCP *:DCC SEND *:?:{ IgnoreWildFile $nopath($filename) }
alias IgnoreWildFile {
  hfree -w IgnoreWildFile.hashtable
  hmake IgnoreWildFile.hashtable
  hload -i IgnoreWildFile.hashtable BadWildFile.ini FileList
  if ($hfind(IgnoreWildFile.hashtable,$1-,W)) {
    .dcc reject
    .msg $nick File:12 $1- rejected because I can...
  }
  else {
    .creq
    ;^ dont know what this is but left it in
  }
  hfree -w IgnoreWildFile.hashtable
}


*code untested*

* place in its OWN script file

BadWildFile.ini file items should be formated as follows...
[FileList]
*fred*.gif=1
*.dat=1
chunkybabes*.*=1
etc etc

Last edited by DaveC; 14/02/06 03:48 AM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
DaveC: You forgot the -i switch in your hload to let the table "know" that the information is coming from an ini file.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Thanks man, now corrected. smile

Joined: Feb 2006
Posts: 9
R
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2006
Posts: 9
Quote:
Code:
CTCP *:DCC SEND *:?:{ IgnoreWildFile $nopath($filename) }
alias IgnoreWildFile {
  hfree -w IgnoreWildFile.hashtable
  hmake IgnoreWildFile.hashtable
  hload -i IgnoreWildFile.hashtable BadWildFile.ini FileList
  if ($hfind(IgnoreWildFile.hashtable,$1-,W)) {
    .dcc reject
    .msg $nick File:12 $1- rejected because I can...
  }
  else {
    .creq
    ;^ dont know what this is but left it in
  }
  hfree -w IgnoreWildFile.hashtable
}


*code untested*

* place in its OWN script file

BadWildFile.ini file items should be formated as follows...
[FileList]
*fred*.gif=1
*.dat=1
chunkybabes*.*=1
etc etc


Dosen't work. Any ideas?

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
CTCP *:DCC SEND *:?:{ IgnoreWildFile $nopath($filename) }
alias IgnoreWildFile {
  hfree -w IgnoreWildFile.hashtable
  hmake IgnoreWildFile.hashtable
  hload -i IgnoreWildFile.hashtable BadWildFile.ini FileList
  if ($hfind(IgnoreWildFile.hashtable,$1-[color:blue],1[/color],W)) {
    .dcc reject
    .msg $nick File:12 $1- rejected because I can...
  }
  else {
    .creq
    ;^ dont know what this is but left it in
  }
  hfree -w IgnoreWildFile.hashtable
}


* forgot the ,1 which makes all the difference!
* code not fully tested but should work now assuming you have the BadWordFile.ini correctly layed out *


Link Copied to Clipboard