branch: elpa/jabber
commit f25fd0a610861087eb12a0a373a2c88b61c2a74e
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>
presence: Separate shared display data
---
lisp/jabber-alert.el | 2 +-
lisp/jabber-chat.el | 1 +
lisp/jabber-modeline.el | 2 +-
lisp/jabber-presence-display.el | 43 +++++++++++++++++++++++++++++++++++++++++
lisp/jabber-roster-menu.el | 2 +-
lisp/jabber-util.el | 1 +
lisp/jabber.el | 21 --------------------
7 files changed, 48 insertions(+), 24 deletions(-)
diff --git a/lisp/jabber-alert.el b/lisp/jabber-alert.el
index 02158d4ee8..71a399349f 100644
--- a/lisp/jabber-alert.el
+++ b/lisp/jabber-alert.el
@@ -28,6 +28,7 @@
;;; Code:
(require 'cl-lib)
+(require 'jabber-presence-display)
(require 'jabber-util)
(require 'jabber-xml)
(require 'jabber-muc-protocol)
@@ -243,7 +244,6 @@ files."
(declare-function jabber-chat-find-buffer "jabber-chat.el" (chat-with))
(declare-function jabber-chat-send "jabber-chat.el"
(jc body &optional extra-elements))
-(defvar jabber-presence-strings) ; jabber.el
(defvar jabber-xml-data) ; jabber.el
(defvar jabber-buffer-connection) ; jabber-chatbuffer.el
diff --git a/lisp/jabber-chat.el b/lisp/jabber-chat.el
index b57eb56b55..ea85a0cb46 100644
--- a/lisp/jabber-chat.el
+++ b/lisp/jabber-chat.el
@@ -41,6 +41,7 @@
(require 'jabber-image)
(require 'jabber-muc-protocol)
(require 'jabber-muc-state)
+(require 'jabber-presence-display)
;; For the `image-property' setf-expander (not preloaded on emacs-nox).
(require 'image)
diff --git a/lisp/jabber-modeline.el b/lisp/jabber-modeline.el
index 1be8b99477..eaf41801f7 100644
--- a/lisp/jabber-modeline.el
+++ b/lisp/jabber-modeline.el
@@ -27,6 +27,7 @@
;;; Code:
(require 'jabber-presence)
+(require 'jabber-presence-display)
(require 'jabber-alert)
(require 'jabber-activity)
(eval-when-compile (require 'cl-lib))
@@ -50,7 +51,6 @@ Available sections: `presence', `contacts', `activity'."
;; Global reference declarations
(defvar jabber-current-show) ; jabber.el
-(defvar jabber-presence-strings) ; jabber.el
;; Activity variables (defined in jabber-activity.el)
diff --git a/lisp/jabber-presence-display.el b/lisp/jabber-presence-display.el
new file mode 100644
index 0000000000..1a07c445c0
--- /dev/null
+++ b/lisp/jabber-presence-display.el
@@ -0,0 +1,43 @@
+;;; jabber-presence-display.el --- Shared presence display data -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Thanos Apollo
+
+;; Maintainer: Thanos Apollo <[email protected]>
+
+;; This file is a part of jabber.el.
+
+;; 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 2, or (at your option)
+;; any later version.
+
+;;; Commentary:
+
+;; Immutable mappings shared by presence renderers and completion UI.
+
+;;; Code:
+
+;;;###autoload
+(defconst jabber-presence-faces
+ '(("" . jabber-roster-user-online)
+ ("away" . jabber-roster-user-away)
+ ("xa" . jabber-roster-user-xa)
+ ("dnd" . jabber-roster-user-dnd)
+ ("chat" . jabber-roster-user-chatty)
+ ("error" . jabber-roster-user-error)
+ (nil . jabber-roster-user-offline))
+ "Mapping from presence types to faces.")
+
+(defconst jabber-presence-strings
+ `(("" . ,(propertize "Online" 'face 'jabber-roster-user-online))
+ ("away" . ,(propertize "Away" 'face 'jabber-roster-user-away))
+ ("xa" . ,(propertize "Extended Away" 'face 'jabber-roster-user-xa))
+ ("dnd" . ,(propertize "Do not Disturb" 'face 'jabber-roster-user-dnd))
+ ("chat" . ,(propertize "Chatty" 'face 'jabber-roster-user-chatty))
+ ("error" . ,(propertize "Error" 'face 'jabber-roster-user-error))
+ (nil . ,(propertize "Offline" 'face 'jabber-roster-user-offline)))
+ "Mapping from presence types to readable, colorized strings.")
+
+(provide 'jabber-presence-display)
+
+;;; jabber-presence-display.el ends here
diff --git a/lisp/jabber-roster-menu.el b/lisp/jabber-roster-menu.el
index 2c0a219041..0ea3a16f1d 100644
--- a/lisp/jabber-roster-menu.el
+++ b/lisp/jabber-roster-menu.el
@@ -29,13 +29,13 @@
(require 'jabber-info)
(require 'jabber-muc)
(require 'jabber-presence)
+(require 'jabber-presence-display)
(require 'jabber-roster)
(require 'jabber-version)
(declare-function jabber-omemo-show-fingerprints "jabber-omemo-trust.el" (jc))
(defvar jabber-current-show) ; jabber.el
-(defvar jabber-presence-strings) ; jabber.el
(defvar jabber-activity-jids) ; jabber-activity.el
(defvar jabber-muc--rooms) ; jabber-muc.el
(defvar jabber-roster-account-action-map)
diff --git a/lisp/jabber-util.el b/lisp/jabber-util.el
index cb36ada8a8..6039baf4ab 100644
--- a/lisp/jabber-util.el
+++ b/lisp/jabber-util.el
@@ -30,6 +30,7 @@
;;; Code:
(require 'cl-lib)
+(require 'jabber-presence-display)
(require 'jabber-state)
(require 'jabber-stanza)
(require 'jabber-xml)
diff --git a/lisp/jabber.el b/lisp/jabber.el
index cff9b632e3..31b6a940eb 100644
--- a/lisp/jabber.el
+++ b/lisp/jabber.el
@@ -240,27 +240,6 @@ One disabled account with a non-standard port:
"Debugging options."
:group 'jabber)
-;;;###autoload
-(defconst jabber-presence-faces
- '(("" . jabber-roster-user-online)
- ("away" . jabber-roster-user-away)
- ("xa" . jabber-roster-user-xa)
- ("dnd" . jabber-roster-user-dnd)
- ("chat" . jabber-roster-user-chatty)
- ("error" . jabber-roster-user-error)
- (nil . jabber-roster-user-offline))
- "Mapping from presence types to faces.")
-
-(defconst jabber-presence-strings
- `(("" . ,(propertize "Online" 'face 'jabber-roster-user-online))
- ("away" . ,(propertize "Away" 'face 'jabber-roster-user-away))
- ("xa" . ,(propertize "Extended Away" 'face 'jabber-roster-user-xa))
- ("dnd" . ,(propertize "Do not Disturb" 'face 'jabber-roster-user-dnd))
- ("chat" . ,(propertize "Chatty" 'face 'jabber-roster-user-chatty))
- ("error" . ,(propertize "Error" 'face 'jabber-roster-user-error))
- (nil . ,(propertize "Offline" 'face 'jabber-roster-user-offline)))
- "Mapping from presence types to readable, colorized strings.")
-
;;;###autoload
(defun jabber-customize ()
"Customize Jabber options."