Compare commits

...

26 Commits

Author SHA1 Message Date
wgreenhouse 77169e6f5a First attempt at shipping jabber.el with lexical binding.
Temporarily ditch `literate-elisp` due to
https://github.com/jingtaozf/literate-elisp/issues/6. It is
incompatible with lexical binding right now.
2021-04-10 01:15:02 -04:00
cnngimenez cb1bc80944 Fixed another pattern with run-hook-* that may not execute.
Simmilar as the last commit, the 'printers variable may generate conflicts with
run-hook-*.

Note: untabify has been used.
2021-03-31 21:34:17 -04:00
cnngimenez aab9a31d4a Fixed symbol definition is void when completing nicks
When hiting TAB on a partial nickname, this error used to appear: "mapcar: Symbol’s
function definition is void: fetch-time".
2021-03-31 21:34:17 -04:00
cnngimenez 8e000430ee Making a local hook dynamic-bound in jabber-muc-process-message. 2021-03-31 21:34:17 -04:00
cnngimenez fd70194b09 Warn if lexical binding is off when compiling and loading. 2021-03-31 21:34:17 -04:00
cnngimenez 10cc5cbbd2 cl-return gives error without the cl-block. 2021-03-31 21:34:17 -04:00
cnngimenez 75f57df0c7 Enable lexical-binding when using literate-elisp-tangle. 2021-03-31 21:34:17 -04:00
cnngimenez 3b0ccf3864 hexrgb.el should not load cl. 2021-03-31 21:34:17 -04:00
cnngimenez 8b0658fa0f Comments about lexical-binding variable. Fixed typo with 't 2021-03-31 21:34:17 -04:00
cnngimenez 7780475042 Replacing incf and defstruct to cl-incf and cl-defstruct 2021-03-31 21:34:17 -04:00
cnngimenez 6978a71f64 Replaced fourth, plusp and assert to its cl-* equivalents 2021-03-31 21:34:17 -04:00
cnngimenez 76ce26d313 Replaced the case, third, destructuring-bind with cl-*. 2021-03-31 21:34:17 -04:00
cnngimenez ae59c6f4e5 Replacing pushnew, loop, return, first and second with cl-* 2021-03-31 21:34:17 -04:00
cnngimenez e345013352 Sorry, typo on lexical-binding local var. 2021-03-31 21:34:17 -04:00
cnngimenez 716b3e4838 lexical binding is on. Replaced lexical-let with let. 2021-03-31 21:34:17 -04:00
cnngimenez 2e770d031c Removed cl library and replaced its deprecated functions 2021-03-31 21:34:17 -04:00
cnngimenez af060c0011 First explanations. Commentary and some functions to implement. 2021-03-30 15:59:26 -03:00
cnngimenez 9c9b410c39 Merging from wgreenhouse master 2021-03-21 10:50:13 -03:00
cnngimenez 630edb69d5 Chekdoc fixes: First line sentence fixed. 2021-03-19 16:47:44 -03:00
cnngimenez 7549ea1f83 Checkdoc fixes: First sentence fix. 2021-03-19 16:36:08 -03:00
cnngimenez 7e771a5061 Checkdoc fix: XML-DATA parameter is documented. 2021-03-19 15:16:59 -03:00
cnngimenez 319bc5a635 Checkdoc fix: Commenting JC parameter on several functions. 2021-03-19 14:22:22 -03:00
cnngimenez e3eab02f17 Explaining jabber-signal-error and linking with the updated RFC 2021-03-19 13:56:04 -03:00
cnngimenez 0da0e067f2 Checkdoc fix: Error messages should start with uppercase
For some reason, checkdoc considers jabber-signal-error. Implemented a
work-around in that function.
2021-03-19 13:47:36 -03:00
cnngimenez 656513e0a9 Checkdoc fixes: Some Error messages fixed.
They should not end with period and start with capital leter.
2021-03-19 12:05:02 -03:00
cnngimenez ffef7f4ea0 Checkdoc fixes: Lot of "two spaces after a period" fixed. 2021-03-19 11:49:53 -03:00
4 changed files with 13568 additions and 1779 deletions

View File

@ -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))

119
jabber-httpupload.org Normal file
View File

@ -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:

12530
jabber.el

File diff suppressed because it is too large Load Diff

2690
jabber.org

File diff suppressed because it is too large Load Diff