Chat.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef CHAT_CHAT_H_
  17. #define CHAT_CHAT_H_
  18. #include <vector>
  19. #include "../../common/types.h"
  20. #include "../../common/EQPacket.h"
  21. #include "../../common/Mutex.h"
  22. #include "../client.h"
  23. #include "ChatChannel.h"
  24. using namespace std;
  25. /*
  26. CREATING A CHANNEL
  27. -- OP_RemoteCmdMsg --
  28. 3/14/2012 20:17:06
  29. 192.168.1.198 -> 69.174.200.73
  30. 0000: 00 09 05 9A 2A 0E 00 0F 00 63 75 73 74 6F 6D 20 ....*....custom
  31. 0010 70 61 73 73 77 6F 72 64 password
  32. TALKING IN A CHANNEL
  33. [11:52.23] <@Xinux> -- OP_RemoteCmdMsg --
  34. [11:52.23] <@Xinux> 3/14/2012 20:17:25
  35. [11:52.23] <@Xinux> 192.168.1.198 -> 69.174.200.73
  36. [11:52.23] <@Xinux> 0000: 00 09 06 2D 2A 11 00 21 00 63 75 73 74 6F 6D 20 ...-*..!.custom
  37. [11:52.23] <@Xinux> 0010: 20 74 68 69 73 20 69 73 20 6D 79 20 63 75 73 74 this is my cust
  38. [11:52.23] <@Xinux> 0020 6F 6D 20 63 68 61 6E 6E 65 6C om channel
  39. [08:37.46] <@Xinux_Work> 00 09 05 8B 00 3A 53 00 00 00 FF 3C 02 00 00 FF .....:S....<....
  40. [08:37.46] <@Xinux_Work> FF FF FF FF FF FF FF 06 00 4C 65 69 68 69 61 07 .........Leihia.
  41. [08:37.46] <@Xinux_Work> 00 4B 6F 65 63 68 6F 68 00 02 00 00 00 00 01 00 .Koechoh........
  42. [08:37.46] <@Xinux_Work> 00 00 22 00 18 00 62 65 74 74 65 72 20 74 68 61 .."...better tha
  43. [08:37.46] <@Xinux_Work> 6E 20 61 20 72 65 64 20 6F 6E 65 20 3A 50 09 00 n a red one :P..
  44. [08:37.46] <@Xinux_Work> 4C 65 76 65 6C 5F 31 2D 39 01 01 00 00 Level_1-9....
  45. OTHERS LEAVING AND JOINING A CHANNEL
  46. -- OP_ClientCmdMsg::OP_EqChatChannelUpdateCmd --
  47. 3/14/2012 20:17:06
  48. 69.174.200.73 -> 192.168.1.198
  49. 0000: 00 3A 18 00 00 00 FF 88 02 03 09 00 4C 65 76 65 .:..........Leve
  50. 0010 6C 5F 31 2D 39 07 00 53 68 61 77 6E 61 68 l_1-9..Shawnah
  51. -- OP_ClientCmdMsg::OP_EqChatChannelUpdateCmd --
  52. 3/14/2012 20:17:06
  53. 69.174.200.73 -> 192.168.1.198
  54. 0000: 00 3A 16 00 00 00 FF 88 02 03 07 00 41 75 63 74 .:..........Auct
  55. 0010 69 6F 6E 07 00 53 68 61 77 6E 61 68 ion..Shawnah
  56. OP_EqChatChannelUpdateCmd
  57. unknown=0 unknown1=blank join
  58. unknown=1 unknown1=blank leave
  59. unknown=2 unknown2=player join/leave?
  60. unknown=3 unknown2=player join/leave?
  61. */
  62. class Chat{
  63. public:
  64. Chat();
  65. virtual ~Chat();
  66. void AddChannel(ChatChannel *channel);
  67. unsigned int GetNumChannels();
  68. EQ2Packet * GetWorldChannelList(Client *client);
  69. bool ChannelExists(const char *channel_name);
  70. bool HasPassword(const char *channel_name);
  71. bool PasswordMatches(const char *channel_name, const char *password);
  72. bool CreateChannel(const char *channel_name);
  73. bool CreateChannel(const char *channel_name, const char *password);
  74. bool IsInChannel(Client *client, const char *channel_name);
  75. bool JoinChannel(Client *client, const char *channel_name);
  76. bool LeaveChannel(Client *client, const char *channel_name);
  77. bool LeaveAllChannels(Client *client);
  78. bool TellChannel(Client *client, const char *channel_name, const char *message, const char* name = 0);
  79. bool SendChannelUserList(Client *client, const char *channel_name);
  80. ChatChannel* GetChannel(const char* channel_name);
  81. private:
  82. Mutex m_channels;
  83. vector<ChatChannel *> channels;
  84. };
  85. #endif