Menu

#25 Make X-properties work

enhancement
open
Net-ICal (57)
6
2012-05-22
2001-03-25
No

RFC2445 allows user-defined properties:

for example:

BEGIN:VALARM
X-FOOBAR;some string the module user wants to toss in
...
END:VALARM

We need a way to solve this problem. It looks
non-trivial, but at least one person has asked about it
on reefknot-users.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Component.pm includes some commented lines to handle x-values.
    Here is one way to make it work. The same things should be done in Property.pm.

    sub new{
    ...# LINE 87: change x-value to x_value
    $map->{'x_value'} = {
    type => 'parameter',
    doc => 'vendor-specific properties',
    domain => 'ref',
    options => 'HASH',
    value => undef,
    };
    ...
    }

    sub parse_lines {
    ...# LINE 222:
    # avoid warnings for doing eq with undef below
    if (not defined $self->get_meta ('domain', $class)) {
    if ($class =~ /^x
    /){
    $self->{'x_value'}->{value}->{$class} = $value;
    return 0; # or something
    }
    return ($class, $value);
    ...

    So it stores things like
    X-NSCP-WCAP-SESSION-ID:5ph5r5s5tbn3r65r
    X-NSCP-WCAP-USER-ID:aaltarn
    X-NSCP-WCAP-CALENDAR-ID:aaltarn
    X-NSCP-WCAP-ERRNO:0

    as

    'x_value' => {
    'value' => {
    'x_nscp_wcap_user_id' => 'aaltarn',
    'x_nscp_wcap_session_id' => '5ph5r5s5tbn3r65r',
    'x_nscp_wcap_errno' => '0',
    'x_nscp_wcap_calendar_id' => 'aaltarn'
    },
    'options' => 'HASH',
    'domain' => 'ref',
    'doc' => 'vendor-specific properties',
    'type' => 'parameter'
    }

    Values can be accessed
    $component->x_value->{x_nscp_wcap_user_id}

     
  • Kirrily Robert

    Kirrily Robert - 2001-06-28

    Logged In: YES
    user_id=9786

    Who posted the sample code below? They weren't logged in
    :-/ Cmon, own up!

     

Log in to post a comment.

MongoDB Logo MongoDB