summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2018-05-13 23:27:39 -0600
committerEduardo Chappa <chappa@washington.edu>2018-05-13 23:27:39 -0600
commitae4bbcf4e8bb991ad3106ff0d7799276912c5815 (patch)
tree9d97791fdc05afd560be33c9d46bfffaaa42739b
parentaac7b10863bcfabe936feb5151e7e11123e13306 (diff)
downloadalpine-ae4bbcf4e8bb991ad3106ff0d7799276912c5815.tar.xz
* For a calendar entry with method PUBLISH, we show all entries in the calendar.
When "More Details" is selected for each individual event, the description of that entry is shown only. When the calendar is opened from the view attachment list screen, all entries will be shown. Mske sure there are no memory leaks. * Reverse some of the changes to make valgrind happy, as this may make Alpine crash by using memory that was released.
-rw-r--r--alpine/mailpart.c286
-rw-r--r--alpine/mailpart.h3
-rw-r--r--alpine/mailview.c6
-rw-r--r--alpine/send.c7
-rw-r--r--imap/src/osdep/unix/ssl_unix.c4
-rw-r--r--pith/handle.h8
-rw-r--r--pith/ical.c345
-rw-r--r--pith/icaltype.h4
-rw-r--r--pith/mailview.c319
-rw-r--r--pith/send.c14
10 files changed, 532 insertions, 464 deletions
diff --git a/alpine/mailpart.c b/alpine/mailpart.c
index 392c76c4..68c69b9e 100644
--- a/alpine/mailpart.c
+++ b/alpine/mailpart.c
@@ -2886,21 +2886,21 @@ display_vcard_att(long int msgno, ATTACH_S *a, int flags)
}
void
-display_vcalendar_att(long int msgno, ATTACH_S *a, int flags)
+display_vevent_summary(long int msgno, ATTACH_S *a, int flags, int depth)
{
BODY *b;
VCALENDAR_S *vcal = NULL;
char *b64text, *caltext;
unsigned long callen;
+ VEVENT_SUMMARY_S *vesy, *vsummary; /* vevent summary */
STORE_S *in_store, *out_store = NULL;
HANDLE_S *handles = NULL;
URL_HILITE_S uh;
gf_io_t gc, pc;
char *errstr = NULL, tmp[MAILTMPLEN], *p;
- int cmd, i;
- VEVENT_SUMMARY_S *vesy; /* vevent summary */
-
- b = mail_body (ps_global->mail_stream, msgno, a->number);
+ int cmd, i, k;
+
+ b = mail_body(ps_global->mail_stream, msgno, a->number);
if(b->sparep == NULL){
b64text = mail_fetch_body(ps_global->mail_stream, msgno, a->number, &callen, 0);
b64text[callen] = '\0'; /* chop off cookie */
@@ -2911,9 +2911,9 @@ display_vcalendar_att(long int msgno, ATTACH_S *a, int flags)
else if(get_body_sparep_type(b->sparep) == iCalType)
vcal = (VCALENDAR_S *) get_body_sparep_data(b->sparep);
- vesy = ical_vevent_summary(vcal);
+ vsummary = ical_vevent_summary(vcal);
- if(vesy == NULL){
+ if(vsummary == NULL){
q_status_message(SM_ORDER | SM_DING, 3, 3,
_("Error parsing event"));
return;
@@ -2921,180 +2921,204 @@ display_vcalendar_att(long int msgno, ATTACH_S *a, int flags)
if(!(in_store = so_get(CharStar, NULL, EDIT_ACCESS))){
q_status_message(SM_ORDER | SM_DING, 3, 3,
- _("Error allocating space for Calendar"));
+ _("Error allocating space to process Calendar"));
return;
}
- if(vesy->cancel){
- so_puts(in_store, _("This event was cancelled"));
- so_puts(in_store, "\015\012");
+ if((out_store = so_get(CharStar, NULL, EDIT_ACCESS)) == NULL){
+ q_status_message(SM_ORDER | SM_DING, 3, 3,
+ _("Error allocating space to write Calendar"));
+ return;
}
- if(vesy->priority){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%d %s",
- _("Priority: "), vesy->priority,
- vesy->priority == 5 ? _("(Normal)")
+ gf_set_so_readc(&gc, in_store);
+ gf_set_so_writec(&pc, out_store);
+
+ for(vesy = vsummary, k = 0; vesy; vesy = vesy->next, k++){
+ if(depth >= 0 && k != depth)
+ continue;
+
+ if(vesy->cancel){
+ so_puts(in_store, _("This event was cancelled"));
+ so_puts(in_store, "\015\012");
+ }
+
+ if(vesy->priority){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%d %s",
+ _("Priority: "), vesy->priority,
+ vesy->priority == 5 ? _("(Normal)")
: (vesy->priority < 5 ? _("(High)")
: _("(Low)")));
- so_puts(in_store, tmp_20k_buf);
- so_puts(in_store, "\015\012");
- }
-
- if(vesy->summary){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
- _("Summary: "), vesy->summary);
- so_puts(in_store, tmp_20k_buf);
- so_puts(in_store, "\015\012");
- }
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
- if(vesy->sender){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
- _("Sender: "), vesy->sender);
- so_puts(in_store, tmp_20k_buf);
- so_puts(in_store, "\015\012");
- }
+ if(vesy->summary){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
+ _("Summary: "), vesy->summary);
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
- if(vesy->organizer){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
- _("Organizer: "), vesy->organizer);
- so_puts(in_store, tmp_20k_buf);
- so_puts(in_store, "\015\012");
- }
+ if(vesy->sender){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
+ _("Sender: "), vesy->sender);
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
- if(vesy->location){
- ical_remove_escapes(&vesy->location);
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
- _("Location: "), vesy->location);
- so_puts(in_store, tmp_20k_buf);
- so_puts(in_store, "\015\012");
- }
+ if(vesy->organizer){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
+ _("Organizer: "), vesy->organizer);
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
- if(vesy->evstart){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
- _("Start Date: "), vesy->evstart);
- so_puts(in_store, tmp_20k_buf);
- so_puts(in_store, "\015\012");
- }
+ if(vesy->location){
+ ical_remove_escapes(&vesy->location);
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
+ _("Location: "), vesy->location);
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
- if(vesy->duration){
- for(i = 0; vesy->duration[i] != NULL; i++){
+ if(vesy->evstart){
utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
- _("Duration: "), vesy->duration[i]);
+ _("Start Date: "), vesy->evstart);
so_puts(in_store, tmp_20k_buf);
so_puts(in_store, "\015\012");
- }
- } else if(vesy->evend){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
- _("End Date: "), vesy->evend);
- so_puts(in_store, tmp_20k_buf);
- so_puts(in_store, "\015\012");
- }
+ }
+
+ if(vesy->duration){
+ for(i = 0; vesy->duration[i] != NULL; i++){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
+ _("Duration: "), vesy->duration[i]);
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
+ } else if(vesy->evend){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
+ _("End Date: "), vesy->evend);
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
- if(vesy->dtstamp){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
- vcal->method ? _("Created on: ") : _("Last Revised on; "),
- vesy->dtstamp);
- so_puts(in_store, tmp_20k_buf);
- so_puts(in_store, "\015\012");
- }
+ if(vesy->dtstamp){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
+ vcal->method ? _("Created on: ") : _("Last Revised on; "),
+ vesy->dtstamp);
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
- if(vesy->description){
- char c;
- int j, empty;
+ if(vesy->description){
+ char c;
+ int j, empty;
- so_puts(in_store, "\015\012");
+ so_puts(in_store, "\015\012");
- for(i = 0; vesy->description[i] != NULL; i++){
- so_puts(in_store, _("Description: "));
- /* Check if empty description */
- empty = 1;
- for(j =0; empty == 1 && vesy->description[i][j] != '\0'; j++){
- c = vesy->description[i][j];
- if(c != '\n' && c != ' ' && c != '\t')
- empty = 0;
- }
- if(empty){
- so_puts(in_store, _("[ No description provided ]"));
- so_puts(in_store, "\015\012");
- }
- else {
- for(j =0; vesy->description[i][j] != '\0'; j++){
- c = vesy->description[i][j];
- if(c == '\n'){
- so_puts(in_store, "\015\012");
- continue;
+ for(i = 0; vesy->description[i] != NULL; i++){
+ so_puts(in_store, _("Description: "));
+ /* Check if empty description */
+ empty = 1;
+ for(j =0; empty == 1 && vesy->description[i][j] != '\0'; j++){
+ c = vesy->description[i][j];
+ if(c != '\n' && c != ' ' && c != '\t')
+ empty = 0;
+ }
+ if(empty){
+ so_puts(in_store, _("[ No description provided ]"));
+ so_puts(in_store, "\015\012");
+ }
+ else {
+ for(j =0; vesy->description[i][j] != '\0'; j++){
+ c = vesy->description[i][j];
+ if(c == '\n'){
+ so_puts(in_store, "\015\012");
+ continue;
+ }
+ so_writec(c, in_store);
}
- so_writec(c, in_store);
- }
- }
- so_puts(in_store, "\015\012");
- }
- }
+ }
+ so_puts(in_store, "\015\012");
+ }
+ }
- if(vesy->attendee){
- so_puts(in_store, "\015\012");
- so_puts(in_store, _("List of Attendees:"));
- so_puts(in_store, "\015\012");
- for(i = 0; vesy->attendee[i] != NULL; i++){
- so_puts(in_store, vesy->attendee[i]);
+ if(vesy->attendee){
so_puts(in_store, "\015\012");
- }
- }
+ so_puts(in_store, _("List of Attendees:"));
+ so_puts(in_store, "\015\012");
+ for(i = 0; vesy->attendee[i] != NULL; i++){
+ so_puts(in_store, vesy->attendee[i]);
+ so_puts(in_store, "\015\012");
+ }
+ so_puts(in_store, "\015\012");
+ }
- so_puts(in_store, "\015\012\015\012");
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF,
+ _("This event was tagged as a %s entry by the sender"), vesy->class);
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012\015\012");
+
+ if(depth < 0 && vesy->next){
+ for(i = 0; i < ps_global->ttyo->screen_cols && i < 40; i++)
+ tmp_20k_buf[i] = '-';
+ tmp_20k_buf[i]= '\0';
+ so_puts(in_store, tmp_20k_buf);
+ so_puts(in_store, "\015\012");
+ }
+ } /* end "for" loop */
do{
- if((out_store = so_get(CharStar, NULL, EDIT_ACCESS)) != NULL){
- so_seek(in_store, 0L, 0);
+ so_seek(in_store, 0L, 0);
- init_handles(&handles);
- gf_filter_init();
+ init_handles(&handles);
+ gf_filter_init();
- if(F_ON(F_VIEW_SEL_URL, ps_global)
+ if(F_ON(F_VIEW_SEL_URL, ps_global)
|| F_ON(F_VIEW_SEL_URL_HOST, ps_global)
|| F_ON(F_SCAN_ADDR, ps_global))
gf_link_filter(gf_line_test,
gf_line_test_opt(url_hilite,
gf_url_hilite_opt(&uh,&handles,0)));
- gf_link_filter(gf_wrap,
+ gf_link_filter(gf_wrap,
gf_wrap_filter_opt(ps_global->ttyo->screen_cols - 4,
ps_global->ttyo->screen_cols,
NULL, 0, GFW_HANDLES));
- gf_link_filter(gf_nvtnl_local, NULL);
+ gf_link_filter(gf_nvtnl_local, NULL);
- gf_set_so_readc(&gc, in_store);
- gf_set_so_writec(&pc, out_store);
+ gf_set_so_readc(&gc, in_store);
+ gf_set_so_writec(&pc, out_store);
- errstr = gf_pipe(gc, pc);
+ errstr = gf_pipe(gc, pc);
- gf_clear_so_readc(in_store);
-
- if(!errstr){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF,
- _("This event was tagged as a %s entry by the sender"), vesy->class);
- errstr = format_editorial(tmp_20k_buf, ps_global->ttyo->screen_cols, 0, NULL, pc);
- }
+ gf_clear_so_readc(in_store);
- gf_clear_so_writec(out_store);
+ gf_clear_so_writec(out_store);
- if(!errstr)
- cmd = scroll_attachment(_("CALENDAR EVENT ATTACHMENT"), out_store,
+ if(!errstr)
+ cmd = scroll_attachment(_("CALENDAR EVENT ATTACHMENT"), out_store,
CharStar, handles, a, flags | DA_RESIZE);
- free_handles(&handles);
- so_give(&out_store);
- }
- else
- errstr = _("Error allocating space");
+ free_handles(&handles);
+ so_give(&out_store);
}
while(!errstr && (cmd == MC_RESIZE || cmd == MC_FULLHDR));
if(errstr)
q_status_message1(SM_ORDER | SM_DING, 3, 3,
_("Can't format entry : %s"), errstr);
-
so_give(&in_store);
+ free_vevent_summary(&vsummary);
+ ps_global->mangled_screen = 1;
+}
+
+
+void
+display_vcalendar_att(long int msgno, ATTACH_S *a, int flags)
+{
+ display_vevent_summary(msgno, a, flags, -1);
}
diff --git a/alpine/mailpart.h b/alpine/mailpart.h
index 86906229..ee9e6382 100644
--- a/alpine/mailpart.h
+++ b/alpine/mailpart.h
@@ -21,7 +21,7 @@
#include "../pith/mailpart.h"
#include "context.h"
#include "../pith/state.h"
-
+#include "../pith/icaltype.h"
#define DA_SAVE 0x01 /* flags used by display_attachment */
#define DA_FROM_VIEW 0x02 /* see mailpart.c */
@@ -34,6 +34,7 @@ void attachment_screen(struct pine *);
void write_attachment(int, long, ATTACH_S *, char *);
int write_attachment_to_file(MAILSTREAM *, long, ATTACH_S *, int, char *);
int display_attachment(long, ATTACH_S *, int);
+void display_vevent_summary(long, ATTACH_S *, int, int);
int dispatch_attachment(ATTACH_S *);
#ifdef _WINDOWS
void display_att_window(ATTACH_S *);
diff --git a/alpine/mailview.c b/alpine/mailview.c
index 5a63e90a..b9e9650d 100644
--- a/alpine/mailview.c
+++ b/alpine/mailview.c
@@ -978,6 +978,12 @@ scroll_handle_launch(HANDLE_S *handle, int force)
case Folder :
break;
+ case iCal:
+ display_vevent_summary(mn_m2raw(ps_global->msgmap, mn_get_cur(ps_global->msgmap)),
+ handle->h.ical.attach,
+ DA_FROM_VIEW | DA_DIDPROMPT, handle->h.ical.depth);
+ break;
+
case Function :
(*handle->h.func.f)(handle->h.func.args.stream,
handle->h.func.args.msgmap,
diff --git a/alpine/send.c b/alpine/send.c
index 496824f4..4768a7e5 100644
--- a/alpine/send.c
+++ b/alpine/send.c
@@ -2168,9 +2168,12 @@ pine_send(ENVELOPE *outgoing, struct mail_bodystruct **body,
*he = he_template[index];
pf->name = cpystr(pf_template[index].name);
- if(index == N_SENDER && F_ON(F_USE_SENDER_NOT_X, ps_global))
+ if(index == N_SENDER && F_ON(F_USE_SENDER_NOT_X, ps_global)){
/* slide string over so it is Sender instead of X-X-Sender */
- memmove(pf->name, pf->name+4, strlen(pf->name)-4+1);
+ for(p = pf->name+4; *p != '\0'; p++)
+ *(p-4) = *p;
+ *(p-4) = '\0';
+ }
pf->type = pf_template[index].type;
pf->canedit = pf_template[index].canedit;
pf->rcptto = pf_template[index].rcptto;
diff --git a/imap/src/osdep/unix/ssl_unix.c b/imap/src/osdep/unix/ssl_unix.c
index ea2df896..4c4d6ef8 100644
--- a/imap/src/osdep/unix/ssl_unix.c
+++ b/imap/src/osdep/unix/ssl_unix.c
@@ -404,14 +404,12 @@ static char *ssl_validate_cert (X509 *cert,char *host)
"Server name does not match certificate";
/* if mismatch, see if in extensions */
if (ret && (ext = X509_get_ext_d2i (cert,NID_subject_alt_name,NIL,NIL)) &&
- (n = sk_GENERAL_NAME_num (ext))){
+ (n = sk_GENERAL_NAME_num (ext)))
/* older versions of OpenSSL use "ia5" instead of dNSName */
for (i = 0; ret && (i < n); i++)
if ((name = sk_GENERAL_NAME_value (ext,i)) &&
(name->type = GEN_DNS) && (s = name->d.ia5->data) &&
ssl_compare_hostnames (host,s)) ret = NIL;
- sk_GENERAL_NAME_pop_free(ext, GENERAL_NAME_free);
- }
}
else ret = "Unable to locate common name in certificate";
return ret;
diff --git a/pith/handle.h b/pith/handle.h
index 265c4cc3..53878e45 100644
--- a/pith/handle.h
+++ b/pith/handle.h
@@ -22,7 +22,7 @@
#include "../pith/msgno.h"
#include "../pith/atttype.h"
#include "../pith/util.h"
-
+#include "../pith/icaltype.h"
typedef struct screen_position_list {
Pos where;
@@ -35,7 +35,7 @@ typedef struct screen_position_list {
*/
typedef struct handle_s {
int key; /* tag number embedded in text */
- enum {URL, Attach, Folder, Function, IMG} type;
+ enum {URL, iCal, Attach, Folder, Function, IMG} type;
unsigned force_display:1; /* Don't ask before launching */
unsigned using_is_used:1; /* bit below is being used */
unsigned is_used:1; /* if not, remove it from list */
@@ -54,6 +54,10 @@ typedef struct handle_s {
} img; /* stuff to describe img */
ATTACH_S *attach; /* Attachment struct for this handle */
struct {
+ ATTACH_S *attach; /* full Calendar entry */
+ int depth; /* which event to display */
+ } ical;
+ struct {
int index; /* folder's place in context's list */
CONTEXT_S *context; /* description of folders */
} f; /* stuff to describe Folder handle */
diff --git a/pith/ical.c b/pith/ical.c
index dee78f58..59e8c42c 100644
--- a/pith/ical.c
+++ b/pith/ical.c
@@ -381,6 +381,7 @@ ical_free_vevent(void **veventpv)
ical_free_prop(&(*veventp)->prop, event_prop, EvUnknown);
if((*veventp)->uk_prop) ical_free_gencline((void **) &(*veventp)->uk_prop);
if((*veventp)->valarm) ical_free_valarm((void **) &(*veventp)->valarm);
+ if((*veventp)->next) ical_free_vevent((void **) &(*veventp)->next);
fs_give(veventpv);
}
@@ -518,6 +519,10 @@ char *ical_unfold_line(char *line)
j += 3; /* get past white space */
continue;
}
+ case '\n': if(ical_wspace(line[j+1])){
+ j += 2; /* get past white space */
+ continue;
+ }
default : line[i++] = line[j++];
}
line[i] = '\0';
@@ -834,8 +839,17 @@ ical_parse_vcalendar(char **text)
if(vcal->comp[ical_comp[i].pos] == NULL)
vcal->comp[ical_comp[i].pos] = v;
- else
- (ical_comp[i].give)(&v);
+ else{
+ if((vcal->method && vcal->method->value
+ && strucmp(vcal->method->value, "PUBLISH"))
+ || struncmp(ical_comp[i].comp, "VEVENT", 6))
+ (ical_comp[i].give)(&v);
+ else{
+ VEVENT_S *vevent = (VEVENT_S *) vcal->comp[VEvent];
+ for(; vevent && vevent->next; vevent = vevent->next);
+ vevent->next = v;
+ }
+ }
} else {
v = (void *) ical_parse_unknown_comp(&s, 0);
if(vcal->uk_comp == NULL)
@@ -2154,7 +2168,7 @@ ical_get_tzid(ICAL_PARAMETER_S *param)
VEVENT_SUMMARY_S *
ical_vevent_summary(VCALENDAR_S *vcal)
{
- VEVENT_SUMMARY_S *rv;
+ VEVENT_SUMMARY_S *rv, *vsummary= NULL;
ICLINE_S *method;
VEVENT_S *vevent;
GEN_ICLINE_S *gicl;
@@ -2164,29 +2178,33 @@ ical_vevent_summary(VCALENDAR_S *vcal)
if(vcal == NULL) return NULL;
method = vcal->method;
- vevent = (VEVENT_S *) vcal->comp[VEvent];
+ vevent = (VEVENT_S *) vcal->comp[VEvent];
if(vevent == NULL || vevent->prop == NULL)
return NULL;
- rv = fs_get(sizeof(VEVENT_SUMMARY_S));
- memset((void *) rv, 0, sizeof(VEVENT_SUMMARY_S));
+ for(vevent = (VEVENT_S *) vcal->comp[VEvent];
+ vevent != NULL && vevent->prop != NULL;
+ vevent = vevent->next, rv = rv->next){
+
+ rv = fs_get(sizeof(VEVENT_SUMMARY_S));
+ memset((void *) rv, 0, sizeof(VEVENT_SUMMARY_S));
- if(method != NULL && !strucmp(method->value, "CANCEL"))
- rv->cancel++;
+ if(method != NULL && !strucmp(method->value, "CANCEL"))
+ rv->cancel++;
- if((icl = (ICLINE_S *) vevent->prop[EvPriority]) != NULL)
- rv->priority = atoi(icl->value);
+ if((icl = (ICLINE_S *) vevent->prop[EvPriority]) != NULL)
+ rv->priority = atoi(icl->value);
- if((icl = (ICLINE_S *) vevent->prop[EvSummary]) != NULL)
- rv->summary = cpystr(icl->value ? icl->value : _("No Summary"));
+ if((icl = (ICLINE_S *) vevent->prop[EvSummary]) != NULL)
+ rv->summary = cpystr(icl->value ? icl->value : _("No Summary"));
- if((icl = (ICLINE_S *) vevent->prop[EvClass]) != NULL)
- rv->class = cpystr(icl->value ? icl->value : _("PUBLIC"));
- else
- rv->class = cpystr(_("PUBLIC"));
+ if((icl = (ICLINE_S *) vevent->prop[EvClass]) != NULL)
+ rv->class = cpystr(icl->value ? icl->value : _("PUBLIC"));
+ else
+ rv->class = cpystr(_("PUBLIC"));
- if((icl = (ICLINE_S *) vevent->prop[EvOrganizer]) != NULL){
+ if((icl = (ICLINE_S *) vevent->prop[EvOrganizer]) != NULL){
char *cn, *sender, *address;
ICAL_PARAMETER_S *param;
@@ -2212,22 +2230,22 @@ ical_vevent_summary(VCALENDAR_S *vcal)
address ? address : _("Unknown address"));
rv->organizer = cpystr(tmp_20k_buf);
}
- } /* end of if(organizer) */
-
- if((icl = (ICLINE_S *) vevent->prop[EvLocation]) != NULL)
- rv->location = cpystr(icl->value ? icl->value : _("Location undisclosed"));
-
- if((icl = (ICLINE_S *) vevent->prop[EvDtstart]) != NULL){
- struct tm ic_date;
- char tmp[200], *tzid;
- int icd; /* ical date return value */
-
- memset((void *)&ic_date, 0, sizeof(struct tm));
- icd = ical_parse_date(icl->value, &ic_date);
- tzid = ical_get_tzid(icl->param);
- if(icd >= 0){
- ic_date.tm_wday = ical_day_of_week(ic_date);
- switch(icd){
+ } /* end of if(organizer) */
+
+ if((icl = (ICLINE_S *) vevent->prop[EvLocation]) != NULL)
+ rv->location = cpystr(icl->value ? icl->value : _("Location undisclosed"));
+
+ if((icl = (ICLINE_S *) vevent->prop[EvDtstart]) != NULL){
+ struct tm ic_date;
+ char tmp[200], *tzid;
+ int icd; /* ical date return value */
+
+ memset((void *)&ic_date, 0, sizeof(struct tm));
+ icd = ical_parse_date(icl->value, &ic_date);
+ tzid = ical_get_tzid(icl->param);
+ if(icd >= 0){
+ ic_date.tm_wday = ical_day_of_week(ic_date);
+ switch(icd){
case 0: /* DATE-TIME */
ical_date_time(tmp, sizeof(tmp), &ic_date);
break;
@@ -2239,129 +2257,129 @@ ical_vevent_summary(VCALENDAR_S *vcal)
break;
default: alpine_panic("Unhandled ical date format");
break;
- }
- }
- else{
- strncpy(tmp, _("Error while parsing event date"), sizeof(tmp));
- tmp[sizeof(tmp) - 1] = '\0';
- }
+ }
+ }
+ else{
+ strncpy(tmp, _("Error while parsing event date"), sizeof(tmp));
+ tmp[sizeof(tmp) - 1] = '\0';
+ }
- if(icl->value == NULL)
- rv->evstart = cpystr(_("Unknown Start Date"));
- else{
- size_t len = strlen(tmp) + 1;
+ if(icl->value == NULL)
+ rv->evstart = cpystr(_("Unknown Start Date"));
+ else{
+ size_t len = strlen(tmp) + 1;
- if(tzid != NULL)
- len += strlen(tzid) + 3; /* 3 = strlen(" ()") */
+ if(tzid != NULL)
+ len += strlen(tzid) + 3; /* 3 = strlen(" ()") */
- rv->evstart = fs_get(len*sizeof(char));
- snprintf(rv->evstart, len, "%s%s%s%s", tmp,
+ rv->evstart = fs_get(len*sizeof(char));
+ snprintf(rv->evstart, len, "%s%s%s%s", tmp,
tzid != NULL ? " (" : "",
tzid != NULL ? tzid : "",
tzid != NULL ? ")" : "");
- rv->evstart[len-1] = '\0';
- }
- if(tzid)
- fs_give((void **)&tzid);
- } /* end of if dtstart */
-
- if((icl = (ICLINE_S *) vevent->prop[EvDuration]) != NULL){
- int i, done = 0;
- ICAL_DURATION_S ic_d, icd2;
- if(ical_parse_duration(icl->value, &ic_d) == 0){
- char tmp[MAILTMPLEN+1];
-
- for(i = 1, icd2 = ic_d; icd2.next != NULL; icd2 = *icd2.next, i++);
- rv->duration = fs_get((i+1)*sizeof(char *));
- i = 0;
-
- do {
- tmp[0] = '\0';
-
- if(ic_d.weeks > 0)
- utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
+ rv->evstart[len-1] = '\0';
+ }
+ if(tzid)
+ fs_give((void **)&tzid);
+ } /* end of if dtstart */
+
+ if((icl = (ICLINE_S *) vevent->prop[EvDuration]) != NULL){
+ int i, done = 0;
+ ICAL_DURATION_S ic_d, icd2;
+ if(ical_parse_duration(icl->value, &ic_d) == 0){
+ char tmp[MAILTMPLEN+1];
+
+ for(i = 1, icd2 = ic_d; icd2.next != NULL; icd2 = *icd2.next, i++);
+ rv->duration = fs_get((i+1)*sizeof(char *));
+ i = 0;
+
+ do {
+ tmp[0] = '\0';
+
+ if(ic_d.weeks > 0)
+ utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
"%d %s ", ic_d.weeks, ic_d.weeks == 1 ? _("week") : _("weeks"));
- if(ic_d.days > 0)
- utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
+ if(ic_d.days > 0)
+ utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
"%d %s ", ic_d.days, ic_d.days == 1 ? _("day") : _("days"));
- if(ic_d.hours > 0)
- utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
+ if(ic_d.hours > 0)
+ utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
"%d %s ", ic_d.hours, ic_d.hours == 1 ? _("hour") : _("hours"));
- if(ic_d.minutes > 0)
- utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
+ if(ic_d.minutes > 0)
+ utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
"%d %s ", ic_d.minutes, ic_d.minutes == 1 ? _("minute") : _("minutes"));
- if(ic_d.seconds > 0)
- utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
+ if(ic_d.seconds > 0)
+ utf8_snprintf(tmp+strlen(tmp), MAILTMPLEN - strlen(tmp),
"%d %s ", ic_d.seconds, ic_d.seconds == 1 ? _("second") : _("seconds"));
- tmp[MAILTMPLEN] = '\0';
- rv->duration[i++] = cpystr(tmp);
-
- if(ic_d.next != NULL)
- ic_d = *ic_d.next;
- else
- done++;
- } while (done == 0);
- rv->duration[i] = NULL;
- }
- } /* end of DURATION */
- else if((icl = (ICLINE_S *) vevent->prop[EvDtend]) != NULL){
- struct tm ic_date;
- char tmp[200], *tzid;
- int icd;
-
- memset((void *)&ic_date, 0, sizeof(struct tm));
- icd = ical_parse_date(icl->value, &ic_date);
- tzid = ical_get_tzid(icl->param);
- if(icd >= 0){
- ic_date.tm_wday = ical_day_of_week(ic_date);
- switch(icd){
- case 0: /* DATE-TIME */
- ical_date_time(tmp, sizeof(tmp), &ic_date);
- break;
- case 1: /* DATE */
- our_strftime(tmp, sizeof(tmp), "%a %x", &ic_date);
- break;
- case 2: /* DATE-TIME in GMT, Bug: add adjust to time zone */
- our_strftime(tmp, sizeof(tmp), "%a %x %I:%M %p", &ic_date);
- break;
- default: alpine_panic("Unhandled ical date format");
- break;
- }
- }
- else{
- strncpy(tmp, _("Error while parsing event date"), sizeof(tmp));
- tmp[sizeof(tmp) - 1] = '\0';
- }
+ tmp[MAILTMPLEN] = '\0';
+ rv->duration[i++] = cpystr(tmp);
+
+ if(ic_d.next != NULL)
+ ic_d = *ic_d.next;
+ else
+ done++;
+ } while (done == 0);
+ rv->duration[i] = NULL;
+ }
+ } /* end of DURATION */
+ else if((icl = (ICLINE_S *) vevent->prop[EvDtend]) != NULL){
+ struct tm ic_date;
+ char tmp[200], *tzid;
+ int icd;
+
+ memset((void *)&ic_date, 0, sizeof(struct tm));
+ icd = ical_parse_date(icl->value, &ic_date);
+ tzid = ical_get_tzid(icl->param);
+ if(icd >= 0){
+ ic_date.tm_wday = ical_day_of_week(ic_date);
+ switch(icd){
+ case 0: /* DATE-TIME */
+ ical_date_time(tmp, sizeof(tmp), &ic_date);
+ break;
+ case 1: /* DATE */
+ our_strftime(tmp, sizeof(tmp), "%a %x", &ic_date);
+ break;
+ case 2: /* DATE-TIME in GMT, Bug: add adjust to time zone */
+ our_strftime(tmp, sizeof(tmp), "%a %x %I:%M %p", &ic_date);
+ break;
+ default: alpine_panic("Unhandled ical date format");
+ break;
+ }
+ }
+ else{
+ strncpy(tmp, _("Error while parsing event date"), sizeof(tmp));
+ tmp[sizeof(tmp) - 1] = '\0';
+ }
- if(icl->value == NULL)
- rv->evend = cpystr(_("Unknown End Date"));
- else{
- size_t len = strlen(tmp) + 1;
+ if(icl->value == NULL)
+ rv->evend = cpystr(_("Unknown End Date"));
+ else{
+ size_t len = strlen(tmp) + 1;
- if(tzid != NULL)
- len += strlen(tzid) + 3; /* 3 = strlen(" ()") */
+ if(tzid != NULL)
+ len += strlen(tzid) + 3; /* 3 = strlen(" ()") */
- rv->evend = fs_get(len*sizeof(char));
- snprintf(rv->evend, len, "%s%s%s%s", tmp,
+ rv->evend = fs_get(len*sizeof(char));
+ snprintf(rv->evend, len, "%s%s%s%s", tmp,
tzid != NULL ? " (" : "",
tzid != NULL ? tzid : "",
tzid != NULL ? ")" : "");
- rv->evend[len-1] = '\0';
- }
- if(tzid)
- fs_give((void **)&tzid);
- } /* end of if dtend */
-
- if((icl = (ICLINE_S *) vevent->prop[EvDtstamp]) != NULL){
- struct tm ic_date;
- char tmp[200], *tzid;
- int icd;
-
- memset((void *)&ic_date, 0, sizeof(struct tm));
- icd = ical_parse_date(icl->value, &ic_date);
- tzid = ical_get_tzid(icl->param);
- if(icd >= 0){
+ rv->evend[len-1] = '\0';
+ }
+ if(tzid)
+ fs_give((void **)&tzid);
+ } /* end of if dtend */
+
+ if((icl = (ICLINE_S *) vevent->prop[EvDtstamp]) != NULL){
+ struct tm ic_date;
+ char tmp[200], *tzid;
+ int icd;
+
+ memset((void *)&ic_date, 0, sizeof(struct tm));
+ icd = ical_parse_date(icl->value, &ic_date);
+ tzid = ical_get_tzid(icl->param);
+ if(icd >= 0){
ic_date.tm_wday = ical_day_of_week(ic_date);
switch(icd){
case 0: /* DATE-TIME */
@@ -2376,29 +2394,29 @@ ical_vevent_summary(VCALENDAR_S *vcal)
default: alpine_panic("Unhandled ical date format");
break;
}
- }
- else{
+ }
+ else{
strncpy(tmp, _("Error while parsing event date"), sizeof(tmp));
tmp[sizeof(tmp) - 1] = '\0';
- }
- if(icl->value == NULL)
- rv->dtstamp = cpystr(_("Unknown when event was scheduled"));
- else{
- size_t len = strlen(tmp) + 1;
+ }
+ if(icl->value == NULL)
+ rv->dtstamp = cpystr(_("Unknown when event was scheduled"));
+ else{
+ size_t len = strlen(tmp) + 1;
- if(tzid != NULL)
+ if(tzid != NULL)
len += strlen(tzid) + 3; /* 3 = strlen(" ()") */
- rv->dtstamp = fs_get(len*sizeof(char));
- snprintf(rv->dtstamp, len, "%s%s%s%s", tmp,
+ rv->dtstamp = fs_get(len*sizeof(char));
+ snprintf(rv->dtstamp, len, "%s%s%s%s", tmp,
tzid != NULL ? " (" : "",
tzid != NULL ? tzid : "",
tzid != NULL ? ")" : "");
- rv->dtstamp[len-1] = '\0';
- }
- } /* end of if dtstamp */
+ rv->dtstamp[len-1] = '\0';
+ }
+ } /* end of if dtstamp */
- if((gicl = (GEN_ICLINE_S *) vevent->prop[EvAttendee]) != NULL){
+ if((gicl = (GEN_ICLINE_S *) vevent->prop[EvAttendee]) != NULL){
int nattendees, i;
for(nattendees = 0; gicl != NULL; gicl = gicl->next, nattendees++);
@@ -2459,15 +2477,15 @@ ical_vevent_summary(VCALENDAR_S *vcal)
rv->attendee[i] = cpystr(tmp_20k_buf);
}
rv->attendee[i] = NULL;
- } /* end of ATTENDEES */
+ } /* end of ATTENDEES */
- if((icl = (ICLINE_S *) vevent->prop[EvDescription]) != NULL){
+ if((icl = (ICLINE_S *) vevent->prop[EvDescription]) != NULL){
char *s, *t, *u, *v;
int i, escaped;
if(icl->value == NULL){
free_vevent_summary(&rv);
- return NULL;
+ return vsummary;
}
v = cpystr(icl->value); /* process a copy of icl->value */
@@ -2478,7 +2496,7 @@ ical_vevent_summary(VCALENDAR_S *vcal)
if(!(*s == '\\' || *s == ',' || *s == 'n' || *s == 'N' || *s == ';')){
free_vevent_summary(&rv);
fs_give((void **)&v);
- return NULL;
+ return vsummary;
}
escaped = 0;
continue;
@@ -2519,9 +2537,17 @@ ical_vevent_summary(VCALENDAR_S *vcal)
rv->description[i++] = cpystr(ical_decode(s, vcal->encoding));
rv->description[i] = NULL;
fs_give((void **)&v);
- } /* end of if(description) */
-
- return rv;
+ } /* end of if(description) */
+ /* last instruction of the loop */
+ if(vsummary == NULL)
+ vsummary = rv;
+ else{
+ VEVENT_SUMMARY_S *vesy;
+ for(vesy = vsummary; vesy && vesy->next; vesy = vesy->next);
+ vesy->next = rv;
+ }
+ } /* end of "for" loop */
+ return vsummary;
}
void
@@ -2553,6 +2579,7 @@ free_vevent_summary(VEVENT_SUMMARY_S **vesy)
fs_give((void **) &(*vesy)->description[i]);
fs_give((void **) &(*vesy)->description);
}
+ if((*vesy)->next) free_vevent_summary(&(*vesy)->next);
fs_give((void **) vesy);
}
diff --git a/pith/icaltype.h b/pith/icaltype.h
index d0670037..0ccea92d 100644
--- a/pith/icaltype.h
+++ b/pith/icaltype.h
@@ -129,7 +129,8 @@ typedef struct vevent_s {
#endif /* if 0 */
void **prop; /* the properties of an event component */
GEN_ICLINE_S *uk_prop; /* unknown values */
- VALARM_S *valarm; /* possible valarm */
+ VALARM_S *valarm; /* possible valarm */
+ struct vevent_s *next; /* calendar of method publish has many events */
} VEVENT_S;
typedef struct vtodo_s {
@@ -443,6 +444,7 @@ typedef struct vevent_summary_s {
char **duration;
char **attendee;
unsigned char **description;
+ struct vevent_summary_s *next;
} VEVENT_SUMMARY_S;
typedef enum {VCalendar = 0, VTimeZone, VEvent, VTodo, VJournal,
diff --git a/pith/mailview.c b/pith/mailview.c
index 39fcfff6..c438371c 100644
--- a/pith/mailview.c
+++ b/pith/mailview.c
@@ -224,90 +224,90 @@ void
format_calendar_vevent(VCALENDAR_S *vcal, ATTACH_S *a, HANDLE_S **handlesp, int flgs, int width, gf_io_t pc, int cflags)
{
int avail, m1, m2, hwid, i, partwid, padwid;
- int s1, s2, dwid;
+ int s1, s2, dwid, minkey;
int *margin;
char padding[1024];
- VEVENT_SUMMARY_S *vesy; /* vevent summary */
+ VEVENT_SUMMARY_S *vesy, *vesummary; /* vevent summary */
- vesy = ical_vevent_summary(vcal);
+ vesummary = vesy = ical_vevent_summary(vcal);
if(vesy == NULL) return;
if((cflags & FC_SUMMARY) && (cflags & FC_FULL))
cflags |= ~FC_FULL;
- avail = width;
- margin = (cflags & FC_FULL) ? NULL
+ minkey = -1; /* initialize to something negative */
+
+ for(; vesy != NULL ; vesy = vesy->next){
+ avail = width;
+ margin = (cflags & FC_FULL) ? NULL
: (flgs & FM_NOINDENT) ? NULL : format_view_margin();
- m1 = MAX(MIN(margin ? margin[0] : 0, avail), 0);
- avail -= m1;
+ m1 = MAX(MIN(margin ? margin[0] : 0, avail), 0);
+ avail -= m1;
- m2 = MAX(MIN(margin ? margin[1] : 0, avail), 0);
- avail -= m2;
+ m2 = MAX(MIN(margin ? margin[1] : 0, avail), 0);
+ avail -= m2;
- hwid = MAX(avail, 0);
- padwid = 0;
+ hwid = MAX(avail, 0);
+ padwid = 0;
- if(ps_global->atmts[1].description == NULL){
-// && (!ps_global->atmts[0].body
-// || (ps_global->atmts[0].body->type == TYPETEXT))){
- avail = width - m1 -2;
+ if(ps_global->atmts[1].description == NULL){
+ avail = width - m1 -2;
- dwid = MAX(MIN(40, avail), 0);
+ dwid = MAX(MIN(40, avail), 0);
- snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s%s", m1, m1, "",
+ snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s%s", m1, m1, "",
repeat_char(dwid, '-'));
- if(!gf_puts(tmp_20k_buf, pc) || !gf_puts(NEWLINE, pc))
+ if(!gf_puts(tmp_20k_buf, pc) || !gf_puts(NEWLINE, pc))
return;
- }
+ }
- if(cflags & FC_SUMMARY){
- i = utf8_width(_("Calendar Entry:"));
- partwid = MIN(i, hwid);
- if(m1 > 0){
+ if(cflags & FC_SUMMARY){
+ i = utf8_width(_("Calendar Entry:"));
+ partwid = MIN(i, hwid);
+ if(m1 > 0){
snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s", m1, m1, "");
if(!gf_puts(tmp_20k_buf, pc))
return;
- }
+ }
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%-*.*w%*.*s",
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%-*.*w%*.*s",
partwid, partwid, _("Calendar Entry:"),
padwid, padwid, "");
if(!gf_puts(tmp_20k_buf, pc) || !gf_puts(NEWLINE, pc))
return;
- }
- else
- partwid = 0;
-
- if(m1 > 0){
- snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s", m1, m1, "");
- if(!gf_puts(tmp_20k_buf, pc))
- return;
- }
+ }
+ else
+ partwid = 0;
- avail = width - m1 - m2;
+ if(m1 > 0){
+ snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s", m1, m1, "");
+ if(!gf_puts(tmp_20k_buf, pc))
+ return;
+ }
- s1 = MAX(MIN(1, avail), 0);
- avail -= s1;
+ avail = width - m1 - m2;
- dwid = MAX(MIN(1, avail), 0);
- avail -= dwid;
+ s1 = MAX(MIN(1, avail), 0);
+ avail -= s1;
- s2 = MAX(MIN(1, avail), 0);
- avail -= s2;
+ dwid = MAX(MIN(1, avail), 0);
+ avail -= dwid;
+ s2 = MAX(MIN(1, avail), 0);
+ avail -= s2;
- if(cflags & FC_SUMMARY)
- utf8_snprintf(padding, sizeof(padding), "%*.*s%*.*w%*.*s",
+ if(cflags & FC_SUMMARY)
+ utf8_snprintf(padding, sizeof(padding), "%*.*s%*.*w%*.*s",
s1, s1, "", dwid, dwid, "", s2, s2, "");
- else
- padding[0] = '\0';
+ else
+ padding[0] = '\0';
- if(vesy->cancel){
+ if(vesy->cancel){
utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
padding, _("This event was cancelled!"));
if((*pc)(TAG_EMBED) && (*pc)(TAG_BOLDON)){
@@ -316,60 +316,60 @@ format_calendar_vevent(VCALENDAR_S *vcal, ATTACH_S *a, HANDLE_S **handlesp, int
(*pc)(TAG_EMBED);
(*pc)(TAG_BOLDOFF);
}
- }
+ }
- if(vesy->organizer){
- if(vesy->sender != NULL){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
+ if(vesy->organizer){
+ if(vesy->sender != NULL){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
padding, _("Sent-by: "), vesy->sender);
- gf_puts(tmp_20k_buf, pc);
- gf_puts(NEWLINE, pc);
- }
-
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
- padding, _("Organizer: "), vesy->organizer);
- gf_puts(tmp_20k_buf, pc);
- gf_puts(NEWLINE, pc);
- } /* end of if(organizer) */
-
- if(vesy->location){
- ical_remove_escapes(&vesy->location);
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
+ gf_puts(tmp_20k_buf, pc);
+ gf_puts(NEWLINE, pc);
+ }
+
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
+ padding, _("Organizer: "), vesy->organizer);
+ gf_puts(tmp_20k_buf, pc);
+ gf_puts(NEWLINE, pc);
+ } /* end of if(organizer) */
+
+ if(vesy->location){
+ ical_remove_escapes(&vesy->location);
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
padding, _("Location: "), vesy->location);
- gf_puts(tmp_20k_buf, pc);
- gf_puts(NEWLINE, pc);
- } /* end of if location */
+ gf_puts(tmp_20k_buf, pc);
+ gf_puts(NEWLINE, pc);
+ } /* end of if location */
- if(vesy->evstart){
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
+ if(vesy->evstart){
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
padding, _("Start Date: "), vesy->evstart);
- gf_puts(tmp_20k_buf, pc);
- gf_puts(NEWLINE, pc);
- } /* end of if dtstart */
+ gf_puts(tmp_20k_buf, pc);
+ gf_puts(NEWLINE, pc);
+ } /* end of if dtstart */
- if(vesy->duration){
- int i;
+ if(vesy->duration){
+ int i;
- for(i = 0; vesy->duration[i] != NULL; i++){
+ for(i = 0; vesy->duration[i] != NULL; i++){
utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
padding, _("Duration: "), vesy->duration[i]);
gf_puts(tmp_20k_buf, pc);
gf_puts(NEWLINE, pc);
- }
- } /* end of DURATION */
- else if(vesy->evend){
+ }
+ } /* end of DURATION */
+ else if(vesy->evend){
utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s%s",
padding, _("End Date: "), vesy->evend);
gf_puts(tmp_20k_buf, pc);
gf_puts(NEWLINE, pc);
- } else { /* end of if dtend */
+ } else { /* end of if dtend */
utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%s%s",
padding, _("No duration nor end time found for this event"));
gf_puts(tmp_20k_buf, pc);
gf_puts(NEWLINE, pc);
- } /* end of else for if (duration) and if (dtend) */
+ } /* end of else for if (duration) and if (dtend) */
- if(vesy->attendee){
+ if(vesy->attendee){
#define MAX_DISPLAYED 3
int i;
@@ -383,109 +383,114 @@ format_calendar_vevent(VCALENDAR_S *vcal, ATTACH_S *a, HANDLE_S **handlesp, int
gf_puts(tmp_20k_buf, pc);
gf_puts(NEWLINE, pc);
}
- if(cflags & FC_SUMMARY){
- COLOR_PAIR *lastc = NULL;
- char numbuf[50];
- int thisdescwid;
- COLOR_PAIR *hdrcolor = NULL;
+ } /* end of ATTENDEES */
- if((flgs & FM_DISPLAY)
- && !(flgs & FM_NOCOLOR)
- && pico_usingcolor()
- && ps_global->VAR_HEADER_GENERAL_FORE_COLOR
- && ps_global->VAR_HEADER_GENERAL_BACK_COLOR
- && ps_global->VAR_NORM_FORE_COLOR
- && ps_global->VAR_NORM_BACK_COLOR
- && (colorcmp(ps_global->VAR_HEADER_GENERAL_FORE_COLOR,
+
+ if(cflags & FC_SUMMARY){
+ COLOR_PAIR *lastc = NULL;
+ char numbuf[50];
+ int thisdescwid;
+ COLOR_PAIR *hdrcolor = NULL;
+
+ if((flgs & FM_DISPLAY)
+ && !(flgs & FM_NOCOLOR)
+ && pico_usingcolor()
+ && ps_global->VAR_HEADER_GENERAL_FORE_COLOR
+ && ps_global->VAR_HEADER_GENERAL_BACK_COLOR
+ && ps_global->VAR_NORM_FORE_COLOR
+ && ps_global->VAR_NORM_BACK_COLOR
+ && (colorcmp(ps_global->VAR_HEADER_GENERAL_FORE_COLOR,
ps_global->VAR_NORM_FORE_COLOR)
|| colorcmp(ps_global->VAR_HEADER_GENERAL_BACK_COLOR,
- ps_global->VAR_NORM_BACK_COLOR))){
+ ps_global->VAR_NORM_BACK_COLOR))){
- if((hdrcolor = new_color_pair(ps_global->VAR_HEADER_GENERAL_FORE_COLOR,
+ if((hdrcolor = new_color_pair(ps_global->VAR_HEADER_GENERAL_FORE_COLOR,
ps_global->VAR_HEADER_GENERAL_BACK_COLOR)) != NULL){
- if(!pico_is_good_colorpair(hdrcolor))
- free_color_pair(&hdrcolor);
- }
+ if(!pico_is_good_colorpair(hdrcolor))
+ free_color_pair(&hdrcolor);
}
+ }
- if(!(!hdrcolor || embed_color(hdrcolor, pc)))
- return;
-
- gf_puts(padding, pc);
- utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "[%s]", _("More Details"));
-
- if(handlesp){
- char buf[16], color[64];
- int l;
- HANDLE_S *h;
-
- h = new_handle(handlesp);
- h->type = Attach;
- h->h.attach = a;
-
- snprintf(buf, sizeof(buf), "%d", h->key);
- buf[sizeof(buf)-1] = '\0';
-
- if(!(flgs & FM_NOCOLOR)
- && handle_start_color(color, sizeof(color), &l, 1)){
- lastc = get_cur_embedded_color();
- if(!gf_nputs(color, (long) l, pc))
- return;
- }
- else if(F_OFF(F_SLCTBL_ITEM_NOBOLD, ps_global)
+ if(!(!hdrcolor || embed_color(hdrcolor, pc)))
+ return;
+
+ gf_puts(padding, pc);
+ utf8_snprintf(tmp_20k_buf, SIZEOF_20KBUF, "[%s]", _("More Details"));
+
+ if(handlesp){
+ char buf[16], color[64];
+ int l;
+ HANDLE_S *h;
+
+ h = new_handle(handlesp);
+ if(minkey < 0) minkey = h->key;
+ h->type = iCal;
+ h->h.ical.attach = a;
+ h->h.ical.depth = h->key - minkey;
+
+ snprintf(buf, sizeof(buf), "%d", h->key);
+ buf[sizeof(buf)-1] = '\0';
+
+ if(!(flgs & FM_NOCOLOR)
+ && handle_start_color(color, sizeof(color), &l, 1)){
+ lastc = get_cur_embedded_color();
+ if(!gf_nputs(color, (long) l, pc))
+ return;
+ }
+ else if(F_OFF(F_SLCTBL_ITEM_NOBOLD, ps_global)
&& (!((*pc)(TAG_EMBED) && (*pc)(TAG_BOLDON))))
return;
- if(!((*pc)(TAG_EMBED) && (*pc)(TAG_HANDLE)
+ if(!((*pc)(TAG_EMBED) && (*pc)(TAG_HANDLE)
&& (*pc)(strlen(buf)) && gf_puts(buf, pc)))
return;
- } else
- tmp_20k_buf[0] = '\0';
-
- if(!format_env_puts(tmp_20k_buf, pc))
- return;
-
- if(handlesp){
- if(lastc){
- if(F_OFF(F_SLCTBL_ITEM_NOBOLD, ps_global)){
- if(!((*pc)(TAG_EMBED) && (*pc)(TAG_BOLDOFF)))
- return;
- }
+ } else
+ tmp_20k_buf[0] = '\0';
- if(!embed_color(lastc, pc))
- return;
+ if(!format_env_puts(tmp_20k_buf, pc))
+ return;
- free_color_pair(&lastc);
- }
- else if(!((*pc)(TAG_EMBED) && (*pc)(TAG_BOLDOFF)))
- return;
+ if(handlesp){
+ if(lastc){
+ if(F_OFF(F_SLCTBL_ITEM_NOBOLD, ps_global)){
+ if(!((*pc)(TAG_EMBED) && (*pc)(TAG_BOLDOFF)))
+ return;
+ }
- if(!((*pc)(TAG_EMBED) && (*pc)(TAG_INVOFF)))
- return;
- }
+ if(!embed_color(lastc, pc))
+ return;
- if(padwid > 0){
- snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s", padwid, padwid, "");
- if(!gf_puts(tmp_20k_buf, pc))
+ free_color_pair(&lastc);
+ }
+ else if(!((*pc)(TAG_EMBED) && (*pc)(TAG_BOLDOFF)))
return;
- }
- if(!gf_puts(NEWLINE, pc))
+ if(!((*pc)(TAG_EMBED) && (*pc)(TAG_INVOFF)))
return;
}
- } /* end of ATTENDEES */
- free_vevent_summary(&vesy);
+ if(padwid > 0){
+ snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s", padwid, padwid, "");
+ if(!gf_puts(tmp_20k_buf, pc))
+ return;
+ }
- avail = width - m1 -2;
+ if(!gf_puts(NEWLINE, pc))
+ return;
+ }
+ avail = width - m1 -2;
- dwid = MAX(MIN(40, avail), 0);
- avail -= dwid;
+ dwid = MAX(MIN(40, avail), 0);
+ avail -= dwid;
- snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s%s", m1, m1, "",
+ snprintf(tmp_20k_buf, SIZEOF_20KBUF, "%*.*s%s", m1, m1, "",
repeat_char(dwid, '-'));
- gf_puts(tmp_20k_buf, pc);
+ gf_puts(tmp_20k_buf, pc);
+ if(vesy->next)
+ gf_puts(NEWLINE, pc);
+ }
+ free_vevent_summary(&vesummary);
}
int
diff --git a/pith/send.c b/pith/send.c
index 8be908c2..460f6a24 100644
--- a/pith/send.c
+++ b/pith/send.c
@@ -1226,10 +1226,12 @@ pine_new_env(ENVELOPE *outgoing, char **fccp, char ***tobufpp, PINEFIELD *custom
for(i=0; i < stdcnt; i++, pf++){
pf->name = cpystr(pf_template[i].name);
- if(i == N_SENDER && F_ON(F_USE_SENDER_NOT_X, ps_global))
+ if(i == N_SENDER && F_ON(F_USE_SENDER_NOT_X, ps_global)){
/* slide string over so it is Sender instead of X-X-Sender */
- for(p=pf->name; *(p+1); p++)
- *p = *(p+4);
+ for(p=pf->name+4; *p != '\0'; p++)
+ *(p-4) = *p;
+ *(p-4) = '\0';
+ }
pf->type = pf_template[i].type;
pf->canedit = pf_template[i].canedit;
@@ -4279,7 +4281,6 @@ pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s)
int add_trailing_crlf;
LOC_2022_JP ljp;
gf_io_t gc;
- void *table = NULL;
dprint((4, "-- pine_rfc822_output_body: %d\n",
body ? body->type : 0));
@@ -4364,7 +4365,7 @@ pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s)
gf_line_test_opt(translate_utf8_to_2022_jp,&ljp));
}
else{
- table = utf8_rmap(charset);
+ void *table = utf8_rmap(charset);
if(table){
gf_link_filter(gf_convert_utf8_charset,
@@ -4411,9 +4412,6 @@ pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s)
display_message('x');
}
- if(table)
- fs_give((void **)&table);
-
gf_clear_so_readc(bodyso);
if(encode_error || !l_flush_net(TRUE))