Changeset 1689

Show
Ignore:
Timestamp:
02/07/07 13:43:37 (2 years ago)
Author:
dgollub
Message:

Fixed #358.
vcard2.1 and vcard3.0 use different format values
for the binary format: B / BASE64
Included attachted patch from #358 for vformat
to handle the base64 stuff.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/formats/vformats-xml/vformat.c

    r1677 r1689  
    13211321                        if (!g_ascii_strcasecmp ((char*)param->values->data, "b")) 
    13221322                                attr->encoding = VF_ENCODING_BASE64; 
     1323                        else if (!g_ascii_strcasecmp ((char*)param->values->data, "BASE64")) 
     1324                                attr->encoding = VF_ENCODING_BASE64; 
    13231325                        else if (!g_ascii_strcasecmp ((char*)param->values->data, "QUOTED-PRINTABLE")) 
    13241326                                attr->encoding = VF_ENCODING_QP; 
  • trunk/formats/vformats-xml/xml-vcard.c

    r1414 r1689  
    687687} 
    688688 
     689static VFormatAttribute *handle_xml_photo_base64_attribute(VFormat *vcard, xmlNode *root, const char *encoding) 
     690{ 
     691        osync_trace(TRACE_INTERNAL, "Handling photo xml attribute"); 
     692        VFormatAttribute *attr = vformat_attribute_new(NULL, "PHOTO"); 
     693        add_value(attr, root, "Content", encoding); 
     694        vformat_attribute_add_param_with_value(attr, "ENCODING", "BASE64"); 
     695        vformat_attribute_add_param_with_value(attr, "TYPE", osxml_find_node(root, "Type")); 
     696        vformat_add_attribute(vcard, attr); 
     697        return attr; 
     698} 
     699 
    689700static VFormatAttribute *handle_xml_birthday_attribute(VFormat *vcard, xmlNode *root, const char *encoding) 
    690701{ 
     
    918929        else 
    919930                std_encoding = "B"; 
    920          
     931 
     932        OSyncHookTables *hooks = (OSyncHookTables *)user_data; 
     933        /*  vcard21 / vcard30  */ 
     934        if (target == VFORMAT_CARD_21) { 
     935                g_hash_table_insert(hooks->attributes, "Photo", handle_xml_photo_base64_attribute); 
     936        } else { 
     937                g_hash_table_insert(hooks->attributes, "Photo", handle_xml_photo_attribute); 
     938        } 
     939 
    921940        if (root) 
    922941                root = root->children; 
    923942        while (root) { 
    924                 xml_vcard_handle_attribute((OSyncHookTables *)user_data, vcard, root, std_encoding); 
     943                xml_vcard_handle_attribute(hooks, vcard, root, std_encoding); 
    925944                root = root->next; 
    926945        } 
     
    10481067        g_hash_table_insert(hooks->attributes, "Name", handle_xml_name_attribute); 
    10491068        g_hash_table_insert(hooks->attributes, "Agent", handle_xml_agent_attribute); 
    1050         g_hash_table_insert(hooks->attributes, "Photo", handle_xml_photo_attribute); 
    10511069        g_hash_table_insert(hooks->attributes, "Birthday", handle_xml_birthday_attribute); 
    10521070        g_hash_table_insert(hooks->attributes, "Address", handle_xml_address_attribute);