sbbs.el

Diff
Login

Differences From Artifact [a7ead60032]:

To Artifact [490ff2e445]:


36
37
38
39
40
41
42
43
44
45

46

47
48
49
50
51
52
53
(defgroup sbbs nil
  "SchemeBBS client."
  :group 'applications
  :prefix "sbbs-")

(defcustom sbbs-boards
  '(("textboard.org" ("sol" "prog") t)
    ("bbs.jp.net" ("mona") t))
  "List of SchemeBBS sites and boards."
  :type '(repeat (list (string :tag "Board Domain")

                       (repeat (string :tag "Board Name"))

                       (boolean :tag "Use TLS?"))))

(defcustom sbbs-default-board nil
  "Jump to first link after narrowing posts."
  :type '(choice (const :tag "None" nil)
                 (cons (string :tag "Board Domain")
                       (string :tag "Board Name"))))







|


>
|
>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
(defgroup sbbs nil
  "SchemeBBS client."
  :group 'applications
  :prefix "sbbs-")

(defcustom sbbs-boards
  '(("textboard.org" ("sol" "prog") t)
    ("bbs.jp.net" (("mona" . "")) t))
  "List of SchemeBBS sites and boards."
  :type '(repeat (list (string :tag "Board Domain")
                       (repeat (or (string :tag "Board Name")
                                   (cons (string :tag "Board Name")
                                         (string :tag "API Path"))))
                       (boolean :tag "Use TLS?"))))

(defcustom sbbs-default-board nil
  "Jump to first link after narrowing posts."
  :type '(choice (const :tag "None" nil)
                 (cons (string :tag "Board Domain")
                       (string :tag "Board Name"))))
128
129
130
131
132
133
134
135






136
137
138
139
140
141
142
143
144
145
146
147
148
149


150
151
152
153
154
155
156
157

(defsubst sbbs--board-domain (board)
  "Get domain part of a BOARD object."
  (aref board 0))

(defsubst sbbs--board-name (board)
  "Get board name part of a BOARD object."
  (aref board 1))







(defsubst sbbs--board-protocol (board)
  "Determine protocol to be used for BOARD object."
  (if (aref board 2) "https" "http"))

(defun sbbs--board-url (&optional path api-p board)
  "Generate URL for BOARD to access PATH.

If API-P is non-nil, prefix path with \"sexp\"."
  (let ((board (or board sbbs--board)))
    (format "%s://%s/%s%s/%s"
            (sbbs--board-protocol board)
            (sbbs--board-domain board)
            (if api-p "sexp/" "")


            (sbbs--board-name board)
            (or path ""))))

(defun sbbs--list-boards ()
  "Return a list of known board objects."
  (let (boards)
    (dolist (ent sbbs-boards)
      (dolist (board (cadr ent))







|
>
>
>
>
>
>














>
>
|







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

(defsubst sbbs--board-domain (board)
  "Get domain part of a BOARD object."
  (aref board 0))

(defsubst sbbs--board-name (board)
  "Get board name part of a BOARD object."
  (let ((name (aref board 1)))
    (if (consp name) (car name) name)))

(defsubst sbbs--board-api (board)
  "Get board name part of a BOARD object."
  (let ((name (aref board 1)))
    (if (consp name) (cdr name) name)))

(defsubst sbbs--board-protocol (board)
  "Determine protocol to be used for BOARD object."
  (if (aref board 2) "https" "http"))

(defun sbbs--board-url (&optional path api-p board)
  "Generate URL for BOARD to access PATH.

If API-P is non-nil, prefix path with \"sexp\"."
  (let ((board (or board sbbs--board)))
    (format "%s://%s/%s%s/%s"
            (sbbs--board-protocol board)
            (sbbs--board-domain board)
            (if api-p "sexp/" "")
            (if api-p
                (sbbs--board-api board)
              (sbbs--board-name board))
            (or path ""))))

(defun sbbs--list-boards ()
  "Return a list of known board objects."
  (let (boards)
    (dolist (ent sbbs-boards)
      (dolist (board (cadr ent))