aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/hooks/wamail16
-rw-r--r--contrib/neomutt/wa-default.muttrc36
2 files changed, 52 insertions, 0 deletions
diff --git a/contrib/hooks/wamail b/contrib/hooks/wamail
new file mode 100755
index 0000000..192589b
--- /dev/null
+++ b/contrib/hooks/wamail
@@ -0,0 +1,16 @@
+#!/bin/sh
+# wa-cli -> wamail hook: real-time delivery to the neomutt Maildir.
+# Install: ln -s /path/to/wa-cli/contrib/hooks/wamail ~/.config/wa-cli/hooks/all.d/50-wamail
+# The daemon runs hooks one at a time, in order; wamail has its own lock against the timer.
+case "$1" in
+ message_create|unread_count|chat_archived) ;;
+ message_revoke_everyone)
+ stanza=$(jq -r '.data.message.stanzaId // empty')
+ [ -n "$stanza" ] && exec "$HOME/.local/bin/wamail" revoked "$WA_CLI_ACCOUNT" "$stanza"
+ exit 0 ;;
+ *) exit 0 ;;
+esac
+chat=$(jq -r '.data.chatId // .data.message.chatId // .data.chat.id // .data.id // empty')
+case "$chat" in
+ *@c.us|*@g.us|*@lid) exec "$HOME/.local/bin/wamail" sync "$WA_CLI_ACCOUNT" --chat "$chat" --quiet ;;
+esac
diff --git a/contrib/neomutt/wa-default.muttrc b/contrib/neomutt/wa-default.muttrc
new file mode 100644
index 0000000..39f2062
--- /dev/null
+++ b/contrib/neomutt/wa-default.muttrc
@@ -0,0 +1,36 @@
+# vim: filetype=muttrc
+# WhatsApp account through wamail (wa-cli): one Maildir folder per chat in ~/Mail/whatsapp.
+# Real-time delivery through the daemon hook (wa-daemon@default) + the wamail-sync systemd timer.
+#
+# Read = mark read on WhatsApp · flag = star · delete = local only
+# Reply: keep the quote (> ...) for a quoted reply; delete it for a normal message.
+
+source ~/.config/neomutt/switch.muttrc
+
+set realname = "WhatsApp"
+set from = "5491125555635@c.us"
+set use_from = yes
+
+set mbox_type = Maildir
+set folder = ~/Mail/whatsapp
+set postponed = +Drafts # borradores locales
+unset trash # delete = remove the local copy (does not delete on WhatsApp)
+set copy = no # sent messages come back through the chat
+set sendmail = "~/.local/bin/wamail send default"
+set header_cache = ~/.cache/neomutt/whatsapp
+set mail_check = 5
+set query_command = "~/.local/bin/wamail query default '%s'"
+
+# One mailbox per chat (WhatsApp order), spoolfile = most recent chat, alternates:
+# generated by `wamail sync`.
+source ~/.cache/wamail/default/mailboxes.muttrc
+
+# Ask whether to quote when replying (default no) and no Cc. The "." send-hook restores
+# the settings values for the mail accounts.
+send-hook . 'set include askcc'
+send-hook '~t "@(c.us|g.us|lid)$"' 'set include=ask-no; unset askcc'
+
+macro index gG "<shell-escape>~/.local/bin/wamail sync default<enter><enter-command>source ~/.config/neomutt/accounts/wa/default.muttrc<enter>" "WhatsApp: sincronizar ahora"
+macro index,pager gA "<enter-command>unset pipe_decode<enter><pipe-message>~/.local/bin/wamail archive default<enter><enter-command>set pipe_decode<enter><enter-command>source ~/.config/neomutt/accounts/wa/default.muttrc<enter>" "WhatsApp: archive/unarchive the chat"
+macro index,pager gR "<enter-command>unset pipe_decode<enter><pipe-message>~/.local/bin/wamail react default<enter><enter-command>set pipe_decode<enter>" "WhatsApp: react to the message"
+macro index,pager gX "<enter-command>unset pipe_decode<enter><pipe-message>~/.local/bin/wamail delete default<enter><enter-command>set pipe_decode<enter><sync-mailbox>" "WhatsApp: delete message (everyone / me)"