[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erbot-cvs] erbot erbc.el erbot.el
From: |
D. Goel |
Subject: |
[Erbot-cvs] erbot erbc.el erbot.el |
Date: |
Tue, 21 Mar 2006 15:47:26 +0000 |
CVSROOT: /cvsroot/erbot
Module name: erbot
Branch:
Changes by: D. Goel <address@hidden> 06/03/21 15:47:25
Modified files:
. : erbc.el erbot.el
Log message:
Extra checks for safety before outputing anything.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/erbot/erbot/erbc.el.diff?tr1=1.120&tr2=1.121&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/erbot/erbot/erbot.el.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
Patches:
Index: erbot/erbc.el
diff -u erbot/erbc.el:1.120 erbot/erbc.el:1.121
--- erbot/erbc.el:1.120 Mon Feb 27 02:56:12 2006
+++ erbot/erbc.el Tue Mar 21 15:47:25 2006
@@ -1,5 +1,5 @@
;;; erbc.el --- Erbot user-interface commands -- see also erbc5.el
-;; Time-stamp: <2006-02-13 14:22:57 deego>
+;; Time-stamp: <2006-03-21 10:42:28 deego>
;; Copyright (C) 2002 D. Goel
;; Emacs Lisp Archive entry
;; Filename: erbc.el
@@ -4955,8 +4955,10 @@
(erbutils-defalias-i '(window-system))
-(erbutils-defalias-i
- '(kbd read-kbd-macro))
+
+(unless erbot-paranoid-p
+ (erbutils-defalias-i
+ '(kbd read-kbd-macro)))
(defconst fs-t t
"As such, when we sandbox a lisp expression, t remains t, so this is
Index: erbot/erbot.el
diff -u erbot/erbot.el:1.48 erbot/erbot.el:1.49
--- erbot/erbot.el:1.48 Mon Feb 27 21:32:54 2006
+++ erbot/erbot.el Tue Mar 21 15:47:25 2006
@@ -1,5 +1,5 @@
;;; erbot.el --- Another robot for ERC.
-;; Time-stamp: <2006-02-27 16:18:58 deego>
+;; Time-stamp: <2006-03-21 10:44:19 deego>
;; Emacs Lisp Archive entry
;; Filename: erbot.el
;; Package: erbot
@@ -131,7 +131,13 @@
t by default. No enablings like erbot-setf-p, etc. will work
unless this is non-nil. If this is non-nil, erbot is paranoid, it will
not allow apply, setf, funcall, sregex, etc. even if the corresponding
-variables are turned on.")
+variables are turned on.
+
+NOTE: Making this variable nil and later non-nil in the middle of a
+running emacs session will NOT make your bot completely paranoid. You
+need to have this function non-nil BEFORE you load erbot. See, for
+example, how we define fs-kbd.
+")
@@ -645,7 +651,7 @@
(lambda (line)
(when (and line
(not (erbot-safep line)))
- (setq line (concat " " line)))
+ (setq line (erbot-safe-make line)))
(goto-char (point-max))
(setq p (re-search-backward (erc-prompt)))
;;(insert (erc-format-timestamp) "<" me "> ")
@@ -860,6 +866,21 @@
server port nick user-full-name (not not-connect-arg) passwd))))))
+(defun erbot-safe-make (line)
+ (let* ((ans line)
+ (rlist (string-to-list line)))
+ (when (string-match "^/" line)
+ (unless (string-match "^/me " line)
+ (setq ans (concat " " line))))
+ (when (member-if (lambda (a) (< a 32)) rlist)
+ (setq ans "<control characters>"))
+ (when (string-match "[\n\r]" line)
+ (setq ans " <newlines> "))
+ ans))
+
+
+
+
(defun erbot-safep (reply)
"Determine whether a reply is safe. Any newlines are simply
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Erbot-cvs] erbot erbc.el erbot.el,
D. Goel <=