author parameter to rss

optional parameter "author" to rss request so you can request posts
just by a single author
This commit is contained in:
Anomaly UK 2016-02-09 16:58:32 +00:00
parent 69f90bca04
commit 7387619c2b

View File

@ -24,6 +24,7 @@ int generateRSS(string uri, string *output)
int max = 20; //default value int max = 20; //default value
string account = parameterMap["account"]; string account = parameterMap["account"];
string strMax = parameterMap["max"]; string strMax = parameterMap["max"];
string author = parameterMap["author"];
if(strMax!="") if(strMax!="")
{ {
try try
@ -66,12 +67,21 @@ int generateRSS(string uri, string *output)
params1.push_back(account); params1.push_back(account);
Array followingArray = getfollowing(params1,false).get_array(); Array followingArray = getfollowing(params1,false).get_array();
Array postSources; Array postSources;
if(author=="") {
// default fetch posts from all followed authors
for(int i=0;i<followingArray.size();i++) for(int i=0;i<followingArray.size();i++)
{ {
Object item; Object item;
item.push_back(Pair("username",followingArray[i])); item.push_back(Pair("username",followingArray[i]));
postSources.push_back(item); postSources.push_back(item);
} }
} else {
// a single author has been specified to fetch posts from
Object item;
item.push_back(Pair("username",author));
postSources.push_back(item);
}
Array params2; Array params2;
params2.push_back(max); params2.push_back(max);