From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/82814 Path: news.gmane.org!not-for-mail From: "Damon Haley" Newsgroups: gmane.emacs.gnus.general Subject: Re: text/calendar attachments invisible in gnus Date: Tue, 08 Jan 2013 09:36:23 -0700 Organization: Vinyl Island University Message-ID: References: <87ehja69wy.fsf@mat.ucm.es> <87k3s8avrk.fsf@kepler.lan> <87sj6tycd1.fsf@topper.koldfront.dk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1357663047 26390 80.91.229.3 (8 Jan 2013 16:37:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Jan 2013 16:37:27 +0000 (UTC) Cc: ding@gnus.org To: asjo@koldfront.dk (Adam =?utf-8?Q?Sj=C3=B8gren?=) Original-X-From: ding-owner+M31080@lists.math.uh.edu Tue Jan 08 17:37:44 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TscBJ-0001Ev-RJ for ding-account@gmane.org; Tue, 08 Jan 2013 17:37:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1TscAD-0001Cr-R9; Tue, 08 Jan 2013 10:36:33 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1TscAA-0001Ca-RB for ding@lists.math.uh.edu; Tue, 08 Jan 2013 10:36:30 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TscA8-0007V0-Lc for ding@lists.math.uh.edu; Tue, 08 Jan 2013 10:36:30 -0600 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1TscA6-0004ih-Ro for ding@gnus.org; Tue, 08 Jan 2013 17:36:27 +0100 Original-Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id B689D20CDC; Tue, 8 Jan 2013 11:36:25 -0500 (EST) Original-Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute3.internal (MEProxy); Tue, 08 Jan 2013 11:36:25 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:cc:subject:in-reply-to:references :date:message-id:mime-version:content-type :content-transfer-encoding; s=smtpout; bh=EofCUEYJaj1NInmH2L3lXm cCJKY=; b=r22NQDJwGzZsx9pupR6Si92olLjUDilGUdOx9Esqf5HJiHObS8iEjB 8X/LEAyFhDMJok2fqtNRukOfaI/xBIqOpaul9pJBN9I01dd5u3LiBK7ljOvAEOVB ERRcx/0+oJDThoan2bZSLnO3w7dvaRaIJdebnMORzgajtAisGeZC8= X-Sasl-enc: DZFwWOqUnihqDXcmPBzugY61pR62XmrWt7gl5cYOK9pk 1357662985 Original-Received: from haley.local (unknown [128.138.79.177]) by mail.messagingengine.com (Postfix) with ESMTPA id 6FC4F4825BB; Tue, 8 Jan 2013 11:36:25 -0500 (EST) Original-Received: by haley.local (Postfix, from userid 253747059) id A78D314D9D6E; Tue, 8 Jan 2013 09:36:24 -0700 (MST) In-Reply-To: <87sj6tycd1.fsf@topper.koldfront.dk> ("Adam =?utf-8?Q?Sj?= =?utf-8?Q?=C3=B8gren=22's?= message of "Tue, 25 Dec 2012 23:51:22 +0100") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.91 (darwin) X-Face: "'PJ-yb+fYF0]%?,#==_(s>`~Hw_iwG![Cc+Sq$k>S|QbU)>?}Y51$4)\9OEt:NL.@kZIqy .L<,Nd[nsMwrN3b]os1UqBw X-Accept-Language: en-us X-Operating-System: Debian GNU/Linux Mail-Followup-To: asjo@koldfront.dk (Adam =?utf-8?Q?Sj=C3=B8gren?=), ding@gnus.org X-Spam-Score: -2.9 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:82814 Archived-At: >>>>> Adam Sj=C3=B8gren writes: > I hacked a little on your recipe recently (my colleagues got a new version > of Outlook and now the HTML parts have no information, none what so ever). > I grabbed some of the time zone stuff from one the the .el-files that can > import into org-mode (I think it was), and fiddled with various other thi= ngs > (charset and some formatting). > I haven't figured the reply-bit out either, because my colleagues look at= my > calender on the Exchange-server, and I'll bet (but I'll be happy to lose = the > bet) that you need to use Outlook for that to work. Adam, thanks for this. Now I can finally see these calendar events I get in gnus. It would be great to eventually be able to accept the Exchange invit= es in gnus, but this is good enough for now. Damon > Anyway, here is my butchering of your recipe: > (add-to-list 'mm-inlined-types "text/calendar") > (add-to-list 'mm-automatic-display "text/calendar") > (add-to-list 'mm-inline-media-tests '("text/calendar" mm-inline-text-cale= ndar identity)) > (require 'icalendar) > (require 'boxquote) > (defun mm-inline-text-calendar (handle) > (let ((text "")) > (with-temp-buffer > (mm-insert-part handle) > (save-window-excursion > (setq info (mapcar (lambda (s) (mm-decode-string s "utf-8")) > (format-text-calendar-for-display (icalendar--= read-element nil nil)))))) > (let ((start (point))) > (mm-insert-inline handle "\n") > (mm-insert-inline handle (car info)) > (mm-insert-inline handle "\n") > (goto-char start) > (when (search-forward "DESCRIPTION " nil t) > (replace-match "" nil t) > (beginning-of-line) > (fill-region (point) (point-max))) > (boxquote-region start (point-max))) > (boxquote-title (car (cdr info))) > (mm-insert-inline handle "\n"))) > (defun format-text-calendar-for-display (element) > "Format a text/calendar element parsed by icalendar--read-element into = text" > (let ((fields '(LOCATION ORGANIZER DESCRIPTION)) > (fieldformat "%-11s %s\n") > (content "") > (first-date "") > (last-date "") > (title "")) > (dolist (event (icalendar--all-events element)) > (let* ((zone-map (icalendar--convert-all-timezones element)) > (dtstart-zone (icalendar--find-time-zone (icalendar--get-eve= nt-property-attributes event 'DTSTART) zone-map)) > (dtstart (icalendar--decode-isodatetime (icalendar--get-even= t-property event 'DTSTART) nil dtstart-zone)) > (dtend-zone (icalendar--find-time-zone (icalendar--get-event= -property-attributes event 'DTEND) zone-map)) > (dtend (icalendar--decode-isodatetime (icalendar--get-even= t-property event 'DTEND) nil dtend-zone)) > (datestring (concat (icalendar--datetime-to-iso-date dtstart= "-") " " > (icalendar--datetime-to-colontime dtstar= t) "-" > (icalendar--datetime-to-colontime dtend)= ))) > (when (string-equal first-date "") > (setq first-date datestring)) > (setq last-date datestring) > (dolist (field fields) > (let ((propertyvalue (mapconcat (lambda (property) > (icalendar--convert-string-fo= r-import property) > (replace-regexp-in-string "\\= \\n" "\n" > (re= place-regexp-in-string "^MAILTO:" "" property))) > (icalendar--get-event-propertie= s event field) " "))) > (when (not (string-equal propertyvalue "")) > (setq content (concat content (format fieldformat field (re= place-regexp-in-string "\\\\ " "" propertyvalue))))))))) > (setq content (replace-regexp-in-string "\n\n$" "" content)) > (setq title (if (string-equal first-date last-date) first-date (conca= t first-date " ... " last-date))) > (list content title))) > I hope some of it is useful. > Best regards, > Adam --=20 app: https://alpha.app.net/haleyscomet net: https://identi.ca/vinylisl git: https://github.com/dhaley irc: dkh on #drupal-colorado/irc/freenode.net