From 946b7425dec6b3a97abdd631f1c00f7f4ca79a4f Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 14 Aug 2019 23:45:13 -0700 Subject: Fix (automatic) syncing of email - Load the necessary environment variables from ‘gnome-keyring-daemon’ when loading fish. - Don’t sync the Archive directory from ryuslash.org, it’s too big and mbsync seems to get really confused about it. - Disable old email accounts from syncing with mbsync. - Fix the ‘get-mail-password’ and ‘set-mail-password’ scripts. - Use ‘secretstorage’ instead of ‘keyring’, this appears to be newer and easier to use. --- mbsync/usr/bin/set-mail-password | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'mbsync/usr/bin/set-mail-password') diff --git a/mbsync/usr/bin/set-mail-password b/mbsync/usr/bin/set-mail-password index 022b5f7..c36e39b 100755 --- a/mbsync/usr/bin/set-mail-password +++ b/mbsync/usr/bin/set-mail-password @@ -1,16 +1,17 @@ #!/usr/bin/python3 -import gi - -gi.require_version('GnomeKeyring', '1.0') - -import logging - -logger = logging.getLogger('keyring') -logger.addHandler(logging.StreamHandler()) - -import keyring import sys -import getpass +from getpass import getpass +import secretstorage + +connection = secretstorage.dbus_init() +collection = secretstorage.get_collection_by_alias(connection, "login") +attributes = {"application": "mbsync", "account": sys.argv[1]} -keyring.set_password('offlineimap', sys.argv[1], getpass.getpass()) +collection.create_item( + "Password for '{}' on '{}'".format( + attributes["account"], attributes["application"] + ), + attributes, + getpass().encode(), +) -- cgit v1.2.3-54-g00ecf