Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

328 lines
10 KiB

  1. // File: confroom.h
  2. #ifndef _CONFROOM_H_
  3. #define _CONFROOM_H_
  4. #include <ias.h>
  5. #include "MRUList.h"
  6. #include "AudioCtl.h"
  7. #include "ConfUtil.h"
  8. #include "callto.h"
  9. class CTopWindow;
  10. class CMainUI;
  11. class CSeparator;
  12. class CRoomListView;
  13. class CConfStatusBar;
  14. class CPopupMsg;
  15. class CFloatToolbar;
  16. class CVideoWindow;
  17. class CParticipant;
  18. class CComponentWnd;
  19. class CAudioControl;
  20. class CCall;
  21. struct IComponentWnd;
  22. struct IConferenceLink;
  23. struct TOOLSMENUSTRUCT;
  24. struct MYOWNERDRAWSTRUCT;
  25. struct RichAddressInfo;
  26. interface IEnumRichAddressInfo;
  27. interface IConferenceChangeHandler : public IUnknown
  28. {
  29. public:
  30. virtual void OnCallStarted() = 0;
  31. virtual void OnCallEnded() = 0;
  32. virtual void OnAudioLevelChange(BOOL fSpeaker, DWORD dwVolume) = 0;
  33. virtual void OnAudioMuteChange(BOOL fSpeaker, BOOL fMute) = 0;
  34. virtual void OnChangeParticipant(CParticipant *pPart, NM_MEMBER_NOTIFY uNotify) = 0;
  35. virtual void OnChangePermissions() = 0;
  36. virtual void OnVideoChannelChanged(NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel) = 0;
  37. } ;
  38. class CConfRoom : RefCount, INmConferenceNotify2, IAppSharingNotify, IAudioEvent
  39. {
  40. friend class CNetMeetingObj;
  41. friend bool IsSpeakerMuted();
  42. friend bool IsMicMuted();
  43. friend void MuteSpeaker(BOOL fMute);
  44. friend void MuteMicrophone(BOOL fMute);
  45. friend DWORD GetRecorderVolume();
  46. friend DWORD GetSpeakerVolume();
  47. friend void SetRecorderVolume(DWORD dw);
  48. friend void SetSpeakerVolume(DWORD dw);
  49. friend CVideoWindow* GetLocalVideo();
  50. friend CVideoWindow* GetRemoteVideo();
  51. private:
  52. CTopWindow * m_pTopWindow;
  53. CSimpleArray<CParticipant*> m_PartList; // CParticipant list
  54. CCopyableArray<IConferenceChangeHandler*> m_CallHandlerList;
  55. CParticipant * m_pPartLocal;
  56. UINT m_cParticipants;
  57. DWORD m_dwConfCookie;
  58. INmConference2 * m_pInternalNmConference;
  59. CAudioControl * m_pAudioControl;
  60. IAppSharing * m_pAS;
  61. NM30_MTG_PERMISSIONS m_settings; // Settings for the meeting
  62. NM30_MTG_PERMISSIONS m_attendeePermissions; // Everybody BUT host
  63. BOOL m_fTopProvider : 1; // TRUE if we're the top provider
  64. BOOL m_fGetPermissions : 1;
  65. BOOL LeaveConference(void);
  66. VOID SaveSettings();
  67. // handlers:
  68. VOID OnCallStarted();
  69. VOID OnCallEnded();
  70. void OnChangeParticipant(CParticipant *pPart, NM_MEMBER_NOTIFY uNotify);
  71. void OnChangePermissions();
  72. BOOL OnPersonJoined(INmMember * pMember);
  73. BOOL OnPersonLeft(INmMember * pMember);
  74. VOID OnPersonChanged(INmMember * pMember);
  75. VOID CheckTopProvider(void);
  76. DWORD GetCallFlags();
  77. public:
  78. CConfRoom();
  79. ~CConfRoom();
  80. // IUnknown methods:
  81. //
  82. STDMETHODIMP_(ULONG) AddRef(void);
  83. STDMETHODIMP_(ULONG) Release(void);
  84. STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppvObj);
  85. //
  86. // INmConferenceNotify2 methods:
  87. //
  88. STDMETHODIMP NmUI(CONFN uNotify);
  89. STDMETHODIMP StateChanged(NM_CONFERENCE_STATE uState);
  90. STDMETHODIMP MemberChanged(NM_MEMBER_NOTIFY uNotify, INmMember *pMember);
  91. STDMETHODIMP ChannelChanged(NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel);
  92. STDMETHODIMP StreamEvent(NM_STREAMEVENT uEvent, UINT uSubCode,INmChannel __RPC_FAR *pChannel);
  93. STDMETHODIMP OnConferenceCreated(INmConference *pConference);
  94. //
  95. // IAppSharingNotify methods
  96. //
  97. STDMETHODIMP OnReadyToShare(BOOL fReady);
  98. STDMETHODIMP OnShareStarted(void);
  99. STDMETHODIMP OnSharingStarted(void);
  100. STDMETHODIMP OnShareEnded(void);
  101. STDMETHODIMP OnPersonJoined(IAS_GCC_ID gccMemberID);
  102. STDMETHODIMP OnPersonLeft(IAS_GCC_ID gccMemberID);
  103. STDMETHODIMP OnStartInControl(IAS_GCC_ID gccOfMemberID);
  104. STDMETHODIMP OnStopInControl(IAS_GCC_ID gccOfMemberID);
  105. STDMETHODIMP OnPausedInControl(IAS_GCC_ID gccOfMemberID);
  106. STDMETHODIMP OnUnpausedInControl(IAS_GCC_ID gccOfMemberID);
  107. STDMETHODIMP OnControllable(BOOL fControllable);
  108. STDMETHODIMP OnStartControlled(IAS_GCC_ID gccByMemberID);
  109. STDMETHODIMP OnStopControlled(IAS_GCC_ID gccByMemberID);
  110. STDMETHODIMP OnPausedControlled(IAS_GCC_ID gccByMemberID);
  111. STDMETHODIMP OnUnpausedControlled(IAS_GCC_ID gccByMemberID);
  112. virtual void OnLevelChange(BOOL fSpeaker, DWORD dwVolume);
  113. virtual void OnMuteChange(BOOL fSpeaker, BOOL fMute);
  114. // end IGenWindow interface
  115. // Public methods:
  116. BOOL Init();
  117. HWND Create(BOOL fShowUI);
  118. VOID CleanUp();
  119. BOOL BringToFront();
  120. VOID UpdateUI(DWORD dwUIMask);
  121. VOID ForceWindowResize();
  122. BOOL FIsClosing();
  123. CTopWindow * GetTopWindow() { return m_pTopWindow; }
  124. HWND GetTopHwnd();
  125. HPALETTE GetPalette();
  126. CSimpleArray<CParticipant*>& GetParticipantList()
  127. { return m_PartList; }
  128. DWORD GetMeetingPermissions(void) { return m_attendeePermissions; }
  129. DWORD GetMeetingSettings(void) { return m_settings; }
  130. void CmdShowFileTransfer(void);
  131. void CmdShowSharing(void);
  132. void CmdShowMeetingSettings(HWND hwnd);
  133. HRESULT FreeAddress(RichAddressInfo **ppAddr);
  134. HRESULT CopyAddress(RichAddressInfo *pAddrIn,
  135. RichAddressInfo **ppAddrOut);
  136. HRESULT
  137. ResolveAndCall
  138. (
  139. const HWND parentWindow,
  140. const TCHAR * const displayName,
  141. const RichAddressInfo * const rai,
  142. const bool secure
  143. );
  144. HRESULT GetRecentAddresses(IEnumRichAddressInfo **ppEnum);
  145. CVideoWindow* GetLocalVideo();
  146. CVideoWindow* GetRemoteVideo();
  147. CAudioControl* GetAudioControl() { return(m_pAudioControl); }
  148. BOOL FIsConferenceActive(void) { return NULL != GetActiveConference(); }
  149. INmConference2* GetActiveConference(void);
  150. INmConference2* GetConference() { return m_pInternalNmConference; }
  151. DWORD GetConferenceStatus(LPTSTR pszStatus, int cchMax, UINT * puID);
  152. HRESULT HostConference(LPCTSTR pcszName, LPCTSTR pcszPassword, BOOL fSecure, DWORD permitFlags, UINT maxParticipants);
  153. void OnCommand(HWND hwnd, int wCommand, HWND hwndCtl, UINT codeNotify);
  154. HRESULT GetSelectedAddress(LPTSTR pszAddress, UINT cchAddress,
  155. LPTSTR pszEmail=NULL, UINT cchEmail=0,
  156. LPTSTR pszName=NULL, UINT cchName=0);
  157. // Application Sharing Functions
  158. BOOL FCanShare();
  159. BOOL FIsSharingAvailable();
  160. void LaunchHostUI(void);
  161. BOOL FInShare();
  162. BOOL FIsSharing();
  163. BOOL FIsControllable();
  164. HRESULT GetPersonShareStatus(UINT gcc, IAS_PERSON_STATUS * pas);
  165. HRESULT AllowControl(BOOL fAllow);
  166. HRESULT RevokeControl(UINT gccTo);
  167. HRESULT GiveControl(UINT gccTo);
  168. HRESULT CancelGiveControl(UINT gccTo);
  169. // the following methods are used by scrapi only
  170. HRESULT CmdShare(HWND hwnd);
  171. HRESULT CmdUnshare(HWND hwnd);
  172. BOOL FIsWindowShareable(HWND hwnd);
  173. BOOL FIsWindowShared(HWND hwnd);
  174. HRESULT GetShareableApps(IAS_HWND_ARRAY** ppList);
  175. HRESULT FreeShareableApps(IAS_HWND_ARRAY* pList);
  176. // Audio Functions
  177. VOID SetSpeakerVolume(DWORD dwLevel);
  178. VOID SetRecorderVolume(DWORD dwLevel);
  179. VOID MuteSpeaker(BOOL fMute);
  180. VOID MuteMicrophone(BOOL fMute);
  181. VOID OnAudioDeviceChanged();
  182. VOID OnAGC_Changed();
  183. VOID OnSilenceLevelChanged();
  184. // Member Functions
  185. CParticipant * GetH323Remote(void);
  186. CParticipant * ParticipantFromINmMember(INmMember * pMember);
  187. CParticipant * GetLocalParticipant() {return m_pPartLocal;}
  188. BOOL FTopProvider() {return m_fTopProvider;}
  189. VOID AddConferenceChangeHandler(IConferenceChangeHandler *pch);
  190. VOID RemoveConferenceChangeHandler(IConferenceChangeHandler *pch);
  191. IAppSharing *GetAppSharing() { return(m_pAS); }
  192. BOOL CanCloseChat(HWND hwndMain);
  193. BOOL CanCloseWhiteboard(HWND hwndMain);
  194. BOOL CanCloseFileTransfer(HWND hwndMain);
  195. void ToggleLdapLogon();
  196. // Stuff needed by CTopWindow
  197. UINT GetMemberCount(void) { return m_cParticipants; }
  198. BOOL OnHangup(HWND hwndParent, BOOL fNeedConfirm=TRUE);
  199. BOOL FHasChildNodes(void);
  200. VOID TerminateAppSharing(void);
  201. VOID FreePartList(void);
  202. VOID StartAppSharing(void);
  203. BOOL IsSharingAllowed();
  204. BOOL IsNewWhiteboardAllowed();
  205. BOOL IsOldWhiteboardAllowed();
  206. BOOL IsChatAllowed();
  207. BOOL IsFileTransferAllowed();
  208. BOOL IsNewCallAllowed();
  209. static HRESULT HangUp(BOOL bUserPrompt = TRUE);
  210. // Global UI shutdown handler:
  211. static VOID UIEndSession(BOOL fLogoff);
  212. static
  213. void
  214. get_securitySettings
  215. (
  216. bool & userAlterable,
  217. bool & secure
  218. );
  219. };
  220. HRESULT ShareWindow(HWND hWnd);
  221. HRESULT UnShareWindow(HWND hWnd);
  222. HRESULT GetWindowState(NM_SHAPP_STATE* pState, HWND hWnd);
  223. BOOL AllowingControl();
  224. HRESULT GetShareableApps(IAS_HWND_ARRAY** ppList);
  225. HRESULT FreeShareableApps(IAS_HWND_ARRAY * pList);
  226. // Global utility functions
  227. BOOL FTopProvider(void);
  228. BOOL FRejectIncomingCalls(void);
  229. BOOL FIsConfRoomClosing(void);
  230. extern CConfRoom * g_pConfRoom;
  231. inline CConfRoom * GetConfRoom(void) {return g_pConfRoom; }
  232. inline CTopWindow * GetTopWindow(void)
  233. { return(NULL == g_pConfRoom ? NULL : g_pConfRoom->GetTopWindow()); }
  234. HRESULT GetShareState(ULONG ulGCCId, NM_SHARE_STATE *puState);
  235. BOOL ConfRoomInit(HANDLE hInstance);
  236. BOOL CreateConfRoomWindow(BOOL fShowUI = TRUE);
  237. DWORD MapNmAddrTypeToNameType(NM_ADDR_TYPE addrType);
  238. HRESULT AllowControl(bool bAllowControl);
  239. HRESULT RevokeControl(UINT gccID);
  240. bool IsSpeakerMuted();
  241. bool IsMicMuted();
  242. DWORD GetRecorderVolume();
  243. DWORD GetSpeakerVolume();
  244. BOOL CmdShowNewWhiteboard(LPCTSTR szFile);
  245. BOOL CmdShowOldWhiteboard(LPCTSTR szFile);
  246. VOID CmdShowChat(void);
  247. void PauseLocalVideo(BOOL fPause);
  248. void PauseRemoteVideo(BOOL fPause);
  249. BOOL IsLocalVideoPaused();
  250. BOOL IsRemoteVideoPaused();
  251. HRESULT GetRemoteVideoState(NM_VIDEO_STATE *puState);
  252. HRESULT GetLocalVideoState(NM_VIDEO_STATE *puState);
  253. HRESULT GetImageQuality(ULONG* pul, BOOL bIncoming);
  254. HRESULT SetImageQuality(ULONG ul, BOOL bIncoming);
  255. HRESULT SetCameraDialog(ULONG ul);
  256. HRESULT GetCameraDialog(ULONG* pul);
  257. #endif // _CONFROOM_H_