Changeset 3393
- Timestamp:
- 07/07/08 09:44:38 (1 month ago)
- Files:
-
- trunk/misc/schemas/plugin_config.xsd (modified) (1 diff)
- trunk/opensync/plugin/opensync_plugin_config.c (modified) (4 diffs)
- trunk/tests/plugin-tests/check_plugin_config.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/misc/schemas/plugin_config.xsd
r3329 r3393 53 53 <xsd:sequence> 54 54 <xsd:element maxOccurs="1" minOccurs="1" name="Enabled" type="xsd:integer" /> 55 <xsd:element maxOccurs="1" minOccurs="0" name="Formats" type="Formats" /> 55 56 <xsd:element maxOccurs="1" minOccurs="0" name="Name" type="xsd:string" /> 56 57 <xsd:element maxOccurs="1" minOccurs="0" name="MIME" type="xsd:string" /> 57 <xsd:element maxOccurs="1" minOccurs=" 0" name="Formats" type="Formats" />58 <xsd:element maxOccurs="1" minOccurs="1" name="ObjType" type="xsd:string" /> 58 59 <xsd:element maxOccurs="1" minOccurs="0" name="Path" type="xsd:string" /> 59 60 <xsd:element maxOccurs="1" minOccurs="0" name="Url" type="xsd:string" /> trunk/opensync/plugin/opensync_plugin_config.c
r3329 r3393 451 451 if (!xmlStrcmp(cur->name, (const xmlChar *)"Enabled")) { 452 452 osync_plugin_ressource_enable(res, atoi(str)); 453 } else if (!xmlStrcmp(cur->name, (const xmlChar *)"Formats")) { 454 if (!_osync_plugin_config_parse_ressource_formats(res, cur->xmlChildrenNode, error)) 455 goto error_free_str; 453 456 } else if (!xmlStrcmp(cur->name, (const xmlChar *)"Name")) { 454 457 osync_plugin_ressource_set_name(res, str); 455 458 } else if (!xmlStrcmp(cur->name, (const xmlChar *)"MIME")) { 456 459 osync_plugin_ressource_set_mime(res, str); 457 } else if (!xmlStrcmp(cur->name, (const xmlChar *)"Formats")) { 458 if (!_osync_plugin_config_parse_ressource_formats(res, cur->xmlChildrenNode, error)) 459 goto error_free_str; 460 } else if (!xmlStrcmp(cur->name, (const xmlChar *)"ObjType")) { 461 osync_plugin_ressource_set_objtype(res, str); 460 462 } else if (!xmlStrcmp(cur->name, (const xmlChar *)"Path")) { 461 463 osync_plugin_ressource_set_path(res, str); … … 804 806 805 807 OSyncList *o; 806 const char *name, *mime, * path, *url;808 const char *name, *mime, *objtype, *path, *url; 807 809 808 810 xmlNode *next, *node = xmlNewChild(cur, NULL, (xmlChar*)"Ressource", NULL); … … 814 816 osync_bool res_enabled = osync_plugin_ressource_is_enabled(res); 815 817 xmlNewChild(node, NULL, (xmlChar*)"Enabled", res_enabled ? (xmlChar*) "1" : (xmlChar*) "0"); 816 817 if ((name = osync_plugin_ressource_get_name(res)))818 xmlNewChild(node, NULL, (xmlChar*)"Name", (xmlChar*)name);819 820 if ((mime = osync_plugin_ressource_get_mime(res)))821 xmlNewChild(node, NULL, (xmlChar*)"MIME", (xmlChar*)mime);822 818 823 819 next = xmlNewChild(node, NULL, (xmlChar*)"Formats", NULL); … … 827 823 goto error; 828 824 } 825 826 if ((name = osync_plugin_ressource_get_name(res))) 827 xmlNewChild(node, NULL, (xmlChar*)"Name", (xmlChar*)name); 828 829 if ((mime = osync_plugin_ressource_get_mime(res))) 830 xmlNewChild(node, NULL, (xmlChar*)"MIME", (xmlChar*)mime); 831 832 objtype = osync_plugin_ressource_get_objtype(res); 833 osync_assert(objtype); /* ObjType for Ressource MUST be set! */ 834 xmlNewChild(node, NULL, (xmlChar*)"ObjType", (xmlChar*) objtype); 829 835 830 836 if ((path = osync_plugin_ressource_get_path(res))) trunk/tests/plugin-tests/check_plugin_config.c
r3330 r3393 451 451 osync_objformat_sink_unref(format_sink2); 452 452 453 /* ObjType */ 454 osync_plugin_ressource_set_objtype(ressource, "foobar"); 455 fail_unless(!strcmp(osync_plugin_ressource_get_objtype(ressource), "foobar"), NULL); 456 457 /* Overwrite (leak check) */ 458 osync_plugin_ressource_set_objtype(ressource, "barfoo"); 459 fail_unless(!strcmp(osync_plugin_ressource_get_objtype(ressource), "barfoo"), NULL); 460 453 461 /* Path */ 454 462 osync_plugin_ressource_set_path(ressource, "foobar"); … … 540 548 osync_plugin_ressource_set_mime(ressource1, "foobar1"); 541 549 osync_plugin_ressource_add_objformat_sink(ressource1, format_sink1); 550 osync_plugin_ressource_set_objtype(ressource1, "foobar1"); 542 551 osync_plugin_ressource_set_path(ressource1, "foobar1"); 543 552 osync_plugin_ressource_set_url(ressource1, "foobar1"); … … 556 565 osync_plugin_ressource_set_mime(ressource2, "foobar2"); 557 566 osync_plugin_ressource_add_objformat_sink(ressource2, format_sink2); 567 osync_plugin_ressource_set_objtype(ressource2, "foobar2"); 558 568 osync_plugin_ressource_set_path(ressource2, "foobar2"); 559 569 osync_plugin_ressource_set_url(ressource2, "foobar2"); … … 599 609 fail_unless(!strcmp(osync_plugin_ressource_get_mime(r->data), value), NULL); 600 610 fail_unless(!strcmp(_format_sink_get_objformat(r->data), value), NULL); 611 fail_unless(!strcmp(osync_plugin_ressource_get_objtype(r->data), value), NULL); 612 601 613 fail_unless(!strcmp(osync_plugin_ressource_get_path(r->data), value), NULL); 602 614 fail_unless(!strcmp(osync_plugin_ressource_get_url(r->data), value), NULL);
