]> git.saurik.com Git - veency.git/commitdiff
If we don't have a dialog mechanism, just refuse.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 3 Feb 2013 00:52:19 +0000 (00:52 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 3 Feb 2013 00:52:19 +0000 (00:52 +0000)
Tweak.mm

index 5e5eddd5b19093d4e00be07b60c08ffed35c6f1f..538c226101b0db5fc5454121ff89cea3aef6d900 100644 (file)
--- a/Tweak.mm
+++ b/Tweak.mm
@@ -132,6 +132,7 @@ static void AshikaseSetEnabled(bool enabled, bool always) {
         AshikaseSendEvent(x_, y_);
 }
 
+MSClassHook(SBAlertItem)
 MSClassHook(SBAlertItemsController)
 MSClassHook(SBStatusBarController)
 
@@ -159,7 +160,14 @@ static void VNCEnabled();
 @implementation VNCBridge
 
 + (void) askForConnection {
-    [[$SBAlertItemsController sharedInstance] activateAlertItem:[[[$VNCAlertItem alloc] init] autorelease]];
+    if ($VNCAlertItem != nil)
+        [[$SBAlertItemsController sharedInstance] activateAlertItem:[[[$VNCAlertItem alloc] init] autorelease]];
+    else {
+        [condition_ lock];
+        action_ = RFB_CLIENT_REFUSE;
+        [condition_ signal];
+        [condition_ unlock];
+    }
 }
 
 + (void) removeStatusBarItem {
@@ -791,11 +799,13 @@ MSInitialize {
     if (wait_)
         MSHookFunction(&IOMobileFramebufferSwapWait, MSHake(IOMobileFramebufferSwapWait));
 
-    $VNCAlertItem = objc_allocateClassPair(objc_getClass("SBAlertItem"), "VNCAlertItem", 0);
-    MSAddMessage2(VNCAlertItem, "v@:@i", alertSheet,buttonClicked);
-    MSAddMessage2(VNCAlertItem, "v@:cc", configure,requirePasscodeForActions);
-    MSAddMessage0(VNCAlertItem, "v@:", performUnlockAction);
-    objc_registerClassPair($VNCAlertItem);
+    if ($SBAlertItem != nil) {
+        $VNCAlertItem = objc_allocateClassPair($SBAlertItem, "VNCAlertItem", 0);
+        MSAddMessage2(VNCAlertItem, "v@:@i", alertSheet,buttonClicked);
+        MSAddMessage2(VNCAlertItem, "v@:cc", configure,requirePasscodeForActions);
+        MSAddMessage0(VNCAlertItem, "v@:", performUnlockAction);
+        objc_registerClassPair($VNCAlertItem);
+    }
 
     CFNotificationCenterAddObserver(
         CFNotificationCenterGetDarwinNotifyCenter(),