salam c# team
Please help in making message repeat filter
Please help in making message repeat filter
No user |
desiboy wrote:dash miran , hadafash ine ke masalan kase 3 bar hi begad to room , ban beshe
ban by same message
timer1.Interval = 5000;
timer1.Enabled = true;
listBox1.Items.Clear();
if(msg.Type==MessageType.groupchat)
{
listBox1.Items.Add(msg.From.Resource+"@"+msg.Body);
if(isBan(msg.From.Resource,msg.Body) == true)
{
agsXMPP.protocol.x.muc.MucManager mucManager = new agsXMPP.protocol.x.muc.MucManager(x);
mucManager.BanUser(new Jid(msg.From.Bare), new Jid(msg.From.Resource + "@nimbuzz.com"));
}
}
bool isBan(string user,string body)
{
if (listBox1.Items.Count > 0)
{
List<string> userMsgs = new List<string>();
for (int i = 0; i < listBox1.Items.Count; i++)
if ((listBox1.Items[i] as string).ToLower().StartsWith(user.ToLower()))
{
userMsgs.Add((listBox1.Items[i] as string).Substring((listBox1.Items[i] as string).Index("@")+1));
}
int index = 0;
for(int j = 0;j < userMsgs.Count;j++)
if(userMsgs[j].ToLower() == body.ToLower())
index++;
if (index > 3)
return true;
else
return false;
}
return false;
}
userMsgs.Add((listBox1.Items[i] as string).Substring((listBox1.Items[i] as string).Index("@")+1));
userMsgs.Add((listBox3.Items[i] as string).Substring((listBox3.Items[i] as string).IndexOf("@") + 1));
if (index > 3)
return true;
else
return false;
if (index > (numericUpDown.Value as int))
if (index > (numericUpDown.Value as int))
Convert.ToInt32(numericUpDown.Value);
if (index > Convert.ToInt32(numericUpDown5.Value))