This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "emacs-jabber".
The branch, master has been updated
via d11bda5e659ceb4d17b33ac0df78dfb6a6f27625 (commit)
from b5cb0d640e7771908d4e772625c79c65c756059e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d11bda5e659ceb4d17b33ac0df78dfb6a6f27625
Author: Magnus Henoch <leg...@us...>
Date: Sun Nov 24 23:33:03 2013 +0000
srv.el: call nslookup if UDP sockets not supported
dns.el requires support for UDP sockets, which is not present on
Windows. Check whether UDP sockets are supported, and if not, parse
the output of nslookup.
diff --git a/srv.el b/srv.el
index e8a3a63..6ead479 100644
--- a/srv.el
+++ b/srv.el
@@ -47,9 +47,7 @@ of the list. The list is empty if no SRV records were found."
(unless (assq 'SRV dns-query-types)
(error "dns.el doesn't support SRV lookups"))
;; `dns-query' used to be `query-dns'. Try both names for now.
- (let* ((result (if (fboundp 'query-dns)
- (query-dns target 'SRV t)
- (dns-query target 'SRV t)))
+ (let* ((result (srv--dns-query target))
(answers (mapcar #'(lambda (a)
(cadr (assq 'data a)))
(cadr (assq 'answers result))))
@@ -97,6 +95,37 @@ of the list. The list is empty if no SRV records were found."
(cadr (assq 'port a))))
(nreverse weighted-result)))))
+(defun srv--dns-query (target)
+ ;; dns-query uses UDP, but that is not supported on Windows...
+ (if (featurep 'make-network-process '(:type datagram))
+ (if (fboundp 'query-dns)
+ (query-dns target 'SRV t)
+ (dns-query target 'SRV t))
+ ;; ...so let's call nslookup instead.
+ (srv--nslookup target)))
+
+(defun srv--nslookup (target)
+ (with-temp-buffer
+ (call-process "nslookup" nil t nil "-type=srv" target)
+ (goto-char (point-min))
+ (let (results)
+ (while (search-forward-regexp
+ (concat "[\s\t]*priority += \\(.*\\)\r?\n"
+ "[\s\t]*weight += \\(.*\\)\r?\n"
+ "[\s\t]*port += \\(.*\\)\r?\n"
+ "[\s\t]*svr hostname += \\(.*\\)\r?\n")
+ nil t)
+ (push
+ (list
+ (list 'data
+ (list
+ (list 'priority (string-to-number (match-string 1)))
+ (list 'weight (string-to-number (match-string 2)))
+ (list 'port (string-to-number (match-string 3)))
+ (list 'target (match-string 4)))))
+ results))
+ (list (list 'answers results)))))
+
(provide 'srv)
;; arch-tag: b43358f2-d241-11da-836e-000a95c2fcd0
;;; srv.el ends here
-----------------------------------------------------------------------
Summary of changes:
srv.el | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
hooks/post-receive
--
emacs-jabber
|