Merge branch 'master' of pc18:/srv/git/r/doldaconnect
[doldaconnect.git] / include / doldaconnect / uimisc.h
CommitLineData
d3372da9 1#ifndef _UIMISC_H
2#define _UIMISC_H
3
4#define DC_LOGIN_ERR_SUCCESS 0
5#define DC_LOGIN_ERR_NOLOGIN 1
6#define DC_LOGIN_ERR_SERVER 2
7#define DC_LOGIN_ERR_USER 3
8#define DC_LOGIN_ERR_CONV 4
9#define DC_LOGIN_ERR_AUTHFAIL 5
10
11#define DC_LOGIN_CONV_NOECHO 0
12#define DC_LOGIN_CONV_ECHO 1
13#define DC_LOGIN_CONV_INFO 2
14#define DC_LOGIN_CONV_ERROR 3
15
16#define DC_FNN_STATE_SYN 0
17#define DC_FNN_STATE_HS 1
18#define DC_FNN_STATE_EST 2
19#define DC_FNN_STATE_DEAD 3
20
8be1b1e3 21#define DC_FNPD_INT 0
22#define DC_FNPD_LL 1
23#define DC_FNPD_STR 2
24
d3372da9 25#define DC_TRNS_WAITING 0
26#define DC_TRNS_HS 1
27#define DC_TRNS_MAIN 2
28#define DC_TRNS_DONE 3
29
30#define DC_TRNSD_UNKNOWN 0
31#define DC_TRNSD_UP 1
32#define DC_TRNSD_DOWN 2
33
34#define DC_TRNSE_NOERROR 0
35#define DC_TRNSE_NOTFOUND 1
36#define DC_TRNSE_NOSLOTS 2
37
38#include <time.h>
39
40struct dc_fnetnode
41{
42 struct dc_fnetnode *next, *prev;
43 int id;
44 wchar_t *name;
45 wchar_t *fnet;
46 int state;
47 int numusers;
48 int found;
49 void (*destroycb)(struct dc_fnetnode *fn);
50 void *udata;
8be1b1e3 51 struct dc_fnetpeer *peers;
52 struct dc_fnetpeerdatum *peerdata;
d4c5deab 53 void (*newpeercb)(struct dc_fnetpeer *peer);
54 void (*delpeercb)(struct dc_fnetpeer *peer);
55 void (*chpeercb)(struct dc_fnetpeer *peer);
d1e8b9fd 56 wchar_t *pubid;
8be1b1e3 57};
58
59struct dc_fnetpeerdatum
60{
61 struct dc_fnetpeerdatum *next, *prev;
62 int refcount;
63 int dt;
64 wchar_t *id;
65};
66
67struct dc_fnetpeerdi
68{
69 struct dc_fnetpeerdatum *datum;
70 union
71 {
72 int num;
73 long long lnum;
74 wchar_t *str;
75 } d;
76};
77
78struct dc_fnetpeer
79{
80 struct dc_fnetpeer *next, *prev;
81 struct dc_fnetnode *fn;
82 wchar_t *id;
83 wchar_t *nick;
84 int dinum;
85 int found;
86 struct dc_fnetpeerdi *di;
d3372da9 87};
88
89struct dc_transfer
90{
91 struct dc_transfer *next, *prev;
92 int id;
93 int dir, state;
94 wchar_t *peerid, *peernick;
95 wchar_t *path;
8f623b36 96 dc_lnum_t size, curpos;
d3372da9 97 int found;
98 int error;
99 time_t errortime;
986e8782 100 wchar_t *hash;
d3372da9 101 void (*destroycb)(struct dc_transfer *transfer);
102 void *udata;
103};
104
e4b88cc0 105int dc_convtty(int type, wchar_t *text, char **resp, void *data);
106int dc_convnone(int type, wchar_t *text, char **resp, void *data);
d3372da9 107void dc_loginasync(char *username, int useauthless, int (*conv)(int, wchar_t *, char **, void *), void (*callback)(int, wchar_t *, void *), void *udata);
e4b88cc0 108int dc_login(char *username, int useauthless, int (*conv)(int, wchar_t *, char **, void *), wchar_t **reason);
d3372da9 109struct dc_fnetnode *dc_findfnetnode(int id);
110void dc_getfnlistasync(void (*callback)(int, void *), void *udata);
111void dc_uimisc_handlenotify(struct dc_response *resp);
112struct dc_transfer *dc_findtransfer(int id);
113void dc_gettrlistasync(void (*callback)(int, void *), void *udata);
114wchar_t **dc_lexsexpr(wchar_t *sexpr);
115void dc_freewcsarr(wchar_t **arr);
8be1b1e3 116void dc_getpeerlistasync(struct dc_fnetnode *fn, void (*callback)(struct dc_fnetnode *, int, void *), void *udata);
117struct dc_fnetpeer *dc_fnetfindpeer(struct dc_fnetnode *fn, wchar_t *id);
d3372da9 118
119extern struct dc_fnetnode *dc_fnetnodes;
120extern struct dc_transfer *dc_transfers;
121
122#endif