|
@@ -661,6 +661,33 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+- (void)search:(NSString *)path folderStartWith:(NSString *)folderStartWith dateLastModified:(NSString *)dateLastModified numberOfItem:(NSInteger)numberOfItem withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest {
|
|
|
+
|
|
|
+ if (!token){
|
|
|
+ token = @"no token";
|
|
|
+ }
|
|
|
+
|
|
|
+ path = [path encodeString:NSUTF8StringEncoding];
|
|
|
+
|
|
|
+ OCWebDAVClient *request = [OCWebDAVClient new];
|
|
|
+ request = [self getRequestWithCredentials:request];
|
|
|
+
|
|
|
+ [request search:path folderStartWith:folderStartWith dateLastModified:dateLastModified numberOfItem:numberOfItem userID:_userID onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
|
|
|
+ if (successRequest) {
|
|
|
+
|
|
|
+ NSData *responseData = (NSData*) responseObject;
|
|
|
+
|
|
|
+ OCXMLListParser *parser = [OCXMLListParser new];
|
|
|
+ [parser initParserWithData:responseData];
|
|
|
+ NSMutableArray *searchList = [parser.searchList mutableCopy];
|
|
|
+
|
|
|
+ successRequest(response, searchList, request.redirectedServer, token);
|
|
|
+ }
|
|
|
+ } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error, NSString *token) {
|
|
|
+ failureRequest(response, error, token, request.redirectedServer);
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
///-----------------------------------
|
|
|
/// @name Setting favorite
|
|
|
///-----------------------------------
|