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.

77 lines
1.6 KiB

  1. #ifndef _Message_h_
  2. #define _Message_h_
  3. #define MSG_IN 1
  4. #define MSG_PRIVATE 2
  5. #define MSG_SYS 4
  6. #define INITIAL_LIMIT 500
  7. class CChatMessage
  8. {
  9. public:
  10. typedef enum eMsgTypes
  11. {
  12. MSG_SYSTEM = MSG_SYS,
  13. MSG_SAY = ~MSG_IN & ~MSG_PRIVATE,
  14. MSG_WHISPER = ~MSG_IN & MSG_PRIVATE,
  15. MSG_FROM_OTHER = MSG_IN & ~MSG_PRIVATE,
  16. MSG_WHISPER_FROM_OTHER = MSG_IN | MSG_PRIVATE
  17. } CHAT_MSGTYPE;
  18. private:
  19. static CChatMessage *ms_pFirst;
  20. static int ms_cMessages;
  21. static CChatMessage *ms_pLast;
  22. static int ms_iMessageLimit;
  23. private:
  24. LPTSTR m_szDate;
  25. LPTSTR m_szTime;
  26. LPTSTR m_szPerson;
  27. LPTSTR m_szMessage;
  28. CHAT_MSGTYPE m_msgType;
  29. CChatMessage *m_pNext;
  30. CChatMessage *m_pPrev;
  31. public:
  32. static CChatMessage *get_head();
  33. static int get_count();
  34. static CChatMessage *get_last();
  35. static void DeleteAll();
  36. static int get_limit();
  37. static void put_limit( int iLimit );
  38. BOOL inline IsPrivate()
  39. {
  40. return m_msgType & MSG_PRIVATE;
  41. }
  42. BOOL inline IsIncoming()
  43. {
  44. return m_msgType & MSG_IN;
  45. }
  46. BOOL inline IsValid()
  47. {
  48. return (m_szPerson != NULL) && (m_szMessage != NULL);
  49. }
  50. public:
  51. CChatMessage *get_next() const;
  52. CChatMessage *get_prev() const;
  53. CChatMessage::CHAT_MSGTYPE get_type() const;
  54. const LPTSTR get_date() const;
  55. const LPTSTR get_time() const;
  56. const LPTSTR get_person() const;
  57. const LPTSTR get_message() const;
  58. CChatMessage( LPCTSTR szPerson, LPCTSTR szMessage, CHAT_MSGTYPE msgType );
  59. ~CChatMessage();
  60. private:
  61. LPTSTR _CopyString( LPCTSTR sz );
  62. void _GetDate();
  63. void _GetTime();
  64. };
  65. #endif