Code Viewer

./WindowHandlers/ContactSelector_handler.js File Size: 4.94 KB

  1. /*
  2. *
  3. *      ContactSelector.xml
  4. *     
  5. */
  6.  
  7. function OnContactSelectorEvent_LstViewDblClicked(pPlusWnd, sControlId, nItemIdx) {
  8.         if (nItemIdx === -1) return false;
  9.         var WndTmpConversationWnd = Messenger.OpenChat(pPlusWnd.LstView_GetItemText(sControlId, nItemIdx, 1));
  10.         if (WndTmpConversationWnd.EditChangeAllowed)
  11.                 oChatWnd_SendFile(WndTmpConversationWnd, objChatWnds[pPlusWnd.Handle].Image);
  12.         CloseWindow('ContactSelector');
  13. }
  14.  
  15. function OnContactSelectorEvent_CtrlClicked(pPlusWnd, sControlId) {
  16.         if (sControlId.match(/^BaseBtn/)) {
  17.                 if (sControlId === 'BaseBtnCancel') {
  18.                         CloseWindow('ScreenshotViewer');
  19.                         return false;
  20.                 } else return; // Check to see if these are the control box controls
  21.         }       
  22.        
  23.         // to do
  24.         switch(sControlId) {
  25.                 case 'chkShowConversationContacts':
  26.                         try { ClearListView(pPlusWnd.GetControlHandle('LvContacts')); } catch (e) {}
  27.                         var bOpenChats = pPlusWnd.Button_IsChecked(sControlId);
  28.                         ContactAddToList(pPlusWnd, 'LvContacts', bOpenChats);
  29.                         break;
  30.                 case 'BtnSend':
  31.                         for (var j=0; j<pPlusWnd.LstView_GetCount('LvContacts'); j ++) {
  32.                                 if (pPlusWnd.LstView_GetCheckedState('LvContacts', j)) {
  33.                                         var WndTmpConversationWnd = Messenger.OpenChat(pPlusWnd.LstView_GetItemText('LvContacts', j, 1));
  34.                                         if (WndTmpConversationWnd.EditChangeAllowed) {
  35.                                                 oChatWnd_SendFile(WndTmpConversationWnd, objChatWnds[pPlusWnd.Handle].Image);
  36.                                         }
  37.                                 }
  38.                         }
  39.                         CloseWindow('ContactSelector');
  40.                         break;
  41.         }
  42. }
  43.  
  44. function ContactAddToList(pPlusWnd, sListView, bOpenChats) {
  45.         var objContacts = {}, nIndex = 0, o, e, e1, i;
  46.         if (bOpenChats === true) {
  47.                 for (e = new Enumerator(Messenger.CurrentChats); !e.atEnd(); e.moveNext()) {
  48.                         for (e1 = new Enumerator(e.item().Contacts); !e1.atEnd(); e1.moveNext()) {
  49.                                 objContacts[e1.item().Email] = e1.item();
  50.                         }
  51.                 }
  52.         } else {
  53.                 for (var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext()) {
  54.                         objContacts[e.item().Email] = e.item();
  55.                 }
  56.         }
  57.  
  58.         for (var i in objContacts) {
  59.                 var o = objContacts[i];
  60.                 if (o.Status > STATUS_OFFLINE && o.Blocked === false && o.Network === 1 && o.Email.indexOf(':') === -1) {
  61.                         nIndex = pPlusWnd.LstView_AddItem(sListView, RemovePlusCodes(o.Name));
  62.                         pPlusWnd.LstView_SetItemText(sListView, nIndex, 1, o.Email);
  63.                         pPlusWnd.LstView_SetItemIcon(sListView, nIndex, oStatus[o.Status], true);
  64.                 }
  65.         }
  66. }
  67.  
  68. function OnContactSelectorEvent_Destroyed(pPlusWnd, nExitCode) {
  69.         if (nExitCode !== 6) {
  70.                 CloseWindow(pPlusWnd.WindowId);
  71.                 return false;
  72.         }
  73. }
  74.  

Version

  • 5.0.0070_20100325_publicbeta1

Developers

Project Details

  • Folders8
  • Files122
  • Total Lines11,867
  • Repository Version70

User Count

  • 162