• Welcome to Valhalla Legends Archive.
 

Unbanning with wildcards and removing users

Started by Gangz, February 07, 2004, 01:20 AM

Previous topic - Next topic

Networks

I dont want a function I want a usage for ID_JOIN and ID_TALK please? Assume i have a channellist if you must.

o.OV

#16
Quote from: Soul Taker on February 09, 2004, 10:29 PM
Yes, would be a good idea to make a function for wildcard matching which changes the default behavior of some masking characters.

Good point. that reminds me..


   leftFlat = "["
   ChrW1 = ChrW$(1)
   TempA = MainStr
   Position = InStr(TempA, leftFlat)
   If Position Then
       For X = 0 To 255
           Mid$(TempA, Position, 1) = Chr1
           Position = InStr(TempA, leftFlat)
           If Position = 0 Then Exit For
       Next X
   End If
   'TempA is to be used with the Like operator in place _
   of MainStr
   'Same should be done for the other one..


That should keep the flat brackets from causing problems.
If the facts don't fit the theory, change the facts. - Albert Einstein

o.OV

Quote from: Networks on February 10, 2004, 07:59 AM
I dont want a function I want a usage for ID_JOIN and ID_TALK please? Assume i have a channellist if you must.

So you plucked the code off of someone and you can't figure out how it works?

Google, Google, and Google?
If the facts don't fit the theory, change the facts. - Albert Einstein

MyndFyre

#18
Quote from: Networks on February 10, 2004, 07:59 AM
I dont want a function I want a usage for ID_JOIN and ID_TALK please? Assume i have a channellist if you must.

Pseudocode:


Switch (EventID)
 Case ID_JOIN:
   If MatchesWildcard(Username, SEARCHSTRING) Then
     BanUser Username
   Else
     ChannelList.Add User
     WriteUserJoinedMessage User, Product
   End If
 End Case
 Case ID_TALK:
   If MatchesWildcard(Username, SEARCHSTRING) Then
     BanUser Username
   Else
     WriteUserSpokeMessage User, Message
   End If
 End Case
End Switch


Wow.....  That was hard....  You should almost be able to move that right into VB by changing the Switch statement and replacing the Write...Message subroutine identifiers...

(Excuse my VB grammar, I'm not sure how the Select...Case operator works....  I know that in C and its derivitives, we use case case:... break)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Networks

I need some help with wildcarding code:

I want to be abled to ban tags like: *]ZeR0[*
in that format for example

my wildcard function is:


Public Function matches(ByVal uName As String, ByVal Check As String) As Boolean
Call PrepareCheck(Check)
If uName = Empty Then
  matches = False
  Exit Function
End If
If LCase$(uName) Like LCase$(Check) Then matches = True
End Function
Function PrepareCheck(ByVal toCheck As String) As String
   toCheck = Replace(toCheck, "[", "ÿ")
   toCheck = Replace(toCheck, "]", "Ö")
   toCheck = Replace(toCheck, "~", "Ü")
   toCheck = Replace(toCheck, "#", "¢")
   toCheck = Replace(toCheck, "-", "£")
   toCheck = Replace(toCheck, "&", "¥")
   toCheck = Replace(toCheck, "@", "¤")
   toCheck = Replace(toCheck, "{", "ƒ")
   toCheck = Replace(toCheck, "}", "á")
   toCheck = Replace(toCheck, "^", "í")
   toCheck = Replace(toCheck, "`", "ó")
   toCheck = Replace(toCheck, "_", "ú")
   toCheck = Replace(toCheck, "+", "ñ")
   toCheck = Replace(toCheck, "$", "Ñ")
   PrepareCheck = LCase(toCheck)
End Function



I tested the function and it works fairly well except it wont find matches with *]ZeR0[* even when there is one:


For II = 1 To Form1.Users.ListItems.Count
If matches(Form1.Users.ListItems(II), "*]zer0[") = True Then
AddC vbGreen, Form1.Users.ListItems(II) & " was found."
End If
Next II


it told me invalid pattern string y is this?
Can someone please help me with wildcard code that can find matches w/ *]ZeR0[* please

MyndFyre

#20
Here is your code:


For II = 1 To Form1.Users.ListItems.Count
If matches(Form1.Users.ListItems(II), "*]zer0[") = True Then
AddC vbGreen, Form1.Users.ListItems(II) & " was found."
End If
Next II


And let me highlight an interesting section:


If matches(Form1.Users.ListItems(II), "*]zer0[" ) = True Then


Forgot a * there smart guy.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Networks

#21
Not really cuz when its: *]ZeR0[ it says invalid pattern and if its *]zer0[* doesn't find it...
Plus i have a user w/ a ]zer0[ tag in users

Smart guy....