I have added the ability to filter the campaign_list request by language,

...to select info only about campaigns that appear to be translated into
that language.
This commit is contained in:
Bruno Wolff III 2005-10-11 01:13:22 +00:00
parent 8942179063
commit bbf7c4d67f
2 changed files with 13 additions and 0 deletions

View File

@ -37,6 +37,7 @@ SVN trunk:
* Support filtering on campaign_list requests
* filter by name
* filter by last update time (before or after)
* filter by language of translation
* campaign_list response now contains the time the request was processed
* campaign_list response now contains information about translations
* utils: added weblist.pl and webtgz.pl web interface programs

View File

@ -139,6 +139,18 @@ void campaign_server::run()
if((const t_string)(*req)["name"] != "" && (*req)["name"] != (**i)["name"]) continue;
if(before_flag && ((const t_string)(**i)["timestamp"] == "" || lexical_cast_default<time_t>((**i)["timestamp"],0) >= before)) continue;
if(after_flag && ((const t_string)(**i)["timestamp"] == "" || lexical_cast_default<time_t>((**i)["timestamp"],0) <= after)) continue;
int found = 1;
if((const t_string)(*req)["language"] != "") {
found = 0;
config::child_list translation = (**i).get_children("translation");
for(config::child_list::iterator j = translation.begin(); j != translation.end(); ++j) {
if((*req)["language"] == (**j)["language"]) {
found = 1;
break;
}
}
}
if(found == 0) continue;
campaign_list.add_child("campaign", (**i));
}
cmps = campaign_list.get_children("campaign");