;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-(defun iankmod-start ()
- (interactive)
- (shell-command "/a/h/get-comments" "*messages*")
- (find-file "/tmp/hcomments")
- (iankmod 1))
+
+;; generally, use m-x iankmod-start. c-u to run on local testing
+;; instance. Alternatively, run get-comments with whatever args,
+;; manually open /tmp/hcomments, then run (iankmod).
+
+(defun iankmod-start (arg)
+ (interactive "P")
+ (setq iankmod-last-arg (if (equal arg '(4)) " -l" ""))
+ (let ((cmd (concat "/a/h/get-comments" iankmod-last-arg)))
+ (shell-command cmd "*messages*")
+ (find-file "/tmp/hcomments")
+ (iankmod 1)))
+
(defun iankmod-save ()
(interactive)
- (shell-command "/a/h/set-comments" "*messages*"))
+ (basic-save-buffer)
+ (let ((cmd (concat "/a/h/set-comments" iankmod-last-arg)))
+ (shell-command cmd "*messages*")))
(defun iankmod-set-state (state)
(interactive)
(iankmod-set-state "banned"))
+;; for test comments, or comments we just want to delete from the
+;; db for whatever reason.
+(defun iankmod-delete ()
+ (interactive)
+ (iankmod-set-state "delete"))
+
(defun iankmod-moderate ()
(interactive)
(iankmod-set-state "moderated"))
(define-key map (kbd "b") 'iankmod-ban)
(define-key map (kbd "m") 'iankmod-moderate)
(define-key map (kbd "x") 'iankmod-save)
+ (define-key map (kbd "d") 'iankmod-delete)
map))