Skip to content

Commit

Permalink
Merge pull request 'warning-remediation' (legoscia#32) from hdasch/em…
Browse files Browse the repository at this point in the history
…acs-jabber:warning-remediation into production

Reduce byte/native compile warnings to a handful.

Reviewed-on: https://codeberg.org/emacs-jabber/emacs-jabber/pulls/32
  • Loading branch information
Hugh Daschbach committed Jul 17, 2023
2 parents c52d60d + ea524e3 commit 4bf92d9
Show file tree
Hide file tree
Showing 56 changed files with 933 additions and 396 deletions.
57 changes: 54 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ Old resources
:END:
1. (WIP) Support for [[https://xmpp.org/extensions/xep-0363.html][XEP-0363: HTTP File Upload]]
2. Support for [[https://xmpp.org/extensions/xep-0280.html][XEP-0280: Message Carbons]]
3. Use of the deprecated =cl= library is almost completely replaced with =cl-lib=
4. Build system changed from Autotools to a =Makefile=
5. Lots of cleanup by addressing =checkdoc= and byte-compiler warnings - addition/improvement of docstrings, function/variable declarations, etc
3. All jabber packages now enable lexical-binding
4. Use of the deprecated =cl= library has been completely replaced with =cl-lib=
5. Build system changed from Autotools to a =Makefile=
6. Lots of cleanup by addressing =checkdoc= and byte-compiler warnings - addition/improvement of docstrings, function/variable declarations, etc

** Requirements
:PROPERTIES:
Expand Down Expand Up @@ -152,6 +153,56 @@ If all goes well, =jabber.el= commands like =jabber-connect= should now be avail

To install the Info documentation, copy =jabber.info= to =/usr/local/info= and run ="install-info /usr/local/info/jabber.info"=.

* Troubleshooting
:PROPERTIES:
:CUSTOM_ID: troubleshooting
:END:

Common connection issues

When a connection fails, there is usually a message in the echo area describing the failure. If the echo area has already been cleared, check the ~*Messages*~ buffer.

Here are some of the common connection failure modes:

*** No response beyond "Connecting..."

#+begin_example
Connecting to <server-name>:5222...
#+end_example

This is likely a DNS lookup failure. Check the XMPP server name in ~jabber-account-list~.

*** Host unknown
#+begin_example
<user-jid>: connection lost: ‘Unexpected stanza (error ((xmlns . http://etherx.jabber.org/streams)) (host-unknown ((xmlns . urn:ietf:params:xml:ns:xmpp-streams))) (text ((xmlns . urn:ietf:params:xml:ns:xmpp-streams)) This server does not serve <server-name>))’
#+end_example

This is likely a server misconfiguration in ~jabber-account-list~, or a misconfiguration of the XMPP server. Verify the Jabber ID (jid) specified in ~jabber-account-list~. If that looks correct, ensure the XMPP server responds to the configured port with something like:

Alternatively, check for ~DNS~ ~SRV~ records pointing to an alternate port:

#+begin_src sh
dig srv _xmpp-client._tcp.ccss.com
# -or-
dig srv _xmpps-client._tcp.ccss.com
#+end_src

Check connectivity to the host and port with a tool like ~nc~ or ~openssl s_client~.

*** Authentication failure
#+begin_example
STARTTLS encryption required, but disabled/non-functional at our end
#+end_example
This likely means that the "gnutls" package is not available. Check
#+begin_src emacs-lisp
(gnutls-available-p)
#+end_src
if that returns ~nil~, consult
#+begin_src emacs-lisp
(info "(emacs-gnutls) Help For Users")
#+end_src
for more details and potential mitigation.

* TODO maintenance [16%]
:PROPERTIES:
:CUSTOM_ID: maintenance
Expand Down
3 changes: 3 additions & 0 deletions jabber-pkg.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
;; For ELPA: http://tromey.com/elpa/

(require 'package)

(define-package "jabber" "@PACKAGE_VERSION@" "A Jabber client for Emacs."
'((fsm "0.2") (srv "0.2")))

Expand Down
1 change: 0 additions & 1 deletion jabber.texi
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,6 @@ interface and do other useful things.
@cindex autoaway
@cindex idle
@cindex xprintidle
@vindex jabber-autoaway-method
@vindex jabber-autoaway-methods
@findex jabber-current-idle-time
@findex jabber-xprintidle-program
Expand Down
26 changes: 19 additions & 7 deletions lisp/jabber-activity.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@

;;; Code:

(require 'cl-lib)
(require 'jabber-core)
(require 'jabber-alert)
(require 'jabber-util)
(require 'jabber-muc-nick-completion) ;we need jabber-muc-looks-like-personal-p
(require 'cl-lib)

(defgroup jabber-activity nil
"Activity tracking options."
Expand Down Expand Up @@ -163,6 +162,17 @@ It is called after `jabber-activity-mode-string' and
(put 'jabber-activity-mode-string 'risky-local-variable t)
(put 'jabber-activity-count-string 'risky-local-variable t)

;; Global reference declarations

(declare-function jabber-chat-get-buffer "jabber-chat.el" (chat-with))
(declare-function jabber-muc-get-buffer "jabber-muc.el" (group))
(declare-function jabber-muc-private-get-buffer "jabber-muc.el"
(group nickname))
(declare-function jabber-muc-sender-p "jabber-muc.el" (jid))
(defvar jabber-silent-mode) ; jabber.el

;;

(defun jabber-activity-make-string-default (jid)
"Return the nick of the JID.
If no nick is available, return the user name part of the JID. In
Expand Down Expand Up @@ -201,7 +211,7 @@ all strings still are unique and at least
#'(lambda (x) (cons x (funcall jabber-activity-make-string x)))
jids)
#'(lambda (x y) (string-lessp (cdr x) (cdr y))))))
(cl-loop for ((prev-jid . prev) (cur-jid . cur) (next-jid . next))
(cl-loop for ((_prev-jid . prev) (cur-jid . cur) (_next-jid . next))
on (cons nil alist)
until (null cur)
collect
Expand All @@ -224,7 +234,9 @@ all strings still are unique and at least
(get-buffer (jabber-muc-get-buffer jid))))

(defun jabber-activity-show-p-default (jid)
"Return non-nil if there is an invisible buffer for JID, and JID is not in `jabber-activity-banned'."
"Return non-nil if JID should be hidden.
A JID should be hidden when there is an invisible buffer for JID,
and JID is not in `jabber-activity-banned'."
(let ((buffer (jabber-activity-find-buffer-name jid)))
(and (buffer-live-p buffer)
(not (get-buffer-window buffer 'visible))
Expand Down Expand Up @@ -303,22 +315,22 @@ Optional PRESENCE mean personal presence request or alert."
(ignore-errors
(jabber-activity-mode-line-update)))

(defun jabber-activity-add (from buffer text proposed-alert)
(defun jabber-activity-add (from _buffer _text _proposed-alert)
"Add a JID to mode line when `jabber-activity-show-p'."
(when (funcall jabber-activity-show-p from)
(add-to-list 'jabber-activity-jids from)
(add-to-list 'jabber-activity-personal-jids from)
(jabber-activity-mode-line-update)))

(defun jabber-activity-add-muc (nick group buffer text proposed-alert)
(defun jabber-activity-add-muc (_nick group _buffer text _proposed-alert)
"Add a JID to mode line when `jabber-activity-show-p'."
(when (funcall jabber-activity-show-p group)
(add-to-list 'jabber-activity-jids group)
(when (jabber-muc-looks-like-personal-p text group)
(add-to-list 'jabber-activity-personal-jids group))
(jabber-activity-mode-line-update)))

(defun jabber-activity-presence (who oldstatus newstatus statustext proposed-alert)
(defun jabber-activity-presence (who _oldstatus newstatus _statustext _proposed-alert)
"Add a JID to mode line on subscription requests."
(when (string= newstatus "subscribe")
(add-to-list 'jabber-activity-jids (symbol-name who))
Expand Down
9 changes: 7 additions & 2 deletions lisp/jabber-ahc.el
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ func - function taking connection object and entire IQ stanza as
Use the function `jabber-ahc-add' to add a command to this list.")

;; Global reference declarations

(defvar jabber-jid-info-menu) ; jabber-menu.el
(defvar jabber-buffer-connection) ; jabber-chatbuffer.el

;;

;;; SERVER
(add-to-list 'jabber-disco-info-nodes
Expand Down Expand Up @@ -89,8 +95,7 @@ obtained from `xml-parse-region'."
(let ((node (car command))
(plist (cdr command)))
(let ((acl (plist-get plist 'acl))
(name (plist-get plist 'name))
(func (plist-get plist 'func)))
(name (plist-get plist 'name)))
(when (or (not (functionp acl))
(funcall acl jc jid))
`(item ((name . ,name)
Expand Down
Loading

0 comments on commit 4bf92d9

Please sign in to comment.