diff options
author | Roderic Morris <roderic@ccs.neu.edu> | 2008-06-03 16:31:32 +0000 |
---|---|---|
committer | Roderic Morris <roderic@ccs.neu.edu> | 2008-06-03 16:31:32 +0000 |
commit | af045b4818333b4360f14981c695817c4c8adb21 (patch) | |
tree | 2b22ff5b23906aa87a2cd5383171ffc44283a829 /src/account-server/dalstorage.cpp | |
parent | 33d5ea3261e70cba7e0f4af5c1e6eb070f168112 (diff) | |
download | manaserv-af045b4818333b4360f14981c695817c4c8adb21.tar.gz manaserv-af045b4818333b4360f14981c695817c4c8adb21.tar.bz2 manaserv-af045b4818333b4360f14981c695817c4c8adb21.tar.xz manaserv-af045b4818333b4360f14981c695817c4c8adb21.zip |
stop storing channels in the db, send channel announcements
Diffstat (limited to 'src/account-server/dalstorage.cpp')
-rw-r--r-- | src/account-server/dalstorage.cpp | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp index 02b095dd..8f6feb53 100644 --- a/src/account-server/dalstorage.cpp +++ b/src/account-server/dalstorage.cpp @@ -127,7 +127,6 @@ void DALStorage::open() createTable(ACCOUNTS_TBL_NAME, SQL_ACCOUNTS_TABLE); createTable(CHARACTERS_TBL_NAME, SQL_CHARACTERS_TABLE); createTable(INVENTORIES_TBL_NAME, SQL_INVENTORIES_TABLE); - createTable(CHANNELS_TBL_NAME, SQL_CHANNELS_TABLE); createTable(GUILDS_TBL_NAME, SQL_GUILDS_TABLE); createTable(GUILD_MEMBERS_TBL_NAME, SQL_GUILD_MEMBERS_TABLE); createTable(QUESTS_TBL_NAME, SQL_QUESTS_TABLE); @@ -628,101 +627,6 @@ bool DALStorage::updateCharacter(Character *character) return true; } -std::map<unsigned short, ChatChannel> -DALStorage::getChannelList() -{ - // specialize the string_to functor to convert - // a string to a short. - string_to<int> toInt; - - // The formatted datas - std::map<unsigned short, ChatChannel> channels; - - try { - std::stringstream sql; - sql << "select id, name, announcement, password from "; - sql << CHANNELS_TBL_NAME; - sql << ";"; - - const dal::RecordSet& channelInfo = mDb->execSql(sql.str()); - - // If the map return is empty then we have no choice but to return false. - if (channelInfo.isEmpty()) { - return channels; - } - - for (unsigned int i = 0; i < channelInfo.rows(); ++i) - { - unsigned short channelId = toInt(channelInfo(i, 0)); - channels.insert( - std::make_pair(channelId, - ChatChannel(channelId, - channelInfo(i, 1), - channelInfo(i, 2), - channelInfo(i, 3)))); - - LOG_DEBUG("Channel (" << channelId << ") loaded: " - << channelInfo(i, 1) << ": " << channelInfo(i, 2)); - } - - return channels; - } - catch (const dal::DbSqlQueryExecFailure& e) { - // TODO: throw an exception. - LOG_ERROR("(DALStorage::getChannelList) SQL query failure: " << e.what()); - } - - return channels; -} - -void -DALStorage::updateChannels(std::map<unsigned short, ChatChannel>& channelList) -{ - try { - // Empties the table - std::stringstream sql; - sql << "delete from " - << CHANNELS_TBL_NAME - << ";"; - - mDb->execSql(sql.str()); - - for (std::map<unsigned short, ChatChannel>::iterator i = channelList.begin(); - i != channelList.end();) - { - // insert registered channel if id < MAX_PUBLIC_CHANNELS_RANGE; - if (i->first < MAX_PUBLIC_CHANNELS_RANGE) - { - if (i->second.getName() != "") - { - sql.str(""); - sql << "insert into " - << CHANNELS_TBL_NAME - << " (id, name, announcement, password, joinable)" - << " values (" - << i->first << ", \"" - << i->second.getName() << "\", \"" - << i->second.getAnnouncement() << "\", \"" - << i->second.getPassword() << "\", \"" - << i->second.canJoin() << "\");"; - - LOG_DEBUG("Channel (" << i->first << ") saved: " - << i->second.getName() - << ": " << i->second.getAnnouncement()); - } - - mDb->execSql(sql.str()); - } - ++i; - } - - } - catch (const dal::DbSqlQueryExecFailure& e) { - // TODO: throw an exception. - LOG_ERROR("(DALStorage::updateChannels) SQL query failure: " << e.what()); - } -} - /** * Create the specified table. |