Great, that works fine. That's that script finished...
Thanks!
Actually, I have another question (sorry to keep on at this). This script blocks the opening of single conversations, group conversations, or both, opened by other users.
js code:
var Window;
var WindowContacts;
var FirstRunSetup = true;
var UserEmail = Messenger.MyEmail;
var SingleEnabled = false;
var GroupEnabled = false;
var SingleMessage = "";
var GroupMessage = "";
function OnEvent_Initialize(MessengerStart)
{
Debug.Trace("-> Welcome to ChatBlock!")
Debug.Trace("---> Settings for " + UserEmail + ":")
Debug.Trace("-----> Single chat block = " + SingleEnabled)
Debug.Trace("-------> Single chat message = \"" + SingleMessage + "\"")
Debug.Trace("-----> Group chat block = " + GroupEnabled)
Debug.Trace("-------> Group chat message = \"" + GroupMessage + "\"")
}
function OnEvent_ChatWndCreated(Wnd)
{
Window = Wnd;
WindowContacts = Wnd.Contacts;
Debug.Trace("-> Conversation window opened!")
Debug.Trace("---> Participants = " + WindowContacts.Count);
if(WindowContacts.Count==1)
{
Debug.Trace("-> Single conversation detected!")
if(SingleEnabled==true)
{
Debug.Trace("---> Single blocking is enabled!")
if(SingleMessage=="")
{
Debug.Trace("---> No single chat message setup...")
}
else
{
Window.SendMessage(SingleMessage);
Debug.Trace("---> Single chat message sent!")
}
Window.SendMessage("/close");
MsgPlus.DisplayToast("ChatBlock", "Single conversation blocked.")
Debug.Trace("-----> Single conversation blocked!")
}
else
{
Debug.Trace("---> Single blocking is disabled!")
}
}
if(WindowContacts.Count > 1)
{
Debug.Trace("-> Group conversation detected!")
if(GroupEnabled==true)
{
Debug.Trace("---> Group blocking is enabled!")
if(GroupMessage=="")
{
Debug.Trace("---> No group chat message setup...")
}
else
{
Window.SendMessage(GroupMessage);
Debug.Trace("---> Group chat message sent!")
}
Window.SendMessage("/close");
MsgPlus.DisplayToast("ChatBlock", "Group conversation blocked.")
Debug.Trace("-----> Group conversation blocked!")
}
else
{
Debug.Trace("---> Group blocking is disabled!")
}
}
}
You'll see that single and group blocking is currently disabled. However, the problem with this is that not only does it block windows opened by other users, but it also blocks the current user from opening windows as well! How can I set it so that if the current user opens a window (there's an email variable called "UserEmail"), the blocker will ignore it?