aboutsummaryrefslogtreecommitdiffstats
path: root/mbsync/usr/bin/get-mail-password
diff options
context:
space:
mode:
authorGravatar Tom Willemse2019-08-14 23:45:13 -0700
committerGravatar Tom Willemse2019-08-14 23:45:13 -0700
commit946b7425dec6b3a97abdd631f1c00f7f4ca79a4f (patch)
tree15f73fbda4707f826fee94d87f650f43b48cdf2b /mbsync/usr/bin/get-mail-password
parent587bcae5e6bd3a930f08363c0494f618ff4b1d3d (diff)
downloadnew-dotfiles-946b7425dec6b3a97abdd631f1c00f7f4ca79a4f.tar.gz
new-dotfiles-946b7425dec6b3a97abdd631f1c00f7f4ca79a4f.zip
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.
Diffstat (limited to 'mbsync/usr/bin/get-mail-password')
-rwxr-xr-xmbsync/usr/bin/get-mail-password19
1 files changed, 8 insertions, 11 deletions
diff --git a/mbsync/usr/bin/get-mail-password b/mbsync/usr/bin/get-mail-password
index 02f4033..ecfbb09 100755
--- a/mbsync/usr/bin/get-mail-password
+++ b/mbsync/usr/bin/get-mail-password
@@ -1,15 +1,12 @@
#!/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 secretstorage
+
+connection = secretstorage.dbus_init()
+collection = secretstorage.get_collection_by_alias(connection, "login")
-print(keyring.get_password('offlineimap', sys.argv[1]))
+for foo in collection.search_items(
+ {"application": "mbsync", "account": sys.argv[1]}
+):
+ print(foo.get_secret().decode())