|
@@ -890,6 +890,35 @@
|
|
|
#pragma mark ===== Server =====
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
|
|
|
+- (NSError *)checkServerSync:(NSString *)serverUrl
|
|
|
+{
|
|
|
+ OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
+ __block NSError *returnError;
|
|
|
+
|
|
|
+ dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
|
+
|
|
|
+ [communication setCredentialsWithUser:_activeUser andPassword:_activePassword];
|
|
|
+ [communication checkServer:serverUrl onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
+
|
|
|
+ returnError = nil;
|
|
|
+ dispatch_semaphore_signal(semaphore);
|
|
|
+
|
|
|
+ } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
|
+
|
|
|
+ // Request trusted certificated
|
|
|
+ if ([error code] == NSURLErrorServerCertificateUntrusted)
|
|
|
+ [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+
|
|
|
+ returnError = error;
|
|
|
+ dispatch_semaphore_signal(semaphore);
|
|
|
+ }];
|
|
|
+
|
|
|
+ while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW))
|
|
|
+ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
|
|
+
|
|
|
+ return returnError;
|
|
|
+}
|
|
|
+
|
|
|
- (void)getFeaturesSupportedByServer
|
|
|
{
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|