mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 20:44:56 +00:00
Merge branch 'master' of github.com:miguelfreitas/twister-core
This commit is contained in:
commit
1e6f152de0
@ -102,6 +102,7 @@ int generateRSS(string uri, string *output)
|
||||
postTitle="Direct Message from "+postAuthor;
|
||||
postMsg=find_value(userArray[i].get_obj(),"text").get_str();
|
||||
Value postTime = find_value(userArray[i].get_obj(),"time");
|
||||
encodeXmlCharacters(postMsg);
|
||||
|
||||
Object item;
|
||||
item.push_back(Pair("time",postTime));
|
||||
@ -146,6 +147,7 @@ int generateRSS(string uri, string *output)
|
||||
}
|
||||
|
||||
Value postTime = find_value(userpost,"time");
|
||||
encodeXmlCharacters(postMsg);
|
||||
|
||||
Object item;
|
||||
item.push_back(Pair("time",postTime));
|
||||
@ -219,3 +221,20 @@ bool sortByTime (Object i,Object j)
|
||||
{
|
||||
return (find_value(i,"time").get_int64()>find_value(j,"time").get_int64());
|
||||
}
|
||||
|
||||
void encodeXmlCharacters(std::string& data)
|
||||
{
|
||||
std::string buffer;
|
||||
buffer.reserve(data.size());
|
||||
for(size_t pos = 0; pos != data.size(); ++pos) {
|
||||
switch(data[pos]) {
|
||||
case '&': buffer.append("&"); break;
|
||||
case '\"': buffer.append("""); break;
|
||||
case '\'': buffer.append("'"); break;
|
||||
case '<': buffer.append("<"); break;
|
||||
case '>': buffer.append(">"); break;
|
||||
default: buffer.append(&data[pos], 1); break;
|
||||
}
|
||||
}
|
||||
data.swap(buffer);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ enum RSSResultCode
|
||||
};
|
||||
|
||||
extern bool sortByTime (json_spirit::Object i,json_spirit::Object j);
|
||||
extern void encodeXmlCharacters (std::string& data);
|
||||
#ifdef HAVE_BOOST_REGEX
|
||||
extern std::map<std::string, std::string> parseQuery(const std::string& query);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user