[gnus git] branch master updated: m0-9-23-gb41f491 =1= Start implementing gnus-cloud.el.

Lars Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  b41f49151270555ce86227b64a56ed4ad6340974 (commit)
      from  b7fcf976d418fab4b68186deac82998135d14db2 (commit)


- Log -----------------------------------------------------------------
commit b41f49151270555ce86227b64a56ed4ad6340974
Author: Lars Ingebrigtsen <[email protected]>
Date:   Sat Feb 1 14:34:57 2014 -0800

    Start implementing gnus-cloud.el.

diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el
index c1ad3b9..174aab8 100644
--- a/lisp/dgnushack.el
+++ b/lisp/dgnushack.el
@@ -331,7 +331,9 @@ This means that every warning will be reported as an error."
     (when (or (featurep 'xemacs)
 	      (or (< emacs-major-version 24)
 		  (< emacs-minor-version 3)))
-      (setq files (delete "gnus-icalendar.el" files)))
+      (setq files (delete "gnus-icalendar.el" files))
+      ;; Temporary during development.
+      (setq files (delete "gnus-cloud.el" files)))
     (dolist (file files)
       (setq file (expand-file-name file srcdir))
       (when (and (file-exists-p
diff --git a/lisp/gnus-cloud.el b/lisp/gnus-cloud.el
index 2a1b2b8..2018dc2 100644
--- a/lisp/gnus-cloud.el
+++ b/lisp/gnus-cloud.el
@@ -26,6 +26,56 @@
 
 (eval-when-compile (require 'cl))
 
+(defgroup gnus-cloud nil
+  "Syncing Gnus data via IMAP."
+  :group 'gnus)
+
+(defcustom gnus-cloud-synced-files '("~/\\.authinfo"
+				     "~/\\.authinfo\\.gpg"
+				     "~/\\.gnus\\.el"
+				     "~/News/.*.SCORE")
+  "List of file regexps that should be kept up-to-date via the cloud."
+  :group 'gnus-cloud
+  :type '(repeat regexp))
+
+(defvar gnus-cloud-version "0.1")
+
+(defun gnus-cloud-make-chunk (elems)
+  (with-temp-buffer
+    (insert (format "Version %s\n" gnus-cloud-version))
+    (insert (gnus-cloud-insert-data elems))))
+
+(defun gnus-cloud-insert-data (elems)
+  (mm-with-unibyte-buffer
+    (dolist (elem elems)
+      (cond
+       ((eq (car elem) :file)
+	(let (length data)
+	  (mm-with-unibyte-buffer
+	    (insert-file-contents-literally (cadr elem))
+	    (setq length (buffer-size)
+		  data (buffer-string)))
+	  (insert (format "file %S %s %d\n"
+			  (cadr elem)
+			  (format-time-string
+			   "%FT%T%z" (nth 5 (file-attributes (cadr elem))))
+			  length))
+	  (insert data)
+	  (insert "\n")))
+       ((eq (car elem) :buffer)
+	(insert (format "data %S %d\n" (cadr elem)
+			(with-current-buffer (caddr elem)
+			  (buffer-size))))
+	(insert-buffer-substring (caddr elem))
+	(insert "\n"))))
+    (gnus-cloud-encode-data)
+    (buffer-string)))
+
+(defun gnus-cloud-encode-data ()
+  (call-process-region (point-min) (point-max) "gzip" t (current-buffer) nil
+		       "-c")
+  (base64-encode-region (point-min) (point-max)))
+
 (provide 'gnus-cloud)
 
 ;;; gnus-cloud.el ends here

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/dgnushack.el  |    4 +++-
 lisp/gnus-cloud.el |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 1 deletion(-)

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 "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.