1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

erc-network: fix erc-determine-network when no network

* erc-networks.el (erc-determine-network): Check that NETWORK as a
value, some servers set it to nothing.
This commit is contained in:
Julien Danjou 2014-02-25 18:37:25 +01:00
parent 98bd6b321c
commit ea922c8bb3
2 changed files with 16 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2014-02-25 Julien Danjou <julien@danjou.info>
* erc-networks.el (erc-determine-network): Check that NETWORK as a
value, some servers set it to nothing.
2014-01-31 Glenn Morris <rgm@gnu.org>
* erc.el (erc-accidental-paste-threshold-seconds): Doc tweak.

View File

@ -724,16 +724,17 @@ MATCHER is used to find a corresponding network to a server while connected to
server parameter NETWORK if provided, otherwise parse the server name and
search for a match in `erc-networks-alist'."
;; The server made it easy for us and told us the name of the NETWORK
(if (assoc "NETWORK" erc-server-parameters)
(intern (cdr (assoc "NETWORK" erc-server-parameters)))
(or
;; Loop through `erc-networks-alist' looking for a match.
(let ((server (or erc-server-announced-name erc-session-server)))
(cl-loop for (name matcher) in erc-networks-alist
when (and matcher
(string-match (concat matcher "\\'") server))
do (cl-return name)))
'Unknown)))
(let ((network-name (cdr (assoc "NETWORK" erc-server-parameters))))
(if network-name
(intern network-name)
(or
;; Loop through `erc-networks-alist' looking for a match.
(let ((server (or erc-server-announced-name erc-session-server)))
(cl-loop for (name matcher) in erc-networks-alist
when (and matcher
(string-match (concat matcher "\\'") server))
do (cl-return name)))
'Unknown))))
(defun erc-network ()
"Return the value of `erc-network' for the current server."