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 | |
40 | struct 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); |
8be1b1e3 |
56 | }; |
57 | |
58 | struct dc_fnetpeerdatum |
59 | { |
60 | struct dc_fnetpeerdatum *next, *prev; |
61 | int refcount; |
62 | int dt; |
63 | wchar_t *id; |
64 | }; |
65 | |
66 | struct dc_fnetpeerdi |
67 | { |
68 | struct dc_fnetpeerdatum *datum; |
69 | union |
70 | { |
71 | int num; |
72 | long long lnum; |
73 | wchar_t *str; |
74 | } d; |
75 | }; |
76 | |
77 | struct dc_fnetpeer |
78 | { |
79 | struct dc_fnetpeer *next, *prev; |
80 | struct dc_fnetnode *fn; |
81 | wchar_t *id; |
82 | wchar_t *nick; |
83 | int dinum; |
84 | int found; |
85 | struct dc_fnetpeerdi *di; |
d3372da9 |
86 | }; |
87 | |
88 | struct dc_transfer |
89 | { |
90 | struct dc_transfer *next, *prev; |
91 | int id; |
92 | int dir, state; |
93 | wchar_t *peerid, *peernick; |
94 | wchar_t *path; |
95 | int size, curpos; |
96 | int found; |
97 | int error; |
98 | time_t errortime; |
986e8782 |
99 | wchar_t *hash; |
d3372da9 |
100 | void (*destroycb)(struct dc_transfer *transfer); |
101 | void *udata; |
102 | }; |
103 | |
104 | void dc_loginasync(char *username, int useauthless, int (*conv)(int, wchar_t *, char **, void *), void (*callback)(int, wchar_t *, void *), void *udata); |
105 | struct dc_fnetnode *dc_findfnetnode(int id); |
106 | void dc_getfnlistasync(void (*callback)(int, void *), void *udata); |
107 | void dc_uimisc_handlenotify(struct dc_response *resp); |
108 | struct dc_transfer *dc_findtransfer(int id); |
109 | void dc_gettrlistasync(void (*callback)(int, void *), void *udata); |
110 | wchar_t **dc_lexsexpr(wchar_t *sexpr); |
111 | void dc_freewcsarr(wchar_t **arr); |
8be1b1e3 |
112 | void dc_getpeerlistasync(struct dc_fnetnode *fn, void (*callback)(struct dc_fnetnode *, int, void *), void *udata); |
113 | struct dc_fnetpeer *dc_fnetfindpeer(struct dc_fnetnode *fn, wchar_t *id); |
d3372da9 |
114 | |
115 | extern struct dc_fnetnode *dc_fnetnodes; |
116 | extern struct dc_transfer *dc_transfers; |
117 | |
118 | #endif |