config/emacs: nvm lmao

This commit is contained in:
Sakooooo 2024-09-25 12:03:26 +04:00
parent feb403f6b8
commit a0b28b8101
Signed by: sako
GPG key ID: 3FD715D87D7725E0

View file

@ -1162,102 +1162,6 @@ GNU patch review metho dor sometihng idk
;; sending mail ;; sending mail
(setq message-send-mail-function 'smtpmail-send-it) (setq message-send-mail-function 'smtpmail-send-it)
;; refresh token for stmpmail
(cl-defmethod smtpmail-try-auth-method
(process (_mech (eql xoauth2)) user password)
(cond
((or (equal user ,outlook-mail-address ))
;; from https://github.com/UvA-FNWI/M365-IMAP/issues/3
(let ((token (gethash "access_token"
(let ((url-request-method "POST")
(url-request-extra-headers `(("Content-Type" . "application/x-www-form-urlencoded")))
(url-request-data (concat "client_id=" "9e5f94bc-e8a4-4e73-b8be-63364c29d753")
"&client_secret="
"&refresh_token=" (password-store-get-field "Microsoft" "client_refresh_token")
"&grant_type=refresh_token")))
(with-temp-buffer (url-insert-file-contents
"https://login.microsoftonline.com/common/oauth2/v2.0/token")
(json-parse-buffer :object-type 'hash-table)))
)))
(smtpmail-command-or-throw
process
(concat "AUTH XOAUTH2 "
(base64-encode-string
(concat "user=" user "\1auth=Bearer " token "\1\1") t)))))
((equal user ,gmail-1-mail-address)
(let ((token (gethash "access_token"
(let ((url-request-method "POST")
(url-request-extra-headers `(("Content-Type" . "application/x-www-form-urlencoded")))
(url-request-data (concat "client_id=" (password-store-get-field "email/oauth/gmail" "client_id")
"&client_secret=" (password-store-get-field "email/oauth/gmail" "client_secret")
"&refresh_token=" (password-store-get-field "accounts.google.com/one" "client_refresh_token")
"&grant_type=refresh_token")))
(with-temp-buffer (url-insert-file-contents
"https://oauth2.googleapis.com/token")
(json-parse-buffer :object-type 'hash-table)))
)))
(smtpmail-command-or-throw
process
(concat "AUTH XOAUTH2 "
(base64-encode-string
(concat "user=" user "\1auth=Bearer " token "\1\1") t)))))
((equal user ,gmail-2-mail-address)
(let ((token (gethash "access_token"
(let ((url-request-method "POST")
(url-request-extra-headers `(("Content-Type" . "application/x-www-form-urlencoded")))
(url-request-data (concat "client_id=" (password-store-get-field "email/oauth/gmail" "client_id")
"&client_secret=" (password-store-get-field "email/oauth/gmail" "client_secret")
"&refresh_token=" (password-store-get-field "accounts.google.com/two" "client_refresh_token")
"&grant_type=refresh_token")))
(with-temp-buffer (url-insert-file-contents
"https://oauth2.googleapis.com/token")
(json-parse-buffer :object-type 'hash-table)))
)))
(smtpmail-command-or-throw
process
(concat "AUTH XOAUTH2 "
(base64-encode-string
(concat "user=" user "\1auth=Bearer " token "\1\1") t)))))
((equal user ,gmail-1-mail-address)
(let ((token (gethash "access_token"
(let ((url-request-method "POST")
(url-request-extra-headers `(("Content-Type" . "application/x-www-form-urlencoded")))
(url-request-data (concat "client_id=" (password-store-get-field "email/oauth/gmail" "client_id")
"&client_secret=" (password-store-get-field "email/oauth/gmail" "client_secret")
"&refresh_token=" (password-store-get-field "accounts.google.com/two" "client_refresh_token")
"&grant_type=refresh_token")))
(with-temp-buffer (url-insert-file-contents
"https://oauth2.googleapis.com/token")
(json-parse-buffer :object-type 'hash-table)))
)))
(smtpmail-command-or-throw
process
(concat "AUTH XOAUTH2 "
(base64-encode-string
(concat "user=" user "\1auth=Bearer " token "\1\1") t)))))
((equal user ,gmail-2-mail-address)
(let ((token (gethash "access_token"
(let ((url-request-method "POST")
(url-request-extra-headers `(("Content-Type" . "application/x-www-form-urlencoded")))
(url-request-data (concat "client_id=" (password-store-get-field "email/oauth/gmail" "client_id")
"&client_secret=" (password-store-get-field "email/oauth/gmail" "client_secret")
"&refresh_token=" (password-store-get-field "accounts.google.com/one" "client_refresh_token")
"&grant_type=refresh_token")))
(with-temp-buffer (url-insert-file-contents
"https://oauth2.googleapis.com/token")
(json-parse-buffer :object-type 'hash-table)))
)))
(smtpmail-command-or-throw
process
(concat "AUTH XOAUTH2 "
(base64-encode-string
(concat "user=" user "\1auth=Bearer " token "\1\1") t)))))
(t nil))
(setq mu4e-update-interval (* 10 60)) (setq mu4e-update-interval (* 10 60))
(setq mu4e-get-mail-command "offlineimap") (setq mu4e-get-mail-command "offlineimap")
(setq mu4e-maildir "~/Mail") (setq mu4e-maildir "~/Mail")