Ill post the code here...
code:
var blocked = "False";
var BlockedContacts = new Array()
function OnEvent_ChatWndCreated(ChatWnd) {
var e = new Enumerator(ChatWnd.Contacts);
var Contact = e.item();
Contact.Blocked = "False";
}
function OnGetScriptMenu(Location) {
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"mnuBlockall\">Block all!</MenuEntry>";
ScriptMenu += "<Seperator/>";
ScriptMenu += "<MenuEntry Id=\"mnuUnblockall\">Unblock all!</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd) {
switch(MenuItemId) {
case 'mnuBlockall':
blockall();
break;
case 'mnuUnblockall':
unblockall();
break;
}
}
function blockall()
{
i = -1;
var e = new Enumerator(Messenger.MyContacts);
for(; !e.atEnd(); e.moveNext()) {
var Contact = e.item();
if (Contact.Blocked) {
BlockedContacts[i++] = Contact.Email;
}
Contact.Blocked = true;
}
blocked = true;
}
function unblockall()
{
var e = new Enumerator(Messenger.MyContacts);
for(; !e.atEnd(); e.moveNext()) {
var Contact = e.item();
// Check if contact was blocked before
Match = false;
var e2 = new Enumerator(BlockedContacts);
for(; !e2.atEnd(); e2.moveNext()) {
var BlockedEmail = e2.item();
if (Contact.Email == BlockedEmail) {
Match = true;
}
}
// Contact was blocked before > dont unblock
if (Match != true) {
Contact.Blocked = false;
}
}
blocked = false;
}