Common.h
上传用户:guangzhiyw
上传日期:2007-01-09
资源大小:495k
文件大小:5k
源码类别:

ICQ/即时通讯

开发平台:

Visual C++

  1. #ifndef _COMMON_HEADER
  2. #define _COMMON_HEADER
  3. #define WM_RECIEVE_MSG  WM_USER+104
  4. #define WM_SHOW_NOTICE  WM_USER+105
  5. #define WM_SHOW_FRIEND_DETAIL WM_USER+106
  6. #define WM_RECVMSG WM_USER+ 107
  7. #define WM_SEND_MSG  WM_USER+108
  8. #define WM_RECV_SEARCH WM_USER+109
  9. #define WM_REFRESH_DATA WM_USER+110
  10. #define WM_ADDFRIEND_REFRESH WM_USER+111
  11. #define WM_NOTICE_ADDFRIEND WM_USER+112
  12. #define ResponseMsg "ok"
  13. #define USERFILE "users.db"
  14. #define MSGFILE  "msg.db"
  15. #define ALLUSERIDFILE "client.cfg"
  16. #define USERSETUP "config.dat"
  17. #define FACEINIFILE "face\face.ini"
  18. #define DEFAULT_SERVER_IP "127.0.0.1"
  19. #define DEFAULT_SERVER_PORT 4000
  20. const int TimeWaitForRes=6000;
  21. const int MaxUserNumber=500;
  22. const int UserIdRadix=2000;
  23. const int PersonNumEveryTime=20;
  24. const int TimerSpanServer=30000;
  25. const int TimerSpanClient=40000;
  26. const int DataBufLength=1000;
  27. const int MaxResponseMsgLength=20;
  28. const int UserFileReservedLength=20;
  29. const int MaxPasswordLength=16;
  30. const int LimitMaxMsgLength=900;
  31. const int AutoSaveTime=200000;
  32. const int CheckBufLength=128;
  33. const int crColorMask=0x01;
  34. const int RecvWndNumber=20;
  35. const int TimeWaitForFriendDetail=6000;
  36. const int TimeWaitForSearch=6000;
  37. const int TimeWaitForAddFriend=6000;
  38. class CData;
  39. class CMsg1;
  40. class CMsg2;
  41. class CLookDlg;
  42. class CTalkDlg;
  43. class CFriendDetailDlg;
  44. class CClientSocket;
  45. struct UserInfo{
  46. BYTE HaveDetail; //(0 no, 1 have)
  47. BYTE CanbeAdd;
  48. BYTE Sex;
  49. DWORD Id;
  50. DWORD PhotoId;
  51. char Age[10];
  52. char Name[20];
  53. char Phone[20];
  54. char Email[30];
  55. char Fax[20];
  56. char Homepage[40];
  57. char Address[60];
  58. char Department[20];
  59. char Description[100];
  60. UserInfo();
  61. };
  62. #define NORMAL_MSG 0
  63. #define NOTICE_MSG 1
  64. #define BEADDED_MSG 2
  65. #define ID_CHECK_MSG 3
  66. struct SaveMsg
  67. {
  68. BYTE type;
  69. DWORD ID;
  70. CTime Time;
  71. CString Msg;
  72. };
  73. struct FriendState
  74. {
  75. FriendState();
  76. ~FriendState();
  77. BYTE OnlineState;  //(0,1,2 offline,online,onhide)
  78. DWORD IP;
  79. DWORD Port;
  80. CArray<SaveMsg*,SaveMsg*>aMsg;
  81. int nCurrentMsg;
  82. CTalkDlg* pTalk;
  83. CLookDlg* pRecv;
  84. CFriendDetailDlg* pFInfo;
  85. };
  86. UINT RequestFriendDetail(LPVOID param);
  87. //--------------------------- Server Receive ------------------------------------------------
  88. //--------------------------- Client Send To Server------------------------------------------
  89. #define SEND_MSG_TO_FRIEND       1   //CMsg1 index,friendId,myId,msg,time  
  90. #define FRIEND_IDENTITY_VALIDATE 2   //CMsg1
  91. #define ADD_AS_FRIEND            3   //CMsg1 
  92. #define FRIEND_DETAIL            4   //CMsg1 
  93. #define FIND_FRIEND_BY_ID        5   //CMsg1 
  94. #define DELETE_A_FRIEND          6   //CMsg1 
  95. #define DELETE_SELF_IN_FRIEND    7   //CMsg1  选择在某人的好友中删除自己
  96. #define ACCEPT_AS_FRIEND         8   //CMsg1  响应加为好友请求反馈信息(属于系统消息)
  97. #define REFUSE_AS_FRIEND         9   //CMsg1  响应加为好友请求反馈信息(属于系统消息)
  98. #define ONLINE                  10   //CData index,myid 
  99. #define ONHIDE                  11   //CData index,myid 
  100. #define OFFLINE                 12   //CData index,myid 
  101. #define MULTI_SEND_MSG          13   //CMsg2 index,myid,friendidarray,msg,time  
  102. #define APPLY_SHOW_ONLINE       14   //CMsg3  index,myid,value 请求查看在线的人 
  103. #define TEST_BROADCAST_PWD      15   //CMsg4 index,id,broadcastpwd,msg  
  104. #define SEND_BROADCAST          16   //CMsg4 
  105. #define FIND_FRIEND_BY_NAME     17   //CMsg4 index,myid,name(msg)
  106. #define CHANGE_PERSONAL_INFO    18   //CMsgModifyPI index,myid,mask,name,address,phone,fax,email,homepage,photoid,canbeadd,department,sex,age,description
  107. #define CHANGE_PASSWORD         19   //CMsgModifyPwd index,myid,oldpwd,newpwd 
  108. #define HAVE_ID_LOGIN           20   //CMsgModifyPwd index,id,pwd(oldpwd) 
  109. #define APPLY_ID_LOGIN          21   //CMsgPerson index,name,address,phone,fax,email,homepage,photoid,canbeadd,department,sex,age,pwd,description
  110. //-------------------------------- Server Send To Client -------------------------------------------
  111. //-------------------------------- Client Recv From Server -----------------------------------------
  112. #define RE_ADD_AS_FRIEND         31   //CMsg3 index,myid,value(0,1,2,3)(别人拒绝,成功加入,要求验证人份,此人已经为好友)
  113. #define RE_TEST_BROADCAST_PWD    32   //CMsg3 index,myid,value (0,1) 密码错误,密码正确 
  114. #define TOTAL_ONLINE             33   //CMsg3 index,myId,Value 响应发送的总在线人数信息 
  115. #define RE_LOGIN_INFO            34   //CMsg3 index,myid,value (0,1,2) 帐号不存在,密码错误,OK 
  116. #define RECV_SHOW_ONLINE         35   //CShowOnlinePeople
  117. #define FOUND_FRIEND_BY_NAME     36   //CShowOnlinePeople
  118. #define APPLY_ID_OK              37   //CData index,myid(收到这个信息,这表示登陆成功)
  119. #define ID_NOT_FOUND_BY_ID       38   //CData
  120. #define NAME_NOT_FOUND_BY_NAME   39   //CData
  121. #define ONHIDE_OK                41
  122. #define ONLINE_OK                52
  123. #define FOUND_FRIEND_BY_ID       43   //CMsgPerson 
  124. #define RE_FRIEND_DETAIL         44   //CMsgPerson
  125. #define ALL_FRIEND_ID            45   //CMsg2 index,id,friendidarray(收到这个信息,这表示登陆成功)
  126. #define ONLINE_FRIEND            46   //CMsgOnlineFriend index,id,aFriendid,aFriendstate,aFriendIP,aFriendPort
  127. #define BE_ADDED_AS_FRIEND       47   //CMsg1 响应好友加入的消息
  128. #define SYSTEM_BROADCAST         48   //CMsg1
  129. #define SOMEONE_ONLINE           49
  130. #define SOMEONE_ONHIDE           50
  131. #define SOMEONE_OFFLINE          51
  132. //----------------------------------Client To Client-----------------------------------------------
  133. //SEND_MSG_TO_FRIEND
  134. //FRIEND_IDENTITY_VALIDATE
  135. #endif