Merge pull request #376 from AnomalyUK/authorstream

author parameter to rss
This commit is contained in:
miguelfreitas 2016-02-15 19:12:14 -02:00
commit 4d59ebe2ab

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,11 +67,23 @@ 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;
for(int i=0;i<followingArray.size();i++)
if(author=="")
{
// default fetch posts from all followed authors
for(int i=0;i<followingArray.size();i++)
{
Object item;
item.push_back(Pair("username",followingArray[i]));
postSources.push_back(item);
}
}
else
{ {
Object item; // a single author has been specified to fetch posts from
item.push_back(Pair("username",followingArray[i])); Object item;
postSources.push_back(item); item.push_back(Pair("username",author));
postSources.push_back(item);
} }
Array params2; Array params2;