Re: ics files with nhm / mh-e

2020-01-02 Thread Axel Jantsch
Hello All,

> On Tue, 31 Dec 2019 07:47:39 -0800, Henrique Martins 
>  said:

> If it is not too big, maybe post it in a reply,

Attached is the script replyics.sh that allows to reply to an ics event
invitation.
It acts differently depending on its name because in mh-e "K e" I cannot
easily hand over an argument. Hence, I have soft links for

icalaccept
icaldecline
icalshow
icaltentaive
icalcancel

If invoked on the event invitation it will use generate an ics file with
the respective response and use mhmail to send it to the event
organizer.
E.g.

icalaccept event.ics

From MH-E it can be invoked with "K e icalaccept" on the appropriate
mime part.


If there are suggestions for improving it, let me know.

Cheers,
Axel



> On Tue, 31 Dec 2019 07:47:39 -0800, Henrique Martins 
>  said:

> David Levine  wrote:

axel> So this works reasonably well. I am happy to share it
axel> with anyone who is interested.

david> I'd be interested.

> If it is not too big, maybe post it in a reply,

> -- Henrique


-- 
Axel Jantsch, Prof. of Systems on Chip
TU Wien
Gusshausstrasse 27-29/384, 1040 Vienna, Austria
Phone: +43 1 58801 38415
Email: axel.jant...@tuwien.ac.at
Web: www.ict.tuwien.ac.at

#!/bin/sh

#
# replyics.sh expects an ics file as firts and only argument.
# It does different things depending on its name:
# icalshow:  Show the ics file with mhical
# icalaccept:generate a response icf file for accepting the invitation and send an email reposonse to the orgnaizer.
# icaldecline:   generate a response icf file for declining the invitation and send an email reposonse to the orgnaizer.
# icaltentative: generate a response icf file for tentatively accepting the invitation and send an email reposonse to the orgnaizer.
# icalcancel:generate a response icf file for canceling the invitation and send an email reposonse to the orgnaizer.


cmnd=`basename $0`

partf=calmsg.ics
responsef=response.ics
responseaddr=""

# Function for extracting the organizer's email address from the ics file:
getaddr () {
local icalf=$1;
addr=`awk 'BEGIN {IGNORECASE=1; }
   /^organizer/ { split($0, orgrec, "mailto:"); print orgrec[2]; }' $icalf`
return
}

USAGE="$0 ICSFILE\n
   
   $0 expects exactly one argument which have to be an ics file."

#
#

if [ $# -ne 1 ]
then echo $USAGE;
 exit 2;
fi

prevdir=`pwd`
tmpd=$HOME/tmp/replyicstmpdir
mkdir -p $tmpd

cp $1 $tmpd/$partf

cd $tmpd


ftype=`file -b $partf |cut -f 1 -d " "`
if [ $ftype \!= "vCalendar" ]
then
echo $USAGE; exit 2;
fi


pMail=0;
case $cmnd in
icalshow) mhical -infile $partf |xmessage -file - ;;
icalaccept) mhical -infile $partf -reply accept -outfile $responsef ;
	   pMail=1;
	   subject="Accepted"
	   ;;
icaldecline) mhical -infile $partf -reply decline -outfile $responsef ;
	   pMail=1;
	   subject="Declined"
	   ;;
icaltentative) mhical -infile $partf -reply tentative -outfile $responsef ;
	   pMail=1;
	   subject="Tentative Accept"
	   ;;
icalcancel) mhical -infile $partf -cancel -outfile $responsef ;
	   pMail=1;
	   subject="Canceled"
	   ;;
*) echo "Unknown command: $cmnd"; exit 2;;
esac

# Sending email:
if [ $pMail -eq 1 ]
then
getaddr $partf; responseaddr=$addr;
if [ "_$responseaddr" = "_" ]
then echo "Organizer address not found in ics part."; exit 2;
elif [ `expr $responseaddr : ".*@.*\..*"` -eq 0 ]
then echo "Organizer address not found in ics part."; exit 2;
fi;

mhmail -to $responseaddr -attach $responsef -body " " -subject "$subject"
# cp $responsef ../ifile.ics
fi


# Cleaning up:
rm  -f $tmpd/*
rmdir $tmpd

exit






Re: ics files with nhm / mh-e

2019-12-31 Thread Henrique Martins
David Levine  wrote:

axel> So this works reasonably well. I am happy to share it
axel> with anyone who is interested.

david> I'd be interested.

If it is not too big, maybe post it in a reply,

-- Henrique



Re: ics files with nhm / mh-e

2019-12-30 Thread David Levine
Axel writes:

> I was not aware of mhical and used it to build a script that allows to
> accept/decline/... to an invite; and I call it with 'K e' from mh-e.
> So this works reasonably well. I am happy to share it with anyone who is 
> interested.

I'd be interested.

> I still have no smooth way to add events to my Google calendar;

Seems that a carefully formatted message should work, if you or
anyone is interested in figuring that out.

> I could not get the replaliases functions to work, but did not try very hard.

If you let me know what went wrong, I'd be glad to update the functions.

David



Re: ics files with nhm / mh-e

2019-12-30 Thread Axel Jantsch
Many thanks to all who replied!!

I was not aware of mhical and used it to build a script that allows to
accept/decline/... to an invite; and I call it with 'K e' from mh-e.
So this works reasonably well. I am happy to share it with anyone who is 
interested.

I still have no smooth way to add events to my Google calendar;
forwarding to my gmail mail box works, but is a bit lengthy.

I could not get the replaliases functions to work, but did not try very hard. 

Thanks again.
Cheers,
Axel



> On Sun, 29 Dec 2019 10:53:25 +0100, Axel Jantsch 
>  said:

> Hi,

> What are the best ways to deal with ics calendar files with nhm and/or 
mh-e ?

> I use nmh with mh-e as front end, and get regularly ics files. When
> getting such a file I would like to do the following:

> 1 a) Add the event to my google calendar;
>   b) Make an update to an existing event in my google calendar  

> 2 a) Add it to the emacs diary file;
>   b) Make an update to an existing entry in emacs diary;
  
> 3) Acknowledge / accept / reject the event;


> For (1a) I use gcalcli but I feel it is a bit unreliable; it worked
> well, then it did not work for several months due to an update; then it
> worked again on some of my platforms but not others. So I wonder if
> there is a better alternative.

> For (1b) and (3) I have no working solution.

> What methods do others use?

> Cheers,
> Axel

> -- 
> Axel Jantsch
> TU Wien
> Email: axel.jant...@tuwien.ac.at
> Web: www.ict.tuwien.ac.at


-- 
Axel Jantsch, Prof. of Systems on Chip
TU Wien
Gusshausstrasse 27-29/384, 1040 Vienna, Austria
Phone: +43 1 58801 38415
Email: axel.jant...@tuwien.ac.at
Web: www.ict.tuwien.ac.at



Re: ics files with nhm / mh-e

2019-12-29 Thread Bill Wohler
Axel,

Once you find something that works on the command line, I can think of a
couple of ways to access your method with MH-E:

1. Use the `|' (mh-pipe-msg) command to pipe the entire message through
   an appropriate command.

   https://mh-e.sourceforge.io/manual/mh-e.html#Files-and-Pipes

2. Use `K e' (mh-display-with-external-viewer) to 'view' the ICS
   attachment with an appropriate command.

   https://mh-e.sourceforge.io/manual/mh-e.html#Viewing-Attachments

Axel Jantsch  wrote:

> Hi,
> 
> What are the best ways to deal with ics calendar files with nhm and/or mh-e ?
> 
> I use nmh with mh-e as front end, and get regularly ics files. When
> getting such a file I would like to do the following:
> 
> 1 a) Add the event to my google calendar;
>   b) Make an update to an existing event in my google calendar  
> 
> 2 a) Add it to the emacs diary file;
>   b) Make an update to an existing entry in emacs diary;
>   
> 3) Acknowledge / accept / reject the event;
> 
> 
> For (1a) I use gcalcli but I feel it is a bit unreliable; it worked
> well, then it did not work for several months due to an update; then it
> worked again on some of my platforms but not others. So I wonder if
> there is a better alternative.
> 
> For (1b) and (3) I have no working solution.
> 
> What methods do others use?
> 
> Cheers,
> Axel
> 
> -- 
> Axel Jantsch
> TU Wien
> Email: axel.jant...@tuwien.ac.at
> Web: www.ict.tuwien.ac.at
> 
> 
> ___
> mh-e-users mailing list
> mh-e-us...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mh-e-users
> 

-- 
Bill Wohler  aka 
http://www.newt.com/wohler/, GnuPG ID:610BD9AD



Re: ics files with nhm / mh-e

2019-12-29 Thread Michael Richardson

Axel Jantsch  wrote:
> What are the best ways to deal with ics calendar files with nhm and/or
> mh-e ?

> I use nmh with mh-e as front end, and get regularly ics files. When
> getting such a file I would like to do the following:

> 1 a) Add the event to my google calendar;
> b) Make an update to an existing event in my google calendar

I bounce the email to my gmail account :-(
If there were a reliable IMAP server that could serve my desktop +inbox,
then I'd point gmail and/or Thunderbird (with Google Calendar plugin) at it.
{my desktop has public IPv6}

> 2 a) Add it to the emacs diary file;
> b) Make an update to an existing entry in emacs diary;

I tried to use it once, but I didn't get far.

> 3) Acknowledge / accept / reject the event;

You can do that from google calendar, once it is in place.

> For (1a) I use gcalcli but I feel it is a bit unreliable; it worked
> well, then it did not work for several months due to an update; then it
> worked again on some of my platforms but not others. So I wonder if
> there is a better alternative.

I never got gcalcli working.  Maybe I tried when it didn't work.
That seems like the best solution to me.

--
]   Never tell me the odds! | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works|IoT architect   [
] m...@sandelman.ca  http://www.sandelman.ca/|   ruby on rails[



signature.asc
Description: PGP signature


Re: ics files with nhm / mh-e

2019-12-29 Thread Ken Hornstein
Someone else will have to speak toward the MH-E side of things, but
speaking in terms of pure nmh ...

>I use nmh with mh-e as front end, and get regularly ics files. When
>getting such a file I would like to do the following:
>
>1 a) Add the event to my google calendar;
>  b) Make an update to an existing event in my google calendar  

We don't have any native tools for interfacing with an server speaking
the CalDev network protocol, which is sounds like is what you want for
this piece.  I see there is a project called "calendar-cli" which might
do that.

The one piece I wish we did here was have mhical convert a "request"
into a pure calendar entry, for the case where I use nmh to reply to
the calendar request but want to add it to my calendar (basically, strip
out the method line).  I keep meaning to bring that up to David (who
wrote mhical) or do that myself, but now is a good as of a time as any
to mention it, I suspect.

>2 a) Add it to the emacs diary file;
>  b) Make an update to an existing entry in emacs diary;

It seems like you could use mhical to extract out the bits from the
calendar entry so it was what emacs needed.

>3) Acknowledge / accept / reject the event;

You can do this natively in nmh.  You can look at "replaliases" in
the nmh contrib directory for "replaliases" that has the shell aliases
"calaccept", "caldecline", "caltentative", "cancancel" (I do not believe
iCalendar supports an "acknowledge" response).  The shell aliases
end up running something like this:

% repl -noformat -editor mhbuild \
-convertargs text/calendar '-reply accept -contenttype' 

--Ken



Re: ics files with nhm / mh-e

2019-12-29 Thread Ralph Corderoy
Hi Axel,

> What are the best ways to deal with ics calendar files with nhm and/or
> mh-e ?

I've not used it so I don't know how well it covers your requirements.

$ man -k icalendar
mhical (1)   - nmh's manipulator of iCalendar event requests

Its author is on the nmh-workers@nongnu.org list.

-- 
Cheers, Ralph.