1 ;; Copyright (C) 2016 Ian Kelling
3 ;; This program is free software: you can redistribute it and/or modify
4 ;; it under the terms of the GNU General Public License as published by
5 ;; the Free Software Foundation, either version 3 of the License, or
6 ;; (at your option) any later version.
8 ;; This program is distributed in the hope that it will be useful,
9 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ;; GNU General Public License for more details.
13 ;; You should have received a copy of the GNU General Public License
14 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
16 (defun iankmod-start ()
18 (shell-command "/a/h/get-comments" "*messages*")
19 (find-file "/tmp/hcomments")
21 (defun iankmod-save ()
23 (shell-command "/a/h/set-comments" "*messages*"))
26 (defun iankmod-set-state (state)
28 (re-search-forward "|" nil t)
29 (re-search-forward "[^|]*" nil t)
33 (defun iankmod-pick ()
35 (iankmod-set-state "picked"))
39 (iankmod-set-state "banned"))
41 (defun iankmod-moderate ()
43 (iankmod-set-state "moderated"))
45 (define-minor-mode iankmod
46 "Moderation of comments for iankelling.org"
47 :keymap (let ((map (make-sparse-keymap)))
48 (define-key map (kbd "p") 'iankmod-pick)
49 (define-key map (kbd "b") 'iankmod-ban)
50 (define-key map (kbd "m") 'iankmod-moderate)
51 (define-key map (kbd "x") 'iankmod-save)