diff options
166 files changed, 116953 insertions, 104111 deletions
diff --git a/libical/src/Net-ICal-Libical/netical_wrap.c b/libical/src/Net-ICal-Libical/netical_wrap.c index 233c2dc7f7..32eee6f80b 100644 --- a/libical/src/Net-ICal-Libical/netical_wrap.c +++ b/libical/src/Net-ICal-Libical/netical_wrap.c @@ -96,6 +96,12 @@ extern "C" { * SWIGSTATIC. * * $Log$ + * Revision 1.2 2003/10/21 18:28:33 ettore + * Merge new-ui-branch to the trunk. + * + * Revision 1.1.2.1 2003/09/23 19:43:57 ettore + * Sync with trunk, and fixicate a bit so it still works. + * * Revision 1.1 2003/09/11 22:04:08 hansp * Import new libical from mainline HEAD and make appropriate changes to * Evolution. diff --git a/libical/src/libical/Makefile.am b/libical/src/libical/Makefile.am index 4416f28289..302c32a6a0 100644 --- a/libical/src/libical/Makefile.am +++ b/libical/src/libical/Makefile.am @@ -2,7 +2,7 @@ # FILE: Makefile.am # CREATOR: eric # -# $Id: Makefile.am,v 1.40 2003/10/09 21:02:23 fejj Exp $ +# $Id: Makefile.am,v 1.41 2003/10/21 18:28:29 ettore Exp $ # # # (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org diff --git a/libical/src/libical/icalderivedparameter.c.in b/libical/src/libical/icalderivedparameter.c.in index b41587e0de..250cf188ee 100644 --- a/libical/src/libical/icalderivedparameter.c.in +++ b/libical/src/libical/icalderivedparameter.c.in @@ -3,7 +3,7 @@ FILE: icalderivedparameters.{c,h} CREATOR: eric 09 May 1999 - $Id: icalderivedparameter.c.in,v 1.2 2003/09/11 22:04:19 hansp Exp $ + $Id: icalderivedparameter.c.in,v 1.3 2003/10/21 18:28:29 ettore Exp $ $Locker: $ diff --git a/libical/src/libical/icalderivedparameter.h.in b/libical/src/libical/icalderivedparameter.h.in index a8f3a36085..0e7c29fa65 100644 --- a/libical/src/libical/icalderivedparameter.h.in +++ b/libical/src/libical/icalderivedparameter.h.in @@ -4,7 +4,7 @@ CREATOR: eric 20 March 1999 - $Id: icalderivedparameter.h.in,v 1.2 2003/09/11 22:04:19 hansp Exp $ + $Id: icalderivedparameter.h.in,v 1.3 2003/10/21 18:28:29 ettore Exp $ $Locker: $ diff --git a/libical/src/libical/icalderivedproperty.c.in b/libical/src/libical/icalderivedproperty.c.in index 36ddc846ae..30b86b0f8c 100644 --- a/libical/src/libical/icalderivedproperty.c.in +++ b/libical/src/libical/icalderivedproperty.c.in @@ -4,7 +4,7 @@ FILE: icalderivedproperty.c CREATOR: eric 15 Feb 2001 - $Id: icalderivedproperty.c.in,v 1.2 2003/09/11 22:04:19 hansp Exp $ + $Id: icalderivedproperty.c.in,v 1.3 2003/10/21 18:28:29 ettore Exp $ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org diff --git a/libical/src/libical/icalderivedproperty.h.in b/libical/src/libical/icalderivedproperty.h.in index eda95ee031..515034742d 100644 --- a/libical/src/libical/icalderivedproperty.h.in +++ b/libical/src/libical/icalderivedproperty.h.in @@ -3,7 +3,7 @@ FILE: icalderivedproperties.{c,h} CREATOR: eric 09 May 1999 - $Id: icalderivedproperty.h.in,v 1.2 2003/09/11 22:04:19 hansp Exp $ + $Id: icalderivedproperty.h.in,v 1.3 2003/10/21 18:28:29 ettore Exp $ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ diff --git a/libical/src/libical/icalderivedvalue.c.in b/libical/src/libical/icalderivedvalue.c.in index d96461e2b7..33f5083589 100644 --- a/libical/src/libical/icalderivedvalue.c.in +++ b/libical/src/libical/icalderivedvalue.c.in @@ -3,7 +3,7 @@ FILE: icalvalue.c CREATOR: eric 02 May 1999 - $Id: icalderivedvalue.c.in,v 1.4 2003/09/11 22:04:19 hansp Exp $ + $Id: icalderivedvalue.c.in,v 1.5 2003/10/21 18:28:29 ettore Exp $ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org diff --git a/libical/src/libical/icalderivedvalue.h.in b/libical/src/libical/icalderivedvalue.h.in index 1df5e5126e..ab52499aa8 100644 --- a/libical/src/libical/icalderivedvalue.h.in +++ b/libical/src/libical/icalderivedvalue.h.in @@ -4,7 +4,7 @@ CREATOR: eric 20 March 1999 - $Id: icalderivedvalue.h.in,v 1.3 2003/09/11 22:04:19 hansp Exp $ + $Id: icalderivedvalue.h.in,v 1.4 2003/10/21 18:28:29 ettore Exp $ $Locker: $ diff --git a/libical/src/libical/icallexer.l b/libical/src/libical/icallexer.l new file mode 100644 index 0000000000..fe292c8b6d --- /dev/null +++ b/libical/src/libical/icallexer.l @@ -0,0 +1,161 @@ +%{ +/* -*- Mode: C -*- + ====================================================================== + FILE: icallexer.l + CREATOR: eric 10 June 1999 + + DESCRIPTION: + + $Id: icallexer.l,v 1.10 2003/10/21 18:28:28 ettore Exp $ + $Locker: $ + + (C) COPYRIGHT 1999 Eric Busboom + http://www.softwarestudio.org + + The contents of this file are subject to the Mozilla Public License + Version 1.0 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and + limitations under the License. + + The original author is Eric Busboom + The original code is icalitip.y + + + + ======================================================================*/ +#include "icalparser.h" +#include "icalenums.h" +#include "icalmemory.h" +#include "assert.h" +#include "icalyacc.h" + +#include <string.h> /* For strdup() */ + +int icalparser_flex_input(char* buf, int max_size); +void icalparser_clear_flex_input(void); + + +#define ICAL_MAX_STR_CONST 1024 + +#undef YY_INPUT +#define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms)) +#undef yywrap + +#undef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) ical_yyerror(msg) + +icalvalue_kind value_kind=ICAL_NO_VALUE; +void set_parser_value_state(icalvalue_kind kind); +extern int yydebug; + +void ical_yyerror(char *s); + +void init_str_buf(void); + +int last_state; + +char *str_buf; +char *str_buf_p; +size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/ + +%} + +crlf \x0D?\x0A +space [ ] +qsafechar [^\x00-\x1F\"] +safechar [^\x00-\x1F\"\:\;\,] +tsafechar [\x20-\x21\x23-\x2B\x2D-\x39\x3C-\x5B\x5D-\x7E] +valuechar [^\x00-\x08\x10-\x1F] +xname X-[a-zA-Z0-9\-]+ +xname2 [a-zA-Z0-9\-\ ] +paramtext {safechar}+ +value {valuechar}+ +quotedstring \"{qsafechar}+\" +digit [0-9] + +%array /* Make yytext an array. Slow, but handy. HACK */ + +%option caseless + +%s quoted_string +%s binary_value boolean_value uri_value time_value duration_value number_value period_value recur_value text_value utcoffset_value +%s enum_param_value string_param_value stringlist_param_value keyword line_start component seperator parameter end_of_value paramtext + + + +%% + +%{ +%} + + +<time_value>{ +{digit}+ { ical_yylval.v_string =icalmemory_tmp_copy(yytext) ; + return DIGITS; } +T { return TIME_CHAR; } +Z { return UTC_CHAR; } +[\/\+\-PWHMSD] { return yytext[0]; } +{crlf} { return EOL;} + +} + +<utcoffset_value>{ +{crlf} { return EOL;} +\-|\+ { return yytext[0]; } +{digit}{digit} { ical_yylval.v_int=atoi(yytext); return INTNUMBER; } + +} + +<enum_param_value>{ +. { return CHARACTER; } +{crlf} { return EOL;} + +} + +<seperator>{ +, { BEGIN(last_state); return COMMA; } +} + + +%% + +int yywrap() +{ + return 1; +} + + +void set_parser_value_state(icalvalue_kind kind) +{ + + switch (kind){ + + case ICAL_UTCOFFSET_VALUE: + {BEGIN(utcoffset_value);break;} + + case ICAL_DATETIMEPERIOD_VALUE: + case ICAL_DURATION_VALUE: + case ICAL_PERIOD_VALUE: + {BEGIN(time_value);break;} + + default: + { + assert(1==0); + } + } +} + +void init_str_buf(void) +{ + str_buf = icalmemory_tmp_buffer(ICAL_MAX_STR_CONST); + str_buf_p = str_buf; + buf_sz = ICAL_MAX_STR_CONST; + + +} + diff --git a/libical/src/libical/icalyacc.y b/libical/src/libical/icalyacc.y new file mode 100644 index 0000000000..65f0041ec4 --- /dev/null +++ b/libical/src/libical/icalyacc.y @@ -0,0 +1,417 @@ +%{ +/* -*- Mode: C -*- + ====================================================================== + FILE: icalitip.y + CREATOR: eric 10 June 1999 + + DESCRIPTION: + + $Id: icalyacc.y,v 1.16 2003/10/21 18:28:27 ettore Exp $ + $Locker: $ + + (C) COPYRIGHT 1999 Eric Busboom + http://www.softwarestudio.org + + The contents of this file are subject to the Mozilla Public License + Version 1.0 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and + limitations under the License. + + The original author is Eric Busboom + The original code is icalitip.y + + + + =======================================================================*/ + +#include <stdlib.h> +#include <string.h> /* for strdup() */ +#include "icalparser.h" +#include "pvl.h" + +icalvalue *icalparser_yy_value; /* Current Value */ + +void ical_yyerror(char* s); +void icalparser_clear_flex_input(); +int ical_yy_lex(void); + +/* Globals for UTCOFFSET values */ +int utc; +int utc_b; +int utcsign; + +/* Globals for DURATION values */ +struct icaldurationtype duration; + +/* Globals for TRIGGER values */ +struct icaltriggertype trigger; + +void copy_list(short* array, size_t size); +void add_prop(icalproperty_kind); +void icalparser_fill_date(struct tm* t, char* dstr); +void icalparser_fill_time(struct tm* t, char* tstr); +void set_value_type(icalvalue_kind kind); +void set_parser_value_state(); +struct icaltimetype fill_datetime(char* d, char* t); +void ical_yy_error(char *s); /* Don't know why I need this.... */ +int yylex(void); /* Or this. */ + + + +/* Set the state of the lexer so it will interpret values ( iCAL + VALUEs, that is, ) correctly. */ + +%} + +%union { + float v_float; + int v_int; + char* v_string; +} + + + /* Renaming hack */ + +/* +#define yymaxdepth ical_yy_maxdepth +#define yyparse ical_yy_parse +#define yyerror ical_yy_error +#define yylval ical_yy_lval +#define yychar ical_yy_char +#define yydebug ical_yy_debug +#define yypact ical_yy_pact +#define yyr1 ical_yy_r1 +#define yyr2 ical_yy_r2 +#define yydef ical_yy_def +#define yychk ical_yy_chk +#define yypgo ical_yy_pgo +#define yyact ical_yy_act +#define yyexca ical_yy_exca +#define yyerrflag ical_yy_errflag +#define yynerrs ical_yy_nerrs +#define yyps ical_yy_ps +#define yypv ical_yy_pv +#define yys ical_yy_s +#define yy_yys ical_yy_yys +#define yystate ical_yy_state +#define yytmp ical_yy_tmp +#define yyv ical_yy_v +#define yy_yyv ical_yy_yyv +#define yyval ical_yy_val +#define yylloc ical_yy_lloc +#define yyreds ical_yy_reds +#define yytoks ical_yy_toks +#define yylhs ical_yy_yylhs +#define yylen ical_yy_yylen +#define yydefred ical_yy_yydefred +#define yydgoto ical_yy_yydgoto +#define yydefred ical_yy_yydefred +#define yydgoto ical_yy_yydgoto +#define yysindex ical_yy_yysindex +#define yyrindex ical_yy_yyrindex +#define yygindex ical_yy_yygindex +#define yytable ical_yy_yytable +#define yycheck ical_yy_yycheck +#define yyname ical_yy_yyname +#define yyrule ical_yy_yyrule +#define yy_scan_bytes ical_yy_scan_bytes +#define yy_scan_string ical_yy_scan_string +#define yy_scan_buffer ical_yy_scan_buffer +*/ + +/* These are redefined with the -P option to flex */ +/* +#define yy_create_buffer ical_yy_create_buffer +#define yy_delete_buffer ical_yy_delete_buffer +#define yy_flex_debug ical_yy_flex_debug +#define yy_init_buffer ical_yy_init_buffer +#define yy_flush_buffer ical_yy_flush_buffer +#define yy_load_buffer_state ical_yy_load_buffer_state +#define yy_switch_to_buffer ical_yy_switch_to_buffer +#define yyin ical_yyin +#define yyleng ical_yyleng +#define yylex ical_yylex +#define yylineno ical_yylineno +#define yyout ical_yyout +#define yyrestart ical_yyrestart +#define yytext ical_yytext +#define yywrap ical_yywrap +*/ + + +%token <v_string> DIGITS +%token <v_int> INTNUMBER +%token <v_float> FLOATNUMBER +%token <v_string> STRING +%token EOL EQUALS CHARACTER COLON COMMA SEMICOLON MINUS TIMESEPERATOR + +%token TRUE FALSE + +%token FREQ BYDAY BYHOUR BYMINUTE BYMONTH BYMONTHDAY BYSECOND BYSETPOS BYWEEKNO +%token BYYEARDAY DAILY MINUTELY MONTHLY SECONDLY WEEKLY HOURLY YEARLY +%token INTERVAL COUNT UNTIL WKST MO SA SU TU WE TH FR + +%token BIT8 ACCEPTED ADD AUDIO BASE64 BINARY BOOLEAN BUSY BUSYTENTATIVE +%token BUSYUNAVAILABLE CALADDRESS CANCEL CANCELLED CHAIR CHILD COMPLETED +%token CONFIDENTIAL CONFIRMED COUNTER DATE DATETIME DECLINECOUNTER DECLINED +%token DELEGATED DISPLAY DRAFT DURATION EMAIL END FINAL FLOAT FREE GREGORIAN +%token GROUP INDIVIDUAL INPROCESS INTEGER NEEDSACTION NONPARTICIPANT +%token OPAQUE OPTPARTICIPANT PARENT PERIOD PRIVATE PROCEDURE PUBLIC PUBLISH +%token RECUR REFRESH REPLY REQPARTICIPANT REQUEST RESOURCE ROOM SIBLING +%token START TENTATIVE TEXT THISANDFUTURE THISANDPRIOR TIME TRANSPAENT +%token UNKNOWN UTCOFFSET XNAME + +%token ALTREP CN CUTYPE DAYLIGHT DIR ENCODING EVENT FBTYPE FMTTYPE LANGUAGE +%token MEMBER PARTSTAT RANGE RELATED RELTYPE ROLE RSVP SENTBY STANDARD URI + +%token TIME_CHAR UTC_CHAR + + +%% + +value: + date_value + | datetime_value + | duration_value + | period_value + | utcoffset_value + | error { + icalparser_yy_value = 0; + icalparser_clear_flex_input(); + yyclearin; + } +; + + +date_value: DIGITS + { + struct icaltimetype stm; + + stm = fill_datetime($1,0); + + stm.hour = -1; + stm.minute = -1; + stm.second = -1; + stm.is_utc = 0; + stm.is_date = 1; + + icalparser_yy_value = icalvalue_new_date(stm); + } +; + +utc_char: + /*empty*/ {utc = 0;} + | UTC_CHAR {utc = 1;} +; + +/* This is used in the period_value, where there may be two utc characters per rule. */ +utc_char_b: + /*empty*/ {utc_b = 0;} + | UTC_CHAR {utc_b = 1;} +; + +datetime_value: + DIGITS TIME_CHAR DIGITS utc_char + { + struct icaltimetype stm; + stm = fill_datetime($1, $3); + stm.is_utc = utc; + stm.is_date = 0; + + icalparser_yy_value = + icalvalue_new_datetime(stm); + } +; + + +/* Duration */ + + +dur_date: dur_day + | dur_day dur_time +; + +dur_week: DIGITS 'W' + { + duration.weeks = atoi($1); + } +; + +dur_time: TIME_CHAR dur_hour + { + } + | TIME_CHAR dur_minute + { + } + | TIME_CHAR dur_second + { + } +; + +dur_hour: DIGITS 'H' + { + duration.hours = atoi($1); + } + | DIGITS 'H' dur_minute + { + duration.hours = atoi($1); + } +; + +dur_minute: DIGITS 'M' + { + duration.minutes = atoi($1); + } + | DIGITS 'M' dur_second + { + duration.minutes = atoi($1); + } +; + +dur_second: DIGITS 'S' + { + duration.seconds = atoi($1); + } +; + +dur_day: DIGITS 'D' + { + duration.days = atoi($1); + } +; + +dur_prefix: /* empty */ + { + duration.is_neg = 0; + } + | '+' + { + duration.is_neg = 0; + } + | '-' + { + duration.is_neg = 1; + } +; + +duration_value: dur_prefix 'P' dur_date + { + icalparser_yy_value = icalvalue_new_duration(duration); + memset(&duration,0, sizeof(duration)); + } + | dur_prefix 'P' dur_time + { + icalparser_yy_value = icalvalue_new_duration(duration); + memset(&duration,0, sizeof(duration)); + } + | dur_prefix 'P' dur_week + { + icalparser_yy_value = icalvalue_new_duration(duration); + memset(&duration,0, sizeof(duration)); + } +; + + +/* Period */ + +period_value: DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b + { + struct icalperiodtype p; + + p.start = fill_datetime($1,$3); + p.start.is_utc = utc; + p.start.is_date = 0; + + + p.end = fill_datetime($6,$8); + p.end.is_utc = utc_b; + p.end.is_date = 0; + + p.duration.days = -1; + p.duration.weeks = -1; + p.duration.hours = -1; + p.duration.minutes = -1; + p.duration.seconds = -1; + + icalparser_yy_value = icalvalue_new_period(p); + } + | DIGITS TIME_CHAR DIGITS utc_char '/' duration_value + { + struct icalperiodtype p; + + p.start = fill_datetime($1,$3); + p.start.is_utc = utc; + p.start.is_date = 0; + + p.end.year = -1; + p.end.month = -1; + p.end.day = -1; + p.end.hour = -1; + p.end.minute = -1; + p.end.second = -1; + + /* The duration_value rule setes the global 'duration' + variable, but it also creates a new value in + icalparser_yy_value. So, free that, then copy + 'duration' into the icalperiodtype struct. */ + + p.duration = icalvalue_get_duration(icalparser_yy_value); + icalvalue_free(icalparser_yy_value); + icalparser_yy_value = 0; + + icalparser_yy_value = icalvalue_new_period(p); + + } +; + + +/* UTC Offset */ + +plusminus: '+' { utcsign = 1; } + | '-' { utcsign = -1; } +; + +utcoffset_value: + plusminus INTNUMBER INTNUMBER + { + icalparser_yy_value = icalvalue_new_utcoffset( utcsign * (($2*3600) + ($3*60)) ); + } + + | plusminus INTNUMBER INTNUMBER INTNUMBER + { + icalparser_yy_value = icalvalue_new_utcoffset(utcsign * (($2*3600) + ($3*60) +($4))); + } +; + +%% + +struct icaltimetype fill_datetime(char* datestr, char* timestr) +{ + struct icaltimetype stm; + + memset(&stm,0,sizeof(stm)); + + if (datestr != 0){ + sscanf(datestr,"%4d%2d%2d",&(stm.year), &(stm.month), + &(stm.day)); + } + + if (timestr != 0){ + sscanf(timestr,"%2d%2d%2d", &(stm.hour), &(stm.minute), + &(stm.second)); + } + + return stm; + +} + +void ical_yyerror(char* s) +{ + /*fprintf(stderr,"Parse error \'%s\'\n", s);*/ +} + diff --git a/libical/src/libicalcap/Makefile.am b/libical/src/libicalcap/Makefile.am index 519c126905..f6112b7c05 100644 --- a/libical/src/libicalcap/Makefile.am +++ b/libical/src/libicalcap/Makefile.am @@ -2,7 +2,7 @@ # FILE: Makefile.am # CREATOR: acampi # -# $Id: Makefile.am,v 1.4 2003/10/07 14:28:18 danw Exp $ +# $Id: Makefile.am,v 1.5 2003/10/21 18:28:26 ettore Exp $ # # # (C) COPYRIGHT 2003, Andrea Campi, mailto:a.campi@inet.it diff --git a/libical/src/libicalss/Makefile.am b/libical/src/libicalss/Makefile.am index c714e8ca5a..1b72cd03c9 100644 --- a/libical/src/libicalss/Makefile.am +++ b/libical/src/libicalss/Makefile.am @@ -2,7 +2,7 @@ # FILE: Makefile.am # CREATOR: eric # -# $Id: Makefile.am,v 1.21 2003/10/09 21:02:25 fejj Exp $ +# $Id: Makefile.am,v 1.22 2003/10/21 18:28:20 ettore Exp $ # # # (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org diff --git a/libical/src/libicalss/icalgauge.h b/libical/src/libicalss/icalgauge.h index c35b4f7508..1064b5f41f 100644 --- a/libical/src/libicalss/icalgauge.h +++ b/libical/src/libicalss/icalgauge.h @@ -29,6 +29,8 @@ #ifndef ICALGAUGE_H #define ICALGAUGE_H +#include <libical/icalcomponent.h> + /** @file icalgauge.h * @brief Routines implementing a filter for ical components */ diff --git a/libical/src/libicalss/icalsslexer.c b/libical/src/libicalss/icalsslexer.c deleted file mode 100644 index e5afa81f61..0000000000 --- a/libical/src/libicalss/icalsslexer.c +++ /dev/null @@ -1,1746 +0,0 @@ -#define yy_create_buffer ss_create_buffer -#define yy_delete_buffer ss_delete_buffer -#define yy_scan_buffer ss_scan_buffer -#define yy_scan_string ss_scan_string -#define yy_scan_bytes ss_scan_bytes -#define yy_flex_debug ss_flex_debug -#define yy_init_buffer ss_init_buffer -#define yy_flush_buffer ss_flush_buffer -#define yy_load_buffer_state ss_load_buffer_state -#define yy_switch_to_buffer ss_switch_to_buffer -#define yyin ssin -#define yyleng ssleng -#define yylex sslex -#define yyout ssout -#define yyrestart ssrestart -#define yytext sstext -#define yywrap sswrap - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header$ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include <stdio.h> -#include <unistd.h> - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include <stdlib.h> - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include <io.h> -#include <stdlib.h> -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char yytext[]; - - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - if ( yyleng >= YYLMAX ) \ - YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ - yy_flex_strncpy( yytext, yytext_ptr, yyleng + 1 ); \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 23 -#define YY_END_OF_BUFFER 24 -static yyconst short int yy_accept[56] = - { 0, - 0, 0, 0, 0, 0, 0, 24, 22, 18, 18, - 22, 17, 21, 4, 19, 8, 5, 9, 21, 21, - 21, 21, 21, 21, 21, 18, 7, 0, 21, 10, - 6, 11, 21, 21, 14, 21, 21, 13, 21, 21, - 20, 12, 21, 15, 21, 21, 21, 2, 16, 21, - 21, 21, 3, 1, 0 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 5, 1, 1, 1, 1, 1, 6, 1, - 1, 7, 1, 8, 7, 7, 1, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 9, 10, 11, - 12, 13, 1, 7, 14, 7, 15, 16, 17, 18, - 7, 19, 20, 7, 7, 21, 22, 23, 24, 7, - 7, 25, 26, 27, 28, 7, 29, 7, 7, 7, - 1, 1, 1, 1, 1, 1, 14, 7, 15, 16, - - 17, 18, 7, 19, 20, 7, 7, 21, 22, 23, - 24, 7, 7, 25, 26, 27, 28, 7, 29, 7, - 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[30] = - { 0, - 1, 1, 1, 2, 1, 1, 3, 1, 2, 1, - 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3 - } ; - -static yyconst short int yy_base[58] = - { 0, - 0, 0, 0, 0, 0, 0, 68, 69, 28, 31, - 55, 0, 0, 69, 69, 54, 53, 52, 40, 37, - 35, 12, 35, 42, 39, 35, 69, 51, 0, 69, - 69, 69, 40, 31, 0, 27, 32, 0, 31, 34, - 69, 0, 28, 0, 28, 31, 22, 0, 0, 31, - 28, 17, 0, 0, 69, 39, 40 - } ; - -static yyconst short int yy_def[58] = - { 0, - 55, 1, 1, 1, 1, 1, 55, 55, 55, 55, - 55, 56, 57, 55, 55, 55, 55, 55, 57, 57, - 57, 57, 57, 57, 57, 55, 55, 56, 57, 55, - 55, 55, 57, 57, 57, 57, 57, 57, 57, 57, - 55, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 0, 55, 55 - } ; - -static yyconst short int yy_nxt[99] = - { 0, - 8, 9, 10, 9, 11, 12, 13, 14, 8, 15, - 16, 17, 18, 19, 13, 13, 13, 20, 13, 21, - 13, 13, 22, 23, 13, 24, 13, 13, 25, 26, - 26, 26, 26, 26, 26, 36, 26, 26, 26, 37, - 28, 28, 29, 54, 53, 52, 51, 50, 49, 48, - 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, - 35, 34, 33, 32, 31, 30, 27, 55, 7, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55 - - } ; - -static yyconst short int yy_chk[99] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, - 9, 9, 10, 10, 10, 22, 26, 26, 26, 22, - 56, 56, 57, 52, 51, 50, 47, 46, 45, 43, - 40, 39, 37, 36, 34, 33, 28, 25, 24, 23, - 21, 20, 19, 18, 17, 16, 11, 7, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55 - - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -#ifndef YYLMAX -#define YYLMAX 8192 -#endif - -char yytext[YYLMAX]; -char *yytext_ptr; -#line 1 "icalsslexer.l" -#define INITIAL 0 -#line 2 "icalsslexer.l" -/* -*- Mode: C -*- - ====================================================================== - FILE: icalsslexer.l - CREATOR: eric 8 Aug 2000 - - DESCRIPTION: - - $Id$ - $Locker$ - -(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - - This program is free software; you can redistribute it and/or modify - it under the terms of either: - - The LGPL as published by the Free Software Foundation, version - 2.1, available at: http://www.fsf.org/copyleft/lesser.html - - Or: - - The Mozilla Public License Version 1.0. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - ======================================================================*/ - -#include "icalssyacc.h" -#include "icalgaugeimpl.h" -#include "assert.h" - -#include <string.h> /* For strdup() */ - -const char* input_buffer; -const char* input_buffer_p; - -#define min(a,b) ((a) < (b) ? (a) : (b)) - -int icalss_input(char* buf, int max_size) -{ - int n = min(max_size,strlen(input_buffer_p)); - - if (n > 0){ - memcpy(buf, input_buffer_p, n); - input_buffer_p += n; - return n; - } else { - return 0; - } -} - -#undef YY_INPUT -#define YY_INPUT(b,r,ms) ( r= icalss_input(b,ms)) - -#undef SS_FATAL_ERROR -#define SS_FATAL_ERROR(msg) sserror(msg) - -#define sql 1 -#define string_value 2 - -#line 488 "icalsslexer.c" - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; - register int yy_act; - -#line 83 "icalsslexer.l" - - - - - - -#line 646 "icalsslexer.c" - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 56 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 69 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 89 "icalsslexer.l" -{ return SELECT; } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 90 "icalsslexer.l" -{ return FROM; } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 91 "icalsslexer.l" -{ return WHERE; } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 92 "icalsslexer.l" -{ return COMMA; } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 93 "icalsslexer.l" -{ return EQUALS; } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 94 "icalsslexer.l" -{ return EQUALS; } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 95 "icalsslexer.l" -{ return NOTEQUALS; } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 96 "icalsslexer.l" -{ return LESS; } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 97 "icalsslexer.l" -{ return GREATER; } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 98 "icalsslexer.l" -{ return LESSEQUALS; } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 99 "icalsslexer.l" -{ return GREATEREQUALS; } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 100 "icalsslexer.l" -{ return AND; } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 101 "icalsslexer.l" -{ return OR; } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 102 "icalsslexer.l" -{ return IS; } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 103 "icalsslexer.l" -{ return NOT; } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 104 "icalsslexer.l" -{ return SQLNULL; } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 105 "icalsslexer.l" -{ return QUOTE; } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 106 "icalsslexer.l" -; - YY_BREAK -case 19: -YY_RULE_SETUP -#line 107 "icalsslexer.l" -{ return EOL; } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 109 "icalsslexer.l" -{ - int c = input(); - unput(c); - if(c!='\''){ - sslval.v_string= icalmemory_tmp_copy(yytext); - return STRING; - } else { - /*ssmore();*/ - } -} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 120 "icalsslexer.l" -{ - sslval.v_string= icalmemory_tmp_copy(yytext); - return STRING; -} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 126 "icalsslexer.l" -{ return yytext[0]; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 128 "icalsslexer.l" -ECHO; - YY_BREAK -#line 856 "icalsslexer.c" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(sql): -case YY_STATE_EOF(string_value): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 56 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 56 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 55); - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } -#endif /* YY_NO_INPUT */ - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 128 "icalsslexer.l" - - -int yywrap() -{ - return 1; -} - diff --git a/libical/src/libicalss/icalsslexer.l b/libical/src/libicalss/icalsslexer.l index fe89bfde99..b6bc4dee05 100644 --- a/libical/src/libicalss/icalsslexer.l +++ b/libical/src/libicalss/icalsslexer.l @@ -6,7 +6,7 @@ DESCRIPTION: - $Id: icalsslexer.l,v 1.4 2003/09/24 02:06:52 hansp Exp $ + $Id: icalsslexer.l,v 1.5 2003/10/21 18:28:18 ettore Exp $ $Locker: $ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org diff --git a/libical/src/libicalss/icalssyacc.c b/libical/src/libicalss/icalssyacc.c deleted file mode 100644 index 8e27cd75ed..0000000000 --- a/libical/src/libicalss/icalssyacc.c +++ /dev/null @@ -1,1397 +0,0 @@ -/* A Bison parser, made from /home/hpj/work/cvs/cvs.gnome.org/evolution-trunk/libical/src/libicalss/icalssyacc.y - by GNU bison 1.35. */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define yyparse ssparse -#define yylex sslex -#define yyerror sserror -#define yylval sslval -#define yychar sschar -#define yydebug ssdebug -#define yynerrs ssnerrs -# define STRING 257 -# define SELECT 258 -# define FROM 259 -# define WHERE 260 -# define COMMA 261 -# define QUOTE 262 -# define EQUALS 263 -# define NOTEQUALS 264 -# define LESS 265 -# define GREATER 266 -# define LESSEQUALS 267 -# define GREATEREQUALS 268 -# define AND 269 -# define OR 270 -# define EOL 271 -# define END 272 -# define IS 273 -# define NOT 274 -# define SQLNULL 275 - -#line 1 "icalssyacc.y" - -/* -*- Mode: C -*- - ====================================================================== - FILE: icalssyacc.y - CREATOR: eric 08 Aug 2000 - - DESCRIPTION: - - $Id$ - $Locker$ - -(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - - This program is free software; you can redistribute it and/or modify - it under the terms of either: - - The LGPL as published by the Free Software Foundation, version - 2.1, available at: http://www.fsf.org/copyleft/lesser.html - - Or: - - The Mozilla Public License Version 1.0. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - ======================================================================*/ -/*#define YYDEBUG 1*/ -#include <stdlib.h> -#include <string.h> /* for strdup() */ -#include <limits.h> /* for SHRT_MAX*/ -#include <libical/ical.h> -#include <libicalss/icalgauge.h> -#include "icalgaugeimpl.h" - -extern struct icalgauge_impl *icalss_yy_gauge; - -#define YYPARSE_PARAM yy_globals -#define YYLEX_PARAM yy_globals -#define YY_EXTRA_TYPE icalgauge_impl* - - -static void ssyacc_add_where(struct icalgauge_impl* impl, char* prop, - icalgaugecompare compare , char* value); -static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1); -static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1); -static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l); -void sserror(char *s); /* Don't know why I need this.... */ - - -#line 53 "icalssyacc.y" -#ifndef YYSTYPE -typedef union { - char* v_string; -} yystype; -# define YYSTYPE yystype -# define YYSTYPE_IS_TRIVIAL 1 -#endif -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - - - -#define YYFINAL 38 -#define YYFLAG -32768 -#define YYNTBASE 22 - -/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 27) - -/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ -static const char yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21 -}; - -#if YYDEBUG -static const short yyprhs[] = -{ - 0, 0, 7, 12, 14, 16, 20, 22, 26, 27, - 31, 35, 40, 44, 48, 52, 56, 60, 62, 66 -}; -static const short yyrhs[] = -{ - 4, 23, 5, 24, 6, 26, 0, 4, 23, 5, - 24, 0, 1, 0, 3, 0, 23, 7, 3, 0, - 3, 0, 24, 7, 3, 0, 0, 3, 9, 3, - 0, 3, 19, 21, 0, 3, 19, 20, 21, 0, - 3, 10, 3, 0, 3, 11, 3, 0, 3, 12, - 3, 0, 3, 13, 3, 0, 3, 14, 3, 0, - 25, 0, 26, 15, 25, 0, 26, 16, 25, 0 -}; - -#endif - -#if YYDEBUG -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const short yyrline[] = -{ - 0, 64, 65, 66, 72, 74, 78, 80, 83, 85, - 86, 87, 88, 89, 90, 91, 92, 95, 97, 98 -}; -#endif - - -#if (YYDEBUG) || defined YYERROR_VERBOSE - -/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ -static const char *const yytname[] = -{ - "$", "error", "$undefined.", "STRING", "SELECT", "FROM", "WHERE", "COMMA", - "QUOTE", "EQUALS", "NOTEQUALS", "LESS", "GREATER", "LESSEQUALS", - "GREATEREQUALS", "AND", "OR", "EOL", "END", "IS", "NOT", "SQLNULL", - "query_min", "select_list", "from_list", "where_clause", "where_list", 0 -}; -#endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const short yyr1[] = -{ - 0, 22, 22, 22, 23, 23, 24, 24, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 26, 26, 26 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const short yyr2[] = -{ - 0, 6, 4, 1, 1, 3, 1, 3, 0, 3, - 3, 4, 3, 3, 3, 3, 3, 1, 3, 3 -}; - -/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE - doesn't specify something else to do. Zero means the default is an - error. */ -static const short yydefact[] = -{ - 0, 3, 0, 4, 0, 0, 0, 6, 2, 5, - 8, 0, 0, 17, 1, 7, 0, 0, 0, 0, - 0, 0, 0, 8, 8, 9, 12, 13, 14, 15, - 16, 0, 10, 18, 19, 11, 0, 0, 0 -}; - -static const short yydefgoto[] = -{ - 36, 4, 8, 13, 14 -}; - -static const short yypact[] = -{ - 5,-32768, 9,-32768, 6, 17, 18,-32768, 1,-32768, - 19, 20, -9,-32768, -1,-32768, 21, 22, 23, 24, - 25, 26, -4, 19, 19,-32768,-32768,-32768,-32768,-32768, - -32768, 10,-32768,-32768,-32768,-32768, 30, 32,-32768 -}; - -static const short yypgoto[] = -{ - -32768,-32768,-32768, -5,-32768 -}; - - -#define YYLAST 32 - - -static const short yytable[] = -{ - 16, 17, 18, 19, 20, 21, 1, 10, 11, 2, - 22, 5, 3, 6, 23, 24, 31, 32, 33, 34, - 7, 9, 12, 15, 25, 26, 27, 28, 29, 30, - 37, 35, 38 -}; - -static const short yycheck[] = -{ - 9, 10, 11, 12, 13, 14, 1, 6, 7, 4, - 19, 5, 3, 7, 15, 16, 20, 21, 23, 24, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 0, 21, 0 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison/bison.simple" - -/* Skeleton output parser for bison, - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software - Foundation, Inc. - - 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 2, 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser when - the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free -# endif -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ - - -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - short yyss; - YYSTYPE yyvs; -# if YYLSP_NEEDED - YYLTYPE yyls; -# endif -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# if YYLSP_NEEDED -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAX) -# else -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAX) -# endif - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - register YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (0) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - - -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror ("syntax error: cannot back up"); \ - YYERROR; \ - } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). - - When YYLLOC_DEFAULT is run, CURRENT is set the location of the - first token. By default, to implement support for ranges, extend - its range to the last symbol. */ - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#if YYPURE -# if YYLSP_NEEDED -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval, &yylloc) -# endif -# else /* !YYLSP_NEEDED */ -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval) -# endif -# endif /* !YYLSP_NEEDED */ -#else /* !YYPURE */ -# define YYLEX yylex () -#endif /* !YYPURE */ - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -#endif /* !YYDEBUG */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#if YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - -#ifdef YYERROR_VERBOSE - -# ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) -yystrlen (const char *yystr) -# else -yystrlen (yystr) - const char *yystr; -# endif -{ - register const char *yys = yystr; - - while (*yys++ != '\0') - continue; - - return yys - yystr - 1; -} -# endif -# endif - -# ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -# if defined (__STDC__) || defined (__cplusplus) -yystpcpy (char *yydest, const char *yysrc) -# else -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif -{ - register char *yyd = yydest; - register const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif -#endif - -#line 315 "/usr/share/bison/bison.simple" - - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -# define YYPARSE_PARAM_DECL -# else -# define YYPARSE_PARAM_ARG YYPARSE_PARAM -# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -# endif -#else /* !YYPARSE_PARAM */ -# define YYPARSE_PARAM_ARG -# define YYPARSE_PARAM_DECL -#endif /* !YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -# ifdef YYPARSE_PARAM -int yyparse (void *); -# else -int yyparse (void); -# endif -#endif - -/* YY_DECL_VARIABLES -- depending whether we use a pure parser, - variables are global, or local to YYPARSE. */ - -#define YY_DECL_NON_LSP_VARIABLES \ -/* The lookahead symbol. */ \ -int yychar; \ - \ -/* The semantic value of the lookahead symbol. */ \ -YYSTYPE yylval; \ - \ -/* Number of parse errors so far. */ \ -int yynerrs; - -#if YYLSP_NEEDED -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES \ - \ -/* Location data for the lookahead symbol. */ \ -YYLTYPE yylloc; -#else -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES -#endif - - -/* If nonreentrant, generate the variables here. */ - -#if !YYPURE -YY_DECL_VARIABLES -#endif /* !YYPURE */ - -int -yyparse (YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - /* If reentrant, generate the variables here. */ -#if YYPURE - YY_DECL_VARIABLES -#endif /* !YYPURE */ - - register int yystate; - register int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ - int yychar1 = 0; - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; - -#if YYLSP_NEEDED - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#endif - -#if YYLSP_NEEDED -# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -# define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - YYSIZE_T yystacksize = YYINITDEPTH; - - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; -#if YYLSP_NEEDED - YYLTYPE yyloc; -#endif - - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; -#if YYLSP_NEEDED - yylsp = yyls; -#endif - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. */ -# if YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), - &yystacksize); - yyls = yyls1; -# else - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); -# endif - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyoverflowlab; -# else - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - goto yyoverflowlab; - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; - - { - short *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyoverflowlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); -# if YYLSP_NEEDED - YYSTACK_RELOCATE (yyls); -# endif -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; -#if YYLSP_NEEDED - yylsp = yyls + yysize - 1; -#endif - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yychar1 = YYTRANSLATE (yychar); - -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables - which are defined only if `YYDEBUG' is set. */ - if (yydebug) - { - YYFPRINTF (stderr, "Next token is %d (%s", - yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise - meaning of a token, for further debugging info. */ -# ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -# endif - YYFPRINTF (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %d (%s), ", - yychar, yytname[yychar1])); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#if YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - yystate = yyn; - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to the semantic value of - the lookahead token. This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - -#if YYLSP_NEEDED - /* Similarly for the default location. Let the user run additional - commands if for instance locations are ranges. */ - yyloc = yylsp[1-yylen]; - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); -#endif - -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables which - are defined only if `YYDEBUG' is set. */ - if (yydebug) - { - int yyi; - - YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - switch (yyn) { - -case 3: -#line 66 "icalssyacc.y" -{ - yyclearin; - YYABORT; - } - break; -case 4: -#line 73 "icalssyacc.y" -{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);} - break; -case 5: -#line 74 "icalssyacc.y" -{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);} - break; -case 6: -#line 79 "icalssyacc.y" -{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);} - break; -case 7: -#line 80 "icalssyacc.y" -{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);} - break; -case 9: -#line 85 "icalssyacc.y" -{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); } - break; -case 10: -#line 86 "icalssyacc.y" -{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_ISNULL,""); } - break; -case 11: -#line 87 "icalssyacc.y" -{ssyacc_add_where(icalss_yy_gauge,yyvsp[-3].v_string,ICALGAUGECOMPARE_ISNOTNULL,""); } - break; -case 12: -#line 88 "icalssyacc.y" -{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); } - break; -case 13: -#line 89 "icalssyacc.y" -{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); } - break; -case 14: -#line 90 "icalssyacc.y" -{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); } - break; -case 15: -#line 91 "icalssyacc.y" -{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); } - break; -case 16: -#line 92 "icalssyacc.y" -{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); } - break; -case 17: -#line 96 "icalssyacc.y" -{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_NONE);} - break; -case 18: -#line 97 "icalssyacc.y" -{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_AND);} - break; -case 19: -#line 98 "icalssyacc.y" -{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_OR);} - break; -} - -#line 705 "/usr/share/bison/bison.simple" - - - yyvsp -= yylen; - yyssp -= yylen; -#if YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG - if (yydebug) - { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; -#if YYLSP_NEEDED - *++yylsp = yyloc; -#endif - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - YYSIZE_T yysize = 0; - char *yymsg; - int yyx, yycount; - - yycount = 0; - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) - if (yycheck[yyx + yyn] == yyx) - yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("parse error, unexpected ") + 1; - yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "parse error, unexpected "); - yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); - - if (yycount < 5) - { - yycount = 0; - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); - yyx++) - if (yycheck[yyx + yyn] == yyx) - { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); - yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - yyerror ("parse error; also virtual memory exhausted"); - } - else -#endif /* defined (YYERROR_VERBOSE) */ - yyerror ("parse error"); - } - goto yyerrlab1; - - -/*--------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action | -`--------------------------------------------------*/ -yyerrlab1: - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - YYDPRINTF ((stderr, "Discarding token %d (%s).\n", - yychar, yytname[yychar1])); - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - - -/*-------------------------------------------------------------------. -| yyerrdefault -- current state does not do anything special for the | -| error token. | -`-------------------------------------------------------------------*/ -yyerrdefault: -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - - /* If its default is to accept any token, ok. Otherwise pop it. */ - yyn = yydefact[yystate]; - if (yyn) - goto yydefault; -#endif - - -/*---------------------------------------------------------------. -| yyerrpop -- pop the current state because it cannot handle the | -| error token | -`---------------------------------------------------------------*/ -yyerrpop: - if (yyssp == yyss) - YYABORT; - yyvsp--; - yystate = *--yyssp; -#if YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG - if (yydebug) - { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "Error: state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); - } -#endif - -/*--------------. -| yyerrhandle. | -`--------------*/ -yyerrhandle: - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - - YYDPRINTF ((stderr, "Shifting error token, ")); - - *++yyvsp = yylval; -#if YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -/*---------------------------------------------. -| yyoverflowab -- parser overflow comes here. | -`---------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); - yyresult = 2; - /* Fall through. */ - -yyreturn: -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif - return yyresult; -} -#line 102 "icalssyacc.y" - - -static void ssyacc_add_where(struct icalgauge_impl* impl, char* str1, - icalgaugecompare compare , char* value_str) -{ - - struct icalgauge_where *where; - char *compstr, *propstr, *c, *s,*l; - - if ( (where = malloc(sizeof(struct icalgauge_where))) ==0){ - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return; - } - - memset(where,0,sizeof(struct icalgauge_where)); - where->logic = ICALGAUGELOGIC_NONE; - where->compare = ICALGAUGECOMPARE_NONE; - where->comp = ICAL_NO_COMPONENT; - where->prop = ICAL_NO_PROPERTY; - - /* remove enclosing quotes */ - s = value_str; - if(*s == '\''){ - s++; - } - l = s+strlen(s)-1; - if(*l == '\''){ - *l=0; - } - - where->value = strdup(s); - - /* Is there a period in str1 ? If so, the string specified both a - component and a property*/ - if( (c = strrchr(str1,'.')) != 0){ - compstr = str1; - propstr = c+1; - *c = '\0'; - } else { - compstr = 0; - propstr = str1; - } - - - /* Handle the case where a component was specified */ - if(compstr != 0){ - where->comp = icalenum_string_to_component_kind(compstr); - } else { - where->comp = ICAL_NO_COMPONENT; - } - - where->prop = icalenum_string_to_property_kind(propstr); - - where->compare = compare; - - if(where->value == 0){ - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - free(where->value); - return; - } - - pvl_push(impl->where,where); -} - -static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l) -{ - pvl_elem e = pvl_tail(impl->where); - struct icalgauge_where *where = pvl_data(e); - - where->logic = l; - -} - - - -static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1) -{ - char *c, *compstr, *propstr; - struct icalgauge_where *where; - - /* Uses only the prop and comp fields of the where structure */ - if ( (where = malloc(sizeof(struct icalgauge_where))) ==0){ - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return; - } - - memset(where,0,sizeof(struct icalgauge_where)); - where->logic = ICALGAUGELOGIC_NONE; - where->compare = ICALGAUGECOMPARE_NONE; - where->comp = ICAL_NO_COMPONENT; - where->prop = ICAL_NO_PROPERTY; - - /* Is there a period in str1 ? If so, the string specified both a - component and a property*/ - if( (c = strrchr(str1,'.')) != 0){ - compstr = str1; - propstr = c+1; - *c = '\0'; - } else { - compstr = 0; - propstr = str1; - } - - - /* Handle the case where a component was specified */ - if(compstr != 0){ - where->comp = icalenum_string_to_component_kind(compstr); - } else { - where->comp = ICAL_NO_COMPONENT; - } - - - /* If the property was '*', then accept all properties */ - if(strcmp("*",propstr) == 0) { - where->prop = ICAL_ANY_PROPERTY; - } else { - where->prop = icalenum_string_to_property_kind(propstr); - } - - - if(where->prop == ICAL_NO_PROPERTY){ - free(where); - icalerror_set_errno(ICAL_BADARG_ERROR); - return; - } - - pvl_push(impl->select,where); -} - -static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1) -{ - icalcomponent_kind ckind; - - ckind = icalenum_string_to_component_kind(str1); - - if(ckind == ICAL_NO_COMPONENT){ - assert(0); - } - - pvl_push(impl->from,(void*)ckind); - -} - - -void sserror(char *s){ - fprintf(stderr,"Parse error \'%s\'\n", s); - icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); -} diff --git a/libical/src/libicalss/icalssyacc.y b/libical/src/libicalss/icalssyacc.y index 85ee6c64c5..101adc8383 100644 --- a/libical/src/libicalss/icalssyacc.y +++ b/libical/src/libicalss/icalssyacc.y @@ -6,7 +6,7 @@ DESCRIPTION: - $Id: icalssyacc.y,v 1.3 2003/09/24 02:06:52 hansp Exp $ + $Id: icalssyacc.y,v 1.4 2003/10/21 18:28:18 ettore Exp $ $Locker: $ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org @@ -30,7 +30,7 @@ #include <stdlib.h> #include <string.h> /* for strdup() */ #include <limits.h> /* for SHRT_MAX*/ -#include "ical.h" +#include <libical/ical.h> #include "icalgauge.h" #include "icalgaugeimpl.h" diff --git a/mail/ChangeLog b/mail/ChangeLog index 1ca3dae2d2..a5548f1232 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,85 @@ +2003-10-21 Not Zed <NotZed@Ximian.com> + + * mail-component.c (emc_popup_properties): implement. + (emc_popup_properties_got_folder): builds dynamic + folder-properties dialogue. + (emc_popup_properties_response): set the properties on the folder + on an ok response. + (emc_popup_properties_free): free the properties working data. + + * mail-folder-cache.c (unset_folder_info): unhook from the right + function for message_changed. + +2003-10-20 Not Zed <NotZed@Ximian.com> + + * mail-component.c (emc_popup_new_folder): pass the right object + to set_selected(). Fixes a new real bug. Undid reformatting. + +2003-10-17 Jeffrey Stedfast <fejj@ximian.com> + + * mail-component.c: General compile fixes. + (emc_popup_new_folder): Fixed to not shadow a parameter. Fixes a + real bug. + + * mail-component.h: Added some prototypes. + +2003-10-13 Not Zed <NotZed@Ximian.com> + + * em-popup.c (em_popup_create_menu_once): only hookup target free + if we have a target set. + + * mail-component.c (load_accounts): removed debug i accidentally + left in. + (emc_tree_right_click): handle right-click context menu, using an + EMPopup table. + (emc_popup_*): setup empty popup handlers. + +2003-10-13 Not Zed <NotZed@Ximian.com> + + * em-folder-selection.c (em_select_folder): asynchornous folder + selection call. + (emfs_folder_selected): callback for folder selected. + + * em-folder-view.c (emfv_popup_move): implement. + (emfv_popup_copy): " + (emfv_popup_move_cb): async folder select callback to run it. + +2003-10-10 Not Zed <NotZed@Ximian.com> + + * mail-account-gui.c + (mail_account_gui_folder_selector_button_new): use + em_folder_selection_button. + (mail_account_gui_new): " + (folder_selected): " + + * em-folder-selection-button.c: Make this use camel uri's rather + than camelfolders. + (set_selection): removed, redundant. + (impl_dispose): removed, not needed. + + * em-folder-selection-button.h: change the selected signal not to + actually return the selection, which must get retrieved later. + + * mail-component.c (em_uri_from_camel): create an evo mail uri + from a camel one. + (em_uri_to_camel): the reverse. + + * mail-signature-editor.c (mail_signature_editor): up the version + of the gtkhtml editor. + +2003-10-09 Not Zed <NotZed@Ximian.com> + + * em-folder-selection-button.c (set_selection): always set + selected_folder, otherwise we don't unset it properly. + + * em-folder-selection.c (em_folder_selection_run_dialog): fix a + small memleak. + (em_folder_selection_run_dialog_uri): do the same as run_dialog + but take, and return physical uri's. + + * mail-component-factory.c (factory): removed some fixme's, and + re-hookedup the composer. + 2003-10-09 Frederic Crozat <fcrozat@mandrakesoft.com> * em-icon-stream.c: (emis_sync_close): @@ -10,6 +92,38 @@ create-rule-from-message bars so that we don't segfault when we right click with a multi-selection. +2003-10-08 Chris Toshok <toshok@ximian.com> + + * em-utils.c (em_utils_camel_address_to_destination): EDestination + => EABDestination, and e_destination => eab_destination. + (reply_get_composer): same. + (post_reply_to_message): same. + + * em-composer-utils.c (ask_confirm_for_unwanted_html_mail) + EDestination => EABDestination, and e_destination => + eab_destination. + (composer_get_message):same. + +2003-10-08 Not Zed <NotZed@Ximian.com> + + * mail-component.c (mail_component_peek): setup vfolders once we + hve the component, since its setup will call mail_component_peek, + fun recursion. + +2003-10-08 Not Zed <NotZed@Ximian.com> + + * mail-component.c (setup_local_folder): removed. + (setup_local_store): setup various needed globals properly. + (setup_account_storages): renamed to load_accounts. + (go_online): turn on interactivity as well as onlinedness. + + * GNOME_Evolution_Mail.server.in.in: point the preferences pages + to the right factory. + +2003-10-07 Not Zed <NotZed@Ximian.com> + + * mail-component.[ch]: Fix copyrights. + 2003-10-06 Jeffrey Stedfast <fejj@ximian.com> * mail-config-druid.c (identity_prepare): Fixed. @@ -28,6 +142,22 @@ the first unread message for now. This is actually annoying the fuck out of me, Radek, and a few other people. +2003-10-02 Not Zed <NotZed@Ximian.com> + + * mail-component.c (add_storage): Add the storage to the hash + after we've initialised it. + (mail_component_evomail_uri_from_folder): hardcode "local" account + pseudo-id for local folders. + (mail_component_get_folder_from_evomail_uri): handle the "local" + account case. + +2003-10-02 Not Zed <NotZed@Ximian.com> + + * mail-component.c (setup_local_store): use mbox:/path rather than + mbox:///path - the mbox code is 'wrong', but this is easier to + fix. fixes local unread counts. maybe the provider url-compare + should address this too. + 2003-10-02 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com> * mail-config-druid.c: Fix for 40917 "Backspace shouldn't @@ -101,6 +231,27 @@ * em-format.c (emf_init): Oops, put the arguments in the right order. +2003-09-29 Ettore Perazzoli <ettore@ximian.com> + + * mail-component.c: New member local_store in + MailComponentPrivate. + (impl_dispose): Unref. + (mail_component_load_storage_by_uri): Return the CamelStore. + (setup_local_folder): New. + (setup_local_store): New. + (mail_component_init): Call it. + (mail_component_peek_storage_set): New. + (mail_component_get_folder_from_evomail_uri): New. + (mail_component_evomail_uri_from_folder): New. + + * em-folder-selection-button.c: New. + * em-folder-selection-button.h: New. + + * em-folder-selection.c: New. + * em-folder-selection.h: New. + + * em-marshal.list: Add NONE:POINTER. + 2003-09-25 Jeffrey Stedfast <fejj@ximian.com> * mail-account-gui.c (mail_account_gui_save): Allow any file: uri @@ -120,6 +271,33 @@ charset string is empty, default the charset to the user's locale charset. Partial fix for bug #47638. +2003-09-23 Ettore Perazzoli <ettore@ximian.com> + + * mail-component.c (add_storage): Remove unused arg "uri". + (mail_component_add_store): Likewise. + (add_storage): Don't set the "Connecting..." node. + (mail_component_init): Set up local store at + ~/.evolution/mail/local. + + * evolution-mbox-upgrade.c (get_local_store): Remove a double + xmlFree() that was causing it to crash. + + +2003-09-23 Ettore Perazzoli <ettore@ximian.com> + + * mail-component.c (add_storage): Note the new store. + + * mail-component-factory.c: Don't include "mail-callbacks.h" + anymore. + + * em-format-html.c (em_format_html_get_type): Get the base + directory with mail_component_peek_base_directory(). + * em-utils.c (filter_editor_response): Likewise. + (em_utils_edit_filters): Likewise. + + * em-folder-browser.c (emfb_init): Get the search context through + mail_component_peek_search_context(). + 2003-09-23 Jeffrey Stedfast <fejj@ximian.com> * evolution-mbox-upgrade.c (get_local_store): Don't xmlFree (name) @@ -273,6 +451,14 @@ * evolution-mbox-upgrade.c: New source file to migrate from the old mbox structure to the new mbox structure. +2003-09-08 Ettore Perazzoli <ettore@ximian.com> + + * mail-folder-cache.c (mail_note_store): Allow NULL storage in + precondition. + + * mail-component.c (mail_component_init): Remove debugging + message. + 2003-08-22 Not Zed <NotZed@Ximian.com> * mail-format.c (write_date): translate the local time format. @@ -284,14 +470,13 @@ day names, and the autoconf magic which made Not Zed dislike the inclusion of the timezone name. -2003-08-14 Jeffrey Stedfast <fejj@ximian.com> +2003-08-18 Ettore Perazzoli <ettore@ximian.com> - * mail-ops.c (mail_send_message): Don't abort at the first failure - after sending (filtering, appending to Sent, syncing). Instead, - keep a running tab of exceptions and then set a culmulative - exception at the end to report to our caller. Also, if we fail to - append to the account Sent folder, try again with the local Sent - folder. Fixes bug #46512. + * GNOME_Evolution_Mail.server.in.in: Rename + GNOME_Evolution_Mail_Component2 to + GNOME_Evolution_Mail_Component_2 and GNOME_Evolution_Mail_Factory2 + to GNOME_Evolution_Mail_Factory_2. + * mail-component-factory.c: Update accordingly. 2003-08-18 Jeffrey Stedfast <fejj@ximian.com> @@ -336,6 +521,15 @@ * mail-display.c (mail_display_render): Change "%P" to "%p" so that strftime() can work under solaris. +2003-08-14 Jeffrey Stedfast <fejj@ximian.com> + + * mail-ops.c (mail_send_message): Don't abort at the first failure + after sending (filtering, appending to Sent, syncing). Instead, + keep a running tab of exceptions and then set a culmulative + exception at the end to report to our caller. Also, if we fail to + append to the account Sent folder, try again with the local Sent + folder. Fixes bug #46512. + 2003-08-13 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com> * e-searching-tokenizer.c (searcher_next_token): Fix for 45818 ( @@ -353,6 +547,12 @@ * mail-session.c (remove_timeout): Removed. (register_timeout): Removed. +2003-08-09 Ettore Perazzoli <ettore@ximian.com> + + * mail-component.c (storage_go_online): Pass NULL for the + operation pointer to mail_note_store(), to sync with Michael's + changes. + 2003-08-05 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (handle_multipart_encrypted): Updated for @@ -1308,6 +1508,154 @@ * message-browser.c (message_browser_new): Handle our own Delete key presses. Fixes bug #45597. +2003-07-25 Ettore Perazzoli <ettore@ximian.com> + + * mail-callbacks.c (do_view_message): No need to pass a shell + argument to message_browser_new() anymore. + + * message-browser.c (message_browser_new): Removed arg shell. No + need to pass it to folder_browser_new() either. + + * mail-component.c (create_view_callback): No need to pass a shell + arg to folder_browser_factory_new_control() anymore. + + * folder-browser-factory.c (folder_browser_factory_new_control): + Removed arg shell; folder_browser_browser_new() doesn't need it + anymore. + + * folder-browser.c (folder_browser_destroy): No need to unref + ->shell anymore. + (folder_browser_new): Removed shell arg. + (folder_browser_gui_init): Removed a const qualifier that was not + supposed to be there. + + * folder-browser.h: Removed member shell from struct + FolderBrowser. + +2003-07-25 Ettore Perazzoli <ettore@ximian.com> + + * folder-browser.c (folder_browser_gui_init): Get the search + context through mail_component_peek_search_context(), since it's + no longer a global variable. + (folder_browser_gui_init): Cleaned up an extra unneeded if() + statement. + + * mail-component.c: New member search_context in struct + MailComponentPrivate. + (mail_component_peek_search_context): New. + (setup_search_context): New function to initialize the + search_context, based on the old code in component-factory.c. + (mail_component_init): Call it here. + (impl_dispose): Unref the rule_context. + + * mail-component-factory.c: Removed global variable + search_context. + +2003-07-25 Ettore Perazzoli <ettore@ximian.com> + + * mail-component.c (browser_page_switched_callback): New callback + for the "page_switched" signal on EStorageBrowser; deactivate the + previous page, activate the new one. + (impl_createControls): Connect. + +2003-07-24 Ettore Perazzoli <ettore@ximian.com> + + * mail-mt.c (do_op_status): Pass "evolution-mail" as the ID to + evolution_activity_client_new(). [This is just a temporary thing + to avoid the fact that we don't have component-factory.h anymore. + Eventually we'll just get rid of the activity client stuff.] + + * mail-component-factory.c: Added to the build. Also, finished + implementing and moving the factory over from component-factory.c. + + * component-factory.c: Removed from the build. + * component-factory.h: Removed from the build. + + * mail-component.c: Removed some debugging messages. + +2003-07-23 Ettore Perazzoli <ettore@ximian.com> + + * subscribe-dialog.c: Converted to use EStorages instead of + EvolutionStorages and the new MailComponent object. + + * mail.h: Nuked a bunch of stuff. This will go away when I am + done refactoring. + + * mail-offline-handler.c: Use the new MailComponent object. + + * mail-folder-cache.c, mail-folder-cache.h: Converted to use + EStorages instead of EvolutionStorages. + + * mail-display.c: Use g_timeout and g_source functions instead of + gtk_timeout functions. + + * mail-send-recv.c: Use g_timeout and g_source functions instead + of gtk_timeout functions. + (receive_update_got_store): Updated for the new mail_note_store(). + + * mail-session.c: Use g_timeout and g_source functions instead of + gtk_timeout functions. + + * mail-config-factory.c (factory): Removed. + + * folder-browser.c (folder_browser_destroy): Use GLib + timeout/source functions instead of the deprecated GTK ones. + (done_message_selected): Likewise. + (folder_browser_gui_init): Protect against fb->search being NULL. + + * mail-account-gui.c (add_new_store): Use new MailComponent object + and EStorages instead of EvolutionStorages. + (mail_account_gui_save): Likewise. + + * mail-accounts.c (account_delete_clicked): Use new MailComponent + object and EStorages instead of EvolutionStorages. + (account_able_clicked): Likewise. + (account_able_toggled): Likewise. + + * mail-autofilter.c: Use mail_component_peek_base_directory() + instead of the evolution_dir global. + * mail-callbacks.c: Likewise. + * mail-config.c (uri_to_evname): Likewise. + (mail_config_get_signature_list): Likewise. + (delete_unused_signature_file): Likewise. + * mail-display.c (mail_display_class_init): Likewise. + * mail-importer.c (mail_importer_make_local_folder): Likewise. + * mail-local.c (mlf_getv): Likewise. + * mail-ops.c (uid_cachename_hack): Likewise. + * mail-summary.c (generate_folder_summaries): Likewise. + * mail-tools.c (mail_tool_get_local_inbox): Likewise. + (mail_tools_folder_to_url): Likewise. + * mail-vfolder.c (mail_vfolder_delete_uri): Likewise. + (mail_vfolder_rename_uri): Likewise. + (context_rule_removed): Likewise. + (store_folder_deleted): Likewise. + (store_folder_renamed): Likewise. + (vfolder_load_storage): Likewise. + (vfolder_editor_response): Likewise. + (edit_rule_response): Likewise. + (new_rule_clicked): Likewise. + (vfolder_gui_add_rule): Likewise. + * mail-session.c (main_get_filter_driver): Likewise. + (mail_session_forget_password): Likewise. + (mail_session_init): Get a base_directory arg. + + * component-factory.c, component-factory.h: Disabled a bunch of + stuff to get it to compile in the new configuration. These files + will eventually go away when I am done refactoring this. + + * Makefile.am: Do not build importers, compile generate + skels/stubs for Evolution. + + * GNOME_Evolution_Mail.server.in.in: Rename control factory to + OAFIID:GNOME_Evolution_Mail_Factory2. Add new component + GNOME_Evolution_Mail_Component2. + + * mail-component-factory.c: New file implementing the Bonobo + factory. + + * mail-component.c, mail-component.h: New files implementing the + new mail component, using the new Evolution::Component IDL. + 2003-07-23 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (mail_format_data_wrapper_write_to_stream): Revert diff --git a/mail/GNOME_Evolution_Mail.server.in.in b/mail/GNOME_Evolution_Mail.server.in.in index 9d0391d0be..30fcd5b070 100644 --- a/mail/GNOME_Evolution_Mail.server.in.in +++ b/mail/GNOME_Evolution_Mail.server.in.in @@ -3,7 +3,7 @@ <!-- Folder display control --> <!-- (factory) --> - <oaf_server iid="OAFIID:GNOME_Evolution_Mail_ControlFactory" + <oaf_server iid="OAFIID:GNOME_Evolution_Mail_Factory_2" type="shlib" location="@COMPONENTDIR@/libevolution-mail.so"> @@ -29,6 +29,22 @@ _value="Evolution Mail folder viewer"/> </oaf_server> + <!-- Component Interface --> + + <oaf_server iid="OAFIID:GNOME_Evolution_Mail_Component_2" + type="factory" + location="OAFIID:GNOME_Evolution_Mail_Factory_2"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/Evolution/Component:1.0"/> + </oaf_attribute> + + <oaf_attribute name="name" type="string" _value="Evolution Mail component"/> + + <oaf_attribute name="evolution:component_icon" type="string" value="evolution-inbox.png"/> + <oaf_attribute name="evolution:component_display_order" type="number" value="1"/> + </oaf_server> + <!-- Shell Component --> <oaf_server iid="OAFIID:GNOME_Evolution_Mail_ShellComponent" @@ -53,7 +69,7 @@ <!-- (composer) --> <oaf_server iid="OAFIID:GNOME_Evolution_Mail_Composer" type="factory" - location="OAFIID:GNOME_Evolution_Mail_ControlFactory"> + location="OAFIID:GNOME_Evolution_Mail_Factory_2"> <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:GNOME/Evolution:Composer:1.0"/> @@ -109,7 +125,7 @@ <!-- Account Editor --> <oaf_server iid="OAFIID:GNOME_Evolution_Mail_Accounts_ConfigControl" type="factory" - location="OAFIID:GNOME_Evolution_Mail_ControlFactory"> + location="OAFIID:GNOME_Evolution_Mail_Factory_2"> <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/> @@ -138,7 +154,7 @@ <!-- Mail Preferences --> <oaf_server iid="OAFIID:GNOME_Evolution_Mail_Preferences_ConfigControl" type="factory" - location="OAFIID:GNOME_Evolution_Mail_ControlFactory"> + location="OAFIID:GNOME_Evolution_Mail_Factory_2"> <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/> @@ -163,7 +179,7 @@ <!-- Composer Preferences --> <oaf_server iid="OAFIID:GNOME_Evolution_Mail_ComposerPrefs_ConfigControl" type="factory" - location="OAFIID:GNOME_Evolution_Mail_ControlFactory"> + location="OAFIID:GNOME_Evolution_Mail_Factory_2"> <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/> diff --git a/mail/Makefile.am b/mail/Makefile.am index 75802f396e..ac0b6827bd 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = importers +SUBDIRS = # importers FIXME libexec_PROGRAMS = \ evolution-mbox-upgrade @@ -39,128 +39,153 @@ INCLUDES = \ component_LTLIBRARIES = libevolution-mail.la -EVOLUTION_MAIL_CORBA_GENERATED_H = \ + +# Code generation for Mailer.idl + +MAILER_IDL = Mailer.idl + +MAILER_IDL_GENERATED_H = \ Mailer.h -EVOLUTION_MAIL_CORBA_GENERATED_C = \ +MAILER_IDL_GENERATED_C = \ Mailer-common.c \ Mailer-skels.c \ Mailer-stubs.c -EVOLUTION_MAIL_CORBA_GENERATED = $(EVOLUTION_MAIL_CORBA_GENERATED_C) $(EVOLUTION_MAIL_CORBA_GENERATED_H) +MAILER_IDL_GENERATED = $(MAILER_IDL_GENERATED_C) $(MAILER_IDL_GENERATED_H) + +$(MAILER_IDL_GENERATED_H): Mailer.idl + $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $(srcdir)/Mailer.idl +$(MAILER_IDL_GENERATED_C): $(MAILER_IDL_GENERATED_H) + + +# Code generation for Spell.idl SPELL_IDL = Spell.idl -IDL_GENERATED_H = \ +SPELL_IDL_GENERATED_H = \ Spell.h -IDL_GENERATED_C = \ +SPELL_IDL_GENERATED_C = \ Spell-common.c \ Spell-skels.c \ Spell-stubs.c -IDL_GENERATED = $(IDL_GENERATED_C) $(IDL_GENERATED_H) +SPELL_IDL_GENERATED = $(SPELL_IDL_GENERATED_C) $(SPELL_IDL_GENERATED_H) -$(IDL_GENERATED_H): $(SPELL_IDL) +$(SPELL_IDL_GENERATED_H): $(SPELL_IDL) $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $(srcdir)/Spell.idl -$(IDL_GENERATED_C): $(IDL_GENERATED_H) +$(SPELL_IDL_GENERATED_C): $(SPELL_IDL_GENERATED_H) Spell-impl.o: Spell.h -libevolution_mail_la_SOURCES = \ - $(EVOLUTION_MAIL_CORBA_GENERATED) \ - $(IDL_GENERATED) \ - component-factory.c \ - component-factory.h \ - e-searching-tokenizer.c \ - e-searching-tokenizer.h \ - em-inline-filter.c \ - em-inline-filter.h \ - em-folder-view.c \ - em-folder-view.h \ - em-folder-browser.c \ - em-folder-browser.h \ - em-format.c \ - em-format.h \ - em-format-html.c \ - em-format-html.h \ - em-format-html-display.c \ - em-format-html-display.h \ - em-format-html-print.c \ - em-format-html-print.h \ - em-format-html-quote.c \ - em-format-html-quote.h \ - em-format-quote.c \ - em-format-quote.h \ - em-marshal.c \ - em-marshal.h \ - em-message-browser.c \ - em-message-browser.h \ - em-composer-utils.c \ - em-composer-utils.h \ - em-popup.c \ - em-popup.h \ - em-utils.c \ - em-utils.h \ - em-subscribe-editor.c \ - em-subscribe-editor.h \ - em-sync-stream.c \ - em-sync-stream.h \ - em-icon-stream.c \ - em-icon-stream.h \ - em-html-stream.c \ - em-html-stream.h \ - folder-browser-factory.c \ - folder-browser-factory.h \ - folder-info.c \ - folder-info.h \ - mail-account-editor.c \ - mail-account-editor.h \ - mail-account-gui.c \ - mail-account-gui.h \ - mail-accounts.c \ - mail-accounts.h \ - mail-autofilter.c \ - mail-autofilter.h \ - mail-composer-prefs.c \ - mail-composer-prefs.h \ - mail-config.c \ - mail-config.h \ - mail-config-druid.c \ - mail-config-druid.h \ - mail-crypto.c \ - mail-crypto.h \ - mail-config-factory.c \ - mail-config-factory.h \ - mail-preferences.c \ - mail-preferences.h \ - mail-folder-cache.c \ - mail-folder-cache.h \ - mail-importer.c \ - mail-importer.h \ - mail-local.c \ - mail-local.h \ - mail-mt.c \ - mail-mt.h \ - mail-offline-handler.c \ - mail-offline-handler.h \ - mail-ops.c \ - mail-ops.h \ - mail-send-recv.c \ - mail-send-recv.h \ - mail-session.c \ - mail-session.h \ - mail-signature-editor.c \ - mail-signature-editor.h \ - mail-tools.c \ - mail-tools.h \ - mail-types.h \ - mail-vfolder.c \ - mail-vfolder.h \ - message-list.c \ - message-list.h \ - message-tag-editor.c \ - message-tag-editor.h \ - message-tag-followup.c \ - message-tag-followup.h \ + +# libevolution-mail + +libevolution_mail_la_SOURCES = \ + $(SPELL_IDL_GENERATED) \ + $(MAILER_IDL_GENERATED) \ + e-searching-tokenizer.c \ + e-searching-tokenizer.h \ + em-inline-filter.c \ + em-inline-filter.h \ + em-folder-selection.c \ + em-folder-selection.h \ + em-folder-selection-button.c \ + em-folder-selection-button.h \ + em-folder-selector.c \ + em-folder-selector.h \ + em-folder-view.c \ + em-folder-view.h \ + em-folder-browser.c \ + em-folder-browser.h \ + em-format.c \ + em-format.h \ + em-format-html.c \ + em-format-html.h \ + em-format-html-display.c \ + em-format-html-display.h \ + em-format-html-print.c \ + em-format-html-print.h \ + em-format-html-quote.c \ + em-format-html-quote.h \ + em-format-quote.c \ + em-format-quote.h \ + em-marshal.c \ + em-marshal.h \ + em-message-browser.c \ + em-message-browser.h \ + em-composer-utils.c \ + em-composer-utils.h \ + em-popup.c \ + em-popup.h \ + em-utils.c \ + em-utils.h \ + em-subscribe-editor.c \ + em-subscribe-editor.h \ + em-sync-stream.c \ + em-sync-stream.h \ + em-icon-stream.c \ + em-icon-stream.h \ + em-html-stream.c \ + em-html-stream.h \ + folder-browser-factory.c \ + folder-browser-factory.h \ + folder-info.c \ + folder-info.h \ + mail-account-editor.c \ + mail-account-editor.h \ + mail-account-gui.c \ + mail-account-gui.h \ + mail-accounts.c \ + mail-accounts.h \ + mail-autofilter.c \ + mail-autofilter.h \ + mail-component-factory.c \ + mail-component.c \ + mail-component.h \ + mail-composer-prefs.c \ + mail-composer-prefs.h \ + mail-config.c \ + mail-config.h \ + mail-config-druid.c \ + mail-config-druid.h \ + mail-crypto.c \ + mail-crypto.h \ + mail-config-factory.c \ + mail-config-factory.h \ + mail-preferences.c \ + mail-preferences.h \ + mail-folder-cache.c \ + mail-folder-cache.h \ + mail-importer.c \ + mail-importer.h \ + mail-mt.c \ + mail-mt.h \ + mail-offline-handler.c \ + mail-offline-handler.h \ + mail-ops.c \ + mail-ops.h \ + mail-send-recv.c \ + mail-send-recv.h \ + mail-session.c \ + mail-session.h \ + mail-signature-editor.c \ + mail-signature-editor.h \ + mail-tools.c \ + mail-tools.h \ + mail-types.h \ + mail-vfolder.c \ + mail-vfolder.h \ + message-list.c \ + message-list.h \ + message-tag-editor.c \ + message-tag-editor.h \ + message-tag-followup.c \ + message-tag-followup.h \ mail.h +# EPFIXME: Functionality to be brought back to life. +# +# mail-local.c +# mail-local.h + libevolution_mail_la_LIBADD = \ $(top_builddir)/shell/importer/libevolution-importer.la \ $(top_builddir)/camel/libcamel.la \ @@ -177,6 +202,9 @@ libevolution_mail_la_LIBADD = \ libevolution_mail_la_LDFLAGS = \ -avoid-version -module + +# .server files + evolution_mbox_upgrade_SOURCES = evolution-mbox-upgrade.c evolution_mbox_upgrade_LDADD = \ $(top_builddir)/camel/libcamel.la \ @@ -190,21 +218,16 @@ server_DATA = $(server_in_files:.server.in.in=.server) sed -e "s|\@COMPONENTDIR\@|$(componentdir)|" $< > $@ @INTLTOOL_SERVER_RULE@ -MARSHAL_GENERATED = em-marshal.c em-marshal.h -@EVO_MARSHAL_RULE@ - -glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade message-tags.glade mail-search.glade -etspec_DATA = message-list.etspec +# Misc data to install -schemadir = $(GCONF_SCHEMA_FILE_DIR) -schema_DATA = evolution-mail.schemas +glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade message-tags.glade mail-search.glade +MARSHAL_GENERATED = em-marshal.c em-marshal.h +@EVO_MARSHAL_RULE@ -idl_DATA = Mailer.idl +etspec_DATA = mail-accounts.etspec message-list.etspec subscribe-dialog.etspec -$(EVOLUTION_MAIL_CORBA_GENERATED_H): Mailer.idl - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $(srcdir)/Mailer.idl -$(EVOLUTION_MAIL_CORBA_GENERATED_C): $(EVOLUTION_MAIL_CORBA_GENERATED_H) +idl_DATA = $(MAILER_IDL) EXTRA_DIST = \ ChangeLog.pre-1-4 \ @@ -217,6 +240,9 @@ EXTRA_DIST = \ $(server_DATA) \ $(etspec_DATA) + +# Purify support + if ENABLE_PURIFY PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @@ -228,6 +254,12 @@ evolution-mail.pure: evolution-mail endif + +# GConf + +schemadir = $(GCONF_SCHEMA_FILE_DIR) +schema_DATA = evolution-mail.schemas + install-data-local: if test -z "$(DESTDIR)" ; then \ for p in $(schema_DATA) ; do \ @@ -235,8 +267,11 @@ install-data-local: done \ fi + +# Prologue + dist-hook: cd $(distdir); rm -f $(BUILT_SOURCES) -BUILT_SOURCES = $(EVOLUTION_MAIL_CORBA_GENERATED) $(IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA) +BUILT_SOURCES = $(MAILER_IDL_GENERATED) $(SPELL_IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA) CLEANFILES = $(BUILT_SOURCES) diff --git a/mail/component-factory.c b/mail/component-factory.c index a1d0c322eb..9f361ec5fc 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -20,6 +20,8 @@ * Boston, MA 02111-1307, USA. */ +/* EPFIXME: This file should go away. */ + #ifdef HAVE_CONFIG_H #include <config.h> @@ -54,6 +56,7 @@ #include "mail-config.h" #include "mail-config-factory.h" #include "mail-preferences.h" +#include "mail-component.h" #include "mail-composer-prefs.h" #include "mail-tools.h" #include "mail-ops.h" @@ -79,7 +82,6 @@ char *default_sent_folder_uri; CamelFolder *sent_folder = NULL; char *default_outbox_folder_uri; CamelFolder *outbox_folder = NULL; -char *evolution_dir; EvolutionShellClient *global_shell_client = NULL; @@ -136,6 +138,14 @@ type_is_vtrash (const char *type) return !strcmp (type, "vtrash"); } + +/* Forward decls just to get it to compile without warnings. EPFIXME: This is + all junk at this point in the refactoring anyways, so it will all die. */ +static void mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const char *name); +static void mail_load_storages (GNOME_Evolution_Shell shell, EAccountList *accounts); +static void mail_hash_storage (CamelService *store, EvolutionStorage *storage); + + /* EvolutionShellComponent methods and signals. */ static BonoboControl * @@ -766,6 +776,7 @@ owner_set_cb (EvolutionShellComponent *shell_component, const char *evolution_homedir, gpointer user_data) { +#if 0 GNOME_Evolution_Shell corba_shell; EAccountList *accounts; int i; @@ -774,7 +785,6 @@ owner_set_cb (EvolutionShellComponent *shell_component, global_shell_client = shell_client; g_object_weak_ref ((GObject *) shell_client, (GWeakNotify) shell_client_destroy, NULL); - evolution_dir = g_strdup (evolution_homedir); mail_session_init (); async_event = mail_async_event_new(); @@ -831,6 +841,7 @@ owner_set_cb (EvolutionShellComponent *shell_component, /* Everything should be ready now */ evolution_folder_info_notify_ready (); +#endif } static void @@ -1037,7 +1048,7 @@ request_quit (EvolutionShellComponent *shell_component, } static BonoboObject * -create_component (void) +create_shell_component (void) { EvolutionShellComponentDndDestinationFolder *destination_interface; MailOfflineHandler *offline_handler; @@ -1336,12 +1347,14 @@ storage_xfer_folder (EvolutionStorage *storage, camel_exception_clear (&ex); } +#if 0 /* EPFIXME */ static void storage_connected (CamelStore *store, CamelFolderInfo *info, void *listener) { notify_listener (listener, (info ? GNOME_Evolution_Storage_OK : GNOME_Evolution_Storage_GENERIC_ERROR)); } +#endif static void storage_connect (EvolutionStorage *storage, @@ -1349,8 +1362,10 @@ storage_connect (EvolutionStorage *storage, const char *path, CamelStore *store) { +#if 0 /* EPFIXME */ mail_note_store (CAMEL_STORE (store), NULL, storage, CORBA_OBJECT_NIL, storage_connected, listener); +#endif } static void @@ -1373,7 +1388,7 @@ add_storage (const char *name, const char *uri, CamelService *store, evolution_storage_has_subfolders (storage, "/", _("Connecting...")); mail_hash_storage (store, storage); /*if (auto_connect)*/ - mail_note_store ((CamelStore *) store, NULL, storage, CORBA_OBJECT_NIL, NULL, NULL); + /* EPFIXME mail_note_store ((CamelStore *) store, NULL, storage, CORBA_OBJECT_NIL, NULL, NULL); */ /* falllll */ case EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED: case EVOLUTION_STORAGE_ERROR_EXISTS: @@ -1386,34 +1401,7 @@ add_storage (const char *name, const char *uri, CamelService *store, } } -void -mail_add_storage (CamelStore *store, const char *name, const char *uri) -{ - EvolutionShellClient *shell_client; - GNOME_Evolution_Shell shell; - CamelException ex; - - g_return_if_fail (CAMEL_IS_STORE (store)); - - shell_client = evolution_shell_component_get_owner (shell_component); - shell = evolution_shell_client_corba_objref (shell_client); - - camel_exception_init (&ex); - - if (name == NULL) { - char *service_name; - - service_name = camel_service_get_name ((CamelService *) store, TRUE); - add_storage (service_name, uri, (CamelService *) store, shell, &ex); - g_free (service_name); - } else { - add_storage (name, uri, (CamelService *) store, shell, &ex); - } - - camel_exception_clear (&ex); -} - -void +static void mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const char *name) { CamelException ex; @@ -1468,7 +1456,7 @@ mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const ch camel_object_unref (CAMEL_OBJECT (store)); } -void +static void mail_load_storages (GNOME_Evolution_Shell shell, EAccountList *accounts) { CamelException ex; @@ -1500,103 +1488,23 @@ mail_load_storages (GNOME_Evolution_Shell shell, EAccountList *accounts) g_object_unref (iter); } -void +static void mail_hash_storage (CamelService *store, EvolutionStorage *storage) { camel_object_ref (CAMEL_OBJECT (store)); g_hash_table_insert (storages_hash, store, storage); } -EvolutionStorage * -mail_lookup_storage (CamelStore *store) -{ - EvolutionStorage *storage; - - /* Because the storages_hash holds a reference to each store - * used as a key in it, none of them will ever be gc'ed, meaning - * any call to camel_session_get_{service,store} with the same - * URL will always return the same object. So this works. - */ - - storage = g_hash_table_lookup (storages_hash, store); - if (storage) - bonobo_object_ref (BONOBO_OBJECT (storage)); - - return storage; -} - +#if 0 static void store_disconnect(CamelStore *store, void *event_data, void *data) { camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); camel_object_unref (CAMEL_OBJECT (store)); } +#endif -void -mail_remove_storage (CamelStore *store) -{ - EvolutionStorage *storage; - EvolutionShellClient *shell_client; - GNOME_Evolution_Shell corba_shell; - - /* Because the storages_hash holds a reference to each store - * used as a key in it, none of them will ever be gc'ed, meaning - * any call to camel_session_get_{service,store} with the same - * URL will always return the same object. So this works. - */ - - storage = g_hash_table_lookup (storages_hash, store); - if (!storage) - return; - - g_hash_table_remove (storages_hash, store); - - /* so i guess potentially we could have a race, add a store while one - being removed. ?? */ - mail_note_store_remove(store); - - shell_client = evolution_shell_component_get_owner (shell_component); - corba_shell = evolution_shell_client_corba_objref(shell_client); - - evolution_storage_deregister_on_shell (storage, corba_shell); - - mail_async_event_emit(async_event, MAIL_ASYNC_THREAD, (MailAsyncFunc)store_disconnect, store, NULL, NULL); -} - -void -mail_remove_storage_by_uri (const char *uri) -{ - CamelProvider *prov; - CamelService *store; - - prov = camel_session_get_provider (session, uri, NULL); - if (!prov) - return; - if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE) || - (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL)) - return; - - store = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL); - if (store != NULL) { - mail_remove_storage (CAMEL_STORE (store)); - camel_object_unref (CAMEL_OBJECT (store)); - } -} - -int -mail_storages_count (void) -{ - return g_hash_table_size (storages_hash); -} - -void -mail_storages_foreach (GHFunc func, gpointer data) -{ - g_hash_table_foreach (storages_hash, func, data); -} - - -#define FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ControlFactory" +#define FACTORY_ID "OAFIID:GNOME_Evolution_Mail_Factory_2" #define MAIL_CONFIG_IID "OAFIID:GNOME_Evolution_MailConfig" #define WIZARD_IID "OAFIID:GNOME_Evolution_Mail_Wizard" @@ -1608,9 +1516,14 @@ factory (BonoboGenericFactory *factory, const char *component_id, void *closure) { - if (strcmp (component_id, COMPONENT_ID) == 0) - return create_component(); - else if (strcmp(component_id, MAIL_CONFIG_IID) == 0) + if (strcmp (component_id, SHELL_COMPONENT_ID) == 0) + return create_shell_component(); + else if (strcmp (component_id, COMPONENT_ID) == 0) { + MailComponent *component = mail_component_peek (); + + bonobo_object_ref (BONOBO_OBJECT (component)); + return BONOBO_OBJECT (component); + } else if (strcmp(component_id, MAIL_CONFIG_IID) == 0) return (BonoboObject *)g_object_new (evolution_mail_config_get_type (), NULL); else if (strcmp(component_id, FOLDER_INFO_IID) == 0) return evolution_folder_info_new(); diff --git a/mail/component-factory.h b/mail/component-factory.h index 3abd058556..fdc7c4056f 100644 --- a/mail/component-factory.h +++ b/mail/component-factory.h @@ -23,7 +23,8 @@ #ifndef COMPONENT_FACTORY_H #define COMPONENT_FACTORY_H -#define COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_ShellComponent" +#define COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_Component2" +#define SHELL_COMPONENT_ID "OAFIID:GNOME_Evolution_Mail_ShellComponent" #define SUMMARY_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ExecutiveSummaryComponentFactory" #endif diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index e181c2cb33..75166a19b4 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -101,7 +101,7 @@ composer_destroy_cb (gpointer user_data, GObject *deadbeef) } static gboolean -ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recipients) +ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EABDestination **recipients) { gboolean show_again, res; GConfClient *gconf; @@ -117,10 +117,10 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip str = g_string_new (_("You are sending an HTML-formatted message. Please make sure that\n" "the following recipients are willing and able to receive HTML mail:\n")); for (i = 0; recipients[i] != NULL; ++i) { - if (!e_destination_get_html_mail_pref (recipients[i])) { + if (!eab_destination_get_html_mail_pref (recipients[i])) { const char *name; - name = e_destination_get_textrep (recipients[i], FALSE); + name = eab_destination_get_textrep (recipients[i], FALSE); g_string_append_printf (str, " %s\n", name); } @@ -262,7 +262,7 @@ static CamelMimeMessage * composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_object_data) { CamelMimeMessage *message = NULL; - EDestination **recipients, **recipients_bcc; + EABDestination **recipients, **recipients_bcc; gboolean send_html, confirm_html; CamelInternetAddress *cia; int hidden = 0, shown = 0; @@ -286,15 +286,15 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_ /* see which ones are visible/present, etc */ if (recipients) { for (i = 0; recipients[i] != NULL; i++) { - const char *addr = e_destination_get_address (recipients[i]); + const char *addr = eab_destination_get_address (recipients[i]); if (addr && addr[0]) { camel_address_decode ((CamelAddress *) cia, addr); if (camel_address_length ((CamelAddress *) cia) > 0) { camel_address_remove ((CamelAddress *) cia, -1); num++; - if (e_destination_is_evolution_list (recipients[i]) - && !e_destination_list_show_addresses (recipients[i])) { + if (eab_destination_is_evolution_list (recipients[i]) + && !eab_destination_list_show_addresses (recipients[i])) { hidden++; } else { shown++; @@ -307,7 +307,7 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_ recipients_bcc = e_msg_composer_get_bcc (composer); if (recipients_bcc) { for (i = 0; recipients_bcc[i] != NULL; i++) { - const char *addr = e_destination_get_address (recipients_bcc[i]); + const char *addr = eab_destination_get_address (recipients_bcc[i]); if (addr && addr[0]) { camel_address_decode ((CamelAddress *) cia, addr); @@ -318,7 +318,7 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_ } } - e_destination_freev (recipients_bcc); + eab_destination_freev (recipients_bcc); } camel_object_unref (cia); @@ -347,7 +347,7 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_ if (recipients) { for (i = 0; recipients[i] != NULL && !html_problem; i++) { - if (!e_destination_get_html_mail_pref (recipients[i])) + if (!eab_destination_get_html_mail_pref (recipients[i])) html_problem = TRUE; } } @@ -384,12 +384,12 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_ /* Get the message recipients and 'touch' them, boosting their use scores */ if (recipients) - e_destination_touchv (recipients); + eab_destination_touchv (recipients); finished: if (recipients) - e_destination_freev (recipients); + eab_destination_freev (recipients); return message; } diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 243ea449eb..03ab55800f 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -156,9 +156,8 @@ static void emfb_init(GObject *o) { EMFolderBrowser *emfb = (EMFolderBrowser *)o; + RuleContext *search_context = mail_component_peek_search_context (mail_component_peek ()); struct _EMFolderBrowserPrivate *p; - /* FIXME ... */ - extern RuleContext *search_context; p = emfb->priv = g_malloc0(sizeof(struct _EMFolderBrowserPrivate)); diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c new file mode 100644 index 0000000000..ac5a6e1d06 --- /dev/null +++ b/mail/em-folder-selection-button.c @@ -0,0 +1,242 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* em-folder-selection-button.c + * + * Copyright (C) 2003 Ximian, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli <ettore@ximian.com> + */ + +#include <config.h> + +#include <string.h> + +#include "em-folder-selection-button.h" + +#include "mail-component.h" +#include "em-folder-selector.h" + +#include <gal/util/e-util.h> + +#include <gtk/gtkimage.h> +#include <gtk/gtklabel.h> +#include <gtk/gtkhbox.h> + + +#define PARENT_TYPE gtk_button_get_type () +static GtkButtonClass *parent_class = NULL; + + +struct _EMFolderSelectionButtonPrivate { + GtkWidget *icon; + GtkWidget *label; + + char *uri; + + char *title; + char *caption; +}; + +enum { + SELECTED, + LAST_SIGNAL +}; +static guint signals[LAST_SIGNAL] = { 0 }; + + +/* Utility functions. */ + +static void +set_contents_unselected (EMFolderSelectionButton *button) +{ + gtk_image_set_from_pixbuf (GTK_IMAGE (button->priv->icon), NULL); + gtk_label_set_text (GTK_LABEL (button->priv->label), _("<click here to select a folder>")); +} + +static void +set_contents (EMFolderSelectionButton *button) +{ + EMFolderSelectionButtonPrivate *priv = button->priv; + char *path, *tmp, *label; + + if (priv->uri == NULL) + goto unset; + + /* We set the button name directly from the storage set path, which is /accountname/path/foldername */ + path = e_storage_set_get_path_for_physical_uri(mail_component_peek_storage_set(mail_component_peek()), priv->uri); + + if (path == NULL) + goto unknown; + + tmp = strchr(path+1, '/'); + if (tmp == NULL) + goto unknown; + *tmp++ = 0; + + label = g_strdup_printf(_("\"%s\" in \"%s\""), tmp, path+1); + gtk_label_set_text (GTK_LABEL (priv->label), label); + g_free (label); + + g_free(path); + return; + +unknown: + g_free(path); +unset: + set_contents_unselected(button); +} + +static void +impl_finalize (GObject *object) +{ + EMFolderSelectionButtonPrivate *priv = EM_FOLDER_SELECTION_BUTTON (object)->priv; + + g_free (priv->title); + g_free (priv->caption); + g_free(priv->uri); + g_free (priv); + + (* G_OBJECT_CLASS (parent_class)->finalize) (object); +} + +static void +emfsb_selector_response(EMFolderSelector *emfs, int response, EMFolderSelectionButton *button) +{ + if (response == GTK_RESPONSE_OK) { + const char *uri = em_folder_selector_get_selected_uri(emfs); + + em_folder_selection_button_set_selection(button, uri); + g_signal_emit(button, signals[SELECTED], 0); + } + + gtk_widget_destroy((GtkWidget *)emfs); +} + +static void +impl_clicked (GtkButton *button) +{ + EMFolderSelectionButtonPrivate *priv = EM_FOLDER_SELECTION_BUTTON (button)->priv; + EStorageSet *ess; + GtkWidget *w; + GtkWidget *toplevel; + + if (GTK_BUTTON_CLASS (parent_class)->clicked != NULL) + (* GTK_BUTTON_CLASS (parent_class)->clicked) (button); + + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button)); + ess = mail_component_peek_storage_set(mail_component_peek()); + w = em_folder_selector_new(ess, EM_FOLDER_SELECTOR_CAN_CREATE, priv->title, priv->caption); + em_folder_selector_set_selected_uri((EMFolderSelector *)w, priv->uri); + g_signal_connect(w, "response", G_CALLBACK(emfsb_selector_response), button); + gtk_widget_show(w); +} +#if 0 +{ + uri = em_folder_selection_run_dialog_uri((GtkWindow *)toplevel, + priv->title, + priv->caption, + priv->uri); + + em_folder_selection_button_set_selection (EM_FOLDER_SELECTION_BUTTON (button), uri); + g_free(uri); + + g_signal_emit (button, signals[SELECTED], 0); +} +#endif + +static void +class_init (EMFolderSelectionButtonClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkButtonClass *button_class = GTK_BUTTON_CLASS (class); + + object_class->finalize = impl_finalize; + + button_class->clicked = impl_clicked; + + parent_class = g_type_class_peek_parent (class); + + signals[SELECTED] = g_signal_new ("selected", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EMFolderSelectionButtonClass, selected), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +init (EMFolderSelectionButton *folder_selection_button) +{ + EMFolderSelectionButtonPrivate *priv; + GtkWidget *box; + + priv = g_new0 (EMFolderSelectionButtonPrivate, 1); + folder_selection_button->priv = priv; + + box = gtk_hbox_new (FALSE, 4); + + priv->icon = gtk_image_new (); + gtk_box_pack_start (GTK_BOX (box), priv->icon, FALSE, TRUE, 0); + + priv->label = gtk_label_new (""); + gtk_label_set_justify (GTK_LABEL (priv->label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.0); + gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0); + + gtk_widget_show_all (box); + gtk_container_add (GTK_CONTAINER (folder_selection_button), box); + + set_contents (folder_selection_button); +} + +GtkWidget * +em_folder_selection_button_new(const char *title, const char *caption) +{ + EMFolderSelectionButton *button = g_object_new (EM_TYPE_FOLDER_SELECTION_BUTTON, NULL); + + button->priv->title = g_strdup (title); + button->priv->caption = g_strdup (caption); + + return GTK_WIDGET (button); +} + + +void +em_folder_selection_button_set_selection(EMFolderSelectionButton *button, const char *uri) +{ + EMFolderSelectionButtonPrivate *p = button->priv; + + g_return_if_fail(EM_IS_FOLDER_SELECTION_BUTTON(button)); + + if (p->uri != uri) { + g_free(p->uri); + p->uri = g_strdup(uri); + } + + set_contents(button); +} + + +const char * +em_folder_selection_button_get_selection(EMFolderSelectionButton *button) +{ + g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL); + + return button->priv->uri; +} + +E_MAKE_TYPE (em_folder_selection_button, "EMFolderSelectionButton", EMFolderSelectionButton, class_init, init, PARENT_TYPE) diff --git a/mail/em-folder-selection-button.h b/mail/em-folder-selection-button.h new file mode 100644 index 0000000000..1ab4eb461c --- /dev/null +++ b/mail/em-folder-selection-button.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* em-folder-selection-button.h + * + * Copyright (C) 2003 Ximian, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli <ettore@ximian.com> + */ + +#ifndef _EM_FOLDER_SELECTION_BUTTON_H_ +#define _EM_FOLDER_SELECTION_BUTTON_H_ + +#include <gtk/gtkbutton.h> + +#define EM_TYPE_FOLDER_SELECTION_BUTTON (em_folder_selection_button_get_type ()) +#define EM_FOLDER_SELECTION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButton)) +#define EM_FOLDER_SELECTION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EM_TYPE_FOLDER_SELECTION_BUTTON, EMFolderSelectionButtonClass)) +#define EM_IS_FOLDER_SELECTION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON)) +#define EM_IS_FOLDER_SELECTION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EM_TYPE_FOLDER_SELECTION_BUTTON)) + +typedef struct _EMFolderSelectionButton EMFolderSelectionButton; +typedef struct _EMFolderSelectionButtonPrivate EMFolderSelectionButtonPrivate; +typedef struct _EMFolderSelectionButtonClass EMFolderSelectionButtonClass; + +struct _EMFolderSelectionButton { + GtkButton parent; + + EMFolderSelectionButtonPrivate *priv; +}; + +struct _EMFolderSelectionButtonClass { + GtkButtonClass parent_class; + + /* Signals. */ + + void (* selected) (EMFolderSelectionButton *button); +}; + +GType em_folder_selection_button_get_type (void); + +GtkWidget *em_folder_selection_button_new(const char *title, const char *caption); + +void em_folder_selection_button_set_selection(EMFolderSelectionButton *button, const char *uri); +const char *em_folder_selection_button_get_selection(EMFolderSelectionButton *button); + +#endif /* _EM_FOLDER_SELECTION_BUTTON_H_ */ diff --git a/mail/em-folder-selection.c b/mail/em-folder-selection.c new file mode 100644 index 0000000000..c65ad80fc7 --- /dev/null +++ b/mail/em-folder-selection.c @@ -0,0 +1,170 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* em-folder-selection.c - UI for selecting folders. + * + * Copyright (C) 2002 Ximian, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli <ettore@ximian.com> + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "em-folder-selection.h" + +#include "mail-component.h" +#include "mail-tools.h" + +#include "shell/e-folder-selection-dialog.h" + + +CamelFolder * +em_folder_selection_run_dialog (GtkWindow *parent_window, + const char *title, + const char *caption, + CamelFolder *default_folder) +{ + EStorageSet *storage_set = mail_component_peek_storage_set (mail_component_peek ()); + char *default_path = NULL; + CamelStore *default_store; + GtkWidget *dialog; + EFolder *selected_e_folder; + CamelFolder *selected_camel_folder; + int response; + + default_store = camel_folder_get_parent_store (default_folder); + if (default_store != NULL) { + EStorage *storage = mail_component_lookup_storage (mail_component_peek (), default_store); + + if (storage != NULL) { + default_path = g_strconcat ("/", + e_storage_get_name (storage), + "/", + camel_folder_get_full_name (default_folder), + NULL); + } + } + + /* EPFIXME: Allowed types? */ + dialog = e_folder_selection_dialog_new (storage_set, title, caption, default_path, NULL, FALSE); + g_free(default_path); + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + if (response != GTK_RESPONSE_OK) { + gtk_widget_destroy (dialog); + return NULL; + } + + selected_e_folder = e_storage_set_get_folder (storage_set, + e_folder_selection_dialog_get_selected_path (E_FOLDER_SELECTION_DIALOG (dialog))); + if (selected_e_folder == NULL) { + gtk_widget_destroy (dialog); + return NULL; + } + + selected_camel_folder = mail_tool_uri_to_folder (e_folder_get_physical_uri (selected_e_folder), 0, NULL); + gtk_widget_destroy (dialog); + + return selected_camel_folder; +} + +/* FIXME: This isn't the way to do it, but then neither is the above, really ... */ +char * +em_folder_selection_run_dialog_uri(GtkWindow *parent_window, + const char *title, + const char *caption, + const char *default_folder_uri) +{ + EStorageSet *storage_set = mail_component_peek_storage_set (mail_component_peek ()); + char *default_path; + GtkWidget *dialog; + EFolder *selected_e_folder; + int response; + + default_path = e_storage_set_get_path_for_physical_uri(storage_set, default_folder_uri); + dialog = e_folder_selection_dialog_new (storage_set, title, caption, default_path, NULL, FALSE); + g_free(default_path); + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + if (response != GTK_RESPONSE_OK) { + gtk_widget_destroy (dialog); + return NULL; + } + + selected_e_folder = e_storage_set_get_folder (storage_set, + e_folder_selection_dialog_get_selected_path (E_FOLDER_SELECTION_DIALOG (dialog))); + gtk_widget_destroy (dialog); + if (selected_e_folder == NULL) + return NULL; + + return g_strdup(e_folder_get_physical_uri(selected_e_folder)); +} + + +struct _select_folder_data { + void (*done)(const char *uri, void *data); + void *data; +}; + +static void +emfs_folder_selected(GtkWidget *w, const char *path, struct _select_folder_data *d) +{ + const char *uri = NULL; + EStorageSet *storage_set = mail_component_peek_storage_set (mail_component_peek ()); + EFolder *folder; + + folder = e_storage_set_get_folder(storage_set, path); + if (folder) + uri = e_folder_get_physical_uri(folder); + + gtk_widget_hide(w); + + d->done(uri, d->data); + + gtk_widget_destroy(w); +} + +static void +emfs_folder_cancelled(GtkWidget *w, struct _select_folder_data *d) +{ + gtk_widget_destroy(w); +} + +void +em_select_folder(GtkWindow *parent_window, const char *title, const char *text, const char *default_folder_uri, void (*done)(const char *uri, void *data), void *data) +{ + EStorageSet *storage_set = mail_component_peek_storage_set (mail_component_peek ()); + char *path; + GtkWidget *dialog; + struct _select_folder_data *d; + + d = g_malloc0(sizeof(*d)); + d->data = data; + d->done = done; + + if (default_folder_uri) + path = e_storage_set_get_path_for_physical_uri(storage_set, default_folder_uri); + else + path = NULL; + dialog = e_folder_selection_dialog_new(storage_set, title, text, path, NULL, TRUE); + g_free(path); + /* ugh, painful api ... */ + g_signal_connect(dialog, "folder_selected", G_CALLBACK(emfs_folder_selected), d); + g_signal_connect(dialog, "cancelled", G_CALLBACK(emfs_folder_cancelled), d); + g_object_set_data_full((GObject *)dialog, "emfs_data", d, g_free); + gtk_widget_show(dialog); +} diff --git a/mail/em-folder-selection.h b/mail/em-folder-selection.h new file mode 100644 index 0000000000..374e1eec3f --- /dev/null +++ b/mail/em-folder-selection.h @@ -0,0 +1,41 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* em-folder-selection.h - UI for selecting folders. + * + * Copyright (C) 2002 Ximian, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli <ettore@ximian.com> + */ + +#ifndef EM_FOLDER_SELECTION_H +#define EM_FOLDER_SELECTION_H + +#include <camel/camel-folder.h> + +#include <gtk/gtkwindow.h> + +CamelFolder *em_folder_selection_run_dialog (GtkWindow *parent_window, + const char *title, + const char *caption, + CamelFolder *default_folder); +char *em_folder_selection_run_dialog_uri(GtkWindow *parent_window, + const char *title, + const char *caption, + const char *default_folder_uri); + +void em_select_folder(GtkWindow *parent_window, const char *title, const char *text, const char *default_folder_uri, void (*done)(const char *uri, void *data), void *data); + +#endif /* EM_FOLDER_SELECTION_H */ diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c new file mode 100644 index 0000000000..3ccf00e497 --- /dev/null +++ b/mail/em-folder-selector.c @@ -0,0 +1,349 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- + * + * Copyright(C) 2000, 2001, 2002, 2003 Ximian, Inc. + * + * Authors: Ettore Perazzoli + * Michael Zucchi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "em-folder-selector.h" + +#include "shell/e-storage-set-view.h" +#include "shell/e-storage-set.h" + +#include <libgnome/gnome-i18n.h> + +#include <gal/util/e-util.h> +#include <gal/widgets/e-gui-utils.h> + +#include <gtk/gtkentry.h> +#include <gtk/gtkbox.h> +#include <gtk/gtkhbox.h> +#include <gtk/gtklabel.h> +#include <gtk/gtkscrolledwindow.h> +#include <gtk/gtksignal.h> +#include <gtk/gtkstock.h> + +#include <camel/camel-url.h> + +#include <string.h> + +#define PARENT_TYPE (gtk_dialog_get_type()) +static GtkDialogClass *parent_class = NULL; + +static gboolean +check_folder_type_valid(EMFolderSelector *emfs) +{ + const char *selected; + EFolder *folder; + + selected = e_storage_set_view_get_current_folder(emfs->essv); + if (selected == NULL) + return FALSE; + + folder = e_storage_set_get_folder(emfs->ess, selected); + if (folder == NULL) + return FALSE; + + return TRUE; +} + +#if 0 /* EPFIXME */ +static void +folder_creation_dialog_result_cb(EShell *shell, + EShellFolderCreationDialogResult result, + const char *path, + void *data) +{ + EMFolderSelector *dialog; + + dialog = EM_FOLDER_SELECTOR(data); + + if (result == E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS) + e_storage_set_view_set_current_folder(E_STORAGE_SET_VIEW(priv->storage_set_view), + path); +} +#endif + +static void +emfs_dispose(GObject *object) +{ + EMFolderSelector *emfs = (EMFolderSelector *)object; + + if (emfs->ess != NULL) { + g_object_unref(emfs->ess); + emfs->ess = NULL; + emfs->essv = NULL; + } + + (* G_OBJECT_CLASS(parent_class)->dispose)(object); +} + +static void +emfs_finalize(GObject *object) +{ + /*EMFolderSelector *emfs = (EMFolderSelector *)object;*/ + + (* G_OBJECT_CLASS(parent_class)->finalize)(object); +} + +static void +emfs_response(GtkDialog *dialog, int response) +{ + EMFolderSelector *emfs = (EMFolderSelector *)dialog; + const char *path; + + switch (response) { + case EM_FOLDER_SELECTOR_RESPONSE_NEW: + path = e_storage_set_view_get_current_folder(emfs->essv); + + printf("create new folder, default parent '%s'\n", path); + break; + } +} + +static void +emfs_class_init(EMFolderSelectorClass *klass) +{ + GObjectClass *object_class; + GtkDialogClass *dialog_class; + + parent_class = g_type_class_ref(PARENT_TYPE); + object_class = G_OBJECT_CLASS(klass); + dialog_class = GTK_DIALOG_CLASS(klass); + + object_class->dispose = emfs_dispose; + object_class->finalize = emfs_finalize; + + dialog_class->response = emfs_response; +} + +static void +emfs_init(EMFolderSelector *emfs) +{ + emfs->flags = 0; +} + +static void +folder_selected_cb(EStorageSetView *essv, const char *path, EMFolderSelector *emfs) +{ + if (check_folder_type_valid(emfs)) + gtk_dialog_set_response_sensitive(GTK_DIALOG(emfs), GTK_RESPONSE_OK, TRUE); + else + gtk_dialog_set_response_sensitive(GTK_DIALOG(emfs), GTK_RESPONSE_OK, FALSE); +} + +static void +double_click_cb(EStorageSetView *essv, int row, ETreePath path, int col, GdkEvent *event, EMFolderSelector *emfs) +{ + if (check_folder_type_valid(emfs)) { + /*g_signal_emit(emfs, signals[FOLDER_SELECTED], 0, + em_folder_selector_get_selected(emfs));*/ + printf("double clicked!\n"); + } +} + +void +em_folder_selector_construct(EMFolderSelector *emfs, EStorageSet *ess, guint32 flags, const char *title, const char *text) +{ + GtkWidget *scrolled_window; + GtkWidget *text_label; + + gtk_window_set_default_size(GTK_WINDOW(emfs), 350, 300); + gtk_window_set_modal(GTK_WINDOW(emfs), TRUE); + gtk_window_set_title(GTK_WINDOW(emfs), title); + gtk_container_set_border_width(GTK_CONTAINER(emfs), 6); + + emfs->flags = flags; + if (flags & EM_FOLDER_SELECTOR_CAN_CREATE) + gtk_dialog_add_buttons(GTK_DIALOG(emfs), GTK_STOCK_NEW, EM_FOLDER_SELECTOR_RESPONSE_NEW, NULL); + + gtk_dialog_add_buttons(GTK_DIALOG(emfs), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + + gtk_dialog_set_response_sensitive(GTK_DIALOG(emfs), GTK_RESPONSE_OK, FALSE); + gtk_dialog_set_default_response(GTK_DIALOG(emfs), GTK_RESPONSE_OK); + + emfs->ess = ess; + g_object_ref(ess); + + emfs->essv = (EStorageSetView *)e_storage_set_create_new_view(ess, NULL); + e_storage_set_view_set_allow_dnd(emfs->essv, FALSE); + e_storage_set_view_enable_search(emfs->essv, TRUE); + + g_signal_connect(emfs->essv, "double_click", G_CALLBACK(double_click_cb), emfs); + g_signal_connect(emfs->essv, "folder_selected", G_CALLBACK(folder_selected_cb), emfs); + + scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + gtk_container_add(GTK_CONTAINER(scrolled_window), (GtkWidget *)emfs->essv); + + gtk_box_pack_end(GTK_BOX(GTK_DIALOG(emfs)->vbox), scrolled_window, TRUE, TRUE, 6); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(emfs)->vbox), 6); + + gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(emfs)->vbox), 6); + + gtk_widget_show((GtkWidget *)emfs->essv); + gtk_widget_show(scrolled_window); + + if (text != NULL) { + text_label = gtk_label_new(text); + gtk_label_set_justify(GTK_LABEL(text_label), GTK_JUSTIFY_LEFT); + gtk_widget_show(text_label); + + gtk_box_pack_end(GTK_BOX(GTK_DIALOG(emfs)->vbox), text_label, FALSE, TRUE, 6); + gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(emfs)->vbox), 6); + } + + GTK_WIDGET_SET_FLAGS((GtkWidget *)emfs->essv, GTK_CAN_FOCUS); + gtk_widget_grab_focus((GtkWidget *)emfs->essv); +} + +GtkWidget * +em_folder_selector_new(EStorageSet *ess, guint32 flags, const char *title, const char *text) +{ + EMFolderSelector *emfs; + + g_return_val_if_fail(E_IS_STORAGE_SET(ess), NULL); + + emfs = g_object_new(em_folder_selector_get_type(), NULL); + em_folder_selector_construct(emfs, ess, flags, title, text); + + return GTK_WIDGET(emfs); +} + +static void +emfs_create_name_changed(GtkEntry *entry, EMFolderSelector *emfs) +{ + int active; + + active = e_storage_set_view_get_current_folder(emfs->essv) != NULL + && emfs->name_entry->text_length > 0; + + gtk_dialog_set_response_sensitive((GtkDialog *)emfs, GTK_RESPONSE_OK, active); +} + +static void +emfs_create_name_activate(GtkEntry *entry, EMFolderSelector *emfs) +{ + printf("entry activated, woop\n"); +} + +GtkWidget * +em_folder_selector_create_new(EStorageSet *ess, guint32 flags, const char *title, const char *text) +{ + EMFolderSelector *emfs; + GtkWidget *hbox, *w; + + g_return_val_if_fail(E_IS_STORAGE_SET(ess), NULL); + + emfs = g_object_new(em_folder_selector_get_type(), NULL); + em_folder_selector_construct(emfs, ess, flags, title, text); + + hbox = gtk_hbox_new(FALSE, 0); + w = gtk_label_new_with_mnemonic(_("Folder _name")); + gtk_box_pack_start((GtkBox *)hbox, w, FALSE, FALSE, 6); + emfs->name_entry = (GtkEntry *)gtk_entry_new(); + g_signal_connect(emfs->name_entry, "changed", G_CALLBACK(emfs_create_name_changed), emfs); + g_signal_connect(emfs->name_entry, "activate", G_CALLBACK(emfs_create_name_activate), emfs); + gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)emfs->name_entry, TRUE, FALSE, 6); + gtk_widget_show_all(hbox); + + gtk_box_pack_start((GtkBox *)((GtkDialog *)emfs)->vbox, hbox, FALSE, TRUE, 0); + + return GTK_WIDGET(emfs); +} + +void +em_folder_selector_set_selected(EMFolderSelector *emfs, const char *path) +{ + e_storage_set_view_set_current_folder(emfs->essv, path); +} + +void +em_folder_selector_set_selected_uri(EMFolderSelector *emfs, const char *uri) +{ + const char *path; + + path = e_storage_set_get_path_for_physical_uri(emfs->ess, uri); + if (path) + e_storage_set_view_set_current_folder(emfs->essv, path); +} + +const char * +em_folder_selector_get_selected(EMFolderSelector *emfs) +{ + const char *path; + + path = e_storage_set_view_get_current_folder(emfs->essv); + if (emfs->name_entry) { + g_free(emfs->selected); + emfs->selected = g_strdup_printf("%s/%s", path, gtk_entry_get_text(emfs->name_entry)); + path = emfs->selected; + } + + return path; +} + +const char * +em_folder_selector_get_selected_uri(EMFolderSelector *emfs) +{ + const char *path; + EFolder *folder; + + path = e_storage_set_view_get_current_folder(emfs->essv); + if (path == NULL) { + printf("current folder is null?\n"); + return NULL; + } + + folder = e_storage_set_get_folder(emfs->ess, path); + if (folder == NULL) { + printf("path ok, but can't get folder?\n"); + return NULL; + } + + path = e_folder_get_physical_uri(folder); + if (path && emfs->name_entry) { + CamelURL *url; + char *newpath; + + url = camel_url_new(path, NULL); + newpath = g_strdup_printf("%s/%s", url->fragment?url->fragment:url->path, gtk_entry_get_text(emfs->name_entry)); + if (url->fragment) + camel_url_set_fragment(url, newpath); + else + camel_url_set_path(url, newpath); + g_free(emfs->selected_uri); + emfs->selected_uri = camel_url_to_string(url, 0); + camel_url_free(url); + path = emfs->selected_uri; + } + + return path; +} + +E_MAKE_TYPE(em_folder_selector, "EMFolderSelector", EMFolderSelector, emfs_class_init, emfs_init, PARENT_TYPE) diff --git a/mail/em-folder-selector.h b/mail/em-folder-selector.h new file mode 100644 index 0000000000..48fc6758b5 --- /dev/null +++ b/mail/em-folder-selector.h @@ -0,0 +1,96 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* e-folder-selection-dialog.h + * + * Copyright (C) 2000, 2001, 2002, 2003 Ximian, Inc. + * + * Authors: Ettore Perazzoli + * Michael Zucchi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifndef EM_FOLDER_SELECTOR_H +#define EM_FOLDER_SELECTOR_H + +#include <gtk/gtkdialog.h> + +#ifdef cplusplus +extern "C" { +#pragma } +#endif /* cplusplus */ + +#define EM_TYPE_FOLDER_SELECTOR (em_folder_selector_get_type ()) +#define EM_FOLDER_SELECTOR(obj) (GTK_CHECK_CAST ((obj), E_TYPEM_FOLDER_SELECTOR, EMFolderSelector)) +#define EM_FOLDER_SELECTOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPEM_FOLDER_SELECTOR, EMFolderSelectorClass)) +#define EM_IS_FOLDER_SELECTOR(obj) (GTK_CHECK_TYPE ((obj), E_TYPEM_FOLDER_SELECTOR)) +#define EM_IS_FOLDER_SELECTOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPEM_FOLDER_SELECTOR)) + +typedef struct _EMFolderSelector EMFolderSelector; +typedef struct _EMFolderSelectorPrivate EMFolderSelectorPrivate; +typedef struct _EMFolderSelectorClass EMFolderSelectorClass; + +struct _EStorageSet; +struct _EStorageSetView; + +struct _EMFolderSelector { + GtkDialog parent; + + guint32 flags; + struct _EStorageSet *ess; + struct _EStorageSetView *essv; + + struct _GtkEntry *name_entry; + char *selected; + char *selected_uri; +}; + +struct _EMFolderSelectorClass { + GtkDialogClass parent_class; + +#if 0 + void (* folder_selected) (EMFolderSelector *folder_selection_dialog, + const char *path); + void (* cancelled) (EMFolderSelector *folder_selection_dialog); +#endif +}; + +enum { + EM_FOLDER_SELECTOR_CAN_CREATE = 1, +}; + +enum { + EM_FOLDER_SELECTOR_RESPONSE_NEW = 1, +}; + +GtkType em_folder_selector_get_type (void); +void em_folder_selector_construct(EMFolderSelector *, struct _EStorageSet *, guint32, const char *, const char *); +/* for selecting folders */ +GtkWidget *em_folder_selector_new (struct _EStorageSet *, guint32, const char *, const char *); + +/* for creating folders */ +GtkWidget *em_folder_selector_create_new(struct _EStorageSet *ess, guint32 flags, const char *title, const char *text); + +void em_folder_selector_set_selected (EMFolderSelector *emfs, const char *path); +void em_folder_selector_set_selected_uri(EMFolderSelector *emfs, const char *uri); + +const char *em_folder_selector_get_selected (EMFolderSelector *emfs); +const char *em_folder_selector_get_selected_uri(EMFolderSelector *emfs); + +#ifdef cplusplus +} +#endif /* cplusplus */ + +#endif /* EM_FOLDER_SELECTOR_H */ diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 8099191b01..fac7d155d3 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -542,16 +542,52 @@ emfv_popup_undelete(GtkWidget *w, EMFolderView *emfv) em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_DELETED, 0); } +struct _move_data { + EMFolderView *emfv; + GPtrArray *uids; + int delete; +}; + +static void +emfv_popup_move_cb(const char *uri, void *data) +{ + struct _move_data *d = data; + + if (uri) + mail_transfer_messages(d->emfv->folder, d->uids, d->delete, uri, 0, NULL, NULL); + else + em_utils_uids_free(d->uids); + + g_object_unref(d->emfv); + g_free(d); +} + static void emfv_popup_move(GtkWidget *w, EMFolderView *emfv) { - /* FIXME */ + struct _move_data *d; + + d = g_malloc(sizeof(*d)); + d->emfv = emfv; + g_object_ref(emfv); + d->uids = message_list_get_selected(emfv->list); + d->delete = TRUE; + + em_select_folder((GtkWidget *)emfv, _("Select folder"), NULL, NULL, emfv_popup_move_cb, d); } static void emfv_popup_copy(GtkWidget *w, EMFolderView *emfv) { - /* FIXME */ + struct _move_data *d; + + d = g_malloc(sizeof(*d)); + d->emfv = emfv; + g_object_ref(emfv); + d->uids = message_list_get_selected(emfv->list); + d->delete = FALSE; + + em_select_folder((GtkWidget *)emfv, _("Select folder"), NULL, NULL, emfv_popup_move_cb, d); } static void diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 6d38eda3f5..f95624e655 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -62,6 +62,8 @@ #include <camel/camel-file-utils.h> #include <e-util/e-msgport.h> + +#include "mail-component.h" #include "mail-mt.h" #include "em-format-html.h" @@ -214,15 +216,15 @@ em_format_html_get_type(void) sizeof(EMFormatHTML), 0, (GInstanceInitFunc)efh_init }; - extern char *evolution_dir; + const char *base_directory = mail_component_peek_base_directory (mail_component_peek ()); char *path; efh_parent = g_type_class_ref(em_format_get_type()); type = g_type_register_static(em_format_get_type(), "EMFormatHTML", &info, 0); /* cache expiry - 2 hour access, 1 day max */ - path = alloca(strlen(evolution_dir)+16); - sprintf(path, "%s/cache", evolution_dir); + path = alloca(strlen(base_directory)+16); + sprintf(path, "%s/cache", base_directory); emfh_http_cache = camel_data_cache_new(path, 0, NULL); camel_data_cache_set_expire_age(emfh_http_cache, 24*60*60); camel_data_cache_set_expire_access(emfh_http_cache, 2*60*60); diff --git a/mail/em-marshal.list b/mail/em-marshal.list index 910bfb1b3d..0c8bfbbbfb 100644 --- a/mail/em-marshal.list +++ b/mail/em-marshal.list @@ -1 +1,2 @@ BOOLEAN:BOXED,POINTER,POINTER +NONE:POINTER diff --git a/mail/em-popup.c b/mail/em-popup.c index 69fd1d0b6d..74ba86c33b 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -353,7 +353,8 @@ em_popup_create_menu_once(EMPopup *emp, EMPopupTarget *target, guint32 hide_mask menu = em_popup_create_menu(emp, hide_mask, disable_mask); - g_signal_connect_swapped(menu, "selection_done", G_CALLBACK(em_popup_target_free), target); + if (target) + g_signal_connect_swapped(menu, "selection_done", G_CALLBACK(em_popup_target_free), target); g_signal_connect(menu, "selection_done", G_CALLBACK(emp_popup_done), emp); return menu; diff --git a/mail/em-popup.h b/mail/em-popup.h index 877b28fc28..0ad1d0015c 100644 --- a/mail/em-popup.h +++ b/mail/em-popup.h @@ -69,6 +69,7 @@ enum _em_popup_target_t { EM_POPUP_TARGET_SELECT, EM_POPUP_TARGET_URI, EM_POPUP_TARGET_PART, + EM_POPUP_TARGET_FOLDER, }; /* Flags that describe a TARGET_SELECT */ @@ -103,6 +104,13 @@ enum { EM_POPUP_PART_IMAGE = 1<<1, }; +/* Flags that describe TARGET_FOLDER */ +enum { + EM_POPUP_FOLDER_LOCAL = 1<<0, + EM_POPUP_FOLDER_REMOTE = 1<<1, + EM_POPUP_FOLDER_VFOLDER = 1<<2, +}; + struct _EMPopupTarget { enum _em_popup_target_t type; guint32 mask; /* depends on type, see above */ @@ -118,6 +126,9 @@ struct _EMPopupTarget { char *mime_type; struct _CamelMimePart *part; } part; + struct { + char *folder_uri; + } folder; } data; }; diff --git a/mail/em-utils.c b/mail/em-utils.c index 49ef9af792..5b16d0cd7b 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -36,6 +36,7 @@ #include <filter/filter-editor.h> +#include "mail-component.h" #include "mail-mt.h" #include "mail-ops.h" #include "mail-tools.h" @@ -215,14 +216,14 @@ static GtkWidget *filter_editor = NULL; static void filter_editor_response (GtkWidget *dialog, int button, gpointer user_data) { - extern char *evolution_dir; FilterContext *fc; if (button == GTK_RESPONSE_ACCEPT) { char *user; fc = g_object_get_data ((GObject *) dialog, "context"); - user = g_strdup_printf ("%s/filters.xml", evolution_dir); + user = g_strdup_printf ("%s/filters.xml", + mail_component_peek_base_directory (mail_component_peek ())); rule_context_save ((RuleContext *) fc, user); g_free (user); } @@ -249,7 +250,7 @@ static const char *filter_source_names[] = { void em_utils_edit_filters (GtkWidget *parent) { - extern char *evolution_dir; + const char *base_directory = mail_component_peek_base_directory (mail_component_peek ()); char *user, *system; FilterContext *fc; @@ -259,7 +260,7 @@ em_utils_edit_filters (GtkWidget *parent) } fc = filter_context_new (); - user = g_strdup_printf ("%s/filters.xml", evolution_dir); + user = g_strdup_printf ("%s/filters.xml", base_directory); system = EVOLUTION_PRIVDATADIR "/filtertypes.xml"; rule_context_load ((RuleContext *) fc, system, user); g_free (user); @@ -773,10 +774,10 @@ generate_account_hash (void) return account_hash; } -static EDestination ** +static EABDestination ** em_utils_camel_address_to_destination (CamelInternetAddress *iaddr) { - EDestination *dest, **destv; + EABDestination *dest, **destv; int n, i, j; if (iaddr == NULL) @@ -785,14 +786,14 @@ em_utils_camel_address_to_destination (CamelInternetAddress *iaddr) if ((n = camel_address_length ((CamelAddress *) iaddr)) == 0) return NULL; - destv = g_malloc (sizeof (EDestination *) * (n + 1)); + destv = g_malloc (sizeof (EABDestination *) * (n + 1)); for (i = 0, j = 0; i < n; i++) { const char *name, *addr; if (camel_internet_address_get (iaddr, i, &name, &addr)) { - dest = e_destination_new (); - e_destination_set_name (dest, name); - e_destination_set_email (dest, addr); + dest = eab_destination_new (); + eab_destination_set_name (dest, name); + eab_destination_set_email (dest, addr); destv[j++] = dest; } @@ -813,7 +814,7 @@ reply_get_composer (GtkWidget *parent, CamelMimeMessage *message, EAccount *acco CamelInternetAddress *to, CamelInternetAddress *cc) { const char *message_id, *references; - EDestination **tov, **ccv; + EABDestination **tov, **ccv; EMsgComposer *composer; char *subject; @@ -1211,7 +1212,7 @@ post_reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *m const char *message_id, *references; CamelInternetAddress *to = NULL; GtkWidget *parent = user_data; - EDestination **tov = NULL; + EABDestination **tov = NULL; EMsgComposer *composer; char *subject, *url; EAccount *account; diff --git a/mail/em-utils.h b/mail/em-utils.h index 0114c86ae2..a30c9109fb 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -36,6 +36,7 @@ struct _GtkWindow; struct _CamelFolder; struct _CamelStream; struct _CamelMimeMessage; +struct _CamelMimePart; struct _GtkSelectionData; struct _GtkAdjustment; struct _EMsgComposer; diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index f0157bac9a..194396b062 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -118,14 +118,13 @@ control_destroy_cb (GtkObject *fb, GObject *control) } BonoboControl * -folder_browser_factory_new_control (const char *uri, - const GNOME_Evolution_Shell shell) +folder_browser_factory_new_control (const char *uri) { BonoboControl *control; GtkWidget *fb; #if 0 - if (!(fb = folder_browser_new (shell, uri))) + if (!(fb = folder_browser_new (uri))) return NULL; FOLDER_BROWSER (fb)->pref_master = TRUE; /* save UI settings changed in this FB */ diff --git a/mail/folder-browser-factory.h b/mail/folder-browser-factory.h index 2c858c9c56..109938c27e 100644 --- a/mail/folder-browser-factory.h +++ b/mail/folder-browser-factory.h @@ -15,8 +15,7 @@ #include "Evolution.h" #include "e-util/e-list.h" -BonoboControl *folder_browser_factory_new_control (const char *uri, - const GNOME_Evolution_Shell shell); +BonoboControl *folder_browser_factory_new_control (const char *uri); EList *folder_browser_factory_get_control_list (void); struct _EMFolderBrowser *folder_browser_factory_get_browser(const char *uri); diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c new file mode 100644 index 0000000000..9ccdb2db79 --- /dev/null +++ b/mail/folder-browser-ui.c @@ -0,0 +1,816 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Peter Williams <peterw@ximian.com> + * Jeffrey Stedfast <fejj@ximian.com> + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string.h> + +#include <gconf/gconf.h> +#include <gconf/gconf-client.h> + +#include <libgnome/gnome-util.h> /* gnome_util_prepend_user_home */ + +#include <bonobo/bonobo-exception.h> +#include <bonobo/bonobo-ui-component.h> +#include <bonobo/bonobo-ui-util.h> + +#include "widgets/misc/e-charset-picker.h" +#include "widgets/menus/gal-view-menus.h" /* GalView stuff */ +#include <gal/menus/gal-view-factory-etable.h> +#include <gal/menus/gal-view-etable.h> + +#include "e-util/e-meta.h" + +#include "mail-config.h" +#include "mail-callbacks.h" /* almost all the verbs */ +#include "mail-session.h" /* mail_session_forget_passwords */ + +#include "folder-browser-ui.h" + +#include "evolution-shell-component-utils.h" /* Pixmap stuff */ + + +/* + * Add with 'folder_browser' + */ + +static BonoboUIVerb message_verbs [] = { + BONOBO_UI_UNSAFE_VERB ("MailNext", next_msg), + BONOBO_UI_UNSAFE_VERB ("MailNextFlagged", next_flagged_msg), + BONOBO_UI_UNSAFE_VERB ("MailNextUnread", next_unread_msg), + BONOBO_UI_UNSAFE_VERB ("MailNextThread", next_thread), + BONOBO_UI_UNSAFE_VERB ("MailPrevious", previous_msg), + BONOBO_UI_UNSAFE_VERB ("MailPreviousFlagged", previous_flagged_msg), + BONOBO_UI_UNSAFE_VERB ("MailPreviousUnread", previous_unread_msg), + BONOBO_UI_UNSAFE_VERB ("AddSenderToAddressbook", add_sender_to_addrbook), + BONOBO_UI_UNSAFE_VERB ("MessageApplyFilters", apply_filters), + BONOBO_UI_UNSAFE_VERB ("MessageCopy", copy_msg), + BONOBO_UI_UNSAFE_VERB ("MessageDelete", delete_msg), + BONOBO_UI_UNSAFE_VERB ("MessageForward", forward), + BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", forward_attached), + BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", forward_inline), + BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", forward_quoted), + BONOBO_UI_UNSAFE_VERB ("MessageRedirect", redirect), + BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", mark_as_seen), + BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", mark_as_unseen), + BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", mark_as_important), + BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", mark_as_unimportant), + BONOBO_UI_UNSAFE_VERB ("MessageFollowUpFlag", flag_for_followup), + BONOBO_UI_UNSAFE_VERB ("MessageMove", move_msg), + BONOBO_UI_UNSAFE_VERB ("MessageOpen", open_message), + BONOBO_UI_UNSAFE_VERB ("MessagePostReply", post_reply), + BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", reply_to_all), + BONOBO_UI_UNSAFE_VERB ("MessageReplyList", reply_to_list), + BONOBO_UI_UNSAFE_VERB ("MessageReplySender", reply_to_sender), + BONOBO_UI_UNSAFE_VERB ("MessageResend", resend_msg), + BONOBO_UI_UNSAFE_VERB ("MessageSaveAs", save_msg), + BONOBO_UI_UNSAFE_VERB ("MessageSearch", search_msg), + BONOBO_UI_UNSAFE_VERB ("MessageUndelete", undelete_msg), + BONOBO_UI_UNSAFE_VERB ("PrintMessage", print_msg), + BONOBO_UI_UNSAFE_VERB ("TextZoomIn", zoom_in), + BONOBO_UI_UNSAFE_VERB ("TextZoomOut", zoom_out), + BONOBO_UI_UNSAFE_VERB ("TextZoomReset", zoom_reset), + BONOBO_UI_UNSAFE_VERB ("PrintPreviewMessage", print_preview_msg), + BONOBO_UI_UNSAFE_VERB ("ToolsFilterMailingList", filter_mlist), + BONOBO_UI_UNSAFE_VERB ("ToolsFilterRecipient", filter_recipient), + BONOBO_UI_UNSAFE_VERB ("ToolsFilterSender", filter_sender), + BONOBO_UI_UNSAFE_VERB ("ToolsFilterSubject", filter_subject), + BONOBO_UI_UNSAFE_VERB ("ToolsVFolderMailingList", vfolder_mlist), + BONOBO_UI_UNSAFE_VERB ("ToolsVFolderRecipient", vfolder_recipient), + BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSender", vfolder_sender), + BONOBO_UI_UNSAFE_VERB ("ToolsVFolderSubject", vfolder_subject), + BONOBO_UI_UNSAFE_VERB ("ViewLoadImages", load_images), + /* ViewHeaders stuff is a radio */ + /* CaretMode is a toggle */ + + BONOBO_UI_VERB_END +}; + +static BonoboUIVerb list_verbs [] = { + BONOBO_UI_UNSAFE_VERB ("EditCut", folder_browser_cut), + BONOBO_UI_UNSAFE_VERB ("EditCopy", folder_browser_copy), + BONOBO_UI_UNSAFE_VERB ("EditPaste", folder_browser_paste), + BONOBO_UI_UNSAFE_VERB ("EditInvertSelection", invert_selection), + BONOBO_UI_UNSAFE_VERB ("EditSelectAll", select_all), + BONOBO_UI_UNSAFE_VERB ("EditSelectThread", select_thread), + BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", configure_folder), + BONOBO_UI_UNSAFE_VERB ("FolderExpunge", expunge_folder), + /* HideDeleted is a toggle */ + BONOBO_UI_UNSAFE_VERB ("MessageMarkAllAsRead", mark_all_as_seen), + BONOBO_UI_UNSAFE_VERB ("ViewHideRead", hide_read), + BONOBO_UI_UNSAFE_VERB ("ViewHideSelected", hide_selected), + BONOBO_UI_UNSAFE_VERB ("ViewShowAll", hide_none), + /* ViewThreaded is a toggle */ + + BONOBO_UI_VERB_END +}; + +static BonoboUIVerb global_verbs [] = { + BONOBO_UI_UNSAFE_VERB ("EmptyTrash", empty_trash), + BONOBO_UI_UNSAFE_VERB ("ForgetPasswords", mail_session_forget_passwords), + BONOBO_UI_UNSAFE_VERB ("MailCompose", compose_msg), + BONOBO_UI_UNSAFE_VERB ("MailPost", post_message), + BONOBO_UI_UNSAFE_VERB ("MailStop", stop_threads), + BONOBO_UI_UNSAFE_VERB ("ToolsFilters", filter_edit), + BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", manage_subscriptions), + BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", vfolder_edit_vfolders), + /* ViewPreview is a toggle */ + + BONOBO_UI_VERB_END +}; + +static EPixmap message_pixcache [] = { + E_PIXMAP ("/commands/PrintMessage", "print.xpm"), + E_PIXMAP ("/commands/PrintPreviewMessage", "print-preview.xpm"), + E_PIXMAP ("/commands/MessageDelete", "evolution-trash-mini.png"), + E_PIXMAP ("/commands/MessageUndelete", "undelete_message-16.png"), + E_PIXMAP ("/commands/MessageCopy", "copy_16_message.xpm"), + E_PIXMAP ("/commands/MessageMove", "move_message.xpm"), + E_PIXMAP ("/commands/MessageReplyAll", "reply_to_all.xpm"), + E_PIXMAP ("/commands/MessageReplySender", "reply.xpm"), + E_PIXMAP ("/commands/MessageForward", "forward.xpm"), + E_PIXMAP ("/commands/MessageApplyFilters", "apply-filters-16.xpm"), + E_PIXMAP ("/commands/MessageSearch", "search-16.png"), + E_PIXMAP ("/commands/MessageSaveAs", "save-as-16.png"), + E_PIXMAP ("/commands/MessageMarkAsRead", "mail-read.xpm"), + E_PIXMAP ("/commands/MessageMarkAsUnRead", "mail-new.xpm"), + E_PIXMAP ("/commands/MessageMarkAsImportant", "priority-high.xpm"), + E_PIXMAP ("/commands/MessageFollowUpFlag", "flag-for-followup-16.png"), + + E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplySender", "buttons/reply.png"), + E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplyAll", "buttons/reply-to-all.png"), + E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageForward", "buttons/forward.png"), + E_PIXMAP ("/Toolbar/MailMessageToolbar/PrintMessage", "buttons/print.png"), + E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMove", "buttons/move-message.png"), + E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageCopy", "buttons/copy-message.png"), + E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageDelete", "buttons/delete-message.png"), + + E_PIXMAP ("/Toolbar/MailNextButtons/MailNext", "buttons/next-message.png"), + E_PIXMAP ("/Toolbar/MailNextButtons/MailPrevious", "buttons/previous-message.png"), + + E_PIXMAP_END +}; + +static EPixmap list_pixcache [] = { + E_PIXMAP ("/commands/ChangeFolderProperties", "configure_16_folder.xpm"), + E_PIXMAP ("/commands/ViewHideRead", "hide_read_messages.xpm"), + E_PIXMAP ("/commands/ViewHideSelected", "hide_selected_messages.xpm"), + E_PIXMAP ("/commands/ViewShowAll", "show_all_messages.xpm"), + + E_PIXMAP ("/commands/EditCut", "16_cut.png"), + E_PIXMAP ("/commands/EditCopy", "16_copy.png"), + E_PIXMAP ("/commands/EditPaste", "16_paste.png"), + + E_PIXMAP_END +}; + +static EPixmap global_pixcache [] = { + E_PIXMAP ("/commands/MailCompose", "new-message.xpm"), + + E_PIXMAP_END +}; + +enum { + IS_DRAFTS_FOLDER = (1 << 0), + IS_OUTBOX_FOLDER = (1 << 1), + IS_SENT_FOLDER = (1 << 2), + + IS_OUTGOING_FOLDER = (IS_DRAFTS_FOLDER | IS_OUTBOX_FOLDER | IS_SENT_FOLDER), + IS_INCOMING_FOLDER = (1 << 3), + + IS_ANY_FOLDER = (IS_OUTGOING_FOLDER | IS_INCOMING_FOLDER), + + SELECTION_NONE = (1 << 4), + SELECTION_SINGLE = (1 << 5), + SELECTION_MULTIPLE = (1 << 6), + + SELECTION_ANYTHING = (SELECTION_SINGLE | SELECTION_MULTIPLE), + + IS_THREADED = (1 << 7), + NOT_THREADED = (1<<8), + ANY_THREADED = (IS_THREADED|NOT_THREADED), + + HAS_UNDELETED = (1 << 9), + HAS_DELETED = (1 << 10), + HAS_UNREAD = (1 << 11), + HAS_READ = (1 << 12), + HAS_UNIMPORTANT = (1 << 13), + HAS_IMPORTANT = (1 << 14) +}; + +#define HAS_FLAGS (HAS_UNDELETED | HAS_DELETED | \ + HAS_UNREAD | HAS_READ | \ + HAS_UNIMPORTANT | HAS_IMPORTANT) + +#define IS_1MESSAGE (IS_ANY_FOLDER | SELECTION_SINGLE | ANY_THREADED | HAS_FLAGS) +#define IS_0MESSAGE (IS_ANY_FOLDER | SELECTION_ANYTHING | SELECTION_NONE | ANY_THREADED | HAS_FLAGS) +#define IS_NMESSAGE (IS_ANY_FOLDER | SELECTION_ANYTHING | ANY_THREADED | HAS_FLAGS) + +struct _UINode { + const char *name; + guint32 enable_mask; +}; + +struct _UINode default_ui_nodes[] = { + { "ViewLoadImages", IS_1MESSAGE }, + { "ViewFullHeaders", IS_0MESSAGE }, + { "ViewNormal", IS_0MESSAGE }, + { "ViewSource", IS_0MESSAGE }, + { "CaretMode", IS_0MESSAGE }, + + { "AddSenderToAddressbook", IS_INCOMING_FOLDER | SELECTION_SINGLE | ANY_THREADED | HAS_FLAGS }, + + { "MessageResend", IS_SENT_FOLDER | SELECTION_SINGLE | ANY_THREADED | HAS_FLAGS }, + + /* actions that work on exactly 1 message */ + { "MessagePostReply", IS_1MESSAGE }, + { "MessageReplyAll", IS_1MESSAGE }, + { "MessageReplyList", IS_1MESSAGE }, + { "MessageReplySender", IS_1MESSAGE }, + { "MessageForwardInline", IS_1MESSAGE }, + { "MessageForwardQuoted", IS_1MESSAGE }, + { "MessageRedirect", IS_1MESSAGE }, + { "MessageSearch", IS_1MESSAGE }, + + { "PrintMessage", IS_1MESSAGE }, + { "PrintPreviewMessage", IS_1MESSAGE }, + + { "ToolsFilterMailingList", IS_1MESSAGE }, + { "ToolsFilterRecipient", IS_1MESSAGE }, + { "ToolsFilterSender", IS_1MESSAGE }, + { "ToolsFilterSubject", IS_1MESSAGE }, + + { "ToolsVFolderMailingList", IS_1MESSAGE }, + { "ToolsVFolderRecipient", IS_1MESSAGE }, + { "ToolsVFolderSender", IS_1MESSAGE }, + { "ToolsVFolderSubject", IS_1MESSAGE }, + + /* actions that work on >= 1 message */ + { "MessageApplyFilters", IS_NMESSAGE }, + { "MessageCopy", IS_NMESSAGE }, + { "MessageMove", IS_NMESSAGE }, + { "MessageDelete", IS_NMESSAGE }, + { "MessageUndelete", IS_NMESSAGE & ~HAS_DELETED }, + { "MessageMarkAsRead", IS_NMESSAGE & ~HAS_UNREAD }, + { "MessageMarkAsUnRead", IS_NMESSAGE & ~HAS_READ }, + { "MessageMarkAsImportant", IS_NMESSAGE & ~HAS_UNIMPORTANT }, + { "MessageMarkAsUnimportant", IS_NMESSAGE & ~HAS_IMPORTANT }, + { "MessageFollowUpFlag", IS_NMESSAGE }, + { "MessageOpen", IS_NMESSAGE }, + { "MessageSaveAs", IS_NMESSAGE }, + { "MessageForward", IS_NMESSAGE }, + { "MessageForwardAttached", IS_NMESSAGE }, + + { "EditCut", IS_NMESSAGE }, + { "EditCopy", IS_NMESSAGE }, + { "EditPaste", IS_0MESSAGE }, + { "EditSelectThread", IS_ANY_FOLDER | SELECTION_ANYTHING | IS_THREADED | HAS_FLAGS}, + + { "ViewHideSelected", IS_NMESSAGE }, + + /* FIXME: should these be single-selection? */ + { "MailNext", IS_NMESSAGE }, + { "MailNextFlagged", IS_NMESSAGE }, + { "MailNextUnread", IS_NMESSAGE }, + { "MailNextThread", IS_NMESSAGE }, + { "MailPrevious", IS_NMESSAGE }, + { "MailPreviousFlagged", IS_NMESSAGE }, + { "MailPreviousUnread", IS_NMESSAGE }, +}; + +static int num_default_ui_nodes = sizeof (default_ui_nodes) / sizeof (default_ui_nodes[0]); + + +static void +ui_add (FolderBrowser *fb, const char *name, BonoboUIVerb verb[], EPixmap pixcache[]) +{ + BonoboUIComponent *uic = fb->uicomp; + char *file; + + bonobo_ui_component_add_verb_list_with_data (uic, verb, fb); + + /*bonobo_ui_component_freeze (uic, NULL);*/ + + file = g_strconcat (EVOLUTION_UIDIR "/evolution-mail-", name, ".xml", NULL); + bonobo_ui_util_set_ui (uic, PREFIX, file, "evolution-mail", NULL); + g_free (file); + + e_pixmaps_update (uic, pixcache); + + /*bonobo_ui_component_thaw (uic, NULL);*/ +} + +/* more complex stuff */ + +static void +display_view (GalViewInstance *instance, GalView *view, gpointer data) +{ + FolderBrowser *fb = data; + + if (GAL_IS_VIEW_ETABLE (view)) { + gal_view_etable_attach_tree (GAL_VIEW_ETABLE (view), fb->message_list->tree); + } +} + +void +folder_browser_ui_setup_view_menus (FolderBrowser *fb) +{ + static GalViewCollection *collection = NULL; + char *id; + gboolean outgoing; + + if (fb->uicomp == NULL || fb->folder == NULL) + return; + + g_assert (fb->view_instance == NULL); + g_assert (fb->view_menus == NULL); + + outgoing = folder_browser_is_drafts (fb) || + folder_browser_is_sent (fb) || + folder_browser_is_outbox (fb); + + if (collection == NULL) { + ETableSpecification *spec; + char *local_dir; + GalViewFactory *factory; + + collection = gal_view_collection_new (); + + gal_view_collection_set_title (collection, _("Mail")); + + local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/"); + gal_view_collection_set_storage_directories (collection, + EVOLUTION_GALVIEWSDIR "/mail/", + local_dir); + g_free (local_dir); + + spec = e_table_specification_new (); + e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); + + factory = gal_view_factory_etable_new (spec); + g_object_unref (spec); + gal_view_collection_add_factory (collection, factory); + g_object_unref (factory); + + gal_view_collection_load (collection); + } + + id = mail_config_folder_to_safe_url (fb->folder); + fb->view_instance = gal_view_instance_new (collection, id); + g_free (id); + + if (outgoing) + gal_view_instance_set_default_view (fb->view_instance, "As_Sent_Folder"); + + if (!gal_view_instance_exists (fb->view_instance)) { + char *path; + struct stat st; + + gal_view_instance_load (fb->view_instance); + + path = mail_config_folder_to_cachename (fb->folder, "et-header-"); + if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { + ETableSpecification *spec; + ETableState *state; + GalView *view; + + spec = e_table_specification_new(); + e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/message-list.etspec"); + view = gal_view_etable_new (spec, ""); + g_object_unref (spec); + + state = e_table_state_new (); + e_table_state_load_from_file (state, path); + gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state); + g_object_unref (state); + + gal_view_instance_set_custom_view (fb->view_instance, view); + g_object_unref (view); + } + g_free (path); + } + + fb->view_menus = gal_view_menus_new (fb->view_instance); + gal_view_menus_apply (fb->view_menus, fb->uicomp, NULL); + + /* Due to CORBA reentrancy, the view could be gone now. */ + if (fb->view_instance == NULL) + return; + + g_signal_connect (fb->view_instance, "display_view", G_CALLBACK (display_view), fb); + + display_view (fb->view_instance, gal_view_instance_get_current_view (fb->view_instance), fb); +} + +/* Gets rid of the view instance and view menus objects */ +void +folder_browser_ui_discard_view_menus (FolderBrowser *fb) +{ + g_assert (fb->view_instance != NULL); + g_assert (fb->view_menus != NULL); + + g_object_unref (fb->view_instance); + fb->view_instance = NULL; + + g_object_unref (fb->view_menus); + fb->view_menus = NULL; +} + +void +folder_browser_ui_message_list_focus (FolderBrowser *fb) +{ + g_assert (fb->uicomp != NULL); + + bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection", + "sensitive", "1", NULL); +/* bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread", + "sensitive", "1", NULL);*/ +} + +void +folder_browser_ui_message_list_unfocus (FolderBrowser *fb) +{ + g_assert (fb->uicomp != NULL); + + bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection", + "sensitive", "0", NULL); + /*bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread", + "sensitive", "0", NULL);*/ +} + +static void +folder_browser_setup_property_menu (FolderBrowser *fb, BonoboUIComponent *uic) +{ + char *name, *base = NULL; + CamelURL *url; + + url = camel_url_new (fb->uri, NULL); + if (url) + base = g_path_get_basename(url->fragment?url->fragment:url->path); + + if (base && base[0] != '\0') + name = g_strdup_printf (_("Properties for \"%s\""), base); + else + name = g_strdup (_("Properties")); + + bonobo_ui_component_set_prop ( + uic, "/menu/File/Folder/ComponentPlaceholder/ChangeFolderProperties", + "label", name, NULL); + g_free (name); + g_free(base); + + if (url) + camel_url_free (url); + + fbui_sensitise_item (fb, "ChangeFolderProperties", + (strncmp (fb->uri, "vfolder:", 8) == 0 || strncmp (fb->uri, "file:", 5) == 0)); +} + +/* Must be in the same order as MailConfigDisplayStyle */ +/* used in folder-browser.c as well (therefore not static) */ +char *message_display_styles[] = { + "/commands/ViewNormal", + "/commands/ViewFullHeaders", + "/commands/ViewSource" +}; + +/* public */ + +void +folder_browser_ui_add_message (FolderBrowser *fb) +{ + BonoboUIComponent *uic = fb->uicomp; + FolderBrowserSelectionState prev_state; + GConfClient *gconf; + int style; + gboolean caret_mode; + + gconf = mail_config_get_gconf_client (); + + if (fb->sensitise_state) { + g_hash_table_destroy(fb->sensitise_state); + fb->sensitise_state = NULL; + } + + ui_add (fb, "message", message_verbs, message_pixcache); + + caret_mode = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/caret_mode", NULL); + bonobo_ui_component_set_prop(uic, "/commands/CaretMode", "state", caret_mode?"1":"0", NULL); + bonobo_ui_component_add_listener (uic, "CaretMode", folder_browser_toggle_caret_mode, fb); + + /* Display Style */ + style = gconf_client_get_int (gconf, "/apps/evolution/mail/display/message_style", NULL); + style = style >= 0 && style < MAIL_CONFIG_DISPLAY_MAX ? style : 0; + bonobo_ui_component_set_prop (uic, message_display_styles[style], "state", "1", NULL); + bonobo_ui_component_add_listener (uic, "ViewNormal", folder_browser_set_message_display_style, fb); + bonobo_ui_component_add_listener (uic, "ViewFullHeaders", folder_browser_set_message_display_style, fb); + bonobo_ui_component_add_listener (uic, "ViewSource", folder_browser_set_message_display_style, fb); + if (fb->mail_display->display_style != style) { + fb->mail_display->display_style = style; + mail_display_redisplay (fb->mail_display, TRUE); + } + + /* Resend Message */ + if (fb->folder && !folder_browser_is_sent (fb)) + fbui_sensitise_item (fb, "MessageResend", FALSE); + + /* sensitivity of message-specific commands */ + prev_state = fb->selection_state; + fb->selection_state = FB_SELSTATE_UNDEFINED; + folder_browser_ui_set_selection_state (fb, prev_state); + + /* Charset picker */ + e_charset_picker_bonobo_ui_populate (uic, "/menu/View", FB_DEFAULT_CHARSET, + folder_browser_charset_changed, fb); +} + +void +folder_browser_ui_add_list (FolderBrowser *fb) +{ + BonoboUIComponent *uic = fb->uicomp; + GConfClient *gconf; + int state; + + gconf = mail_config_get_gconf_client (); + + if (fb->sensitise_state) { + g_hash_table_destroy (fb->sensitise_state); + fb->sensitise_state = NULL; + } + + ui_add (fb, "list", list_verbs, list_pixcache); + + /* Hide Deleted */ + state = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL); + bonobo_ui_component_set_prop (uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL); + bonobo_ui_component_add_listener (uic, "HideDeleted", folder_browser_toggle_hide_deleted, fb); + if (!(fb->folder && (fb->folder->folder_flags & CAMEL_FOLDER_IS_TRASH))) + message_list_set_hidedeleted (fb->message_list, state); + else + fbui_sensitise_item (fb, "HideDeleted", FALSE); + + /* Threaded toggle */ + state = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_list", NULL); + if (fb->meta) + state = e_meta_get_bool(fb->meta, "thread_list", state); + + bonobo_ui_component_set_prop (uic, "/commands/ViewThreaded", "state", state ? "1" : "0", NULL); + bonobo_ui_component_add_listener (uic, "ViewThreaded", folder_browser_toggle_threads, fb); + message_list_set_threaded (fb->message_list, state); + state = fb->selection_state; + fb->selection_state = FB_SELSTATE_UNDEFINED; + folder_browser_ui_set_selection_state (fb, state); + + /* Property menu */ + folder_browser_setup_property_menu (fb, fb->uicomp); + + /* View menu */ + if (fb->view_instance == NULL) + folder_browser_ui_setup_view_menus (fb); +} + +void +folder_browser_ui_rm_list (FolderBrowser *fb) +{ + /* View menu */ + if (fb->view_instance != NULL) + folder_browser_ui_discard_view_menus (fb); +} + +void +folder_browser_ui_add_global (FolderBrowser *fb) +{ + BonoboUIComponent *uic = fb->uicomp; + gboolean show_preview; + GConfClient *gconf; + int paned_size; + + gconf = mail_config_get_gconf_client (); + + if (fb->sensitise_state) { + g_hash_table_destroy (fb->sensitise_state); + fb->sensitise_state = NULL; + } + + ui_add (fb, "global", global_verbs, global_pixcache); + + /* (Pre)view pane size (do this first because it affects the + preview settings - see folder_browser_set_message_preview() + internals for details) */ + paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL); + g_signal_handler_block (fb->vpaned, fb->paned_resize_id); + gtk_paned_set_position (GTK_PANED (fb->vpaned), paned_size); + g_signal_handler_unblock (fb->vpaned, fb->paned_resize_id); + + /* (Pre)view toggle */ + show_preview = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_preview", NULL); + if (fb->meta) + show_preview = e_meta_get_bool(fb->meta, "show_preview", show_preview); + bonobo_ui_component_set_prop (uic, "/commands/ViewPreview", "state", show_preview ? "1" : "0", NULL); + folder_browser_set_message_preview (fb, show_preview); + + /* listen for user-changes */ + bonobo_ui_component_add_listener (uic, "ViewPreview", folder_browser_toggle_preview, fb); + + /* Stop button */ + /* TODO: Go through cache, but we can't becaus eof mail-mt.c:set_stop at the moment */ + bonobo_ui_component_set_prop (uic, "/commands/MailStop", "sensitive", "0", NULL); +} + +void +folder_browser_ui_rm_all (FolderBrowser *fb) +{ + BonoboUIComponent *uic = fb->uicomp; + + if (bonobo_ui_component_get_container (uic) != NULL) { + bonobo_ui_component_rm (uic, "/", NULL); + bonobo_ui_component_unset_container (uic, NULL); + } + + if (fb->sensitise_state) { + g_hash_table_destroy (fb->sensitise_state); + fb->sensitise_state = NULL; + } +} + +void +fbui_sensitise_item (FolderBrowser *fb, const char *item, int state) +{ + char *name, *key; + gpointer val_ptr; + int val; + + /* If this whole caching idea doesn't work, remove it here */ + if (fb->sensitise_state == NULL) + fb->sensitise_state = g_hash_table_new (g_str_hash, g_str_equal); + + if (g_hash_table_lookup_extended (fb->sensitise_state, item, (void **)&key, &val_ptr)) { + val = GPOINTER_TO_INT(val_ptr); + if (val == state) + return; + } + + if (fb->uicomp) { + name = g_alloca (strlen (item) + strlen ("/commands/") + 1); + sprintf (name, "/commands/%s", item); + bonobo_ui_component_set_prop (fb->uicomp, name, "sensitive", state ? "1" : "0", NULL); + g_hash_table_insert (fb->sensitise_state, (char *) item, GINT_TO_POINTER(state)); + } +} + +static void +fbui_sensitize_items (FolderBrowser *fb, guint32 enable_mask) +{ + gboolean enable; + int i; + + for (i = 0; i < num_default_ui_nodes; i++) { + enable = (default_ui_nodes[i].enable_mask & enable_mask) == enable_mask; + fbui_sensitise_item (fb, default_ui_nodes[i].name, enable); + } +} + +void +folder_browser_ui_scan_selection (FolderBrowser *fb) +{ + gboolean outgoing = FALSE; + guint32 enable_mask = 0; + + if (fb->selection_state == FB_SELSTATE_SINGLE || + fb->selection_state == FB_SELSTATE_MULTIPLE) { + GPtrArray *uids; + CamelMessageInfo *info; + guint32 temp_mask = 0; + int i; + + uids = g_ptr_array_new (); + message_list_foreach (fb->message_list, enumerate_msg, uids); + + for (i = 0; i < uids->len; i++) { + info = camel_folder_get_message_info (fb->folder, uids->pdata[i]); + if (info == NULL) + continue; + + if (info->flags & CAMEL_MESSAGE_DELETED) + temp_mask |= HAS_DELETED; + else + temp_mask |= HAS_UNDELETED; + + if (info->flags & CAMEL_MESSAGE_SEEN) + temp_mask |= HAS_READ; + else + temp_mask |= HAS_UNREAD; + + if (info->flags & CAMEL_MESSAGE_FLAGGED) + temp_mask |= HAS_IMPORTANT; + else + temp_mask |= HAS_UNIMPORTANT; + + camel_folder_free_message_info (fb->folder, info); + g_free (uids->pdata[i]); + } + + g_ptr_array_free (uids, TRUE); + + /* yeah, the naming is a bit backwards, but we need to support + * the case when, say, both a deleted and an undeleted message + * are selected. Both the Delete and Undelete menu items should + * be sensitized, but the only good way to set the flags is as + * above. Anyway, the naming is a bit of a lie but it works out + * so that it's sensible both above and in the definition of + * the UI items, so deal with it. + */ + + enable_mask |= (~temp_mask & HAS_FLAGS); + } + + if (folder_browser_is_drafts (fb)) { + enable_mask |= IS_DRAFTS_FOLDER; + outgoing = TRUE; + } + + if (folder_browser_is_outbox (fb)) { + enable_mask |= IS_OUTBOX_FOLDER; + outgoing = TRUE; + } + + if (folder_browser_is_sent (fb)) { + enable_mask |= IS_SENT_FOLDER; + outgoing = TRUE; + } + + if (fb->message_list && fb->message_list->threaded) + enable_mask |= IS_THREADED; + else + enable_mask |= NOT_THREADED; + + if (outgoing == FALSE) + enable_mask |= IS_INCOMING_FOLDER; + + switch (fb->selection_state) { + case FB_SELSTATE_SINGLE: + enable_mask |= SELECTION_SINGLE; + break; + case FB_SELSTATE_MULTIPLE: + enable_mask |= SELECTION_MULTIPLE; + break; + case FB_SELSTATE_NONE: + default: + enable_mask |= SELECTION_NONE; + break; + } + + fbui_sensitize_items (fb, enable_mask); +} + +void +folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelectionState state) +{ + /* the state may be the same but with + * different messages selected, necessitating + * a recheck of the flags of the selected + * messages. + */ + + if (state == fb->selection_state && + state != FB_SELSTATE_SINGLE && + state != FB_SELSTATE_MULTIPLE) + return; + + fb->selection_state = state; + folder_browser_ui_scan_selection (fb); +} + +void +folder_browser_ui_message_loaded (FolderBrowser *fb) +{ + BonoboUIComponent *uic = fb->uicomp; + + if (uic) { + fb->selection_state = FB_SELSTATE_NONE; + folder_browser_ui_set_selection_state (fb, FB_SELSTATE_SINGLE); + } +} diff --git a/mail/folder-browser-ui.h b/mail/folder-browser-ui.h new file mode 100644 index 0000000000..5c2bc1fa28 --- /dev/null +++ b/mail/folder-browser-ui.h @@ -0,0 +1,36 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * folder-browser-ui.c: Sets up the Bonobo UI for FolderBrowsers + * + * Author: + * Peter Williams <peterw@ximian.com> + * + * (C) 2001 Ximian, Inc. + */ + +#ifndef _FOLDER_BROWSER_UI_H +#define _FOLDER_BROWSER_UI_H + +#include "folder-browser.h" + +void folder_browser_ui_add_message (FolderBrowser *fb); +void folder_browser_ui_add_list (FolderBrowser *fb); +void folder_browser_ui_add_global (FolderBrowser *fb); + +void folder_browser_ui_rm_list (FolderBrowser *fb); +void folder_browser_ui_rm_all (FolderBrowser *fb); + +/* these affect the sensitivity of UI elements */ +void folder_browser_ui_scan_selection (FolderBrowser *fb); +void folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelectionState state); +void folder_browser_ui_message_loaded (FolderBrowser *fb); + +void folder_browser_ui_discard_view_menus (FolderBrowser *fb); +void folder_browser_ui_setup_view_menus (FolderBrowser *fb); +/* Set the sensitivity of a single item */ +void fbui_sensitise_item(FolderBrowser *fb, const char *item, int state); + +void folder_browser_ui_message_list_focus (FolderBrowser *fb); +void folder_browser_ui_message_list_unfocus (FolderBrowser *fb); + +#endif /* _FOLDER_BROWSER_UI_H */ diff --git a/mail/folder-browser.c b/mail/folder-browser.c new file mode 100644 index 0000000000..6d7deb2bdb --- /dev/null +++ b/mail/folder-browser.c |