#+TITLE: jabber.el - The XMPP client for Emacs
#+TEXINFO_DIR_NAME: * jabber.el: (jabber)
#+TEXINFO_DIR_DESC: jabber.el - The XMPP client for Emacs
#+TEXINFO_DIR_CATEGORY: Emacs

* About
[[https://elpa.nongnu.org/nongnu/jabber.svg]]

=jabber.el= is an [[http://xmpp.org][XMPP]] client for Emacs.

See the [[https://xmpp.org/software/jabber-el/][xmpp.org page]] for the full list of supported XEPs.

+ [[https://thanosapollo.org/projects/jabber/][Homepage]]

+ Source:
  + [[https://codeberg.org/emacs-jabber/emacs-jabber/][Codeberg]]

+ Discuss the project in these XMPP MUCs:
  + =jabber-el@conference.hmm.st= for the project
  + =emacs@conference.conversations.im= for Emacs peer support including jabber.el

* Requirements

+ Emacs 29.1 or later, compiled with dynamic module support

** OMEMO encryption (optional)

OMEMO end-to-end encryption uses a native C module built from the
vendored [[https://github.com/mierenhoop/picomemo][picomemo]] source.  Build dependencies: a C compiler,
=pkg-config=, and Mbed TLS 3.0 or later (=mbedcrypto=).

Build the module manually from the jabber source or ELPA/package
directory:

#+begin_src sh
  cd /path/to/jabber-source-or-elpa-dir
  make module
#+end_src

The resulting =jabber-omemo-core.so= (or =.dylib= on macOS) lands
beside the Elisp files and is loaded automatically.  If the module is
missing, OMEMO use signals =OMEMO module not compiled=.

* Installation
=jabber.el= is available via [[https://elpa.nongnu.org/nongnu/jabber.html][NonGNU ELPA]].

You can install it via =M-x package-install RET jabber=

** package-vc (Emacs 30+)

Emacs honors package-vc build commands such as =:make= only when
=package-vc-allow-build-commands= allows the package.

#+begin_src emacs-lisp
  (setq package-vc-allow-build-commands '(jabber))

  (use-package jabber
    :ensure nil
    :vc (:url "https://codeberg.org/emacs-jabber/emacs-jabber.git"
              :branch "master"
              :rev :newest
              :lisp-dir "lisp"
              :doc "README.org"
              :make "module")
    :custom
    (jabber-account-list '(("user@example.org")))
    :config
    (jabber-modeline-mode 1)
    :bind-keymap (("C-x C-j" . jabber-global-keymap))
    :hook (kill-emacs . jabber-disconnect))
#+end_src

** straight.el

#+begin_src emacs-lisp
  (use-package jabber
    :straight `(jabber
                :type git
                :host codeberg
                :repo "emacs-jabber/emacs-jabber"
                :branch "master"
                :files ("lisp/*.el"
                        "lisp/jabber-omemo-core.so"
                        "lisp/jabber-omemo-core.dylib")
                :pre-build ,(pcase system-type
                              ('berkeley-unix '(("gmake" "module" "CC=clang")))
                              ('darwin '(("make" "module" "CC=clang")))
                              (_ '(("make" "module")))))
    :custom
    (jabber-account-list '(("user@example.org")))
    :config
    (jabber-modeline-mode 1)
    :bind-keymap (("C-x C-j" . jabber-global-keymap))
    :hook (kill-emacs . jabber-disconnect))
#+end_src


** Nix

The repository ships a =flake.nix= with Emacs, test, lint, and
native-module build dependencies.

#+begin_src sh
  make test
  make module
#+end_src

To enter the same environment manually:

#+begin_src sh
  nix develop
#+end_src

To run the isolated Nix checks:

#+begin_src sh
  nix flake check
#+end_src

* Configuration
** Authentication
Accounts are configured via =jabber-account-list=.  The simplest form
uses auth-source =~/.authinfo.gpg= for passwords:

#+begin_src emacs-lisp
  (setq jabber-account-list '(("user@example.org")
                               ("second@account.org")))
#+end_src

With =pass= (password-store):

#+begin_src emacs-lisp
  (setq jabber-account-list
        `(("user@example.org"
           (:password . ,(auth-source-pass-get 'secret "xmpp/example.org/user")))))
#+end_src

** Bug references

#+begin_src emacs-lisp
  (add-hook 'jabber-chat-mode-hook #'bug-reference-mode)

  ;; Customize references
  (setq jabber-bug-reference-alist
        '(("jabber-el@conference\\.hmm\\.st"
  	 "\\(#\\([0-9]+\\)\\)"
  	 "https://codeberg.org/emacs-jabber/emacs-jabber/issues/%s")
  	("#guix%irc\\.libera.chat@irc\\.biboumi-gateway\\.example"
  	 "\\(#\\([0-9]+\\)\\)"
  	 "https://codeberg.org/guix/guix/issues/%s")))
#+end_src

* Basic commands
+ Use =M-x jabber-roster= or =C-x C-j C-r= to get started.
