Skip to content

Commit

Permalink
If we don't have a dialog mechanism, just refuse.
Browse files Browse the repository at this point in the history
  • Loading branch information
saurik committed Feb 3, 2013
1 parent 451e908 commit f34e529
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Tweak.mm
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ static void AshikaseSetEnabled(bool enabled, bool always) {
AshikaseSendEvent(x_, y_);
}

MSClassHook(SBAlertItem)
MSClassHook(SBAlertItemsController)
MSClassHook(SBStatusBarController)

Expand Down Expand Up @@ -159,7 +160,14 @@ + (void) registerClient;
@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 {
Expand Down Expand Up @@ -791,11 +799,13 @@ static void dlset(Type_ &function, const char *name) {
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(),
Expand Down

0 comments on commit f34e529

Please sign in to comment.