IRC.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 IRC_IRC_H_
  17. #define IRC_IRC_H_
  18. #include <map>
  19. #include "../../common/types.h"
  20. #include "../../common/Mutex.h"
  21. #include "IRCServer.h"
  22. using namespace std;
  23. class IRC {
  24. public:
  25. IRC();
  26. virtual ~IRC();
  27. void SetRunning(bool running) {this->running = running;}
  28. bool IsRunning() {return running;}
  29. int32 GetNumServers();
  30. static const char * GetSafeChannelName(const char *channel_name);
  31. void Start();
  32. void Process();
  33. void ConnectToServer(Client *client, const char *host, short port, const char *nick = NULL);
  34. void ConnectToGlobalServer(const char *host, short port, const char *nick = NULL);
  35. void DisconnectFromServer(Client *client);
  36. void DisconnectFromGlobalServer();
  37. void JoinChannel(Client *client, const char *channel_name);
  38. void LeaveChannel(Client *client, const char *channel_name);
  39. void ListChannels(Client *client);
  40. void Say(Client *client, const char *channel_name, const char *message);
  41. void Say(Client *client, int32 channel_index, const char *message);
  42. IRCServer* GetServer(Client* client);
  43. IRCServer* GetGlobalServer() { return m_globalServer; }
  44. private:
  45. bool running;
  46. Mutex m_servers;
  47. map<int32, IRCServer *> servers;
  48. IRCServer* m_globalServer;
  49. };
  50. #endif