Changeset 3579
- Timestamp:
- 08/22/08 15:16:14 (3 months ago)
- Location:
- plugins/syncml/src
- Files:
-
- 9 modified
-
syncml-http-client (modified) (2 diffs)
-
syncml-http-server (modified) (4 diffs)
-
syncml_common.c (modified) (7 diffs)
-
syncml_common.h (modified) (1 diff)
-
syncml_ds_client.c (modified) (4 diffs)
-
syncml_ds_server.c (modified) (4 diffs)
-
syncml_http_client.c (modified) (1 diff)
-
syncml_http_server.c (modified) (1 diff)
-
syncml_obex_client.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
plugins/syncml/src/syncml-http-client
r3571 r3579 21 21 </AdvancedOption> 22 22 <AdvancedOption> 23 <DisplayName> URL fothe remote server</DisplayName>24 <Name> URL</Name>25 <Type>string</Type> 26 <Value> http://127.0.0.1:8080</Value>23 <DisplayName>Path for the remote server</DisplayName> 24 <Name>Path</Name> 25 <Type>string</Type> 26 <Value></Value> 27 27 </AdvancedOption> 28 28 <AdvancedOption> … … 149 149 <Password></Password> 150 150 </Authentication> 151 <Connection> 152 <Network> 153 <Address>127.0.0.1</Address> 154 <Port>8080</Port> 155 <Protocol>http</Protocol> 156 </Network> 157 </Connection> 151 158 152 159 <!-- To be filed by UI or hand: -
plugins/syncml/src/syncml-http-server
r3571 r3579 99 99 <Resources> 100 100 <Resource> 101 <Name>Contacts</Name> 102 <ObjType>contact</ObjType> 101 <Enabled>1</Enabled> 103 102 <Formats> 104 103 <Format> … … 106 105 </Format> 107 106 </Formats> 108 <Enabled>1</Enabled> 107 <Name>Contacts</Name> 108 <ObjType>contact</ObjType> 109 109 </Resource> 110 110 <Resource> 111 <Name>Calendar</Name> 112 <ObjType>event</ObjType> 111 <Enabled>1</Enabled> 113 112 <Formats> 114 113 <Format> … … 116 115 </Format> 117 116 </Formats> 118 <Enabled>1</Enabled> 117 <Name>Calendar</Name> 118 <ObjType>event</ObjType> 119 119 </Resource> 120 120 <Resource> 121 <Name>Notes</Name> 122 <ObjType>note</ObjType> 121 <Enabled>1</Enabled> 123 122 <Formats> 124 123 <Format> … … 126 125 </Format> 127 126 </Formats> 128 <Enabled>1</Enabled> 127 <Name>Notes</Name> 128 <ObjType>note</ObjType> 129 129 </Resource> 130 130 </Resources> -
plugins/syncml/src/syncml_common.c
r3573 r3579 431 431 osync_bool discover(const char *name, void *data, OSyncPluginInfo *info, OSyncError **error) 432 432 { 433 osync_trace(TRACE_ENTRY, "%s(% p, %p, %p)", __func__, data, info, error);433 osync_trace(TRACE_ENTRY, "%s(%s, %p, %p, %p)", __func__, name, data, info, error); 434 434 435 435 SmlPluginEnv *env = (SmlPluginEnv *)data; … … 459 459 OSyncError **oerror) 460 460 { 461 osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, dsObject, config, oerror); 461 osync_trace(TRACE_ENTRY, "%s(%d, %p, %p, %p)", 462 __func__, tsp, dsObject, config, oerror); 462 463 OSyncPluginConnection *conn; 464 char *url = NULL; 463 465 SmlError *error = NULL; 464 466 … … 525 527 !smlDataSyncSetOption(dsObject, "CONNECTION_TYPE", "NET", &error)) 526 528 goto error; 527 char *port = g_strdup_printf("%u", osync_plugin_connection_net_get_port(conn)); 528 if (!smlDataSyncSetOption(dsObject, "PORT", port, &error)) 529 if (tsp == SML_TRANSPORT_HTTP_CLIENT) 529 530 { 531 url = g_strdup_printf("%s://%s:%d", 532 osync_plugin_connection_net_get_protocol(conn), 533 osync_plugin_connection_net_get_address(conn), 534 osync_plugin_connection_net_get_port(conn)); 535 } else { 536 char *port = g_strdup_printf("%u", osync_plugin_connection_net_get_port(conn)); 537 if (!smlDataSyncSetOption(dsObject, "PORT", port, &error)) 538 { 539 smlSafeCFree(&port); 540 goto error; 541 } 530 542 smlSafeCFree(&port); 531 goto error;532 543 } 533 smlSafeCFree(&port);534 544 break; 535 545 case OSYNC_PLUGIN_CONNECTION_UNKNOWN: … … 597 607 } else if (!strcmp(SYNCML_PLUGIN_CONFIG_PROXY, name)) { 598 608 key = "PROXY"; 599 } else if (!strcmp(SYNCML_PLUGIN_CONFIG_URL, name)) { 600 key = "URL"; 609 } else if (!strcmp(SYNCML_PLUGIN_CONFIG_PATH, name)) { 610 /* build URL together with connection config */ 611 char *value = g_strdup_printf("%s%s", url, val); 612 safe_cfree(&url); 613 if (!smlDataSyncSetOption(dsObject, "URL", value, &error)) { 614 safe_cfree(&value); 615 goto error; 616 } 617 safe_cfree(&value); 601 618 } else if (!strcmp(SYNCML_PLUGIN_CONFIG_CAFILE, name)) { 602 key = " CAFILE";619 key = "SSL_CA_FILE"; 603 620 } else if (!strcmp(SYNCML_PLUGIN_CONFIG_AUTH_TYPE, name)) { 604 621 key = "AUTH_TYPE"; … … 618 635 } 619 636 620 osync_trace(TRACE_EXIT, "%s ", __func__);637 osync_trace(TRACE_EXIT, "%s - TRUE", __func__); 621 638 return TRUE; 622 639 error: … … 651 668 env->dsObject1 = smlDataSyncNew(sessionType, tspType, &error); 652 669 if (!env->dsObject1) 653 goto error ;670 goto error_free_env; 654 671 if (sessionType == SML_SESSION_TYPE_CLIENT) 655 672 { 656 673 env->dsObject2 = smlDataSyncNew(sessionType, tspType, &error); 657 674 if (!env->dsObject2) 658 goto error ;675 goto error_free_env; 659 676 } 660 677 … … 707 724 smlDataSyncRegisterChangeStatusCallback(env->dsObject2, _recv_change_status); 708 725 } 726 osync_trace(TRACE_INTERNAL, "%s: config loaded", __func__); 709 727 710 728 /* configure databases */ -
plugins/syncml/src/syncml_common.h
r3573 r3579 70 70 #define SYNCML_PLUGIN_CONFIG_ONLYLOCALTIME "OnlyLocaltime" 71 71 72 #define SYNCML_PLUGIN_CONFIG_URL "Url" 73 #define SYNCML_PLUGIN_CONFIG_PORT "Port" 72 #define SYNCML_PLUGIN_CONFIG_PATH "Path" 74 73 #define SYNCML_PLUGIN_CONFIG_CAFILE "CaFile" 75 74 #define SYNCML_PLUGIN_CONFIG_PROXY "Proxy" -
plugins/syncml/src/syncml_ds_client.c
r3571 r3579 5 5 SmlBool ds_client_init_databases(SmlPluginEnv *env, OSyncPluginInfo *info, OSyncError **oerror) 6 6 { 7 8 osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, env, info, oerror); 7 9 SmlDatabase *database = NULL; 8 10 SmlError *error = NULL; 9 11 OSyncPluginConfig *config = osync_plugin_info_get_config(info); 12 OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); 10 13 unsigned int i, num_objtypes = osync_plugin_info_num_objtypes(info); 14 osync_trace(TRACE_INTERNAL, "%s: %d objtypes", __func__, num_objtypes); 15 11 16 12 17 for (i=0; i < num_objtypes; i++) { 13 18 OSyncObjTypeSink *sink = osync_plugin_info_nth_objtype(info, i); 14 const char *objtype = osync_objtype_sink_get_name(sink); 19 osync_bool sinkEnabled = osync_objtype_sink_is_enabled(sink); 20 osync_trace(TRACE_INTERNAL, "%s: enabled => %d", __func__, sinkEnabled); 21 if (!sinkEnabled) 22 continue; 15 23 16 database->sink = sink; 17 24 18 25 OSyncObjTypeSinkFunctions functions; 19 26 memset(&functions, 0, sizeof(functions)); … … 22 29 functions.batch_commit = ds_client_batch_commit; 23 30 31 const char *objtype = osync_objtype_sink_get_name(sink); 24 32 OSyncPluginResource *res = osync_plugin_config_find_active_resource(config, objtype); 25 33 if (!(database = syncml_config_parse_database(env, res, oerror))) 26 34 goto oerror; 27 35 36 database->sink = sink; 37 38 /* TODO: Handle all available format sinks! */ 39 OSyncList *fs = osync_plugin_resource_get_objformat_sinks(res); 40 OSyncObjFormatSink *fmtsink = osync_list_nth_data(fs, 0); 41 const char *objformat = osync_objformat_sink_get_objformat(fmtsink); 42 43 database->objformat = osync_format_env_find_objformat(formatenv, objformat); 44 45 /* TODO: Handle error about missing objformat in a nice way. */ 46 g_assert(database->objformat); 47 48 osync_objformat_ref(database->objformat); 49 28 50 osync_objtype_sink_set_functions(sink, functions, database); 51 52 env->databases = g_list_append(env->databases, database); 29 53 30 54 if (!smlDataSyncAddDatastore( … … 35 59 &error)) 36 60 goto error; 61 if (!smlDataSyncAddDatastore( 62 env->dsObject2, 63 get_database_pref_content_type(database, oerror), 64 NULL, 65 database->url, 66 &error)) 67 goto error; 37 68 } 69 osync_trace(TRACE_EXIT, "%s - TRUE", __func__); 38 70 return TRUE; 39 71 error: … … 41 73 smlErrorDeref(&error); 42 74 oerror: 75 osync_trace(TRACE_EXIT_ERROR, "%s - %s", __func__, osync_error_print(oerror)); 43 76 return FALSE; 44 77 } 45 78 46 79 void ds_client_get_changeinfo(void *data, OSyncPluginInfo *info, OSyncContext *ctx) 47 80 { -
plugins/syncml/src/syncml_ds_server.c
r3571 r3579 5 5 SmlBool ds_server_init_databases(SmlPluginEnv *env, OSyncPluginInfo *info, OSyncError **oerror) 6 6 { 7 smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, env, info, oerror);7 osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, env, info, oerror); 8 8 SmlDatabase *database = NULL; 9 9 SmlError *error = NULL; … … 11 11 OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); 12 12 unsigned int i, num_objtypes = osync_plugin_info_num_objtypes(info); 13 smlTrace(TRACE_INTERNAL, "%s: %d objtypes", __func__, num_objtypes);13 osync_trace(TRACE_INTERNAL, "%s: %d objtypes", __func__, num_objtypes); 14 14 15 15 for (i=0; i < num_objtypes; i++) { 16 16 OSyncObjTypeSink *sink = osync_plugin_info_nth_objtype(info, i); 17 17 osync_bool sinkEnabled = osync_objtype_sink_is_enabled(sink); 18 smlTrace(TRACE_INTERNAL, "%s: enabled => %d", __func__, sinkEnabled);18 osync_trace(TRACE_INTERNAL, "%s: enabled => %d", __func__, sinkEnabled); 19 19 if (!sinkEnabled) 20 20 continue; … … 57 57 goto error; 58 58 } 59 smlTrace(TRACE_EXIT, "%s - TRUE", __func__);59 osync_trace(TRACE_EXIT, "%s - TRUE", __func__); 60 60 return TRUE; 61 61 error: … … 63 63 smlErrorDeref(&error); 64 64 oerror: 65 smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, osync_error_print(oerror));65 osync_trace(TRACE_EXIT_ERROR, "%s - %s", __func__, osync_error_print(oerror)); 66 66 return FALSE; 67 67 } -
plugins/syncml/src/syncml_http_client.c
r3573 r3579 56 56 goto error; 57 57 58 osync_trace(TRACE_EXIT, "%s - %p", __func__, env); 59 return env; 58 60 error: 59 osync_trace(TRACE_EXIT_ERROR, "%s :%s", __func__, osync_error_print(oerror));61 osync_trace(TRACE_EXIT_ERROR, "%s - %s", __func__, osync_error_print(oerror)); 60 62 return NULL; 61 63 } -
plugins/syncml/src/syncml_http_server.c
r3573 r3579 32 32 goto error; 33 33 34 osync_trace(TRACE_EXIT, "%s - %p", __func__, env); 35 return env; 34 36 error: 35 37 osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(oerror)); -
plugins/syncml/src/syncml_obex_client.c
r3573 r3579 49 49 osync_trace(TRACE_EXIT, "%s: %p", __func__, env); 50 50 return (void *)env; 51 52 51 error_free_env: 53 52 finalize(env);
