mirror of
https://github.com/google/santa.git
synced 2026-01-15 01:08:12 -05:00
This allows a sync server to send a `custom_url` field along with a rule blocking execution and this will be used as the URL for the "open" button in place of the normally generated URL.
53 lines
1.8 KiB
Objective-C
53 lines
1.8 KiB
Objective-C
/// Copyright 2016 Google Inc. All rights reserved.
|
|
///
|
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|
/// you may not use this file except in compliance with the License.
|
|
/// You may obtain a copy of the License at
|
|
///
|
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
|
///
|
|
/// Unless required by applicable law or agreed to in writing, software
|
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
/// See the License for the specific language governing permissions and
|
|
/// limitations under the License.
|
|
|
|
#ifdef SANTAGUI
|
|
#import <Cocoa/Cocoa.h>
|
|
#else
|
|
#import <Foundation/Foundation.h>
|
|
#endif
|
|
|
|
@class SNTStoredEvent;
|
|
|
|
@interface SNTBlockMessage : NSObject
|
|
|
|
///
|
|
/// Return a message suitable for presenting to the user.
|
|
///
|
|
/// In SantaGUI this will return an NSAttributedString with links and formatting included
|
|
/// while for santad all HTML will be properly stripped.
|
|
///
|
|
+ (NSAttributedString *)formatMessage:(NSString *)message;
|
|
|
|
///
|
|
/// Uses either the configured message depending on the event type or a custom message
|
|
/// if the rule that blocked this file included one, formatted using
|
|
/// +[SNTBlockMessage formatMessage].
|
|
///
|
|
+ (NSAttributedString *)attributedBlockMessageForEvent:(SNTStoredEvent *)event
|
|
customMessage:(NSString *)customMessage;
|
|
|
|
///
|
|
/// Return a URL generated from the EventDetailURL configuration key
|
|
/// after replacing templates in the URL with values from the event.
|
|
///
|
|
+ (NSURL *)eventDetailURLForEvent:(SNTStoredEvent *)event customURL:(NSString *)url;
|
|
|
|
///
|
|
/// Strip HTML from a string, replacing <br /> with newline.
|
|
///
|
|
+ (NSString *)stringFromHTML:(NSString *)html;
|
|
|
|
@end
|