mIRC Home    About    Download    Register    News    Help

Print Thread
Variables..Anti spam.. #14100 04/03/03 07:39 AM
Joined: Jan 2003
Posts: 28
H
Hendon Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Jan 2003
Posts: 28
Hey geniuses, I need your help again..
Trying to do an anti spam that will block out and close dialogs..

In my REMOTES...
================
on *:open:?:*:{
if (%spam isin $strip($1-)) { .close -m $nick | echo -a 4Lame spammer found.. }
}

In my POPUPS..
===========
..Add Spam Words:{
var %newspamword $$?="Add a word to be considered as spam here"
set %spam %spam $+ : $+ %newspamword
}
..Remove Spam Words:{
echo -a %spam
var %removespamword $$?="Type the word to be removed.. A list is generated below"
}

In my VARIABLES...
===============
%spam mycelph.com:funy_pics.tripod.com:geocities.com:d3JpdG:w.stormpages.com:1mess:www.mtvxxx.com:Please visit our website

It doesn't work but I'm quite sure the problem lies with the $chr(58)
1)How do I get it to recognise each word as a different string using : as the seperator?
2)I want to make sure that it is stripped, without stripping it's effectively useless
3)The removal of words part.. I'm quite lost..
4)I'd like the echo -a %spam to be listed out line by line without : instead as a whole string of words..

Last edited by Hendon; 04/03/03 07:41 AM.

===================================
Live my life for a day.. I'll show you where I've been.
Re: Variables..Anti spam.. #14101 04/03/03 02:00 PM
Joined: Dec 2002
Posts: 143
A
Aubs Offline
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
Add everything here to your remotes section.
Make sure you don't have an alias called remspam already on your system.
Also, make sure you don't have an on OPEN event in the same file.
Code:
on *:open:?:*:{
  var %i = 1
  while %i <= $numtok(%spam,59) {
    [color:green];goes through all the items in %spam to see if it is mentioned in the message[/color]
    if ($gettok(%spam,%i,59) isin $strip($1-)) { .close -m $nick | echo -a 4Lame spammer found.. | halt }
    inc %i
  }
}

menu status,menubar,nicklist,query {
  Spam
  .Add Spam Words:{
    var %NewSpamWord $$?="Add a word to be considered as spam here (do not use ;)"
    [color:green];Enter Spam word/sentence[/color]
    if ($istok(%spam,%newspamword,59) == $true) { echo -a Already have >>06,00 %newspamword << in the spam list. | halt }
    [color:green];if you already have it in the list, tell you and stop (don't add)[/color]
    set %spam $addtok(%spam,%newspamword,59)
    [color:green];Add the word to the list, separated by semicolon (;)[/color]
    echo -a Added >>06,00 %NewSpamWord << to Spam List
    [color:green];tell you it has been added[/color]
  }
  .Remove Spam Words:{
    /remspam List
    [color:green];run the alias /remspam to list items in %spam[/color]
  }
}
alias remspam {
  [color:green];if you type: /remspam List :lists items[/color]
  if ($1 == List) {
    var %i = 1
    echo -a SPAM LIST
    [color:green];lists them one by one[/color]
    while %i <= $numtok(%spam,59) { echo -a %i - $gettok(%spam,%i,59) | inc %i }
    echo -a END OF SPAM LIST
    echo -a Remove an item, type: /remspam <number>
    echo -a Display this list, type: /remspam List
    $iif($$?="Enter number to remove" !== $null,set %SpamRemove $!,halt)
    [color:green];you don't have to have the line above. It allows you to enter a number into a popup.[/color]
    [color:green];you can replace it with halt and you will have to type /remspam <number> to remove item[/color]
  }
  if (%SpamRemove !== $null) { tokenize 32 $! }
  [color:green];if you entered something into the popup, the line above tokenises the $1,$2,$3 to be what you typed (should be a number)[/color]
  if ($2 !== $null) { echo -a Incorrect procedure. /remspam <number> or /remspam List | halt }
  [color:green];Checks to see if you entered only ONE number[/color]
  if ($1 !== $null) {
    if ($1 !isnum 1- $+ $numtok(%spam,59)) { echo -a invalid number. /remspam List | halt }
    [color:green];if the number entered is not in the range <1> to <number of items>, tells you[/color]
    echo -a Deleted item $1 ( $+ $gettok(%spam,$1,59) $+ )
    [color:green];Tells you it has been deleted[/color]
    set %spam $deltok(%spam,$1,59)
    [color:green];Deletes it[/color]
  }
}


Hope it helps, I've only briefly tested it - Not tested the on OPEN because I'm not connected to a server!

You may want to remove some of it, but it's there to help YOU code yourself wink


Aubs.
cool