/*
*
* ContactSelector.xml
*
*/
function OnContactSelectorEvent_LstViewDblClicked(pPlusWnd, sControlId, nItemIdx) {
if (nItemIdx === -1) return false;
var WndTmpConversationWnd = Messenger.OpenChat(pPlusWnd.LstView_GetItemText(sControlId, nItemIdx, 1));
if (WndTmpConversationWnd.EditChangeAllowed)
oChatWnd_SendFile(WndTmpConversationWnd, objChatWnds[pPlusWnd.Handle].Image);
CloseWindow('ContactSelector');
}
function OnContactSelectorEvent_CtrlClicked(pPlusWnd, sControlId) {
if (sControlId.match(/^BaseBtn/)) {
if (sControlId === 'BaseBtnCancel') {
CloseWindow('ScreenshotViewer');
return false;
} else return; // Check to see if these are the control box controls
}
// to do
switch(sControlId) {
case 'chkShowConversationContacts':
try { ClearListView(pPlusWnd.GetControlHandle('LvContacts')); } catch (e) {}
var bOpenChats = pPlusWnd.Button_IsChecked(sControlId);
ContactAddToList(pPlusWnd, 'LvContacts', bOpenChats);
break;
case 'BtnSend':
for (var j=0; j<pPlusWnd.LstView_GetCount('LvContacts'); j ++) {
if (pPlusWnd.LstView_GetCheckedState('LvContacts', j)) {
var WndTmpConversationWnd = Messenger.OpenChat(pPlusWnd.LstView_GetItemText('LvContacts', j, 1));
if (WndTmpConversationWnd.EditChangeAllowed) {
oChatWnd_SendFile(WndTmpConversationWnd, objChatWnds[pPlusWnd.Handle].Image);
}
}
}
CloseWindow('ContactSelector');
break;
}
}
function ContactAddToList(pPlusWnd, sListView, bOpenChats) {
var objContacts = {}, nIndex = 0, o, e, e1, i;
if (bOpenChats === true) {
for (e = new Enumerator(Messenger.CurrentChats); !e.atEnd(); e.moveNext()) {
for (e1 = new Enumerator(e.item().Contacts); !e1.atEnd(); e1.moveNext()) {
objContacts[e1.item().Email] = e1.item();
}
}
} else {
for (var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext()) {
objContacts[e.item().Email] = e.item();
}
}
for (var i in objContacts) {
var o = objContacts[i];
if (o.Status > STATUS_OFFLINE && o.Blocked === false && o.Network === 1 && o.Email.indexOf(':') === -1) {
nIndex = pPlusWnd.LstView_AddItem(sListView, RemovePlusCodes(o.Name));
pPlusWnd.LstView_SetItemText(sListView, nIndex, 1, o.Email);
pPlusWnd.LstView_SetItemIcon(sListView, nIndex, oStatus[o.Status], true);
}
}
}
function OnContactSelectorEvent_Destroyed(pPlusWnd, nExitCode) {
if (nExitCode !== 6) {
CloseWindow(pPlusWnd.WindowId);
return false;
}
}