From: Samir Benmendil Date: Fri, 18 May 2018 17:03:27 +0000 (+0100) Subject: mutt: office365 contacts completion X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/590d3718adc3886c5f5e72a684b3e7b121da994f?ds=inline mutt: office365 contacts completion --- diff --git a/bin/office365-book b/bin/office365-book new file mode 100755 index 0000000..3054a5c --- /dev/null +++ b/bin/office365-book @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +user=samir.benmendil@ultrahaptics.com +pass=$(pass ultrahaptics/okta.com/samir.benmendil@ultrahaptics.com) +url="https://outlook.office365.com/EWS/Exchange.asmx" + +read -r -d '' data < + + + + $1 + + + +EOF + +out=$(curl -s -u "$user:$pass" -L "$url" -d "$data") + +readarray -t email < <(echo $out | xpath -q -e '//t:Mailbox/t:EmailAddress/text()') +readarray -t name < <(echo $out | xpath -q -e '//t:Contact/t:DisplayName/text()') + +count=${#email[@]} + +if [[ "$count" -eq 0 ]]; then + echo "No matches" + exit 1 +fi + +echo "$count matches" +for (( i = 0; i < $count; i++ )); do + echo -e "${email[$i]}\t${name[$i]}\t" +done diff --git a/mutt/accounts/gmail b/mutt/accounts/gmail index 69458e0..f5cdc6a 100644 --- a/mutt/accounts/gmail +++ b/mutt/accounts/gmail @@ -9,6 +9,9 @@ set postponed = "+gmail/drafts" # drafts folder unset record # do not move sent msgs to a folder, gmail does that unset move # do not move read msgs, gmail does that +# goobook +set query_command = "goobook query '%s'" + mailboxes "+gmail/inbox" mailboxes "+gmail/sent" mailboxes "+gmail/youtube" diff --git a/mutt/accounts/office365 b/mutt/accounts/office365 index 553b7e5..23ad796 100644 --- a/mutt/accounts/office365 +++ b/mutt/accounts/office365 @@ -9,6 +9,9 @@ set postponed = "+office365/drafts" # drafts folder unset record # do not move sent msgs to a folder, gmail does that unset move # do not move read msgs, gmail does that +# office365 +set query_command = "office365-book" + mailboxes "+office365/inbox" mailboxes "+office365/sent" mailboxes "+office365/archive" diff --git a/mutt/muttrc b/mutt/muttrc index 62b273c..18cdb1d 100644 --- a/mutt/muttrc +++ b/mutt/muttrc @@ -24,9 +24,6 @@ set date_format = "!%b %d, %Y at %-H:%M" # use 24-hour clock # send clacks my_hdr X-Clacks-Overhead: GNU Terry Pratchett -# goobook -set query_command = "goobook query '%s'" - # sort/threading set sort = threads set sort_aux = last-date-received