From 682bdb1fb89ef670f617423023ab637e2247b847 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:50:35 +0400 Subject: [PATCH] config/emacs: offlineimap config init --- config/emacs/.offlineimap.py | 162 +++++++++++++++++++++++++++++++++++ config/emacs/.offlineimaprc | 19 ++++ 2 files changed, 181 insertions(+) create mode 100644 config/emacs/.offlineimap.py create mode 100644 config/emacs/.offlineimaprc diff --git a/config/emacs/.offlineimap.py b/config/emacs/.offlineimap.py new file mode 100644 index 00000000..79f37aae --- /dev/null +++ b/config/emacs/.offlineimap.py @@ -0,0 +1,162 @@ +#! /usr/bin/env python +from subprocess import check_output +import re + + +def get_pass(account): + return check_output("pass " + account, shell=True).splitlines()[0] + + +def get_user(account): + usercmd = check_output("pass " + account, shell=True) + + return re.search(rb"login: (.*)", usercmd, flags=0).group(1) + + +def hydroxide(path): + + file = open(path, "r") + + pword = file.read() + + return pword + + +class oauth: + def get_client_id(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_id: (.*)", cmd, flags=0).group(1) + + def get_client_secret(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_secret: (.*)", cmd, flags=0).group(1) + + def get_client_token(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_token: (.*)", cmd, flags=0).group(1) + + +#! /usr/bin/env python +from subprocess import check_output +import re + + +def get_pass(account): + return check_output("pass " + account, shell=True).splitlines()[0] + + +def get_user(account): + usercmd = check_output("pass " + account, shell=True) + + return re.search(rb"login: (.*)", usercmd, flags=0).group(1) + + +def hydroxide(path): + + file = open(path, "r") + + pword = file.read() + + return pword + + +class oauth: + def get_client_id(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_id: (.*)", cmd, flags=0).group(1) + + def get_client_secret(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_secret: (.*)", cmd, flags=0).group(1) + + def get_client_token(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_token: (.*)", cmd, flags=0).group(1) + + +#! /usr/bin/env python +from subprocess import check_output +import re + + +def get_pass(account): + return check_output("pass " + account, shell=True).splitlines()[0] + + +def get_user(account): + usercmd = check_output("pass " + account, shell=True) + + return re.search(rb"login: (.*)", usercmd, flags=0).group(1) + + +def hydroxide(path): + + file = open(path, "r") + + pword = file.read() + + return pword + + +class oauth: + def get_client_id(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_id: (.*)", cmd, flags=0).group(1) + + def get_client_secret(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_secret: (.*)", cmd, flags=0).group(1) + + def get_client_token(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_token: (.*)", cmd, flags=0).group(1) + + +#! /usr/bin/env python +from subprocess import check_output +import re + + +def get_pass(account): + return check_output("pass " + account, shell=True).splitlines()[0] + + +def get_user(account): + usercmd = check_output("pass " + account, shell=True) + + return re.search(rb"login: (.*)", usercmd, flags=0).group(1) + + +def hydroxide(path): + + file = open(path, "r") + + pword = file.read() + + return pword + + +class oauth: + def get_client_id(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_id: (.*)", cmd, flags=0).group(1) + + def get_client_secret(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_secret: (.*)", cmd, flags=0).group(1) + + def get_client_token(account): + cmd = check_output("pass " + account, shell=True) + + return re.search(rb"client_token: (.*)", cmd, flags=0).group(1) diff --git a/config/emacs/.offlineimaprc b/config/emacs/.offlineimaprc new file mode 100644 index 00000000..c8657e20 --- /dev/null +++ b/config/emacs/.offlineimaprc @@ -0,0 +1,19 @@ +[general] +pythonfile = ~/.offlineimap.py +accounts = Proton + +[Account Proton] +localrepository = Proton-local +remoterepository = Proton-remote + +[Repository Proton-local] +type = Maildir +localfolders = ~/Mail/Proton + +[Repository Proton-remote] +type = IMAP +ssl = no +remotehost = 127.0.0.1 +remoteport = 1143 +remoteusereval = get_user("Proton\ Account") +remotepasseval = hydroxide("/home/sako/.hydroxide-bridge-pass") \ No newline at end of file