ICal-QuickAdd

 view release on metacpan or  search on metacpan

bin/iqa  view on Meta::CPAN


=head2 From a cell phone, Quick-Add an event by email (SMS)

In an email file, like C<.qmail-yourname-cal>:

 iqa --to-email 'you@yourdomain.com' --smtp-host 'mail.yourisp.com'

Now send a text message to this address in the style above. It will receive the
message, convert the message to a date and summary and forward on a new message
to your regular email address with ICS data. A number of systems will allow you
to just click on the resulting message to add it your calendar, where you can
possibly add it later.  You will be sent back a short confirmation message,
showing how the date and time were translated.

There is also a C<--no-reply> if you don't want a confirmation reply.

=head2 From a console, Quick-Add an event to a local calendar

    qae 'Tomorrow at noon. Lunch with Bob'

For this example, You need to create a shell alias that makes
a shortcut with the standard options you would use. For example,
this might go in C<.profile> file:

 # qae = "Quick Add Event"
 # Here the default location of the Evolution groupware calander is used
 alias qae='iqa --to-ics ~/.evolution/calendar/local/system/calendar.ics';

=head2 From a console, Quick-Add an event by email (SMS)

 qar 'Tomorrow at noon. Lunch with Bob'

You are at your work computer but want to quickly add an event to a desktop
calendar accessible only from another computer. Use this tool to generate
an iCal event e-mail to yourself, which you can just click on to accept when
you get home.

 # qar = "Quick Add Remote"
 alias qar='iqa --to-email 'you@yourdomain.com' --smtp-host 'mail.yourisp.com'

=cut



bin/iqa  view on Meta::CPAN

            # SMS seems to want the content in the body. Supress adding a subject
            subject => '',
            body    => $iqa->parsed_string ,
        );
    }
    # We're done with the original incoming mail now.
    $iqa->from_email_obj->noexit(1);
    $iqa->from_email_obj->ignore;
}

=head1 Compatibility with desktop calendar software.

It may not be safe to inject an event into an ICS file that another program is
currently using.  For example, if you inject an event an ICS file that
evolution is managing while it is running. Also, these changes might not show
up right away in the running program, either.

=head2 Evolution

With Evolution, a safer option is to use the C<< --to-email >> option, and open
the message in Evolution. It will recognize it as a special kind of event
message, and offer to add it to your calendar.

You can save an extra step in the work flow by having the email automatically
deleted after you add it your calendar. Look under I<Edit: Preferences: Mail: Calendar and Tasks>
and check the box for "Delete message after acting".

=head1 TODO

 * Find out if it's possible to cause Evolution to reload the ICS file, so the
   event appears.

 * Support end times (example: 1pm - 3pm )

 * Support alarms (examples:  +1d, +15m )

lib/ICal/QuickAdd.pm  view on Meta::CPAN


The PUBLISH method is used when mailing iCalendar events.

=cut

sub as_ical {
    my $self = shift;

    require Data::ICal;

     my $calendar = Data::ICal->new;
     $calendar->add_entry( $self->as_vevent );
     $calendar->add_properties( method => 'PUBLISH');

     return $calendar;
}

=head2 as_ical_email()

 my $email_simple_obj = $iqa->as_ical_email(
        To    => $your_regular_email,
        From  => $from_email, # Defaults to $iqa->from_email
  );

Returns a ready-to-mail L<Email::Simple> object with an iCalendar body.

lib/ICal/QuickAdd.pm  view on Meta::CPAN


sub as_ical_email {
    my $self = shift;
    my %in = validate(@_, {
        To    => { type => SCALAR },
        From  => { type => SCALAR, default => $self->from_email },
    });

     require Email::Simple;
     my $email = Email::Simple->new('');
     $email->header_set("Content-Type", "text/calendar; name=calendar.ics; charset=utf-8; METHOD=PUBLISH");
     $email->header_set(From => $in{From} );
     $email->header_set(To => $in{To} );

     $email->header_set("Subject", $self->parsed_string );
     $email->body_set( $self->as_ical->as_string );

     use Email::Date;
     $email->header_set( Date => format_date );

     return $email;



( run in 0.466 second using v1.01-cache-2.11-cpan-5dc5da66d9d )