mail[Wesnoth-commits] r33284 - /trunk/src/campaign_server/campaign_server.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by soliton . de on March 02, 2009 - 03:20:
Author: soliton
Date: Mon Mar  2 03:20:53 2009
New Revision: 33284

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33284&view=rev
Log:
just compare case insensitive instead of also saving the lowercase name (less 
confusion for clients)

Modified:
    trunk/src/campaign_server/campaign_server.cpp

Modified: trunk/src/campaign_server/campaign_server.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/campaign_server/campaign_server.cpp?rev=33284&r1=33283&r2=33284&view=diff
==============================================================================
--- trunk/src/campaign_server/campaign_server.cpp (original)
+++ trunk/src/campaign_server/campaign_server.cpp Mon Mar  2 03:20:53 2009
@@ -484,10 +484,16 @@
                                                LOG_CS << "uploading campaign 
'" << (*upload)["name"] << "' from " << network::ip_address(sock) << ".\n";
                                                config* data = 
upload->child("data");
                                                const std::string& name = 
(*upload)["name"];
-                                               std::string 
new_name(name.size(), ' ');
-                                               std::transform(name.begin(), 
name.end(), new_name.begin(), tolower);
-                                               (*upload)["name"] = new_name;
-                                               config* campaign = 
campaigns().find_child("campaign","name",(*upload)["name"]);
+                                               std::string 
lc_name(name.size(), ' ');
+                                               std::transform(name.begin(), 
name.end(), lc_name.begin(), tolower);
+                                               const config::child_list& 
campaign_list = campaigns().get_children("campaign");
+                                               config* campaign = NULL;
+                                               for 
(config::child_list::const_iterator i = campaign_list.begin(); i != 
campaign_list.end(); ++i) {
+                                                       if 
(utils::lowercase((**i)["name"]) == lc_name) {
+                                                               campaign = *i;
+                                                               break;
+                                                       }
+                                               }
                                                if(data == NULL) {
                                                        LOG_CS << "Upload 
aborted - no add-on data.\n";
                                                        
network::send_data(construct_error("Add-on rejected: No add-on data was 
supplied."), sock, gzipped);




Related Messages


Powered by MHonArc, Updated Mon Mar 02 04:40:06 2009