bug#39782: 28.0.50; gnus-icalendar does not understand multiple repeating days

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#39782: 28.0.50; gnus-icalendar does not understand multiple repeating days

Mark A. Hershberger

I used gnus-icalendar's "Export to Org" feature on an appointment, and
it successfully made a repeating entry (GOOD!) but failed to catch the
days other than the first one (BAD!).

The created org-entry contains the following RRULE entry:

    :RRULE:    FREQ=WEEKLY;UNTIL=20200519T133000Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;WKST=SU

The only entry created, though, was

    <2020-02-25 09:30-10:00 +1w>

I had to manually add the following entries:

  <2020-02-26 09:30-10:00 +1w>
  <2020-02-27 09:30-10:00 +1w>
  <2020-02-28 09:30-10:00 +1w>
  <2020-03-02 09:30-10:00 +1w>

From skimming gnus-icalendar.el and icalendar.el, it looks like the
"BYDAY" parsing in icalendar.el only looks for one day, instead of the
multiples given.  I think gnus-icalendar.el's export to org functions
are only set up to insert one day instead of the multiple times required
by this rule.



Reply | Threaded
Open this post in threaded view
|

bug#39782: 28.0.50; gnus-icalendar does not understand multiple repeating days

Lars Ingebrigtsen
"Mark A. Hershberger" <[hidden email]> writes:

>>From skimming gnus-icalendar.el and icalendar.el, it looks like the
> "BYDAY" parsing in icalendar.el only looks for one day, instead of the
> multiples given.  I think gnus-icalendar.el's export to org functions
> are only set up to insert one day instead of the multiple times required
> by this rule.

Do you have a ical example file that illustrates the problem?

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#39782: 28.0.50; gnus-icalendar does not understand multiple repeating days

Mark A. Hershberger-2
I'm attaching an appointment I sent my gmail address just now and the resulting org entry (in the tmp.org file) that the [Export to Org] button produced using the gnus-icalendar-sync-event-to-org callback.

Looking at the text property gnus-data for the button, I see:

#s(gnus-icalendar-event-request "[hidden email]"
                                "appointment every weekday, start jul 24, 2020, end aug 24, 2020"
                                "The following is a new meeting request:\n\nSubject: appointment every weekday, start jul 24, 2020, end aug 24, 2020 \nOrganizer: \"Mark A. Hershberger\" <[hidden email]> \n\nTime: 9:00:00 AM - 9:30:00 AM GMT -05:00 US/Canada Eastern\n Recurrence : Every weekday.   End by Aug 24, 2020.   Effective Jul 24, 2020\n\nInvitees: [hidden email] \n\n\n*~*~*~*~*~*~*~*~*~*\n\ntest \n" nil
                                (24346 56144)
                                (24346 57944)
                                "FREQ=DAILY;UNTIL=20200825T035959Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR" "903a5415-9067-4f63-b499-1b6205f49c88" "REQUEST" t required
                                ("Mark Hershberger")
                                nil)


----- On Jul 19, 2020, at 9:58 AM, Lars Ingebrigtsen [hidden email] wrote:

> "Mark A. Hershberger" <[hidden email]> writes:
>
>>>From skimming gnus-icalendar.el and icalendar.el, it looks like the
>> "BYDAY" parsing in icalendar.el only looks for one day, instead of the
>> multiples given.  I think gnus-icalendar.el's export to org functions
>> are only set up to insert one day instead of the multiple times required
>> by this rule.
>
> Do you have a ical example file that illustrates the problem?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

The following is a new meeting request:

Subject:appointment every weekday, start jul 24, 2020, end aug 24, 2020
Organizer:"Mark A. Hershberger" <[hidden email]>

Time:9:00:00 AM - 9:30:00 AM GMT -05:00 US/Canada Eastern
Recurrence: Every weekday. End by Aug 24, 2020. Effective Jul 24, 2020

Invitees:[hidden email]
*~*~*~*~*~*~*~*~*~*

test

tmp.org (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#39782: 28.0.50; gnus-icalendar does not understand multiple repeating days

Mark A. Hershberger
In reply to this post by Lars Ingebrigtsen

Inline since it looks like debbugs is dropping emails with attachments:

I'm attaching an appointment I sent my gmail address just now and the
resulting org entry (in the tmp.org file) that the [Export to Org] button
produced using the gnus-icalendar-sync-event-to-org callback.

Looking at the text property gnus-data for the button, I see:

#s(gnus-icalendar-event-request "[hidden email]"
                                "appointment every weekday, start jul 24, 2020, end aug 24, 2020"
                                "The following is a new meeting
request:\n\nSubject: appointment every weekday, start jul 24, 2020, end aug
24, 2020 \nOrganizer: \"Mark A. Hershberger\" <[hidden email]> \n\nTime:
9:00:00 AM - 9:30:00 AM GMT -05:00 US/Canada Eastern\n Recurrence : Every
weekday.  End by Aug 24, 2020.  Effective Jul 24, 2020\n\nInvitees:
[hidden email] \n\n\n*~*~*~*~*~*~*~*~*~*\n\ntest \n" nil
                                (24346 56144)
                                (24346 57944)
                                "FREQ=DAILY;UNTIL=20200825T035959Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR"
"903a5415-9067-4f63-b499-1b6205f49c88" "REQUEST" t required
                                ("Mark Hershberger")
                                nil)


------=_Part_584222_1719359544.1595172990988
Content-Type: application/octet-stream; name=tmp.org
Content-Disposition: attachment; filename=tmp.org
Content-Transfer-Encoding: base64

KiBhcHBvaW50bWVudCBldmVyeSB3ZWVrZGF5LCBzdGFydCBqdWwgMjQsIDIwMjAsIGVuZCBhdWcg
MjQsIDIwMjAKOlBST1BFUlRJRVM6CjpJQ0FMX0VWRU5UOiB0CjpJRDogICAgICAgOTAzYTU0MTUt
OTA2Ny00ZjYzLWI0OTktMWI2MjA1ZjQ5Yzg4CjpPUkdBTklaRVI6IG1haEBuaWNoZXdvcmsuY29t
CjpMT0NBVElPTjoKOlBBUlRJQ0lQQVRJT05fVFlQRTogcmVxdWlyZWQKOlJFUV9QQVJUSUNJUEFO
VFM6IE1hcmsgSGVyc2hiZXJnZXIKOk9QVF9QQVJUSUNJUEFOVFM6CjpSUlVMRTogICAgRlJFUT1E
QUlMWTtVTlRJTD0yMDIwMDgyNVQwMzU5NTlaO0lOVEVSVkFMPTE7QllEQVk9TU8sVFUsV0UsVEgs
RlIKOlJFUExZOiAgICBOb3QgcmVwbGllZCB5ZXQKOkVORDoKCiAgPDIwMjAtMDctMjQgMDk6MDAt
MDk6MzAgKzFkPgoKICBUaGUgZm9sbG93aW5nIGlzIGEgbmV3IG1lZXRpbmcgcmVxdWVzdDoKCiAg
U3ViamVjdDogYXBwb2ludG1lbnQgZXZlcnkgd2Vla2RheSwgc3RhcnQganVsIDI0LCAyMDIwLCBl
bmQgYXVnIDI0LCAyMDIwCiAgT3JnYW5pemVyOiAiTWFyayBBLiBIZXJzaGJlcmdlciIgPG1haEBu
aWNoZXdvcmsuY29tPgoKICBUaW1lOiA5OjAwOjAwIEFNIC0gOTozMDowMCBBTSBHTVQgLTA1OjAw
IFVTL0NhbmFkYSBFYXN0ZXJuIFJlY3VycmVuY2UgOgogIEV2ZXJ5IHdlZWtkYXkuICBFbmQgYnkg
QXVnIDI0LCAyMDIwLiAgRWZmZWN0aXZlIEp1bCAyNCwgMjAyMAoKICBJbnZpdGVlczogaGV4bW9k
ZUBnbWFpbC5jb20KCgogICp+Kn4qfip+Kn4qfip+Kn4qfioKCiAgdGVzdAo=
------=_Part_584222_1719359544.1595172990988
Content-Type: message/rfc822
Content-Disposition: attachment

Return-Path: hexmode+caf_=mah=[hidden email]
Received: from 108.161.151.158 (LHLO mail.nichework.com) (108.161.151.158)
 by mail.nichework.com with LMTP; Sun, 19 Jul 2020 08:09:11 -0700 (PDT)
Received: from localhost (localhost.localdomain [127.0.0.1])
        by mail.nichework.com (Postfix) with ESMTP id 1B6784E1EBD
        for <[hidden email]>; Sun, 19 Jul 2020 08:09:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at mail.nichework.com
Authentication-Results: mail.nichework.com (amavisd-new);
        dkim=pass (2048-bit key) header.d=nichework.com
Received: from mail.nichework.com ([127.0.0.1])
        by localhost (mail.nichework.com [127.0.0.1]) (amavisd-new, port 10024)
        with ESMTP id uKsJGt_VjgNA for <[hidden email]>;
        Sun, 19 Jul 2020 08:09:11 -0700 (PDT)
Received: from nospam.nichework.com (nospam.nichework.com [206.71.169.33])
        by mail.nichework.com (Postfix) with ESMTPS id F11974E1E55
        for <[hidden email]>; Sun, 19 Jul 2020 08:09:10 -0700 (PDT)
Received: from localhost (localhost.localdmain [127.0.0.1])
        by nospam.nichework.com (Postfix) with ESMTP id 13875B003F
        for <[hidden email]>; Sun, 19 Jul 2020 11:09:01 -0400 (EDT)
Authentication-Results: nospam.nichework.com; dkim=pass
        reason="2048-bit key; insecure key"
        header.d=nichework.com header.i=@nichework.com header.b=H9R3mrfB;
        dkim-adsp=pass; dkim-atps=neutral
X-Virus-Scanned: Debian amavisd-new at nospam.nichework.com
X-Spam-Flag: NO
X-Spam-Score: -2.412
X-Spam-Level:
X-Spam-Status: No, score=-2.412 tagged_above=-100 required=3 WHITELISTED
        tests=[AWL=-0.962, BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1,
        HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001,
        RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001,
        SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no
Received: from nospam.nichework.com ([127.0.0.1])
        by localhost (nospam.nichework.com [127.0.0.1]) (amavisd-new, port 10024)
        with ESMTP id my1bPJSAkehL for <[hidden email]>;
        Sun, 19 Jul 2020 11:08:24 -0400 (EDT)
Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53])
        (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
        (No client certificate requested)
        by nospam.nichework.com (Postfix) with ESMTPS id EF159B003E
        for <[hidden email]>; Sun, 19 Jul 2020 11:08:21 -0400 (EDT)
Authentication-Results: nospam.nichework.com; dkim=pass
        reason="2048-bit key; insecure key"
        header.d=nichework.com header.i=@nichework.com header.b=H9R3mrfB;
        dkim-adsp=pass; dkim-atps=neutral
Received: by mail-vs1-f53.google.com with SMTP id p25so7239494vsg.4
        for <[hidden email]>; Sun, 19 Jul 2020 08:08:30 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:delivered-to:dkim-filter:dkim-signature:date
         :from:to:message-id:subject:mime-version:thread-index:thread-topic;
        bh=mNAZSKoO+4xPTm/w2nyXbeJu9gCdvGnUdQ3qDTO46fo=;
        b=DB/7MJiI43RZyjs8AneUUsyddP6oihnht/edRxJAYub9CFH6EgoE+ByByKP4AnyooH
         4vhWWzpwOVFGhUK7YyFCIoGXHCdk6swbzAFiqofIAwnLmC+4shflTIe593INQ5qLY3SZ
         Z58En7i75EP+WxhJ5mYkfyKvFXuTu9ECTrMnDk1eylJnT331HkolEVf+1ZgJX2GNSF+f
         0EYdVd4Jw7UcNVdUbWjrdieHGPf7zt8sgnlglqaHg8dnuNado9plzKKfway7JfWQ+FRZ
         /u6R1e78kVPhWqn4/fMYDLS1Ba76w8qoCLE3CgGh5MJlali7wIhL0Vi/C1XbPkVFive/
         Lzwg==
X-Gm-Message-State: AOAM533GpwpBU+vuvMMY2u2uoCa6o2C1CcXAxmwEve5NQCka//htxxxm
        NtH3a74V9BFz41srgOG9pE/GS3wIpBG/KLU/jPhtJpjr2Zjjb1o=
X-Received: by 2002:a67:f9cf:: with SMTP id c15mr13822781vsq.185.1595171309877;
        Sun, 19 Jul 2020 08:08:29 -0700 (PDT)
X-Forwarded-To: [hidden email]
X-Forwarded-For: [hidden email] [hidden email]
Delivered-To: [hidden email]
Received: by 2002:a67:3252:0:0:0:0:0 with SMTP id y79csp1224907vsy;
        Sun, 19 Jul 2020 08:08:28 -0700 (PDT)
X-Google-Smtp-Source: ABdhPJxQUBVl+Br0GABhL3Ltj8ih8lFN2EVkbHefGkR60DEJrPVuXOw7qeaTJu18DT4yoz9FTtGf
X-Received: by 2002:a17:902:6544:: with SMTP id d4mr14973154pln.138.1595171308129;
        Sun, 19 Jul 2020 08:08:28 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1595171308; cv=none;
        d=google.com; s=arc-20160816;
        b=uyykWk9YKAeX2kOqNUMtxSt4/jYoYO6GD33f5w8vjXJ5NmN582J0+NojdabrNnOc+0
         PfbtCBdUXt4g1AFiSf2H6zCbP3zYoFUm2oxbhTaCeEbX9+BopemIrcBQL6utB/gLPr+O
         aYPAFSOj/DUK6J10EL6IFiVtHUzg527MfYIUOKETzRbRlSsbGjJ012LdUlU4ed5A2UOp
         hrQ4CyRNLundIgPSJK6MO2/9mXbJukyVy6JiZr/uEmTvFgrUpq6I8tMRfxn8in/W22Pf
         7NRGWXPanlcXkUuB+s7hO+aabU3uVVjcyTOqMaEYghNGOtFa5X5JqGNt9jvgouaiXS7l
         kHvA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=thread-topic:thread-index:mime-version:subject:message-id:to:from
         :date:dkim-signature:dkim-filter;
        bh=mNAZSKoO+4xPTm/w2nyXbeJu9gCdvGnUdQ3qDTO46fo=;
        b=IUFw5nP/MY4Rx+MxLxoESf0i/nrZSNgrkJbEuU7TzPbJWAy1hTkcYkq9Do5bxEnG6I
         190exU5YROD82pFetp3WV6ufK5vq0eqHmchs4JCXRLcxdhaRH0t9ExMVIz0/yrMzwMr+
         iRxMWIQvdVad/B54UpU+GS/gk/Iut6j+TZ3sz3DpXZWSo39m6m7OgbmLSRfUT6XFOTt0
         Q+1NTp2FDTiTwRb4eZkHTBcSRdxauJnqLYQ+PIzmM6iCs2VjrjKuybaPRKud7ONV2okQ
         cnEucrOWTISOY0U2ifvuV+OvV6an2r+f/4x1+syiZHQNfGHuluIZojd48JGcnxvxIAge
         7lvQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@nichework.com header.s=897144A4-59D1-11EA-885D-1509A2A44C35 header.b=H9R3mrfB;
       spf=pass (google.com: domain of [hidden email] designates 206.71.169.33 as permitted sender) smtp.mailfrom=[hidden email];
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nichework.com
Received: from nospam.nichework.com (nospam.nichework.com. [206.71.169.33])
        by mx.google.com with ESMTPS id p30si4468652pgd.443.2020.07.19.08.08.27
        for <[hidden email]>
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 19 Jul 2020 08:08:27 -0700 (PDT)
Received-SPF: pass (google.com: domain of [hidden email] designates 206.71.169.33 as permitted sender) client-ip=206.71.169.33;
Received: from localhost (localhost.localdmain [127.0.0.1])
        by nospam.nichework.com (Postfix) with ESMTP id A50B5B0040
        for <[hidden email]>; Sun, 19 Jul 2020 11:08:16 -0400 (EDT)
X-Virus-Scanned: Debian amavisd-new at nospam.nichework.com
Received: from nospam.nichework.com ([127.0.0.1])
        by localhost (nospam.nichework.com [127.0.0.1]) (amavisd-new, port 10024)
        with ESMTP id BwgfRPhwc3Pl for <[hidden email]>;
        Sun, 19 Jul 2020 11:08:06 -0400 (EDT)
Received: from mail.nichework.com (mail.nichework.com [108.161.151.158])
        (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
        (No client certificate requested)
        by nospam.nichework.com (Postfix) with ESMTPS id CAE0AB003E
        for <[hidden email]>; Sun, 19 Jul 2020 11:08:05 -0400 (EDT)
Received: from mail.nichework.com (localhost.localdomain [127.0.0.1])
        by mail.nichework.com (Postfix) with ESMTPS id 5AB114E1E55
        for <[hidden email]>; Sun, 19 Jul 2020 08:08:15 -0700 (PDT)
Received: from localhost (localhost.localdomain [127.0.0.1])
        by mail.nichework.com (Postfix) with ESMTP id 40B2E4E1EBD
        for <[hidden email]>; Sun, 19 Jul 2020 08:08:15 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.nichework.com 40B2E4E1EBD
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nichework.com;
        s=897144A4-59D1-11EA-885D-1509A2A44C35; t=1595171295;
        bh=mNAZSKoO+4xPTm/w2nyXbeJu9gCdvGnUdQ3qDTO46fo=;
        h=Date:From:To:Message-ID:MIME-Version;
        b=H9R3mrfBGToFObiBElG3KyjFN3IaFj0c/TN+X/C+qtcIMDujVEWDcwz6R96x2Yt+o
         +4PqmkIjHTa0e4iZk2jsSasmjXDKinLM73HlZxkK/Mp/kzXRuPd+g5hriZa+II/8Rl
         LUqG9qU4KRgrKLZiy/1oSJuxps/UvMtL7+i6Tt8FDMWePCK4gZyxsNsM5MA6FVVGOP
         Z7kP6stj/ChBOx7EBUSujdOsb3GHnfxfWSNSGd1ZDpCfI/YyLBcI8SG/fJI+8GWbrD
         45gTeszwcrnQCI6zwAmcrC1xBWF9eMW64AGqloPxpnEsLZPnyoA6/IkCeAWzEg+viV
         tFpRF2cGNSJew==
X-Virus-Scanned: amavisd-new at mail.nichework.com
Received: from mail.nichework.com ([127.0.0.1])
        by localhost (mail.nichework.com [127.0.0.1]) (amavisd-new, port 10026)
        with ESMTP id 2m-IIWcdJmFV for <[hidden email]>;
        Sun, 19 Jul 2020 08:08:15 -0700 (PDT)
Received: from mail.nichework.com (localhost.localdomain [127.0.0.1])
        by mail.nichework.com (Postfix) with ESMTP id 264F44E1E55
        for <[hidden email]>; Sun, 19 Jul 2020 08:08:15 -0700 (PDT)
Date: Sun, 19 Jul 2020 08:08:15 -0700 (PDT)
From: "Mark A. Hershberger" <[hidden email]>
To: Mark Hershberger <[hidden email]>
Message-ID: <[hidden email]>
Subject: appointment every weekday, start jul 24, 2020, end aug 24, 2020
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="=_b2cb3108-dd0d-4a40-b1ff-933a0a1aaa2c"
X-Originating-IP: [209.253.11.94]
X-Mailer: Zimbra 8.7.11_GA_1854 (ZimbraWebClient - FF79 (Linux)/8.7.11_GA_1854)
Thread-Index: +E9s3FawcPa4H3Zk1lbZTAY4aDau4Q==
Thread-Topic: appointment every weekday, start jul 24, 2020, end aug 24, 2020

--=_b2cb3108-dd0d-4a40-b1ff-933a0a1aaa2c
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

The following is a new meeting request:

Subject: appointment every weekday, start jul 24, 2020, end aug 24, 2020
Organizer: "Mark A. Hershberger" <[hidden email]>

Time: 9:00:00 AM - 9:30:00 AM GMT -05:00 US/Canada Eastern
 Recurrence : Every weekday.   End by Aug 24, 2020.   Effective Jul 24, 2020

Invitees: [hidden email]


*~*~*~*~*~*~*~*~*~*

test

--=_b2cb3108-dd0d-4a40-b1ff-933a0a1aaa2c
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<html><body id='htmlmode'><h3>The following is a new meeting request:</h3>

<p>
<table border='0'>
<tr><th align=left>Subject:</th><td>appointment every weekday, start jul 24, 2020, end aug 24, 2020 </td></tr>
<tr><th align=left>Organizer:</th><td>"Mark A. Hershberger" &lt;[hidden email]&gt; </td></tr>
</table>
<p>
<table border='0'>
<tr><th align=left>Time:</th><td>9:00:00 AM - 9:30:00 AM GMT -05:00 US/Canada Eastern
 </td></tr><tr><th align=left>Recurrence</th><td>: Every weekday.   End by Aug 24, 2020.   Effective Jul 24, 2020</td></tr>
</table>
<p>
<table border='0'>
<tr><th align=left>Invitees:</th><td>[hidden email] </td></tr>
</table>
<div>*~*~*~*~*~*~*~*~*~*</div><br><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>test<br data-mce-bogus="1"></div></div></body></html>
--=_b2cb3108-dd0d-4a40-b1ff-933a0a1aaa2c
Content-Type: text/calendar; charset=utf-8; method=REQUEST; name=meeting.ics
Content-Transfer-Encoding: 7bit

BEGIN:VCALENDAR
PRODID:Zimbra-Calendar-Provider
VERSION:2.0
METHOD:REQUEST
BEGIN:VTIMEZONE
TZID:America/New_York
BEGIN:STANDARD
DTSTART:16010101T020000
TZOFFSETTO:-0500
TZOFFSETFROM:-0400
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU
TZNAME:EST
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETTO:-0400
TZOFFSETFROM:-0500
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU
TZNAME:EDT
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:903a5415-9067-4f63-b499-1b6205f49c88
RRULE:FREQ=DAILY;UNTIL=20200825T035959Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
SUMMARY:appointment every weekday\, start jul 24\, 2020\, end aug 24\, 2020
ATTENDEE;CN=Mark Hershberger;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP
 =TRUE:mailto:[hidden email]
ORGANIZER;CN=Mark A. Hershberger:mailto:[hidden email]
DTSTART;TZID="America/New_York":20200724T090000
DTEND;TZID="America/New_York":20200724T093000
STATUS:CONFIRMED
CLASS:PUBLIC
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
TRANSP:OPAQUE
LAST-MODIFIED:20200719T150815Z
DTSTAMP:20200719T150815Z
SEQUENCE:0
DESCRIPTION:The following is a new meeting request:\n\nSubject: appointment
 every weekday\, start jul 24\, 2020\, end aug 24\, 2020 \nOrganizer: "Mark A
 . Hershberger" <[hidden email]> \n\nTime: 9:00:00 AM - 9:30:00 AM GMT -05
 :00 US/Canada Eastern\n Recurrence : Every weekday.   End by Aug 24\, 2020.
   Effective Jul 24\, 2020\n\nInvitees: [hidden email] \n\n\n*~*~*~*~*~*~*
 ~*~*~*\n\ntest \n
X-ALT-DESC;FMTTYPE=text/html:<html><body id='htmlmode'><h3>The following is
 a new meeting request:</h3>\n\n<p>\n<table border='0'>\n<tr><th align=left>S
 ubject:</th><td>appointment every weekday\, start jul 24\, 2020\, end aug 24
 \, 2020 </td></tr>\n<tr><th align=left>Organizer:</th><td>"Mark A. Hershberg
 er" &lt\;[hidden email]&gt\; </td></tr>\n</table>\n<p>\n<table border='0'
 >\n<tr><th align=left>Time:</th><td>9:00:00 AM - 9:30:00 AM GMT -05:00 US/Ca
 nada Eastern\n </td></tr><tr><th align=left>Recurrence</th><td>: Every weekd
 ay.   End by Aug 24\, 2020.   Effective Jul 24\, 2020</td></tr>\n</table>\n<
 p>\n<table border='0'>\n<tr><th align=left>Invitees:</th><td>[hidden email]
 om </td></tr>\n</table>\n<div>*~*~*~*~*~*~*~*~*~*</div><br><div style="font-
 family: arial\, helvetica\, sans-serif\; font-size: 12pt\; color: #000000"><
 div>test<br data-mce-bogus="1"></div></div></body></html>
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER;RELATED=START:-PT5M
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
--=_b2cb3108-dd0d-4a40-b1ff-933a0a1aaa2c--

------=_Part_584222_1719359544.1595172990988--



Reply | Threaded
Open this post in threaded view
|

bug#39782: 28.0.50; gnus-icalendar does not understand multiple repeating days

Lars Ingebrigtsen
"Mark A. Hershberger" <[hidden email]> writes:

> I'm attaching an appointment I sent my gmail address just now and the
> resulting org entry (in the tmp.org file) that the [Export to Org] button
> produced using the gnus-icalendar-sync-event-to-org callback.

OK; Cc-ing Jan on this -- perhaps he has some input here.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#39782: 28.0.50; gnus-icalendar does not understand multiple repeating days

Jan Tatarik
On Mon, Jul 20 2020, Lars Ingebrigtsen wrote:

> "Mark A. Hershberger" <[hidden email]> writes:

>> I'm attaching an appointment I sent my gmail address just now and the
>> resulting org entry (in the tmp.org file) that the [Export to Org] button
>> produced using the gnus-icalendar-sync-event-to-org callback.

> OK; Cc-ing Jan on this -- perhaps he has some input here.

A quick look at gnus-icalendar.el tells me we ignore BYDAY
entirely. I'll see how easy is this to fix.



Reply | Threaded
Open this post in threaded view
|

bug#39782: 28.0.50; gnus-icalendar does not understand multiple repeating days

Jan Tatarik
In reply to this post by Lars Ingebrigtsen
Here's a quick-and-dirty fix (am on vacation now). See if it works for
you.



diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index 305e17fd8f..2860c40581 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -138,6 +138,22 @@ gnus-icalendar-event-reply
     (or (match-string 1 rrule)
         default-interval)))
 
+(cl-defmethod gnus-icalendar-event:recurring-days ((event gnus-icalendar-event))
+  "Return, when available, the week day numbers on which the EVENT recurs."
+  (let ((rrule (gnus-icalendar-event:recur event))
+        (weekday-map '(("SU" . 0)
+                       ("MO" . 1)
+                       ("TU" . 2)
+                       ("WE" . 3)
+                       ("TH" . 4)
+                       ("FR" . 5)
+                       ("SA" . 6))))
+    (when (string-match "BYDAY=\\([^;]+\\)" rrule)
+      (let ((bydays (split-string (match-string 1 rrule) ",")))
+        (seq-map
+         (lambda (x) (cdr (assoc x weekday-map)))
+         (seq-filter (lambda (x) (string-match "^[A-Z]\\{2\\}$" x)) bydays))))))
+
 (cl-defmethod gnus-icalendar-event:start ((event gnus-icalendar-event))
   (format-time-string "%Y-%m-%d %H:%M" (gnus-icalendar-event:start-time event)))
 
@@ -400,23 +416,28 @@ gnus-icalendar-org-enabled-p
       (when org-freq
         (format "+%s%s" (gnus-icalendar-event:recurring-interval event) org-freq)))))
 
-(cl-defmethod gnus-icalendar-event:org-timestamp ((event gnus-icalendar-event))
-  "Build `org-mode' timestamp from EVENT start/end dates and recurrence info."
-  (let* ((start (gnus-icalendar-event:start-time event))
-         (end (gnus-icalendar-event:end-time event))
-         (start-date (format-time-string "%Y-%m-%d" start))
+(defun find-day (start-date end-date day)
+  (let ((time-1-day 86400))
+    (if (= (decoded-time-weekday (decode-time start-date))
+           day)
+        (list start-date end-date)
+      (find-day (time-add start-date time-1-day)
+                (time-add end-date time-1-day)
+                day))))
+
+(defun gnus-icalendar-event--org-timestamp (start end org-repeat)
+  (let* ((start-date (format-time-string "%Y-%m-%d" start))
          (start-time (format-time-string "%H:%M" start))
          (start-at-midnight (string= start-time "00:00"))
          (end-date (format-time-string "%Y-%m-%d" end))
          (end-time (format-time-string "%H:%M" end))
          (end-at-midnight (string= end-time "00:00"))
          (start-end-date-diff
-  (time-to-number-of-days (time-subtract
-   (org-time-string-to-time end-date)
-   (org-time-string-to-time start-date))))
-         (org-repeat (gnus-icalendar-event:org-repeat event))
+      (time-to-number-of-days (time-subtract
+                   (org-time-string-to-time end-date)
+                   (org-time-string-to-time start-date))))
          (repeat (if org-repeat (concat " " org-repeat) ""))
- (time-1-day 86400))
+     (time-1-day 86400))
 
     ;; NOTE: special care is needed with appointments ending at midnight
     ;; (typically all-day events): the end time has to be changed to 23:59 to
@@ -445,7 +466,25 @@ gnus-icalendar-org-enabled-p
      ;; A .:. - A .:. -> A .:.-.:.
      ;; A .:. - B .:.
      ((zerop start-end-date-diff) (format "<%s %s-%s%s>" start-date start-time end-time repeat))
-     (t (format "<%s %s>--<%s %s>" start-date start-time end-date end-time)))))
+     (t (format "<%s %s>--<%s %s>" start-date start-time end-date end-time))))
+  )
+
+(cl-defmethod gnus-icalendar-event:org-timestamp ((event gnus-icalendar-event))
+  "Build `org-mode' timestamp from EVENT start/end dates and recurrence info."
+  ;; if org-repeat +1d or +1w and byday: generate one timestamp per
+  ;; byday, starting at start-date. Change +1d to +7d.
+  (let ((start (gnus-icalendar-event:start-time event))
+        (end (gnus-icalendar-event:end-time event))
+        (org-repeat (gnus-icalendar-event:org-repeat event))
+        (recurring-days (gnus-icalendar-event:recurring-days event)))
+    (if (and (or (string= org-repeat "+1d")
+                 (string= org-repeat "+1w"))
+             recurring-days)
+      (let ((repeat "+1w")
+            (dates (seq-sort-by 'car 'time-less-p (seq-map (lambda (x) (find-day start end x)) recurring-days))))
+        (mapconcat (lambda (x) (gnus-icalendar-event--org-timestamp (car x) (cadr x) repeat)) dates "\n"))
+      (gnus-icalendar-event--org-timestamp start end org-repeat)))
+)
 
 (defun gnus-icalendar--format-summary-line (summary &optional location)
   (if location
diff --git a/test/lisp/gnus/gnus-icalendar-tests.el b/test/lisp/gnus/gnus-icalendar-tests.el
new file mode 100644
index 0000000000..ca686da72c
--- /dev/null
+++ b/test/lisp/gnus/gnus-icalendar-tests.el
@@ -0,0 +1,229 @@
+;;; gnus-icalendar-tests.el --- tests                -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020  Jan Tatarik
+
+;; Author: Jan Tatarik <[hidden email]>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'ert)
+(require 'gnus-icalendar)
+
+
+(defun gnus-icalendar-tests--get-ical-event (ical-string &optional participant)
+  "Return gnus-icalendar event for ICAL-STRING."
+  (let (event)
+    (with-temp-buffer
+      (insert ical-string)
+      (setq event (gnus-icalendar-event-from-buffer (buffer-name) participant)))
+    event))
+
+(defun icalendar-tests--get-ical-event (ical-string)
+  "Return iCalendar event for ICAL-STRING."
+  (save-excursion
+    (with-temp-buffer
+      (insert ical-string)
+      (goto-char (point-min))
+      (car (icalendar--read-element nil nil)))))
+
+(ert-deftest gnus-icalendar-parse ()
+  "test"
+  (let ((event (gnus-icalendar-tests--get-ical-event "
+BEGIN:VCALENDAR
+PRODID:-//Google Inc//Google Calendar 70.9054//EN
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:REQUEST
+BEGIN:VTIMEZONE
+TZID:America/New_York
+X-LIC-LOCATION:America/New_York
+BEGIN:DAYLIGHT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+TZNAME:EDT
+DTSTART:19700308T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+TZNAME:EST
+DTSTART:19701101T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+DTSTART;TZID=America/New_York:20201208T090000
+DTEND;TZID=America/New_York:20201208T100000
+DTSTAMP:20200728T182853Z
+ORGANIZER;CN=Company Events:mailto:liveintent.com_3bm6fh805bme9uoeliqcle1sa
+ [hidden email]
+UID:[hidden email]
+X-MICROSOFT-CDO-OWNERAPPTID:-362490173
+RECURRENCE-ID;TZID=America/New_York:20201208T091500
+CREATED:20200309T134939Z
+DESCRIPTION:In this meeting\, we will cover topics from product and enginee
+ ring presentations and demos to new hire announcements to watching the late
+LAST-MODIFIED:20200728T182852Z
+LOCATION:New York-22-Town Hall Space (250) [Chrome Box]
+SEQUENCE:4
+STATUS:CONFIRMED
+SUMMARY:Townhall | All Company Meeting
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+")))
+
+    (should (eq (eieio-object-class event) 'gnus-icalendar-event-request))
+    (should (not (gnus-icalendar-event:recurring-p event)))
+    (should (string= (gnus-icalendar-event:start event) "2020-12-08 15:00"))
+    (with-slots (organizer summary description location end-time uid rsvp participation-type) event
+        (should (string= organizer "[hidden email]"))
+        (should (string= summary "Townhall | All Company Meeting"))
+        (should (string= description "In this meeting\, we will cover topics from product and engineering presentations and demos to new hire announcements to watching the late"))
+        (should (string= location "New York-22-Town Hall Space (250) [Chrome Box]"))
+        (should (string= (format-time-string "%Y-%m-%d %H:%M" end-time) "2020-12-08 16:00"))
+        (should (string= uid "[hidden email]"))
+        (should (not rsvp))
+(should (eq participation-type 'non-participant)))))
+
+(ert-deftest gnus-icalendary-byday ()
+  ""
+  (let ((event (gnus-icalendar-tests--get-ical-event "
+BEGIN:VCALENDAR
+PRODID:Zimbra-Calendar-Provider
+VERSION:2.0
+METHOD:REQUEST
+BEGIN:VTIMEZONE
+TZID:America/New_York
+BEGIN:STANDARD
+DTSTART:16010101T020000
+TZOFFSETTO:-0500
+TZOFFSETFROM:-0400
+RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU
+TZNAME:EST
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:16010101T020000
+TZOFFSETTO:-0400
+TZOFFSETFROM:-0500
+RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU
+TZNAME:EDT
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:903a5415-9067-4f63-b499-1b6205f49c88
+RRULE:FREQ=DAILY;UNTIL=20200825T035959Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
+SUMMARY:appointment every weekday\, start jul 24\, 2020\, end aug 24\, 2020
+ATTENDEE;CN=Mark Hershberger;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP
+ =TRUE:mailto:hexmode <at> gmail.com
+ORGANIZER;CN=Mark A. Hershberger:mailto:mah <at> nichework.com
+DTSTART;TZID=\"America/New_York\":20200724T090000
+DTEND;TZID=\"America/New_York\":20200724T093000
+STATUS:CONFIRMED
+CLASS:PUBLIC
+X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
+TRANSP:OPAQUE
+LAST-MODIFIED:20200719T150815Z
+DTSTAMP:20200719T150815Z
+SEQUENCE:0
+DESCRIPTION:The following is a new meeting request:
+BEGIN:VALARM
+ACTION:DISPLAY
+TRIGGER;RELATED=START:-PT5M
+DESCRIPTION:Reminder
+END:VALARM
+END:VEVENT
+END:VCALENDAR" (list "Mark Hershberger"))))
+
+    (should (eq (eieio-object-class event) 'gnus-icalendar-event-request))
+    (should (gnus-icalendar-event:recurring-p event))
+    (should (string= (gnus-icalendar-event:recurring-interval event) "1"))
+    (should (string= (gnus-icalendar-event:start event) "2020-07-24 15:00"))
+    (with-slots (organizer summary description location end-time uid rsvp participation-type) event
+      (should (string= organizer "mah <at> nichework.com"))
+      (should (string= summary "appointment every weekday\, start jul 24\, 2020\, end aug 24\, 2020"))
+      (should (string= description "The following is a new meeting request:"))
+      (should (null location))
+      (should (string= (format-time-string "%Y-%m-%d %H:%M" end-time) "2020-07-24 15:30"))
+      (should (string= uid "903a5415-9067-4f63-b499-1b6205f49c88"))
+      (should rsvp)
+      (should (eq participation-type 'required)))
+    (should (equal (gnus-icalendar-event:recurring-days event) '(1 2 3 4 5)))
+    (should (string= (gnus-icalendar-event:org-timestamp event) "<2020-07-24 15:00-15:30 +1w>
+<2020-07-27 15:00-15:30 +1w>
+<2020-07-28 15:00-15:30 +1w>
+<2020-07-29 15:00-15:30 +1w>
+<2020-07-30 15:00-15:30 +1w>"))
+    ))
+
+
+;; (VCALENDAR nil
+;;   ((PRODID nil "Zimbra-Calendar-Provider")
+;;    (VERSION nil "2.0")
+;;    (METHOD nil "REQUEST"))
+;;   ((VTIMEZONE nil
+;;       ((TZID nil "America/New_York"))
+;;       ((STANDARD nil
+;;  ((DTSTART nil "16010101T020000")
+;;   (TZOFFSETTO nil "-0500")
+;;   (TZOFFSETFROM nil "-0400")
+;;   (RRULE nil "FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU")
+;;   (TZNAME nil "EST"))
+;;  nil)
+;; (DAYLIGHT nil
+;;  ((DTSTART nil "16010101T020000")
+;;   (TZOFFSETTO nil "-0400")
+;;   (TZOFFSETFROM nil "-0500")
+;;   (RRULE nil "FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU")
+;;   (TZNAME nil "EDT"))
+;;  nil)))
+;;    (VEVENT nil
+;;    ((UID nil "903a5415-9067-4f63-b499-1b6205f49c88")
+;;     (RRULE nil "FREQ=DAILY;UNTIL=20200825T035959Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR")
+;;     (SUMMARY nil "appointment every weekday, start jul 24, 2020, end aug 24, 2020")
+;;     (ATTENDEE
+;;      (CN "Mark Hershberger" ROLE "REQ-PARTICIPANT" PARTSTAT "NEEDS-ACTION" CN "Mark A. Hershberger")
+;;      "mailto:mah <at> nichework.com")
+;;     (DTSTART
+;;      (TZID "America/New_York")
+;;      "20200724T090000")
+;;     (DTEND
+;;      (TZID "America/New_York")
+;;      "20200724T093000")
+;;     (STATUS nil "CONFIRMED")
+;;     (CLASS nil "PUBLIC")
+;;     (X-MICROSOFT-CDO-INTENDEDSTATUS nil "BUSY")
+;;     (TRANSP nil "OPAQUE")
+;;     (LAST-MODIFIED nil "20200719T150815Z")
+;;     (DTSTAMP nil "20200719T150815Z")
+;;     (SEQUENCE nil "0")
+;;     (DESCRIPTION nil "The following is a new meeting request:"))
+;;    ((VALARM nil
+;;     ((ACTION nil "DISPLAY")
+;;      (TRIGGER
+;;       (RELATED "START")
+;;       "-PT5M")
+;;      (DESCRIPTION nil "Reminder"))
+;;     nil)))))
+
+(provide 'gnus-icalendar-tests)
+;;; gnus-icalendar-tests.el ends here