This is how I would do it:
js code:
function OnEvent_ChatWndSendMessage ( oChatWnd , sMessage ) {
if ( /\/dispc$/.test ( sMessage ) ) {
var oStatusCount = {};
for ( var oContact = new Enumerator ( Messenger.MyContacts ) !oContact.atEnd( ); oContact.moveNext( ) ) {
++oStatusCount [ oContact.item( ).Status ];
}
var s = 'Offline: '+oStatusContact [ STATUS_INVISIBLE ]+'\n'+
'Online: '+oStatusContact [ STATUS_ONLINE ]+'\n'+
'Busy: '+oStatusContact [ STATUS_BUSY ]+'\n'+
'BRB: '+oStatusContact [ STATUS_BRB ]+'\n'+
'Idle: '+oStatusContact [ STATUS_IDLE ]+'\n'+
'Away: '+oStatusContact [ STATUS_AWAY ]+'\n'+
'In a call: '+oStatusContact [ STATUS_INCALL ]+'\n'+
'Eating: '+oStatusContact [ STATUS_OUTLUNCH ]
if ( oChatWnd.EditChangeAllowed === true ) return s;
}
}