summaryrefslogtreecommitdiffabout
path: root/libical/src/libicalss/icalmessage.c
authorzautrix <zautrix>2004-06-29 11:59:46 (UTC)
committer zautrix <zautrix>2004-06-29 11:59:46 (UTC)
commitda43dbdc6c82453228f34766fc74585615cba938 (patch) (side-by-side diff)
tree16576932cea08bf117b2d0320b0d5f66ee8ad093 /libical/src/libicalss/icalmessage.c
parent627489ea2669d3997676bc3cee0f5d0d0c16c4d4 (diff)
downloadkdepimpi-da43dbdc6c82453228f34766fc74585615cba938.zip
kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.gz
kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.bz2
New lib ical.Some minor changes as well.
Diffstat (limited to 'libical/src/libicalss/icalmessage.c') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libicalss/icalmessage.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libical/src/libicalss/icalmessage.c b/libical/src/libicalss/icalmessage.c
index d5c57c1..731a2c7 100644
--- a/libical/src/libicalss/icalmessage.c
+++ b/libical/src/libicalss/icalmessage.c
@@ -19,49 +19,49 @@
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "icalmessage.h"
#include "icalenums.h"
#include <ctype.h> /* for tolower()*/
#include <string.h> /* for strstr */
#include <stdlib.h> /* for free(), malloc() */
icalcomponent* icalmessage_get_inner(icalcomponent* comp)
{
if (icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT){
return icalcomponent_get_first_real_component(comp);
} else {
return comp;
}
}
-char* lowercase(const char* str)
+static char* lowercase(const char* str)
{
char* p = 0;
char* n = icalmemory_strdup(str);
if(str ==0){
return 0;
}
for(p = n; *p!=0; p++){
*p = tolower(*p);
}
return n;
}
icalproperty* icalmessage_find_attendee(icalcomponent* comp, const char* user)
{
icalcomponent *inner = icalmessage_get_inner(comp);
icalproperty *p,*attendee = 0;
char* luser = lowercase(user);
for(p = icalcomponent_get_first_property(inner, ICAL_ATTENDEE_PROPERTY);
p != 0;
p = icalcomponent_get_next_property(inner, ICAL_ATTENDEE_PROPERTY)
@@ -137,50 +137,55 @@ icalcomponent *icalmessage_new_reply_base(icalcomponent* c,
icalmessage_copy_properties(reply,c,ICAL_SEQUENCE_PROPERTY);
icalcomponent_set_dtstamp(reply,icaltime_from_timet(time(0),0));
if(msg != 0){
icalcomponent_add_property(inner,icalproperty_new_comment(msg));
}
/* Copy this user's attendee property */
attendee = icalmessage_find_attendee(c,user);
if (attendee == 0){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
icalcomponent_free(reply);
return 0;
}
icalcomponent_add_property(inner,icalproperty_new_clone(attendee));
/* Add PRODID and VERSION */
icalcomponent_add_property(reply,icalproperty_new_version("2.0"));
+#ifndef WIN32
sprintf(tmp,
"-//SoftwareStudio//NONSGML %s %s //EN",PACKAGE,VERSION);
+#else
+ sprintf(tmp,
+ "-//SoftwareStudio//NONSGML %s %s //EN",ICAL_PACKAGE,ICAL_VERSION);
+#endif
icalcomponent_add_property(reply,icalproperty_new_prodid(tmp));
return reply;
}
icalcomponent* icalmessage_new_accept_reply(icalcomponent* c,
const char* user,
const char* msg)
{
icalcomponent *reply;
icalproperty *attendee;
icalcomponent *inner;
icalerror_check_arg_rz(c,"c");
reply = icalmessage_new_reply_base(c,user,msg);
if(reply == 0){
return 0;
}
inner = icalmessage_get_inner(reply);
@@ -209,53 +214,53 @@ icalcomponent* icalmessage_new_decline_reply(icalcomponent* c,
if(reply == 0){
return 0;
}
attendee = icalcomponent_get_first_property(inner,
ICAL_ATTENDEE_PROPERTY);
icalproperty_set_parameter(attendee,
icalparameter_new_partstat(ICAL_PARTSTAT_DECLINED));
return reply;
}
/* New is modified version of old */
icalcomponent* icalmessage_new_counterpropose_reply(icalcomponent* oldc,
icalcomponent* newc,
const char* user,
const char* msg)
{
icalcomponent *reply;
icalerror_check_arg_rz(oldc,"oldc");
icalerror_check_arg_rz(newc,"newc");
- reply = icalcomponent_new_clone(newc);
+ reply = icalmessage_new_reply_base(newc,user,msg);
icalcomponent_set_method(reply,ICAL_METHOD_COUNTER);
- return newc;
+ return reply;
}
icalcomponent* icalmessage_new_delegate_reply(icalcomponent* c,
const char* user,
const char* delegatee,
const char* msg)
{
icalcomponent *reply;
icalproperty *attendee;
icalcomponent *inner;
icalerror_check_arg_rz(c,"c");
reply = icalmessage_new_reply_base(c,user,msg);
inner = icalmessage_get_inner(reply);
if(reply == 0){
return 0;
}
attendee = icalcomponent_get_first_property(inner,
ICAL_ATTENDEE_PROPERTY);