ClubApp.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*-------------------------------------------------------------------------
  2. ClubApp.h
  3. Main class for the club
  4. Owner:
  5. Copyright 1986-2000 Microsoft Corporation, All Rights Reserved
  6. *-----------------------------------------------------------------------*/
  7. #ifndef _CLUBAPP_H_
  8. #define _CLUBAPP_H_
  9. /////////////////////////////////////////////////////////////////////////////
  10. // Forward Declarations
  11. class IClubAppSite;
  12. class IClubClientSite : public IFedMessagingSite
  13. {
  14. public:
  15. // IFedMessagingSite
  16. virtual HRESULT OnAppMessage(FedMessaging * pthis, CFMConnection & cnxnFrom, FEDMESSAGE * pfm);
  17. virtual HRESULT OnSysMessage(FedMessaging * pthis) ;
  18. virtual void OnMessageNAK(FedMessaging * pthis, DWORD dwTime, CFMRecipient * prcp) ;
  19. virtual HRESULT OnNewConnection(FedMessaging * pthis, CFMConnection & cnxn) ;
  20. virtual HRESULT OnDestroyConnection(FedMessaging * pthis, CFMConnection & cnxn) ;
  21. virtual HRESULT OnSessionLost(FedMessaging * pthis) ;
  22. virtual int OnMessageBox(FedMessaging * pthis, const char * strText, const char * strCaption, UINT nType);
  23. };
  24. class CSQLSiteImpl: public ISQLSite
  25. {
  26. virtual int OnMessageBox(const char * strText, const char * strCaption, UINT nType);
  27. };
  28. extern CSQLSiteImpl g_SQLSite; // needs to be global cause SQL stuff is globally initialized
  29. class CClubApp: public Win32App
  30. //$ ASYNCCLUB
  31. // , public ISQLSite2
  32. {
  33. public:
  34. CClubApp(IClubSite * plas);
  35. ~CClubApp();
  36. // Win32App
  37. virtual bool OnAssert(const char* psz, const char* pszFile, int line, const char* pszModule);
  38. virtual void DebugOutput(const char *psz);
  39. HRESULT Init();
  40. int Run();
  41. IClubSite * GetSite()
  42. {
  43. return m_plas;
  44. }
  45. IClubClientSite * GetClientSite()
  46. {
  47. return &m_siteClient;
  48. }
  49. FedMessaging & GetFMClients()
  50. {
  51. return m_fmClients;
  52. }
  53. virtual int OnMessageBox(const char * strText, const char * strCaption, UINT nType);
  54. CLUB_COUNTERS * GetCounters()
  55. {
  56. return m_pCounters;
  57. }
  58. Time GetNow() // time at beginning of current cycle
  59. {
  60. return m_timeNow;
  61. }
  62. void SetRankInfo(RankInfo * vRankInfo, short cRankInfo)
  63. {
  64. assert(m_vRankInfo == NULL);
  65. m_vRankInfo = vRankInfo;
  66. m_cRankInfo = cRankInfo;
  67. }
  68. RankInfo * GetRankInfo()
  69. {
  70. return m_vRankInfo;
  71. }
  72. short GetRankInfoCount()
  73. {
  74. return m_cRankInfo;
  75. }
  76. char * GetAuthServer()
  77. {
  78. return m_szAuthServer;
  79. }
  80. TRef<IZoneAuthServer> GetZoneAuthServer()
  81. {
  82. return m_pzas;
  83. }
  84. char * GetToken()
  85. {
  86. return m_szToken;
  87. }
  88. //$ ASYNCCLUB
  89. /*
  90. // ISQLSite2
  91. virtual void OnSQLErrorRecord(SSERRORINFO * perror, OLECHAR * postrError);
  92. virtual void OnOLEDBErrorRecord(BSTR bstrDescription, GUID guid, DWORD dwHelpContext,
  93. BSTR bstrHelpFile, BSTR bstrSource );
  94. */
  95. private:
  96. const char * SzFmMsgHeader() {return "Clients: ";}
  97. bool ReadFromRegistry(HKEY & hk, bool bIsString, const char * szItem, void * pValue, DWORD dwDefault);
  98. void SetNow()
  99. {
  100. m_timeNow = Time::Now();
  101. }
  102. IClubSite * m_plas;
  103. FedMessaging m_fmClients;
  104. IClubClientSite m_siteClient;
  105. // *** Perfmon counter stuff ***
  106. CPerfShare m_perfshare;
  107. CLUB_COUNTERS * m_pCounters;
  108. Time m_timeNow;
  109. TRef<IZoneAuthServer> m_pzas;
  110. RankInfo* m_vRankInfo;
  111. short m_cRankInfo;
  112. char m_szAuthServer[64];
  113. char m_szToken[24]; // sizeof(_ZONETICKET_TOKEN.szToken)
  114. /*
  115. //$ ASYNCCLUB
  116. CSQLCore m_sql;
  117. DWORD m_dwThreadsNotify;
  118. DWORD m_dwThreadsSilent;
  119. CComBSTR m_bstrSQLConfig;
  120. */
  121. };
  122. extern CClubApp * g_pClubApp;
  123. #endif