- (error "%s is not displayed. (maybe channel miss)"
- (riece-identity-prefix riece-current-channel)))))
-
-(defun riece-foolproof-enable ()
- (ad-enable-advice 'riece-command-send-message 'before 'riece-foolproof)
- (ad-activate 'riece-command-send-message)
- (setq riece-foolproof-enabled t))
-
-(defun riece-foolproof-disable ()
- (ad-disable-advice 'riece-command-send-message 'before 'riece-foolproof)
- (ad-activate 'riece-command-send-message)
- (setq riece-foolproof-enabled nil))
+ (error "Channel %s is not displayed"
+ (riece-identity-prefix riece-current-channel)))
+ (when (text-property-not-all
+ (riece-line-beginning-position) (riece-line-end-position)
+ 'invisible nil)
+ (error "Invisible text included: %s"
+ (buffer-substring-no-properties
+ (riece-line-beginning-position)
+ (riece-line-end-position))))
+ (when executing-kbd-macro
+ (error "%s" "Forbidden to run keyboard macro"))))
+
+(defun riece-foolproof-insinuate ()
+ (add-hook 'riece-command-send-message-hook
+ 'riece-foolproof-command-send-message-function))
+
+(defun riece-foolproof-uninstall ()
+ (remove-hook 'riece-command-send-message-hook
+ 'riece-foolproof-command-send-message-function))