9
3

ChatDB.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. // JA: for when we add world channel or IRC configs
  17. #include "../../common/Log.h"
  18. #include "Chat.h"
  19. #include "../WorldDatabase.h"
  20. extern Chat chat;
  21. void WorldDatabase::LoadChannels() {
  22. DatabaseResult result;
  23. ChatChannel *channel;
  24. if (database_new.Select(&result, "SELECT `name`,`password`,`level_restriction`,`classes`,`races` FROM `channels`")) {
  25. while (result.Next()) {
  26. channel = new ChatChannel();
  27. channel->SetName(result.GetString(0));
  28. if (!result.IsNull(1))
  29. channel->SetPassword(result.GetString(1));
  30. channel->SetLevelRestriction(result.GetInt16(2));
  31. channel->SetClassesAllowed(result.GetInt64(3));
  32. channel->SetRacesAllowed(result.GetInt64(4));
  33. channel->SetType(CHAT_CHANNEL_TYPE_WORLD);
  34. chat.AddChannel(channel);
  35. }
  36. }
  37. }