Chat.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. #ifdef DISCORD
  25. #ifndef WIN32
  26. #pragma once
  27. #include <dpp/dpp.h>
  28. #endif
  29. #endif
  30. using namespace std;
  31. /*
  32. CREATING A CHANNEL
  33. -- OP_RemoteCmdMsg --
  34. 3/14/2012 20:17:06
  35. 192.168.1.198 -> 69.174.200.73
  36. 0000: 00 09 05 9A 2A 0E 00 0F 00 63 75 73 74 6F 6D 20 ....*....custom
  37. 0010 70 61 73 73 77 6F 72 64 password
  38. TALKING IN A CHANNEL
  39. [11:52.23] <@Xinux> -- OP_RemoteCmdMsg --
  40. [11:52.23] <@Xinux> 3/14/2012 20:17:25
  41. [11:52.23] <@Xinux> 192.168.1.198 -> 69.174.200.73
  42. [11:52.23] <@Xinux> 0000: 00 09 06 2D 2A 11 00 21 00 63 75 73 74 6F 6D 20 ...-*..!.custom
  43. [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
  44. [11:52.23] <@Xinux> 0020 6F 6D 20 63 68 61 6E 6E 65 6C om channel
  45. [08:37.46] <@Xinux_Work> 00 09 05 8B 00 3A 53 00 00 00 FF 3C 02 00 00 FF .....:S....<....
  46. [08:37.46] <@Xinux_Work> FF FF FF FF FF FF FF 06 00 4C 65 69 68 69 61 07 .........Leihia.
  47. [08:37.46] <@Xinux_Work> 00 4B 6F 65 63 68 6F 68 00 02 00 00 00 00 01 00 .Koechoh........
  48. [08:37.46] <@Xinux_Work> 00 00 22 00 18 00 62 65 74 74 65 72 20 74 68 61 .."...better tha
  49. [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..
  50. [08:37.46] <@Xinux_Work> 4C 65 76 65 6C 5F 31 2D 39 01 01 00 00 Level_1-9....
  51. OTHERS LEAVING AND JOINING A CHANNEL
  52. -- OP_ClientCmdMsg::OP_EqChatChannelUpdateCmd --
  53. 3/14/2012 20:17:06
  54. 69.174.200.73 -> 192.168.1.198
  55. 0000: 00 3A 18 00 00 00 FF 88 02 03 09 00 4C 65 76 65 .:..........Leve
  56. 0010 6C 5F 31 2D 39 07 00 53 68 61 77 6E 61 68 l_1-9..Shawnah
  57. -- OP_ClientCmdMsg::OP_EqChatChannelUpdateCmd --
  58. 3/14/2012 20:17:06
  59. 69.174.200.73 -> 192.168.1.198
  60. 0000: 00 3A 16 00 00 00 FF 88 02 03 07 00 41 75 63 74 .:..........Auct
  61. 0010 69 6F 6E 07 00 53 68 61 77 6E 61 68 ion..Shawnah
  62. OP_EqChatChannelUpdateCmd
  63. unknown=0 unknown1=blank join
  64. unknown=1 unknown1=blank leave
  65. unknown=2 unknown2=player join/leave?
  66. unknown=3 unknown2=player join/leave?
  67. */
  68. class Chat{
  69. public:
  70. Chat();
  71. virtual ~Chat();
  72. void AddChannel(ChatChannel *channel);
  73. unsigned int GetNumChannels();
  74. EQ2Packet * GetWorldChannelList(Client *client);
  75. bool ChannelExists(const char *channel_name);
  76. bool HasPassword(const char *channel_name);
  77. bool PasswordMatches(const char *channel_name, const char *password);
  78. bool CreateChannel(const char *channel_name);
  79. bool CreateChannel(const char *channel_name, const char *password);
  80. bool IsInChannel(Client *client, const char *channel_name);
  81. bool JoinChannel(Client *client, const char *channel_name);
  82. bool LeaveChannel(Client *client, const char *channel_name);
  83. bool LeaveAllChannels(Client *client);
  84. bool TellChannel(Client *client, const char *channel_name, const char *message, const char* name = 0);
  85. bool SendChannelUserList(Client *client, const char *channel_name);
  86. //devn00b
  87. int PushDiscordMsg(const char*, const char*);
  88. ChatChannel* GetChannel(const char* channel_name);
  89. private:
  90. Mutex m_channels;
  91. vector<ChatChannel *> channels;
  92. };
  93. #endif