Compare commits
26 Commits
dddcccb926
...
77169e6f5a
Author | SHA1 | Date |
---|---|---|
wgreenhouse | 77169e6f5a | |
cnngimenez | cb1bc80944 | |
cnngimenez | aab9a31d4a | |
cnngimenez | 8e000430ee | |
cnngimenez | fd70194b09 | |
cnngimenez | 10cc5cbbd2 | |
cnngimenez | 75f57df0c7 | |
cnngimenez | 3b0ccf3864 | |
cnngimenez | 8b0658fa0f | |
cnngimenez | 7780475042 | |
cnngimenez | 6978a71f64 | |
cnngimenez | 76ce26d313 | |
cnngimenez | ae59c6f4e5 | |
cnngimenez | e345013352 | |
cnngimenez | 716b3e4838 | |
cnngimenez | 2e770d031c | |
cnngimenez | af060c0011 | |
cnngimenez | 9c9b410c39 | |
cnngimenez | 630edb69d5 | |
cnngimenez | 7549ea1f83 | |
cnngimenez | 7e771a5061 | |
cnngimenez | 319bc5a635 | |
cnngimenez | e3eab02f17 | |
cnngimenez | 0da0e067f2 | |
cnngimenez | 656513e0a9 | |
cnngimenez | ffef7f4ea0 |
|
@ -156,7 +156,7 @@
|
|||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl)) ;; case; plus, for Emacs < 20: when, unless
|
||||
(eval-when-compile (require 'cl-lib)) ;; case; plus, for Emacs < 20: when, unless
|
||||
|
||||
;; Unless you first load `hexrgb.el', then either `palette.el' or `eyedropper.el', you will get
|
||||
;; warnings about variables and functions with prefix `eyedrop-' when you byte-compile
|
||||
|
@ -346,7 +346,7 @@ Optional arg PROMPT is the prompt. Nil means use a default prompt."
|
|||
(try-completion color colors))))
|
||||
(error "No such color: %S" color))
|
||||
(when convert-to-RGB-p (setq color (hexrgb-color-name-to-hex color))))
|
||||
(when (interactive-p) (message "Color: `%s'" color))
|
||||
(when (called-interactively-p 'interactive) (message "Color: `%s'" color))
|
||||
color)))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -370,7 +370,7 @@ returned; otherwise, t is returned."
|
|||
(green (hexrgb-green color))
|
||||
(blue (hexrgb-blue color)))
|
||||
(setq color (hexrgb-rgb-to-hex (- 1.0 red) (- 1.0 green) (- 1.0 blue))))
|
||||
(when (interactive-p) (message "Complement: `%s'" color))
|
||||
(when (called-interactively-p 'interactive) (message "Complement: `%s'" color))
|
||||
color)
|
||||
|
||||
;;;###autoload
|
||||
|
@ -481,7 +481,7 @@ Returns a list of RGB components of value 0.0 to 1.0, inclusive."
|
|||
pp (* value (- 1 saturation))
|
||||
qq (* value (- 1 (* saturation fract)))
|
||||
ww (* value (- 1 (* saturation (- 1 (- hue int-hue))))))
|
||||
(case int-hue
|
||||
(cl-case int-hue
|
||||
((0 6) (setq red value
|
||||
green ww
|
||||
blue pp))
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
#+TODO: TODO WIP EXTEND CLEANUP FIXME REVIEW |
|
||||
#+PROPERTY: header-args :tangle yes
|
||||
|
||||
This file implements the HTTP Upload [[https://xmpp.org/extensions/xep-0363.html][XEP-0363]] extension.
|
||||
|
||||
It is separated from the jabber.org file in order to implement and test it without affecting the original implementation.
|
||||
|
||||
|
||||
* Headers and commentary
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;;; jabber-httpupload.el --- Emacs Jabber HTTP Upload Implementation -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright 2021 cnngimenez
|
||||
;;
|
||||
;; Author: cnngimenez
|
||||
;; Maintainer: cnngimenez
|
||||
;; Version: 0.1.0
|
||||
;; Keywords: comm
|
||||
;; URL: https://github.com/cnngimenez/emacs-jabber
|
||||
;; Package-Requires: ((emacs "24.1"))
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
#+END_SRC
|
||||
|
||||
* Discovering support
|
||||
Disco is used to discover if HTTP Upload is supported on the server side. Two queries are used:
|
||||
|
||||
1. An IQ Disco items request to get all items supported by the server.
|
||||
2. For each item, an IQ Disco info request to test if the item is the Upload service.
|
||||
|
||||
The namespace of the HTTP Upload feature is ~urn:xmpp:http:upload:0~. This will be used on the second query to detect which item is the upload service.
|
||||
|
||||
For more information, see XML examples at the [[https://xmpp.org/extensions/xep-0363.html#disco][Discovering Support section of XEP-0363]].
|
||||
|
||||
** jabber-httpupload-has-support
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun jabber-httpupload-server-has-support (jc)
|
||||
"Check if the server has HTTP Upload support.
|
||||
Return non-nil when there is support from the server.
|
||||
|
||||
JC is the Jabber Connection to use."
|
||||
(seq-find (lambda (iri)
|
||||
(jabber-httpupload-is-upload-item jc iri))
|
||||
(jabber-httpupload-get-items jc)))
|
||||
#+END_SRC
|
||||
|
||||
** jabber-httpupload-is-upload-item
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun jabber-httpupload-is-upload-item (jc iri)
|
||||
"Return non-nil if IRI Disco item supports HTTP Upload.
|
||||
Get the Disco Info from the provided IRI at the current JC jabber connection,
|
||||
if the HTTP Upload namespace feature is in the list, return non-nil.")
|
||||
#+END_SRC
|
||||
** jabber-httpupload-get-items
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun jabber-httpupload-get-items (jc)
|
||||
"Retrieve al Disco IRIs from the server connected in JC.
|
||||
Return a list of IRI strings.
|
||||
|
||||
JC is a jabber connection.")
|
||||
#+END_SRC
|
||||
|
||||
* Requesting a slot
|
||||
* Uploading the file
|
||||
* Providing the package name
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(provide 'jabber-httpupload)
|
||||
|
||||
;;; jabber-httpupload.el ends here
|
||||
|
||||
#+END_SRC
|
||||
|
||||
|
||||
|
||||
* Meta :noexport:
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
#+TITLE: Emacs Jabber HTTP Upload implementation
|
||||
#+EMAIL:
|
||||
#+DESCRIPTION:
|
||||
#+KEYWORDS: jabber, xmpp, xep-0363, http upload
|
||||
|
||||
#+STARTUP: inlineimages hidestars content hideblocks entitiespretty
|
||||
#+STARTUP: indent fninline latexpreview
|
||||
|
||||
#+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:{} -:t f:t *:t <:t
|
||||
#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
|
||||
#+OPTIONS: tex:imagemagick
|
||||
|
||||
# -- Export
|
||||
#+LANGUAGE: en
|
||||
#+LINK_UP: jabber.org
|
||||
#+LINK_HOME: jabber.org
|
||||
#+EXPORT_SELECT_TAGS: export
|
||||
#+EXPORT_EXCLUDE_TAGS: noexport
|
||||
|
||||
# -- HTML Export
|
||||
#+INFOJS_OPT: view:info toc:t ftoc:t ltoc:t mouse:underline buttons:t
|
||||
#+HTML_LINK_UP: jabber.html
|
||||
#+HTML_LINK_HOME: jabber.html
|
||||
#+XSLT:
|
2690
jabber.org
2690
jabber.org
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue