emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116865: Merge from Gnus git master


From: Katsumi Yamaoka
Subject: [Emacs-diffs] trunk r116865: Merge from Gnus git master
Date: Sun, 23 Mar 2014 23:14:58 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116865
revision-id: address@hidden
parent: address@hidden
author: Gnus developers <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Sun 2014-03-23 23:14:52 +0000
message:
  Merge from Gnus git master
  
  2014-02-04 Lars Ingebrigtsen <address@hidden>
   * calendar/parse-time.el (parse-time-iso8601-regexp)
   (parse-iso8601-time-string): Copied from `url-dav' so that we can use
   it more generally.
  
  2014-02-01 Lars Ingebrigtsen <address@hidden>
   * net/dns.el (network-interface-list): Define for XEmacs.
  
  2014-01-31 Magnus Henoch <address@hidden>
   * net/dns.el (dns-servers-up-to-date-p): New function to see whether
   the network interfaces changed.
   (dns-query): Use it to flush the data.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/calendar/parse-time.el    
parsetime.el-20091113204419-o5vbwnq5f7feedwu-2379
  lisp/mail/hashcash.el          
hashcash.el-20091113204419-o5vbwnq5f7feedwu-7650
  lisp/net/dns.el                dns.el-20091113204419-o5vbwnq5f7feedwu-7957
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-23 18:13:35 +0000
+++ b/lisp/ChangeLog    2014-03-23 23:14:52 +0000
@@ -1,3 +1,19 @@
+2014-03-23  Lars Ingebrigtsen  <address@hidden>
+
+       * calendar/parse-time.el (parse-time-iso8601-regexp)
+       (parse-iso8601-time-string): Copied from `url-dav' so that we can use
+       it more generally.
+
+2014-03-23  Lars Ingebrigtsen  <address@hidden>
+
+       * net/dns.el (network-interface-list): Define for XEmacs.
+
+2014-03-23  Magnus Henoch  <address@hidden>
+
+       * net/dns.el (dns-servers-up-to-date-p): New function to see whether
+       the network interfaces changed.
+       (dns-query): Use it to flush the data.
+
 2014-03-23  Juanma Barranquero  <address@hidden>
 
        * vc/vc.el (vc-rollback): Use set-buffer-modified-p.

=== modified file 'lisp/calendar/parse-time.el'
--- a/lisp/calendar/parse-time.el       2014-01-01 07:43:34 +0000
+++ b/lisp/calendar/parse-time.el       2014-03-23 23:14:52 +0000
@@ -218,6 +218,68 @@
                  (rplaca (nthcdr (pop slots) time) new-val))))))))
     time))
 
+(defconst parse-time-iso8601-regexp
+  (let* ((dash "-?")
+        (colon ":?")
+        (4digit "\\([0-9][0-9][0-9][0-9]\\)")
+        (2digit "\\([0-9][0-9]\\)")
+        (date-fullyear 4digit)
+        (date-month 2digit)
+        (date-mday 2digit)
+        (time-hour 2digit)
+        (time-minute 2digit)
+        (time-second 2digit)
+        (time-secfrac "\\(\\.[0-9]+\\)?")
+        (time-numoffset (concat "[-+]\\(" time-hour "\\):" time-minute))
+        (time-offset (concat "Z" time-numoffset))
+        (partial-time (concat time-hour colon time-minute colon time-second
+                              time-secfrac))
+        (full-date (concat date-fullyear dash date-month dash date-mday))
+        (full-time (concat partial-time time-offset))
+        (date-time (concat full-date "T" full-time)))
+    (list (concat "^" full-date)
+         (concat "T" partial-time)
+         (concat "Z" time-numoffset)))
+  "List of regular expressions matching ISO 8601 dates.
+1st regular expression matches the date.
+2nd regular expression matches the time.
+3rd regular expression matches the (optional) timezone specification.")
+
+(defun parse-iso8601-time-string (date-string)
+  (let* ((date-re (nth 0 parse-time-iso8601-regexp))
+        (time-re (nth 1 parse-time-iso8601-regexp))
+        (tz-re (nth 2 parse-time-iso8601-regexp))
+        re-start
+        time seconds minute hour fractional-seconds
+        day month year day-of-week dst tz)
+    ;; We need to populate 'time' with
+    ;; (SEC MIN HOUR DAY MON YEAR DOW DST TZ)
+
+    ;; Nobody else handles iso8601 correctly, let's do it ourselves.
+    (when (string-match date-re date-string re-start)
+      (setq year (string-to-number (match-string 1 date-string))
+           month (string-to-number (match-string 2 date-string))
+           day (string-to-number (match-string 3 date-string))
+           re-start (match-end 0))
+      (when (string-match time-re date-string re-start)
+       (setq hour (string-to-number (match-string 1 date-string))
+             minute (string-to-number (match-string 2 date-string))
+             seconds (string-to-number (match-string 3 date-string))
+             fractional-seconds (string-to-number (or
+                                                    (match-string 4 
date-string)
+                                                    "0"))
+             re-start (match-end 0))
+       (when (string-match tz-re date-string re-start)
+         (setq tz (match-string 1 date-string)))
+       (setq time (list seconds minute hour day month year day-of-week dst 
tz))))
+
+    ;; Fall back to having Gnus do fancy things for us.
+    (when (not time)
+      (setq time (parse-time-string date-string)))
+
+    (and time
+        (apply 'encode-time time))))
+
 (provide 'parse-time)
 
 ;;; parse-time.el ends here

=== modified file 'lisp/mail/hashcash.el'
--- a/lisp/mail/hashcash.el     2014-01-01 07:43:34 +0000
+++ b/lisp/mail/hashcash.el     2014-03-23 23:14:52 +0000
@@ -47,10 +47,6 @@
 
 ;;; Code:
 
-;; For Emacs <22.2 and XEmacs.
-(eval-and-compile
-  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
-
 (eval-when-compile (require 'cl))      ; for case
 
 (defgroup hashcash nil

=== modified file 'lisp/net/dns.el'
--- a/lisp/net/dns.el   2014-01-01 07:43:34 +0000
+++ b/lisp/net/dns.el   2014-03-23 23:14:52 +0000
@@ -31,6 +31,12 @@
   "List of DNS servers to query.
 If nil, /etc/resolv.conf and nslookup will be consulted.")
 
+(defvar dns-servers-valid-for-interfaces nil
+  "The return value of `network-interface-list' when `dns-servers' was set.
+If the set of network interfaces and/or their IP addresses
+change, then presumably the list of DNS servers needs to be
+updated.  Set this variable to t to disable the check.")
+
 ;;; Internal code:
 
 (defvar dns-query-types
@@ -297,6 +303,17 @@
            (t string)))
       (goto-char point))))
 
+(declare-function network-interface-list "process.c")
+
+(defun dns-servers-up-to-date-p ()
+  "Return false if we need to recheck the list of DNS servers."
+  (and dns-servers
+       (or (eq dns-servers-valid-for-interfaces t)
+          ;; `network-interface-list' was introduced in Emacs 22.1.
+          (not (fboundp 'network-interface-list))
+          (equal dns-servers-valid-for-interfaces
+                 (network-interface-list)))))
+
 (defun dns-set-servers ()
   "Set `dns-servers' to a list of DNS servers or nil if none are found.
 Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
@@ -314,7 +331,9 @@
          (goto-char (point-min))
          (re-search-forward
           "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" nil t)
-         (setq dns-servers (list (match-string 1)))))))
+         (setq dns-servers (list (match-string 1))))))
+  (when (fboundp 'network-interface-list)
+    (setq dns-servers-valid-for-interfaces (network-interface-list))))
 
 (defun dns-read-txt (string)
   (if (> (length string) 1)
@@ -378,7 +397,7 @@
 If FULLP, return the entire record returned.
 If REVERSEP, look up an IP address."
   (setq type (or type 'A))
-  (unless dns-servers
+  (unless (dns-servers-up-to-date-p)
     (dns-set-servers))
 
   (when reversep


reply via email to

[Prev in Thread] Current Thread [Next in Thread]