From 2095df4129add3e56e315bbc3837d54bbda0122c Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:22:42 +0400 Subject: [PATCH] (feat) config/emacs: setup outlook support lmao!!!! --- config/emacs/.offlineimap.py | 10 ++++++---- config/emacs/.offlineimaprc | 14 +++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/config/emacs/.offlineimap.py b/config/emacs/.offlineimap.py index 0557d433..77a09b04 100644 --- a/config/emacs/.offlineimap.py +++ b/config/emacs/.offlineimap.py @@ -10,7 +10,7 @@ def get_pass(account): def get_user(account): usercmd = check_output("pass " + account, shell=True) - return re.search(rb"login: (.*)", usercmd, flags=0).group(1) + return re.search(rb"login: (.*)", usercmd, flags=0).group(1).decode("utf-8") def hydroxide(path): @@ -37,12 +37,14 @@ def get_client_secret(account): def get_client_token(account): cmd = check_output("pass " + account, shell=True) - return re.search(rb"client_token: (.*)", cmd, flags=0).group(1) + output = re.search("client_token: (.*)", cmd.decode(), flags=0).group(1) + + return output def get_client_refresh_token(account): cmd = check_output("pass " + account, shell=True) - output = re.search(rb"client_refresh_token: (.*)", cmd, flags=0).group(1) + output = re.search("client_refresh_token: (.*)", cmd.decode(), flags=0).group(1) - return str.encode(output) + return output diff --git a/config/emacs/.offlineimaprc b/config/emacs/.offlineimaprc index e0e554f4..d5011dff 100644 --- a/config/emacs/.offlineimaprc +++ b/config/emacs/.offlineimaprc @@ -1,6 +1,7 @@ [general] pythonfile = ~/.offlineimap.py accounts = Proton, Outlook +socktimeout = 10 [Account Proton] localrepository = Proton-local @@ -20,21 +21,24 @@ remotepasseval = hydroxide("/home/sako/.hydroxide-bridge-pass") folderfilter = lambda foldername: foldername in [ "All Mail", "Archive", "Drafts", "INBOX", "Sent", "Spam", "Starred", "Trash" ] [Account Outlook] -localrepostiory = Outlook-local +localrepository = Outlook-local remoterepository = Outlook-remote [Repository Outlook-local] -type = maildir +type = Maildir localfolders = ~/Mail/Outlook [Repository Outlook-remote] +ssl = yes +sslcacertfile = /etc/ssl/certs/ca-certificates.crt type = IMAP remoteusereval = get_user("Microsoft") remotehost = outlook.office365.com remoteport = 993 auth_mechanisms = XOAUTH2 oauth2_request_url = https://login.microsoftonline.com/common/oauth2/v2.0/token -oauth2_client_id = 9e5f94bc-e8a4-4e73-b8be-63364c29d753 # thunderbird's token not mine lol -oauth2_client_secret = "" # no need for this lmao +oauth2_client_id = 9e5f94bc-e8a4-4e73-b8be-63364c29d753 +# oauth2_client_secret = "" oauth2_refresh_token_eval = get_client_refresh_token("Microsoft") -oauth2_access_token_eval = get_client_token("Microsoft") \ No newline at end of file +oauth2_access_token_eval = get_client_token("Microsoft") +folderfilter = lambda folder: not folder.startswith('Calendar') and not folder.startswith('Contacts') \ No newline at end of file