Allow calIDateTime objects to expose an ical-serialized version of the object as an attribute. Not part of the build.

This commit is contained in:
dmose%mozilla.org 2005-01-02 02:52:11 +00:00
parent 1f56b71934
commit 8d681690e9
2 changed files with 23 additions and 0 deletions

View File

@ -150,6 +150,12 @@ interface calIDateTime : nsISupports
[noscript,notxpcom] void toIcalTime(in icaltimetypeptr itt);
/**
* This object as either an iCalendar DATE or DATETIME string, as
* appropriate.
*/
readonly attribute ACString icalString;
/* JS only:
* attribute Date jsDate;
*/

View File

@ -290,6 +290,23 @@ calDateTime::GetEndOfYear(calIDateTime **aResult)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
calDateTime::GetIcalString(nsACString& aResult)
{
icaltimetype t;
ToIcalTime(&t);
// note that ics is owned by libical, so we don't need to free
char *ics = icaltime_as_ical_string(t);
if (ics) {
aResult.Assign(ics);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
/**
** utility/protected methods