Merge branch 'master' of https://git.gnus.org/gnus
[gnus] / lisp / netrc.el
index 2644659..d76b8cf 100644 (file)
@@ -220,6 +220,17 @@ MODE can be \"login\" or \"password\", suitable for passing to
                          (eq type (car (cddr service)))))))
     (cadr service)))
 
+(defun netrc-store-data (file host port user password)
+  (with-temp-buffer
+    (when (file-exists-p file)
+      (insert-file-contents file))
+    (goto-char (point-max))
+    (unless (bolp)
+      (insert "\n"))
+    (insert (format "machine %s login %s password %s port %s\n"
+                   host user password port))
+    (write-region (point-min) (point-max) file nil 'silent)))
+
 ;;;###autoload
 (defun netrc-credentials (machine &rest ports)
   "Return a user name/password pair.