~itmages/itmages/itmages-windows-extension

« back to all changes in this revision

Viewing changes to itmagescmd.h

  • Committer: Dmitry
  • Date: 2012-03-11 07:56:24 UTC
  • Revision ID: git-v1:d5a30bf1fe74b46641b08d0151d39dba15b67f0e
Migrate from launchpad

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    ITmages  upload client for Windows
 
3
    Copyright (C) 2011 Dmitriy Simbiriatin <slpiv@itmages.ru>
 
4
 
 
5
    This program is free software; you can redistribute it and/or
 
6
    modify it under the terms of the GNU General Public License
 
7
    as published by the Free Software Foundation; either version 2
 
8
    of the License, or (at your option) any later version.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
    GNU General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU General Public License
 
16
    along with this program; if not, write to the Free Software
 
17
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef LIBITMAGES_H
 
21
#define LIBITMAGES_H
 
22
 
 
23
#define ITMAGES_LOGIN_URL "http://www.itmages.ru/api/login"
 
24
#define ITMAGES_LOGOUT_URL "http://www.itmages.ru/api/logout"
 
25
#define ITMAGES_ADD_URL "http://www.itmages.ru/api/add"
 
26
#define ITMAGES_CHECK_URL "http://www.itmages.ru"
 
27
#define ITMAGES_REFERER "http://www.itmages.ru"
 
28
#define ITMAGES_USER_AGENT "Itmages upload client"
 
29
 
 
30
typedef struct {
 
31
    char *full;
 
32
    char *thumb;
 
33
    char *id;
 
34
    char *server;
 
35
    char *key;
 
36
} ItmagesImageLinks;
 
37
 
 
38
/* Checks connection with the ITmages server.
 
39
Returns 0 if the ITmages server is available.
 
40
Returns 1 if the ITmages server is not available.
 
41
Returns -1 if there were some errors during the connection checking. */
 
42
int ItmagesCheckConnection(
 
43
        char *cookies_path, // Path to the cookies' file
 
44
        char *proxy_adrs,
 
45
        char *proxy_port);
 
46
 
 
47
/* Logins to the ITmages account.
 
48
Returns 0 if the login was successfull.
 
49
Returns 1 if the login was failed.
 
50
Returns -1 if there were some errors during the login. */
 
51
int ItmagesLogin(
 
52
        char* usr_login,
 
53
        char* usr_passwd,
 
54
        char *cookies_path, // Path to the cookies' file
 
55
        char *proxy_adrs,
 
56
        char *proxy_port);
 
57
 
 
58
/* Logouts from the ITmages account.
 
59
Returns 0 if the logout was successfull.
 
60
Returns 1 if the logout was failed.
 
61
Returns -1 if there were some errors during the logout.*/
 
62
int ItmagesLogout(
 
63
        char *cookies_path,
 
64
        char *proxy_adrs,
 
65
        char *proxy_port);
 
66
 
 
67
/* Uploads selected image to the ITmages server.
 
68
Returns 0 if the image was uploaded successfully.
 
69
Returns -1 if there were some error during the uplaod. */
 
70
int ItmagesUpload(
 
71
        HWND upload_progress, // Handle of the upload progressbar
 
72
        wchar_t *image_path, // Path to the upload image
 
73
        char *name, // fullname of the image (e.g. "image.png")
 
74
        char *mime, // mime-type of the image(e.g "image/png")
 
75
        char *cookies_path, // Path to the cookies' file
 
76
        char *proxy_adrs,
 
77
        char *proxy_port,
 
78
        size_t size,
 
79
        ItmagesImageLinks *imageLinks);
 
80
 
 
81
// Frees the memory used by the ItmagesImageLinks structure.
 
82
void FreeImageLinks(ItmagesImageLinks *imageLinks);
 
83
 
 
84
#endif
 
85