Here is my code!
There is one thing that can't be changed. Everytime you change the DP to display the "copycated" the picture is added to your DP list. Scripts don't have access to that list so we can't change it!
Also.. it checks for DP changes every 10 seconds.
code:
// Copycat v1.0
var copycat_target = '';
var old_name;
var old_psm;
var old_dp;
var CntDP_old = '';
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if(Message.substr(0, 8) == '!copycat'){
if(copycat_target.length > 1){
copycat_target = '';
Messenger.MyName = old_name;
Messenger.MyPersonalMessage = old_psm;
Messenger.MyDisplayPicture = old_dp;
Debug.Trace("No more copycat");
MsgPlus.CancelTimer('CopyCatTimer');
return '';
}
var contacts = new Enumerator(ChatWnd.Contacts);
if(ChatWnd.Contacts.Count > 1)
return ''; //No copycat to multi users. Find way to warn the user
var e = contacts.item();
copycat_target = e.Email;
var CntDP = e.DisplayPicture;
CntDP_old = CntDP;
old_dp = Messenger.MyDisplayPicture;
if(CntDP != "")
Messenger.MyDisplayPicture = CntDP;
old_name = Messenger.MyName;
Messenger.MyName = e.Name;
var CntPM = e.PersonalMessage;
old_psm = Messenger.MyPersonalMessage;
if(CntPM)
Messenger.MyPersonalMessage = CntPM;
MsgPlus.AddTimer('CopyCatTimer', 10000);
Debug.Trace("CopyCat " + copycat_target);
return '';
}
}
function OnEvent_ContactNameChange(Email, NewName)
{
if(copycat_target == Email){
Debug.Trace("Change Name to " + NewName);
Messenger.MyName = NewName;
}
}
function OnEvent_ContactPsmChange(Email, NewPsm)
{
if(copycat_target == Email){
Debug.Trace("Change Psm to " + NewPsm);
Messenger.MyPersonalMessage = NewPsm;
}
}
function OnEvent_ContactStatusChange(Email, NewStatus)
{
if(copycat_target == Email){
Debug.Trace("Change status to " + NewStatus);
Messenger.MyStatus = NewStatus;
}
}
function OnEvent_Timer(TimerId)
{
if(TimerId == 'CopyCatTimer'){
if(copycat_target != ''){
var CntDP = Messenger.MyContacts.GetContact(copycat_target).DisplayPicture;
if((CntDP != CntDP_old) && (CntDP != "") ){
Messenger.MyDisplayPicture = CntDP;
CntDP_old = CntDP;
Debug.Trace("ChangeDP to " + CntDP);
}
MsgPlus.AddTimer('CopyCatTimer', 10000);
}
}
}
Code tag should maintain tabs..