I changed the code that handles campaign_list...

...to prepare for being able to return information about a subset of
the campaigns. I save a pointer to the request WML. I start with no
campaigns and copy them in one by instead of the old way. I left the
passphrase blanking to a later loop that runs after the list of
campaigns are built. There is probably a more efficient way to do it
when I copy over each individual campaign summary, but it seems easier
not to mess up leaving it work like it did previously.  My next task
will be to handle conditions, but I wanted to get the base code
checked in after testing, before I started adding in the new tests.
This commit is contained in:
Bruno Wolff III 2005-10-08 19:06:01 +00:00
parent 7dc3a8052b
commit 270c5cb9e5

View file

@ -92,10 +92,14 @@ void campaign_server::run()
config data;
while((sock = network::receive_data(data)) != network::null_connection) {
if(data.child("request_campaign_list") != NULL) {
config campaign_list = campaigns();
if(const config* req = data.child("request_campaign_list")) {
config campaign_list;
(campaign_list)["timestamp"] = lexical_cast<std::string>(time(NULL));
config::child_list cmps = campaign_list.get_children("campaign");
config::child_list cmps = campaigns().get_children("campaign");
for(config::child_list::iterator i = cmps.begin(); i != cmps.end(); ++i) {
campaign_list.add_child("campaign", (**i));
}
cmps = campaign_list.get_children("campaign");
for(config::child_list::iterator i = cmps.begin(); i != cmps.end(); ++i) {
(**i)["passphrase"] = "";
}