Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Command-Line Sharing Plugin
Summary Tracker Lists News SCM Files
1 /*
2  * This file is part of sharing-plugin-template
3  *
4  * Copyright (C) 2008-2009 Nokia Corporation. All rights reserved.
5  *
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
8  * directory.
9  *
10  */
12 #include <stdio.h>
13 #include <glib.h>
14 #include <sharing-account.h>
15 #include <sharing-http.h>
16 #include <osso-log.h>
17 #include <conicconnection.h>
18 #include "validate.h"
19 #include "common.h"
21 /**
22  * test:
23  * @account: #SharingAccount to be tested
24  * @con: Connection used
25  * @dead_mans_switch: Turn to %FALSE at least every 30 seconds.
26  *
27  * Test if #SharingAccount is valid.
28  *
29  * Returns: #SharingPluginInterfaceTestAccountResult
30  */
31 SharingPluginInterfaceAccountValidateResult validate (SharingAccount* account,
32     ConIcConnection* con, gboolean *cont, gboolean* dead_mans_switch)
33 {
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));
46     } else {
47       ULOG_ERR_L ("Couldn't get stuff from service\n");
48       ret = SHARING_ACCOUNT_VALIDATE_FAILED;
49     }
50     sharing_http_unref (http); 
51     
53     return ret;
54 }

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment