|
|
|
@ -23,6 +23,15 @@
|
|
|
|
|
|
|
|
|
|
(require 'map)
|
|
|
|
|
|
|
|
|
|
(define-error 'stomp-error
|
|
|
|
|
"Error encountered in implementation of the STOMP protocol")
|
|
|
|
|
|
|
|
|
|
(define-error 'stomp-invalid-header
|
|
|
|
|
"Invalid STOMP frame header encounterd")
|
|
|
|
|
|
|
|
|
|
(define-error 'stomp-invalid-frame
|
|
|
|
|
"Invalid STOMP frame encountered")
|
|
|
|
|
|
|
|
|
|
(defun stomp-send-frame (process frame)
|
|
|
|
|
"Send a message to a STOMP process"
|
|
|
|
|
(process-send-string process (stomp-frame-to-string frame)))
|
|
|
|
@ -84,7 +93,7 @@
|
|
|
|
|
(let ((header (split-string (thing-at-point 'line) ":")))
|
|
|
|
|
(cond
|
|
|
|
|
((= (line-end-position) end-point) headers)
|
|
|
|
|
((> (length header) 2) (throw 'invalid-header nil))
|
|
|
|
|
((> (length header) 2) (signal 'stomp-invalid-header (list header)))
|
|
|
|
|
(t (stomp-read-headers
|
|
|
|
|
buffer
|
|
|
|
|
end-point
|
|
|
|
@ -125,7 +134,7 @@
|
|
|
|
|
'command key. Other optional keys are 'headers (another alist)
|
|
|
|
|
and 'content"
|
|
|
|
|
(unless (assq 'command frame)
|
|
|
|
|
(throw 'invalid-frame "A STOMP frame must define a command"))
|
|
|
|
|
(signal 'stomp-invalid-frame (list "Expected frame to have a command" frame)))
|
|
|
|
|
(let ((headers (if (assq 'headers frame) (alist-get 'headers frame) '()))
|
|
|
|
|
(content (if (assq 'content frame) (alist-get 'content frame) "")))
|
|
|
|
|
(format "%s\n%s\n%s\u0000"
|
|
|
|
|