Redefining JS callbacks

JS callbacks are used to establish communication between Messenger application and your web site. For example add a user to friends list, report a user, etc. Flash object calls relevant JS functions with parameters.

You can redefine these functions in Messenger.htm file and add custom code to perform the required action. In most cases you will have to use AJAX to do that.

function Z5MessengerEvent(event, param1, param2)
{
switch(event)
{
case 'viewProfile':
    var userID = param1;
    var userName = param2; 
     // TODO add your code here
    break;
case 'addFriend':
    var userID = param1;
    var friendID = param2;
    // TODO add your code here
    z5messenger.Refresh();
    break;
case 'removeFriend':
    var userID = param1;
    var friendID = param2;
    // TODO add your code here
    z5messenger.Refresh();
    break;
case 'block':
    var userID = param1;
    var blockID = param2;
    // TODO add your code here
    z5messenger.Refresh();
    break;
case 'unblock':
    var userID = param1;
    var blockID = param2;
    // TODO add your code here
    z5messenger.Refresh();
    break;
case 'abuse':
    var userID = param1;
    var friendID = param2;
 
   break;
   }
}

 

 

Site Messenger caches profile data on media server side therefore if any changes happens to user's profile on the website they will not be reflected with Messenger or Friends List widget. Use the following options to tell Messenger to refresh profile data:

1. Set cookie on user's side: z5refresh=true

2. Call JavaScript function from im.js file: z5messenger.Refresh()