Calendar:Feature Implementations:iTIP-iMIP:iTIP Processor

From MozillaWiki
Jump to: navigation, search

New iTIP Processor Interface

This is based off of the iTIPResponder Patch in bug 334685

This will be the proposed interface into the iTIP Processor that will handle all forms of iTIP action, from replying to an iTIP REQUEST to Rescheduling an invitation (eventually).

The interface is simple. An iTIP invitation is encapsulated as an ItipItem. An ItipItem is one or more iCALENDAR (RFC 2445) objects that are the same type with the same iTIP METHOD (such as PUBLISH). We also use the ItipItem to designate the user's preference for handling the item. The user can specify whether or not to allow automatic, preference based handling of an ItipItem. This would occur if the user had set up a preference setting to "Always Add all Publish Events to Calendar X". Or, the user can direct what method they would like to respond to an iTIP invitation. For example, the user may wish to decline an invitation to a meeting. This information is encapsulated into the ItipItem before it is sent to the ItipProcessorService object.

If the ItipItem is not fully specified when it is received by the ItipProcessorService, the ItipProcessorService will use the user's iTIP Preference settings to act on the ItipItem appropriately.

To this end, there are just two interfaces needed into the ItipProcessorService.

  • getItipPreference
  • process

/**
 * Used to indicate the preference for the default calendar used for this iTIP 
 * transaction
 * This is specified as the second parameter in getItipPreference
 */
const unsigned long TARGET_CALENDAR = 0;
 
/**
 * Used to indicate the preference for the defaultResponseMethod preference 
 * used for this iTIP transaction
 * This is specified as the second parameter in getItipPreference
 */
const unsigned long DEFAULT_RESPONSE_METHOD = 1;
  
/**
 * Used to indicate the preference of whether the user handles the iTIP
 * transaction automatically or not for the given iTIP message
 * This is specified as the second parameter in getItipPreference
 */
const unisgned long IS_HANDLED_AUTOMATICALLY = 2;
   
/**
 * Returns the preference the user asked for. The preference setting is
 * valid for the given type of iTIP item that is passed in.
 * @arg in parameter: A calIItipItem for reference
 * @arg in parameter: One of the above constants indicating the preference 
 *                    to be queried.
 * @return: An AString containing the value of the preference
 */
AString getItipPreference(in calIItipItem itipItem, 
                          in unsigned long prefConstant);

/**
 * Processes the given calIItipItem based on the settings inside the calIItipItem.
 * @arg in parameter: A calIItipItem to process. If the calIItipItem is not
 *                    entirely specified, then the processor will use the
 *                    preference values to supply the missing information.
 * @return: none
 */
void process(in calIItipItem itipItem);