summaryrefslogtreecommitdiff
path: root/src/client/Client.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-14 20:11:54 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-14 20:11:54 (GMT)
commit900e23128a16bd49d8929a232ac57fc7e30ad3f9 (patch)
treea5d04c86dc0ac5efb887579699e86143f12f20a8 /src/client/Client.cpp
parent4c6be4ff2cc822d9c1ed36c9c88261771775dc02 (diff)
downloadpowder-900e23128a16bd49d8929a232ac57fc7e30ad3f9.zip
powder-900e23128a16bd49d8929a232ac57fc7e30ad3f9.tar.gz
Add ability to get favourites
Diffstat (limited to 'src/client/Client.cpp')
-rw-r--r--src/client/Client.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/client/Client.cpp b/src/client/Client.cpp
index 2d65677..9e4732b 100644
--- a/src/client/Client.cpp
+++ b/src/client/Client.cpp
@@ -840,7 +840,7 @@ std::vector<Comment*> * Client::GetComments(int saveID, int start, int count)
return commentArray;
}
-std::vector<Save*> * Client::SearchSaves(int start, int count, string query, string sort, bool showOwn, int & resultCount)
+std::vector<Save*> * Client::SearchSaves(int start, int count, string query, string sort, std::string category, int & resultCount)
{
lastError = "";
resultCount = 0;
@@ -860,15 +860,21 @@ std::vector<Save*> * Client::SearchSaves(int start, int count, string query, str
urlStream << URLEscape(" ");
urlStream << URLEscape("sort:") << URLEscape(sort);
}
- if(showOwn && authUser.ID)
- {
- if(query.length())
- urlStream << URLEscape(" ");
- urlStream << URLEscape("user:") << URLEscape(authUser.Username);
- }
-
}
- data = http_simple_get((char *)urlStream.str().c_str(), &dataStatus, &dataLength);
+ if(category.length())
+ {
+ urlStream << "&Category=" << URLEscape(category);
+ }
+ if(authUser.ID)
+ {
+ std::stringstream userIDStream;
+ userIDStream << authUser.ID;
+ data = http_auth_get((char *)urlStream.str().c_str(), (char *)(userIDStream.str().c_str()), NULL, (char *)(authUser.SessionID.c_str()), &dataStatus, &dataLength);
+ }
+ else
+ {
+ data = http_simple_get((char *)urlStream.str().c_str(), &dataStatus, &dataLength);
+ }
if(dataStatus == 200 && data)
{
try