Rename inbox to flag to sync it and bogofilter spam
This commit is contained in:
		
							parent
							
								
									0030cd4860
								
							
						
					
					
						commit
						3915f133fd
					
				
					 6 changed files with 42 additions and 36 deletions
				
			
		|  | @ -1,5 +1,5 @@ | ||||||
| 
 | 
 | ||||||
| initial_command = search tag:inbox | initial_command = search tag:flagged | ||||||
| periodic_hook_frequency = 60 | periodic_hook_frequency = 60 | ||||||
| edit_headers_blacklist = Content-Type, MIME-Version | edit_headers_blacklist = Content-Type, MIME-Version | ||||||
| attachment_prefix = /data/temporary | attachment_prefix = /data/temporary | ||||||
|  | @ -21,7 +21,7 @@ theme = "mutt" | ||||||
|         sendmail_command = /usr/bin/msmtp --account=posteo -t |         sendmail_command = /usr/bin/msmtp --account=posteo -t | ||||||
|         sent_box = maildir:///data/mail/posteo/Sent |         sent_box = maildir:///data/mail/posteo/Sent | ||||||
|         draft_box = maildir:///data/mail/posteo/Drafts |         draft_box = maildir:///data/mail/posteo/Drafts | ||||||
|         sent_tags = posteo,inbox |         sent_tags = posteo,flagged | ||||||
|         passed_tags = # none |         passed_tags = # none | ||||||
|         sign_by_default = False |         sign_by_default = False | ||||||
| 
 | 
 | ||||||
|  | @ -38,7 +38,7 @@ theme = "mutt" | ||||||
|         sendmail_command = /usr/bin/msmtp --account=gmail -t |         sendmail_command = /usr/bin/msmtp --account=gmail -t | ||||||
|         sent_box = maildir:///data/mail/gmail/Sent |         sent_box = maildir:///data/mail/gmail/Sent | ||||||
|         draft_box = maildir:///data/mail/gmail/Sent |         draft_box = maildir:///data/mail/gmail/Sent | ||||||
|         sent_tags = gmail,inbox |         sent_tags = gmail,flagged | ||||||
|         passed_tags = # none |         passed_tags = # none | ||||||
|         sign_by_default = True |         sign_by_default = True | ||||||
| 
 | 
 | ||||||
|  | @ -56,7 +56,7 @@ theme = "mutt" | ||||||
|         sendmail_command = /usr/bin/msmtp --account=ugent -t |         sendmail_command = /usr/bin/msmtp --account=ugent -t | ||||||
|         sent_box = maildir:///data/mail/ugent/Sent |         sent_box = maildir:///data/mail/ugent/Sent | ||||||
|         draft_box = maildir:///data/mail/ugent/Sent |         draft_box = maildir:///data/mail/ugent/Sent | ||||||
|         sent_tags = ugent,inbox |         sent_tags = ugent,flagged | ||||||
|         passed_tags = # none |         passed_tags = # none | ||||||
|         sign_by_default = True |         sign_by_default = True | ||||||
| 
 | 
 | ||||||
|  | @ -72,7 +72,7 @@ theme = "mutt" | ||||||
|         sendmail_command = true |         sendmail_command = true | ||||||
|         sent_box = maildir:///data/mail/todo |         sent_box = maildir:///data/mail/todo | ||||||
|         draft_box = maildir:///data/mail/todo |         draft_box = maildir:///data/mail/todo | ||||||
|         sent_tags = todo,inbox |         sent_tags = todo,flagged | ||||||
|         passed_tags = # none |         passed_tags = # none | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -82,9 +82,8 @@ theme = "mutt" | ||||||
|     n = compose --sender todo@localhost --to todo |     n = compose --sender todo@localhost --to todo | ||||||
| 
 | 
 | ||||||
|     [[search]] |     [[search]] | ||||||
|         x = toggletags spam,inbox |         a = toggletags flagged | ||||||
|         a = toggletags inbox |         A = toggletags flagged,muted | ||||||
|         A = toggletags inbox,muted |  | ||||||
|         1 = call hooks.delay(ui,1) |         1 = call hooks.delay(ui,1) | ||||||
|         2 = call hooks.delay(ui,2) |         2 = call hooks.delay(ui,2) | ||||||
|         3 = call hooks.delay(ui,3) |         3 = call hooks.delay(ui,3) | ||||||
|  | @ -96,10 +95,11 @@ theme = "mutt" | ||||||
|         9 = call hooks.delay(ui,9) |         9 = call hooks.delay(ui,9) | ||||||
|         0 = call hooks.delay(ui,0) |         0 = call hooks.delay(ui,0) | ||||||
|         i = call hooks.spam(ui) |         i = call hooks.spam(ui) | ||||||
|  |         x = call hooks.togglespam(ui) | ||||||
| 
 | 
 | ||||||
|     [[thread]] |     [[thread]] | ||||||
|         a = toggletags inbox ; fold |         a = toggletags flagged ; fold | ||||||
|         A = toggletags inbox,muted ; fold |         A = toggletags flagged,muted ; fold | ||||||
|         n = togglemimepart |         n = togglemimepart | ||||||
|         r = reply --all |         r = reply --all | ||||||
|         u = pipeto --background selecturl |         u = pipeto --background selecturl | ||||||
|  | @ -117,7 +117,7 @@ theme = "mutt" | ||||||
| 
 | 
 | ||||||
| [tags] | [tags] | ||||||
| 
 | 
 | ||||||
|     [[inbox]] |     [[flagged]] | ||||||
|         translated =  |         translated =  | ||||||
| 
 | 
 | ||||||
|     [[encrypted]] |     [[encrypted]] | ||||||
|  |  | ||||||
|  | @ -15,20 +15,20 @@ async def delay(ui, days): | ||||||
| 
 | 
 | ||||||
| 	if days != 0: | 	if days != 0: | ||||||
| 		for message in messages: | 		for message in messages: | ||||||
| 			if 'inbox' in message.get_tags(): | 			if 'flagged' in message.get_tags(): | ||||||
| 				message.add_tags(['delay', datetag]) | 				message.add_tags(['delay', datetag]) | ||||||
| 		await ui.apply_commandline('untag inbox,unread') | 		await ui.apply_commandline('untag flagged,unread') | ||||||
| 	else: | 	else: | ||||||
| 		for message in messages: | 		for message in messages: | ||||||
| 			if 'delay' in message.get_tags(): | 			if 'delay' in message.get_tags(): | ||||||
| 				message.remove_tags([t for t in message.get_tags() if t.startswith('delay')]) | 				message.remove_tags([t for t in message.get_tags() if t.startswith('delay')]) | ||||||
| 				message.add_tags(['inbox']) | 				message.add_tags(['flagged']) | ||||||
| 		await ui.apply_commandline('untag delay,delay/*') | 		await ui.apply_commandline('untag delay,delay/*') | ||||||
| 
 | 
 | ||||||
| async def spam(ui): | async def spam(ui): | ||||||
| 	message = ui.current_buffer.get_selected_message() | 	message = ui.current_buffer.get_selected_message() | ||||||
| 	message.add_tags(['spam']) | 	message.add_tags(['spam']) | ||||||
| 	message.remove_tags(['unread', 'inbox']) | 	message.remove_tags(['unread', 'flagged']) | ||||||
| 	if 'ugent' in message.get_tags(): | 	if 'ugent' in message.get_tags(): | ||||||
| 		envelope = Envelope( | 		envelope = Envelope( | ||||||
| 			headers=dict( | 			headers=dict( | ||||||
|  |  | ||||||
|  | @ -1,15 +1,13 @@ | ||||||
| #!/bin/sh | #!/bin/sh | ||||||
|  | set -e | ||||||
| 
 | 
 | ||||||
| mid="id:$1" | for mid in $(notmuch search --output=messages tag:inbox "$@"); do | ||||||
| file="$(notmuch show "$mid" | sed -n '1s/.*filename:\([^ ]*\).*/\1/p')" | 	printf "%s ? " "$(notmuch show "$mid" | sed -n 's/Subject: //p')" | ||||||
| temp="$(mktemp)" | 	read ans | ||||||
| 
 | 	case "$ans" in | ||||||
| cat > "$temp" <<HERE | 	y*) | ||||||
| References: <$1> | 		notmuch show --format=raw "$mid" | bogofilter -Sn | ||||||
| HERE | 		notmuch tag -inbox -unread +spam -- "$mid" | ||||||
| 
 | 		;; | ||||||
| alot compose --sender felix.vanderjeugt@ugent.be \ | 	esac | ||||||
|              --template="$temp" \ | done | ||||||
|              --subject spam \ |  | ||||||
|              --to spam@ugent.be \ |  | ||||||
|              --attach "$file" |  | ||||||
|  |  | ||||||
|  | @ -88,4 +88,4 @@ exclude_tags=spam; | ||||||
| synchronize_flags=true | synchronize_flags=true | ||||||
| 
 | 
 | ||||||
| [query] | [query] | ||||||
| inbox=tag:inbox | inbox=tag:flagged | ||||||
|  |  | ||||||
|  | @ -10,10 +10,6 @@ for maildir in /data/mail/*; do | ||||||
| 	addtag "$origin" "folder:/$origin/" | 	addtag "$origin" "folder:/$origin/" | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
| # Spam |  | ||||||
| spam "subject:/^\[SPAM\]/" |  | ||||||
| # TODO: Known spammers |  | ||||||
| 
 |  | ||||||
| # Some aliases | # Some aliases | ||||||
| addtag zeus "to:felixvdj@zeus.ugent.be" | addtag zeus "to:felixvdj@zeus.ugent.be" | ||||||
| addtag dodona "to:dodona@ugent.be" | addtag dodona "to:dodona@ugent.be" | ||||||
|  | @ -60,7 +56,7 @@ done | ||||||
| 
 | 
 | ||||||
| # Undelay threads with new messages | # Undelay threads with new messages | ||||||
| for delaytag in $(notmuch search --output=tags -- tag:delay and thread:{tag:new} | grep 'delay/'); do | for delaytag in $(notmuch search --output=tags -- tag:delay and thread:{tag:new} | grep 'delay/'); do | ||||||
| 	notmuch tag -delay -"$delaytag" +inbox -- tag:"$delaytag" and thread:{tag:new} | 	notmuch tag -delay -"$delaytag" +flagged -- tag:"$delaytag" and thread:{tag:new} | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
| # Github notifications | # Github notifications | ||||||
|  | @ -78,7 +74,9 @@ archive tag:dodona subject:'status was changed to internal error' 'course_id: 33 | ||||||
| archive tag:dodona subject:'status was changed to internal error' 'course_id: 339' # Data Mining 2020-2021 | archive tag:dodona subject:'status was changed to internal error' 'course_id: 339' # Data Mining 2020-2021 | ||||||
| archive tag:dodona subject:'status was changed to internal error' 'course_id: 346' # Programming Basics 2020-2021 | archive tag:dodona subject:'status was changed to internal error' 'course_id: 346' # Programming Basics 2020-2021 | ||||||
| archive tag:dodona subject:'status was changed to internal error' 'course_id: 349' # Programmingin Python 2020-2021 | archive tag:dodona subject:'status was changed to internal error' 'course_id: 349' # Programmingin Python 2020-2021 | ||||||
|  | archive tag:dodona subject:'status was changed to internal error' 'course_id: 374' # Statistiek 2020-2021 | ||||||
| archive tag:dodona subject:'status was changed to internal error' 'course_id: 375' # Statistiek: introductie tot R 2020-2021 | archive tag:dodona subject:'status was changed to internal error' 'course_id: 375' # Statistiek: introductie tot R 2020-2021 | ||||||
|  | archive tag:dodona subject:'status was changed to internal error' 'course_id: 376' # Statistiek: Data Exploratie .. 2020-2021 | ||||||
| archive tag:dodona subject:'status was changed to internal error' 'course_id: 380' # C# 2020-2021 | archive tag:dodona subject:'status was changed to internal error' 'course_id: 380' # C# 2020-2021 | ||||||
| archive tag:dodona subject:'status was changed to internal error' 'course_id: 384' # E620500A 2020-2021 | archive tag:dodona subject:'status was changed to internal error' 'course_id: 384' # E620500A 2020-2021 | ||||||
| archive tag:dodona subject:'status was changed to internal error' 'user_id: 3' # Peter | archive tag:dodona subject:'status was changed to internal error' 'user_id: 3' # Peter | ||||||
|  | @ -94,8 +92,17 @@ archive tag:ugent subject:'Belnet FileSender: Ontvangstbevestiging' | ||||||
| archive thread:{tag:muted} | archive thread:{tag:muted} | ||||||
| notmuch tag -muted -- tag:muted and date:'..30_days' | notmuch tag -muted -- tag:muted and date:'..30_days' | ||||||
| 
 | 
 | ||||||
|  | # Bogofilter | ||||||
|  | for mid in $(notmuch search --output=messages tag:new); do | ||||||
|  | 	case "$(notmuch show --format=raw "$mid" | bogofilter -eut)" in | ||||||
|  | 	H*) true ;; | ||||||
|  | 	S*) spam "$mid" ; echo "$mid" >> ~/spamtest;; | ||||||
|  | 	U*) true ;; | ||||||
|  | 	esac | ||||||
|  | done | ||||||
|  | 
 | ||||||
| # Inbox remaining not-spam | # Inbox remaining not-spam | ||||||
| addtag inbox "not tag:spam" | addtag flagged "not tag:spam" | ||||||
| notmuch tag -new -- tag:new | notmuch tag -new -- tag:new | ||||||
| 
 | 
 | ||||||
| # Show threads after their delay | # Show threads after their delay | ||||||
|  | @ -103,6 +110,6 @@ today="$(date +'%s')" | ||||||
| for delaytag in $(notmuch search --output=tags tag:delay | grep 'delay/'); do | for delaytag in $(notmuch search --output=tags tag:delay | grep 'delay/'); do | ||||||
| 	until="$(date -d "${delaytag#*/}" +'%s')" | 	until="$(date -d "${delaytag#*/}" +'%s')" | ||||||
| 	if [ "$today" -gt "$until"  ]; then | 	if [ "$today" -gt "$until"  ]; then | ||||||
| 		notmuch tag -delay -"$delaytag" +inbox -- tag:"$delaytag" | 		notmuch tag -delay -"$delaytag" +flagged -- tag:"$delaytag" | ||||||
| 	fi | 	fi | ||||||
| done | done | ||||||
							
								
								
									
										1
									
								
								profile
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								profile
									
										
									
									
									
								
							|  | @ -24,6 +24,7 @@ export LESSHISTFILE=- | ||||||
| export FZF_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null' | export FZF_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null' | ||||||
| export SKIM_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null' | export SKIM_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null' | ||||||
| export LC_ALL=en_US.utf8 | export LC_ALL=en_US.utf8 | ||||||
|  | export BOGOFILTER_DIR="$XDG_DATA_HOME/bogofilter" | ||||||
| 
 | 
 | ||||||
| # Select Dock sound card if it's there | # Select Dock sound card if it's there | ||||||
| #(it's broken) | #(it's broken) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Felix Van der Jeugt
						Felix Van der Jeugt