home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / hiddenfr.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  20.9 KB  |  765 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #include "stdafx.h"
  20.  
  21. #include "hiddenfr.h"
  22. #include "template.h"
  23. #ifdef MOZ_MAIL_NEWS
  24. #include "wfemsg.h"
  25. #endif
  26. #include "timer.h"
  27. #ifdef MOZ_MAIL_NEWS
  28. #include "addrfrm.h"
  29. #endif
  30. #include "feselect.h"
  31. #include "postal.h" 
  32. #include "ssl.h"
  33.  
  34. #ifdef MOZ_MAIL_NEWS
  35. #include "nscpmapi.h"         // rhp - for MAPI
  36. #include "mapihook.h"         // rhp - for MAPI
  37. #include "mapismem.h"
  38. #endif 
  39.  
  40. #ifdef _DEBUG
  41. #undef THIS_FILE
  42. static char BASED_CODE THIS_FILE[] = __FILE__;
  43. #endif
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CHiddenFrame
  47.  
  48. #ifndef _AFXDLL
  49. #undef new
  50. #endif
  51. IMPLEMENT_DYNCREATE(CHiddenFrame, CFrameWnd)
  52. #ifndef _AFXDLL
  53. #define new DEBUG_NEW
  54. #endif
  55.  
  56. #define EXITING -10  //multi-instance code return values
  57. #define RUNNING  10
  58.  
  59. const UINT NEAR msg_FoundDNS = RegisterWindowMessage("NetscapeDNSFound");
  60. const UINT NEAR msg_ExitStatus = RegisterWindowMessage("ExitingNetscape");
  61.  
  62. UINT NEAR msg_ForceIOSelect = (UINT)-1;
  63. UINT NEAR msg_NetActivity = (UINT)-1;
  64. const UINT NEAR msg_AltMailBiffNotification = RegisterWindowMessage("Netscape Mail System"); 
  65.  
  66. //  Net dike.
  67. int gNetFloodStage = 0;
  68.  
  69. CHiddenFrame::CHiddenFrame()
  70. {
  71.     //  Attempt to make the registration of this as late as possible as to
  72.     //      get the highest possible ID (see NSPumpMessage).
  73.     msg_ForceIOSelect = RegisterWindowMessage("NetscapeForceIOSelect");
  74.     msg_NetActivity = RegisterWindowMessage("NetscapeSocketSelect");
  75. }
  76.  
  77. CHiddenFrame::~CHiddenFrame()
  78. {
  79. }
  80.  
  81. LONG CHiddenFrame::OnRequestExitStatus(WPARAM wParam/*0*/,LPARAM lParam/*0*/)
  82. {
  83.     return (theApp.m_bExitStatus ? EXITING :RUNNING );
  84. }
  85.  
  86.  
  87. BEGIN_MESSAGE_MAP(CHiddenFrame, CFrameWnd)
  88.     //{{AFX_MSG_MAP(CHiddenFrame)
  89.         // NOTE - the ClassWizard will add and remove mapping macros here.
  90.     ON_REGISTERED_MESSAGE(msg_NetActivity, OnNetworkActivity)
  91.     ON_REGISTERED_MESSAGE(msg_FoundDNS, OnFoundDNS)
  92.     ON_REGISTERED_MESSAGE(msg_ForceIOSelect, OnForceIOSelect)
  93.     ON_REGISTERED_MESSAGE(msg_ExitStatus, OnRequestExitStatus)
  94.     ON_MESSAGE(MSG_TASK_NOTIFY, OnTaskNotify)
  95.     ON_WM_DESTROY()
  96.     ON_WM_ENDSESSION()
  97.     //}}AFX_MSG_MAP
  98. #ifdef MOZ_MAIL_NEWS
  99.     ON_REGISTERED_MESSAGE(msg_AltMailBiffNotification, OnAltMailBiffNotification) 
  100. #endif
  101.     ON_WM_QUERYENDSESSION() //~~av
  102.  
  103. #ifdef MOZ_MAIL_NEWS
  104.     ON_MESSAGE(WM_COPYDATA, OnProcessIPCHook)    // rhp - for MAPI
  105. #endif
  106.  
  107. END_MESSAGE_MAP()
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CHiddenFrame message handlers
  111.  
  112. #define HIDDENTIME 333
  113. struct HiddenMessage   {
  114.     UINT m_uMsg;
  115.     WPARAM m_wParam;
  116.     LPARAM m_lParam;
  117. };
  118. void wfe_HiddenRepost(void *pData)
  119. {
  120.     HiddenMessage *pMsg = (HiddenMessage *)pData;
  121.     if(pMsg)    {
  122.         if(theApp.m_pMainWnd && theApp.m_pMainWnd->GetSafeHwnd())   {
  123.             theApp.m_pMainWnd->PostMessage(pMsg->m_uMsg, pMsg->m_wParam, pMsg->m_lParam);
  124.         }
  125.  
  126.         memset(pMsg, 0, sizeof(*pMsg));
  127.         delete pMsg;
  128.         pMsg = NULL;
  129.     }
  130. }
  131. void wfe_PostDelayedMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, uint32 uMilli = HIDDENTIME)
  132. {
  133.     HiddenMessage *pMsg = new HiddenMessage;
  134.     if(pMsg)    {
  135.         memset(pMsg, 0, sizeof(*pMsg));
  136.         pMsg->m_uMsg = uMsg;
  137.         pMsg->m_wParam = wParam;
  138.         pMsg->m_lParam = lParam;
  139.         void *pSet = FE_SetTimeout(wfe_HiddenRepost, (void *)pMsg, uMilli);
  140.         if(NULL == pSet)    {
  141.             delete pMsg;
  142.             pMsg = NULL;
  143.         }
  144.     }
  145. }
  146.  
  147. #ifdef MOZ_MAIL_NEWS
  148. LONG CHiddenFrame::OnAltMailBiffNotification(WPARAM wParam, LPARAM lParam)
  149. {
  150.     switch(wParam) {
  151.         case INBOX_STATE_NOMAIL:
  152.             FE_UpdateBiff(MSG_BIFF_NoMail);
  153.             break;
  154.  
  155.         case INBOX_STATE_UNKNOWN:
  156.             FE_UpdateBiff(MSG_BIFF_Unknown);
  157.             break;
  158.  
  159.         case INBOX_STATE_NEWMAIL:
  160.             FE_UpdateBiff(MSG_BIFF_NewMail);
  161.             break;
  162.  
  163.         default:
  164.             break;
  165.     }
  166.  
  167.     return(1); 
  168. }
  169. #endif // MOZ_MAIL_NEWS
  170.  
  171. LONG CHiddenFrame::OnForceIOSelect(WPARAM wParam, LPARAM lParam)
  172. {
  173.     //  Net dike. (see hiddenfr.h)
  174.     //  This code protects external message loops from the flood
  175.     //      of network messages we would normally handle, thus
  176.     //      keeping the app responsive while in a different
  177.     //      message loop.  External message loops being loops
  178.     //      other than CNetscapeApp::NSPumpMessage.
  179.     BOOL bDoHandle = TRUE;
  180.     if(::GetMessageTime() != (LONG)theApp.GetMessageTime())   {
  181.         //  Message came from different message loop than one
  182.         //      found in CNetscapeApp::NSPumpMessage.
  183.         BOOL bReposted = FALSE;
  184.         
  185.         //  In the CNetscapeApp::NSPumpMessage this variable is
  186.         //      usually incremented on EVERY MESSAGE.  Note the
  187.         //      difference here that we are incrementing it only
  188.         //      on receipt of a network message, causing a much
  189.         //      smaller window for these messages to get through.
  190.         //  A small counter-balance is that we are going to
  191.         //      repost the message, which causes this function
  192.         //      to be entered again at some later time (thus
  193.         //      incrementing the counter, etc).
  194.         //  CNetscapeApp::NSPumpMessage only peeks and
  195.         //      does not generate the overhead of yet another
  196.         //      message, unlike this suboptimal code.
  197.         gNetFloodStage++;
  198.         
  199.         //  1 : NET_FLOWCONTROL, we force a network event to be
  200.         //      handled regardless of the queue state.
  201.         if((gNetFloodStage % NET_FLOWCONTROL) != 0) {
  202.             //  See if there are messages not our own in the queue.
  203.             MSG msg;
  204.             if(::PeekMessage(&msg, NULL, 0, NET_MESSAGERANGE, PM_NOREMOVE)) {
  205.                 //  There are, repost till next time.
  206.                 //  We use a 1 millisecond timeout, based on what we know
  207.                 //      timers actually do.  Timers don't fire until the
  208.                 //      queue is empty; thus the message will repost once
  209.                 //      all other stuff is done.
  210.                 bDoHandle = FALSE;
  211.                 wfe_PostDelayedMessage(msg_ForceIOSelect, wParam, lParam, 1);
  212.             }
  213.         }
  214.     }
  215.  
  216.     if(bDoHandle) {
  217.         SelectType stType = (SelectType)wParam;
  218.         PRFileDesc *iFD = (PRFileDesc *)lParam;
  219.  
  220.         int iNetlibType = NET_SOCKET_FD;
  221.         if(stType == FileSelect)    {
  222.             iNetlibType = NET_LOCAL_FILE_FD;
  223.         }
  224.         else if(stType == NetlibSelect) {
  225.             iNetlibType = NET_EVERYTIME_TYPE;
  226.         }
  227.  
  228.         //  Must be socket or have in select list to continue.
  229.         //  We don't check sockets here, as it is too difficult to
  230.         //      segregate them out into their different select NetLib
  231.         //      categories (see feselect.cpp).
  232.         //
  233.         //  LJM removed call to HasSelect for nspr20 port 
  234.         //   if(iNetlibType == NET_SOCKET_FD || selecttracker.HasSelect(stType, iFD))    {
  235.         if(iNetlibType == NET_SOCKET_FD)    {
  236.             int iWantMore = 1;
  237.             BOOL bCalledNetlib = FALSE;
  238.         
  239.             if(winfeInProcessNet == FALSE)  {
  240.                 winfeInProcessNet = TRUE;
  241.                 iWantMore = NET_ProcessNet(iFD, iNetlibType);
  242.                 bCalledNetlib = TRUE;
  243.                 winfeInProcessNet = FALSE;
  244.             }
  245.  
  246.             if(bCalledNetlib == FALSE)  {
  247.                 //  Wait to repost message, as we are in the callstack of netlib.
  248.                 //  If a dialog is up, then we don't want to max the CPU by posting
  249.                 //      of the same message over and over and the user can't hit
  250.                 //      a button.
  251.                 wfe_PostDelayedMessage(msg_ForceIOSelect, wParam, lParam);
  252.             }
  253.             // LJM removed call to SSL_DataPending for NSPR20 port
  254.             else if(0 != iWantMore && (NET_SOCKET_FD != iNetlibType))   {
  255.                 //  Sockets don't need reposting if actually called netlib,
  256.                 //      as they will post messages themselves when data is ready.
  257.                 //      This is not true if they have SSL data buffered.
  258.                 //  However, we do repost for files, as they are ready for more.
  259.                 PostMessage(msg_ForceIOSelect, wParam, lParam);
  260.             }
  261.         }
  262.     }
  263.  
  264.     //  Always handled.
  265.     return(1);
  266. }
  267.  
  268. LONG CHiddenFrame::OnNetworkActivity(UINT socket, LONG lParam) 
  269. {
  270.     XP_ASSERT(0);
  271. #ifdef NSPR20_DISABLED
  272.     return(OnForceIOSelect((WPARAM)SocketSelect, (LPARAM)socket));
  273. #endif
  274.     return 0;
  275. }                       
  276.  
  277. LONG CHiddenFrame::OnFoundDNS(WPARAM wParam, LONG lParam) 
  278. {
  279.     int iError = WSAGETASYNCERROR(lParam);
  280.  
  281.     //  Go through the DNS cache, find the correct task ID.
  282.     //  The find should always be successful.
  283.     //  Be sure to initalize values.
  284.     POSITION pos = NULL;
  285.     CString key;
  286.     CDNSObj *obj = NULL;
  287.     int i_found = 0;
  288.     LONG return_value = 1;
  289.  
  290.     for(pos = DNSCacheMap.GetStartPosition(); pos != NULL;) {
  291.         DNSCacheMap.GetNextAssoc(pos, key, (CObject *&)obj);
  292.                 
  293.         if(!obj)
  294.             return return_value;
  295.         // Since the handle is not unique for the session only
  296.         // compare handles that are currently in use (i.e. active entries)
  297.         if(!obj->i_finished && obj->m_handle == (HANDLE)wParam) {
  298.               i_found = 1;
  299.               break;
  300.         }
  301.  
  302.         //  Clear out object if we didn't break.
  303.         //  That way we don't retain value if we leave the loop.
  304.         obj = NULL;
  305.     }
  306.  
  307.     if(!obj)
  308.         return return_value;
  309.   
  310.     TRACE("%s error=%d h_name=%d task=%d\n", obj->m_host, iError,
  311.         (obj->m_hostent->h_name != NULL) ? 1 : 0, obj->m_handle);
  312.  
  313.     //  If by chance we couldn't find it, we have a problem.
  314.     //
  315.     ASSERT(i_found == 1);
  316.  
  317.     /* temp fix */
  318.     if(!i_found)
  319.         return return_value;
  320.  
  321.     //  Mark this as completed.
  322.     //
  323.     obj->i_finished = 1;
  324.   
  325.     //  If there was an error, set it.
  326.     if (iError) {
  327.         TRACE("DNS Lookup failed! \n"); 
  328.         obj->m_iError = iError;
  329.         return_value = 0;
  330.     }
  331.       
  332.     /* call ProcessNet for each socket in the list */
  333.     /* use a for loop so that we don't reference the "obj"
  334.      * after our last call to processNet.  We need to do
  335.      * this because the "obj" can get free'd by the call
  336.      * chain after all the sockets have been removed from
  337.      * sock_list
  338.      */
  339.     PRFileDesc *tmp_sock;
  340.     int count = XP_ListCount(obj->m_sock_list);
  341.     for(; count; count--) {
  342.  
  343.         tmp_sock = (PRFileDesc *) XP_ListRemoveTopObject(obj->m_sock_list);
  344.  
  345.         //    Make sure we call into the Netlib on this socket in particular,
  346.         //        NET_SOCKET_FD type.
  347.         OnForceIOSelect((WPARAM)SocketSelect, (LPARAM)tmp_sock);
  348.     }
  349.  
  350.     return(return_value);
  351. }
  352.  
  353. void CHiddenFrame::OnDestroy()
  354. {
  355. #ifdef _WIN32
  356.     if (sysInfo.m_bWin4) {
  357.         // Kill this biff taskbar icon
  358.         NOTIFYICONDATA nid;
  359.         nid.cbSize = sizeof(NOTIFYICONDATA);
  360.         nid.hWnd = GetSafeHwnd();
  361.         nid.uID = ID_TOOLS_INBOX;
  362.         nid.uFlags = 0;
  363.         Shell_NotifyIcon( NIM_DELETE, &nid );
  364.     }
  365. #endif
  366.     CFrameWnd::OnDestroy();
  367. }
  368.  
  369. /****************************************************************************
  370. *
  371. *    Task notification handling functions
  372. *
  373. ****************************************************************************/
  374.  
  375. /****************************************************************************
  376. *
  377. *    CHiddenFrame::OnTaskNotify
  378. *
  379. *    PARAMETERS:
  380. *        wParam    - icon ID
  381. *        lParam    - mouse event
  382. *
  383. *    RETURNS:
  384. *        Non-zero if message is processed.
  385. *
  386. *    DESCRIPTION:
  387. *        This is the handler for the notification messages we received from
  388. *        task bar icons.
  389. *
  390. ****************************************************************************/
  391.  
  392. LONG CHiddenFrame::OnTaskNotify(WPARAM wParam, LPARAM lParam)
  393. {
  394.     switch (wParam)
  395.     {
  396.         case ID_TOOLS_WEB:
  397.         {
  398.             HandleWebNotification(lParam);
  399.         }
  400.         break;
  401.         
  402. #ifdef MOZ_MAIL_NEWS
  403.         case ID_TOOLS_MAIL:
  404.         {
  405.             HandleMailNotification(lParam);
  406.         }
  407.         break;
  408.         
  409.         case ID_TOOLS_INBOX:
  410.         {
  411.             HandleInboxNotification(lParam);
  412.         }
  413.         break;
  414. #endif /* MOZ_MAIL_NEWS */
  415. #ifdef EDITOR
  416.         case ID_TOOLS_EDITOR:
  417.         {
  418.             HandleEditorNotification(lParam);
  419.         }
  420.         break;
  421. #endif // EDITOR
  422. #ifdef MOZ_MAIL_NEWS        
  423.         case ID_TOOLS_NEWS:
  424.         {
  425.             HandleNewsNotification(lParam);
  426.         }
  427.         break;
  428.  
  429.         case ID_FILE_NEWMESSAGE:
  430.         {
  431.             HandleComposeNotification(lParam);
  432.         }
  433.         break;
  434.  
  435.         case ID_TOOLS_ADDRESSBOOK:
  436.         {
  437.             HandleAddressBookNotification(lParam);
  438.         }
  439.         break;
  440. #endif /* MOZ_MAIL_NEWS */
  441.     }
  442.     
  443.     return(1L);
  444.     
  445. } // END OF    FUNCTION CHiddenFrame::OnTaskNotify()
  446.  
  447. #ifdef MOZ_MAIL_NEWS
  448.  /****************************************************************************
  449. *
  450. *    CHiddenFrame::HandleMailNotification
  451. *
  452. *    PARAMETERS:
  453. *        lMessage    - mouse notification message
  454. *
  455. *    RETURNS:
  456. *        void
  457. *
  458. *    DESCRIPTION:
  459. *        This is the mouse event notification handler for the mail icon
  460. *        located in the Task Bar.
  461. *
  462. ****************************************************************************/
  463.  
  464. void CHiddenFrame::HandleMailNotification(LONG lMessage)
  465. {
  466.     switch (lMessage)
  467.     {
  468.         case WM_LBUTTONUP:
  469.         {
  470.             if(!theApp.m_bKioskMode) {    // TODO: is this still relevant?
  471.                 WFE_MSGOpenInbox();
  472.             }
  473.         }
  474.         break;
  475.         
  476.         case WM_RBUTTONUP:
  477.         case WM_MOUSEMOVE:
  478.         break;
  479.     }
  480. } // END OF    FUNCTION CHiddenFrame::HandleMailNotification()
  481.  
  482.  /****************************************************************************
  483. *
  484. *    CHiddenFrame::HandleInboxNotification
  485. *
  486. *    PARAMETERS:
  487. *        lMessage    - mouse notification message
  488. *
  489. *    RETURNS:
  490. *        void
  491. *
  492. *    DESCRIPTION:
  493. *        This is the mouse event notification handler for the inbox icon
  494. *        located in the Task Bar.
  495. *
  496. ****************************************************************************/
  497.  
  498. void CHiddenFrame::HandleInboxNotification(LONG lMessage)
  499. {
  500.     switch (lMessage)
  501.     {
  502.         case WM_LBUTTONUP:
  503.         {
  504.             // Single click on mail icon means bring forth the mail window,
  505.             // check mail too if it wasn't already open.
  506.             if(!theApp.m_bKioskMode)    // TODO: is this still relevant?
  507.             {
  508.                 WFE_MSGOpenInbox(TRUE);
  509.             }
  510.         }
  511.         break;
  512.         
  513.         case WM_RBUTTONUP:
  514.         case WM_MOUSEMOVE:
  515.         break;
  516.     }
  517. } // END OF    FUNCTION CHiddenFrame::HandleMailNotification()
  518. #endif /* MOZ_MAIL_NEWS */
  519.  
  520. /****************************************************************************
  521. *
  522. *    CHiddenFrame::HandleWebNotification
  523. *
  524. *    PARAMETERS:
  525. *        lMessage    - mouse notification message
  526. *
  527. *    RETURNS:
  528. *        void
  529. *
  530. *    DESCRIPTION:
  531. *        This is the mouse event notification handler for the Web icon
  532. *        located in the Task Bar.
  533. *
  534. ****************************************************************************/
  535.  
  536. void CHiddenFrame::HandleWebNotification(LONG lMessage)
  537. {
  538.     switch (lMessage)
  539.     {
  540.         case WM_LBUTTONUP:
  541.         {
  542.         /*    CAbstractCX *pCX = FEU_GetLastActiveFrameContext(MWContextAny);
  543.             CFrameWnd * pFrame = FEU_GetLastActiveFrame(MWContextAny);
  544.             if (pFrame && IsKindOf(RUNTIME_CLASS(CGenericFrame))) {
  545.                 ((CGenericFrame*)pFrame)->OnToolsWeb();
  546.             } else {
  547.                 theApp.m_ViewTmplate->OpenDocumentFile( NULL );
  548.             }*/
  549.             BOOL bHandledMessage = FALSE;
  550.  
  551.             CFrameWnd * pFrame = FEU_GetLastActiveFrame(MWContextAny);
  552.             if(pFrame)
  553.                 if(pFrame->SendMessage(WM_COMMAND, WPARAM(ID_TOOLS_WEB), 0))
  554.                     bHandledMessage = TRUE;
  555.  
  556.             if(!bHandledMessage)
  557.                 theApp.m_ViewTmplate->OpenDocumentFile( NULL );
  558.  
  559.         }
  560.         break;
  561.         
  562.         case WM_RBUTTONUP:
  563.         case WM_MOUSEMOVE:
  564.         break;
  565.     }
  566.  
  567. } // END OF    FUNCTION CHiddenFrame::HandleWebNotification()
  568.  
  569. #ifdef MOZ_MAIL_NEWS
  570. /****************************************************************************
  571. *
  572. *    CHiddenFrame::HandleNewsNotification
  573. *
  574. *    PARAMETERS:
  575. *        lMessage    - mouse notification message
  576. *
  577. *    RETURNS:
  578. *        void
  579. *
  580. *    DESCRIPTION:
  581. *        This is the mouse event notification handler for the news icon
  582. *        located in the Task Bar.
  583. *
  584. ****************************************************************************/
  585.  
  586. void CHiddenFrame::HandleNewsNotification(LONG lMessage)
  587. {
  588.     switch (lMessage)
  589.     {
  590.         case WM_LBUTTONUP:
  591.         {
  592.             if(!theApp.m_bKioskMode) {    // TODO: is this still relevant?
  593.                 WFE_MSGOpenNews();
  594.             }
  595.         }
  596.         break;
  597.         
  598.         case WM_RBUTTONUP:
  599.         case WM_MOUSEMOVE:
  600.         break;
  601.     }
  602. } // END OF    FUNCTION CHiddenFrame::HandleNewsNotification()
  603. #endif /* MOZ_MAIL_NEWS */
  604.  
  605. #ifdef EDITOR
  606. /****************************************************************************
  607. *
  608. *    CHiddenFrame::HandleEditorNotification
  609. *
  610. *    PARAMETERS:
  611. *        lMessage    - mouse notification message
  612. *
  613. *    RETURNS:
  614. *        void
  615. *
  616. *    DESCRIPTION:
  617. *        This is the mouse event notification handler for the Compose icon
  618. *        located in the Task Bar.
  619. *
  620. ****************************************************************************/
  621.  
  622. void CHiddenFrame::HandleEditorNotification(LONG lMessage)
  623. {
  624.     switch (lMessage)
  625.     {
  626.         case WM_LBUTTONUP:
  627.         {
  628.             // Find last active editor/browser and find or launch new editor from there
  629.  
  630.             // 2/17/96 - fixed bug 45611. Was creating disabled editor window when invoked from a
  631.             // Mail window. We need to look for any active frame, not just Browser frame.
  632.         // We send a message instead of assuming that it's a generic frame because the
  633.         // the inplace frame could be the last active frame.
  634.         CFrameWnd * pFrame = FEU_GetLastActiveFrame(MWContextAny, TRUE);
  635.             if (pFrame) {
  636.             pFrame->SendMessage(WM_COMMAND, WPARAM(ID_TOOLS_EDITOR), 0);
  637.             } else {
  638.                 // there should always be an active frame.
  639.                 ASSERT(FALSE);          // FE_CreateNewEditWindow(NULL, NULL);
  640.             }
  641.         }
  642.         break;
  643.         
  644.         case WM_RBUTTONUP:
  645.         case WM_MOUSEMOVE:
  646.         break;
  647.     }
  648. } // END OF    FUNCTION CHiddenFrame::HandleWebNotification()
  649. #endif
  650.  
  651. #ifdef MOZ_MAIL_NEWS
  652. /****************************************************************************
  653. *
  654. *    CHiddenFrame::HandleComposeNotification
  655. *
  656. *    PARAMETERS:
  657. *        lMessage    - mouse notification message
  658. *
  659. *    RETURNS:
  660. *        void
  661. *
  662. *    DESCRIPTION:
  663. *        This is the mouse event notification handler for the compose icon
  664. *        located in the Task Bar.
  665. *
  666. ****************************************************************************/
  667.  
  668. void CHiddenFrame::HandleComposeNotification(LONG lMessage)
  669. {
  670.     switch (lMessage)
  671.     {
  672.         case WM_LBUTTONUP:
  673.         {
  674.             CGenericFrame * pFrame = (CGenericFrame * )FEU_GetLastActiveFrame();
  675.             ASSERT(pFrame != NULL);
  676.             if (pFrame != NULL)
  677.             {
  678.                 CAbstractCX * pCX = pFrame->GetMainContext();
  679.  
  680.                 if (pCX)
  681.                 {
  682.                     MSG_Mail ( pCX->GetContext()  );
  683.                 }
  684.             }
  685.         }
  686.         break;
  687.         
  688.         case WM_RBUTTONUP:
  689.         case WM_MOUSEMOVE:
  690.         break;
  691.     }
  692. } // END OF    FUNCTION CHiddenFrame::HandleNewsNotification()
  693.  
  694.   void CHiddenFrame::HandleAddressBookNotification(LONG lMessage)
  695. {
  696.     switch (lMessage)
  697.     {
  698.         case WM_LBUTTONUP:
  699.             CAddrFrame::Open();
  700.         break;
  701.         
  702.         case WM_RBUTTONUP:
  703.         case WM_MOUSEMOVE:
  704.         break;
  705.     }
  706. } // END OF    FUNCTION CHiddenFrame::HandleAddressBookNotification()
  707. #endif /* MOZ_MAIL_NEWS */
  708.  
  709. //~~av
  710. // added this message handler not to allow it to fall through the default
  711. // MFC processing. Needed for bug 44748 fix when it crashed on system shutdown
  712. // if plugin was running
  713. BOOL CHiddenFrame::OnQueryEndSession() 
  714. {
  715.     return TRUE;
  716. }
  717.  
  718. void CHiddenFrame::OnEndSession(BOOL bEnding)
  719. {
  720.     if(bEnding) {
  721. #ifdef MOZ_MAIL_NEWS
  722.         WFE_MSGShutdown();
  723. #endif /* MOZ_MAIL_NEWS */
  724.         //  Close all frames, and we'll exit.
  725.         PostMessage(WM_COMMAND, ID_APP_SUPER_EXIT, 0);
  726.     }
  727. }
  728.  
  729. // rhp - 12/5/97
  730. // This will simply turn around and call the function
  731. // LONG ProcessNetscapeMAPIHook(WPARAM wParam, LPARAM lParam);
  732. // and return the result. This is all for MAPI support in 
  733. // Communicator
  734. //
  735. #ifdef MOZ_MAIL_NEWS    // No mail - no MAPI - for now, but this could live
  736.                     // for IPC reasons in the future without MAPI
  737.  
  738. LONG CHiddenFrame::OnProcessIPCHook(WPARAM wParam, LPARAM lParam)
  739. {
  740.   PCOPYDATASTRUCT      pcds = (PCOPYDATASTRUCT) lParam;
  741.  
  742.   if (!pcds)
  743.     return(-1);
  744.  
  745.   // Now check for what type of IPC message this really is?
  746.   if ((pcds->dwData > NSCP_MAPIStartRequestID) && (pcds->dwData < NSCP_MAPIEndRequestID))
  747.   {
  748.       return ( ProcessNetscapeMAPIHook(wParam, lParam) );
  749.   }
  750.  
  751.   return(-1);
  752. }
  753.  
  754. // rhp - new stuff for Address call...
  755. void CHiddenFrame::AddressDialog(LPSTR winText, 
  756.                                  MAPIAddressCallbackProc mapiCB,
  757.                                  MAPIAddressGetAddrProc getProc)
  758. {
  759.     CAddrDialog AddressDialog(this, TRUE, winText, mapiCB, getProc);
  760.     AddressDialog.DoModal();
  761. }
  762.  
  763. #endif /* MOZ_MAIL_NEWS */
  764.  
  765.