| 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 | |
| 21 | #define DC_FNPD_INT 0 |
| 22 | #define DC_FNPD_LL 1 |
| 23 | #define DC_FNPD_STR 2 |
| 24 | |
| 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; |
| 51 | struct dc_fnetpeer *peers; |
| 52 | struct dc_fnetpeerdatum *peerdata; |
| 53 | void (*newpeercb)(struct dc_fnetpeer *peer); |
| 54 | void (*delpeercb)(struct dc_fnetpeer *peer); |
| 55 | void (*chpeercb)(struct dc_fnetpeer *peer); |
| 56 | wchar_t *pubid; |
| 57 | }; |
| 58 | |
| 59 | struct dc_fnetpeerdatum |
| 60 | { |
| 61 | struct dc_fnetpeerdatum *next, *prev; |
| 62 | int refcount; |
| 63 | int dt; |
| 64 | wchar_t *id; |
| 65 | }; |
| 66 | |
| 67 | struct 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 | |
| 78 | struct 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; |
| 87 | }; |
| 88 | |
| 89 | struct 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; |
| 96 | int size, curpos; |
| 97 | int found; |
| 98 | int error; |
| 99 | time_t errortime; |
| 100 | wchar_t *hash; |
| 101 | void (*destroycb)(struct dc_transfer *transfer); |
| 102 | void *udata; |
| 103 | }; |
| 104 | |
| 105 | int dc_convtty(int type, wchar_t *text, char **resp, void *data); |
| 106 | int dc_convnone(int type, wchar_t *text, char **resp, void *data); |
| 107 | void dc_loginasync(char *username, int useauthless, int (*conv)(int, wchar_t *, char **, void *), void (*callback)(int, wchar_t *, void *), void *udata); |
| 108 | int dc_login(char *username, int useauthless, int (*conv)(int, wchar_t *, char **, void *), wchar_t **reason); |
| 109 | struct dc_fnetnode *dc_findfnetnode(int id); |
| 110 | void dc_getfnlistasync(void (*callback)(int, void *), void *udata); |
| 111 | void dc_uimisc_handlenotify(struct dc_response *resp); |
| 112 | struct dc_transfer *dc_findtransfer(int id); |
| 113 | void dc_gettrlistasync(void (*callback)(int, void *), void *udata); |
| 114 | wchar_t **dc_lexsexpr(wchar_t *sexpr); |
| 115 | void dc_freewcsarr(wchar_t **arr); |
| 116 | void dc_getpeerlistasync(struct dc_fnetnode *fn, void (*callback)(struct dc_fnetnode *, int, void *), void *udata); |
| 117 | struct dc_fnetpeer *dc_fnetfindpeer(struct dc_fnetnode *fn, wchar_t *id); |
| 118 | |
| 119 | extern struct dc_fnetnode *dc_fnetnodes; |
| 120 | extern struct dc_transfer *dc_transfers; |
| 121 | |
| 122 | #endif |