2 * This file is part of sharing-plugin-template
4 * Copyright (C) 2008-2009 Nokia Corporation. All rights reserved.
6 * This maemo code example is licensed under a MIT-style license,
7 * that can be found in the file called "COPYING" in the root
14 #include <sharing-account.h>
15 #include <sharing-http.h>
17 #include <conicconnection.h>
23 * @account: #SharingAccount to be tested
24 * @con: Connection used
25 * @dead_mans_switch: Turn to %FALSE at least every 30 seconds.
27 * Test if #SharingAccount is valid.
29 * Returns: #SharingPluginInterfaceTestAccountResult
31 SharingPluginInterfaceAccountValidateResult validate (SharingAccount* account,
32 ConIcConnection* con, gboolean *cont, gboolean* dead_mans_switch)
34 SharingPluginInterfaceAccountValidateResult ret =
35 SHARING_ACCOUNT_VALIDATE_SUCCESS;
37 SharingHTTP * http = sharing_http_new ();
39 /* Correct fields must be added to http request before sending */
41 SharingHTTPRunResponse res;
42 res = sharing_http_run (http, "http://example.com/post");
43 if (res == SHARING_HTTP_RUNRES_SUCCESS) {
44 ULOG_DEBUG_L ("Got response (%d): %s\n", sharing_http_get_res_code (http),
45 sharing_http_get_res_body (http, NULL));
47 ULOG_ERR_L ("Couldn't get stuff from service\n");
48 ret = SHARING_ACCOUNT_VALIDATE_FAILED;
50 sharing_http_unref (http);