configure: add stuff for spell checking
[rofl0r-ixchat.git] / src / common / dcc.h
blobff0787a28ac143a280c9d90211102da0bf45b794
1 /* dcc.h */
3 #include <time.h> /* for time_t */
5 #ifndef XCHAT_DCC_H
6 #define XCHAT_DCC_H
8 #define STAT_QUEUED 0
9 #define STAT_ACTIVE 1
10 #define STAT_FAILED 2
11 #define STAT_DONE 3
12 #define STAT_CONNECTING 4
13 #define STAT_ABORTED 5
15 #define TYPE_SEND 0
16 #define TYPE_RECV 1
17 #define TYPE_CHATRECV 2
18 #define TYPE_CHATSEND 3
20 #define CPS_AVG_WINDOW 10
22 /* can we do 64-bit dcc? */
23 #if defined(G_GINT64_FORMAT)
24 #define USE_DCC64
25 /* we really get only 63 bits, since st_size is signed */
26 #define DCC_SIZE gint64
27 #define DCC_SFMT G_GINT64_FORMAT
28 #else
29 #define DCC_SIZE unsigned int
30 #define DCC_SFMT "u"
31 #endif
33 struct DCC
35 struct server *serv;
36 struct dcc_chat *dccchat;
37 struct proxy_state *proxy;
38 guint32 addr; /* the 32bit IP number, host byte order */
39 int fp; /* file pointer */
40 int sok;
41 int iotag; /* reading io tag */
42 int wiotag; /* writing/sending io tag */
43 int port;
44 int pasvid; /* mIRC's passive DCC id */
45 int cps;
46 int resume_error;
47 int resume_errno;
49 GTimeVal lastcpstv, firstcpstv;
50 DCC_SIZE lastcpspos;
51 int maxcps;
53 unsigned char ack_buf[4]; /* buffer for reading 4-byte ack */
54 int ack_pos;
56 DCC_SIZE size;
57 DCC_SIZE resumable;
58 DCC_SIZE ack;
59 DCC_SIZE pos;
60 time_t starttime;
61 time_t offertime;
62 time_t lasttime;
63 char *file; /* utf8 */
64 char *destfile; /* utf8 */
65 char *destfile_fs; /* local filesystem encoding */
66 char *nick;
67 unsigned char type; /* 0 = SEND 1 = RECV 2 = CHAT */
68 unsigned char dccstat; /* 0 = QUEUED 1 = ACTIVE 2 = FAILED 3 = DONE */
69 unsigned int resume_sent:1; /* resume request sent */
70 unsigned int fastsend:1;
71 unsigned int ackoffset:1; /* is reciever sending acks as an offset from */
72 /* the resume point? */
73 unsigned int throttled:2; /* 0x1 = per send/get throttle
74 0x2 = global throttle */
77 #define MAX_PROXY_BUFFER 1024
78 struct proxy_state
80 int phase;
81 unsigned char buffer[MAX_PROXY_BUFFER];
82 int buffersize;
83 int bufferused;
86 struct dcc_chat
88 char linebuf[2048];
89 int pos;
92 struct dccstat_info
94 char *name; /* Display name */
95 int color; /* Display color (index into colors[] ) */
98 extern struct dccstat_info dccstat[];
100 gboolean is_dcc (struct DCC *dcc);
101 void dcc_abort (session *sess, struct DCC *dcc);
102 void dcc_get (struct DCC *dcc);
103 int dcc_resume (struct DCC *dcc);
104 void dcc_check_timeouts (void);
105 void dcc_change_nick (server *serv, char *oldnick, char *newnick);
106 void dcc_notify_kill (struct server *serv);
107 struct DCC *dcc_write_chat (char *nick, char *text);
108 void dcc_send (struct session *sess, char *to, char *file, int maxcps, int passive);
109 struct DCC *find_dcc (char *nick, char *file, int type);
110 void dcc_get_nick (struct session *sess, char *nick);
111 void dcc_chat (session *sess, char *nick, int passive);
112 void handle_dcc (session *sess, char *nick, char *word[], char *word_eol[]);
113 void dcc_show_list (session *sess);
114 guint32 dcc_get_my_address (void);
115 void dcc_get_with_destfile (struct DCC *dcc, char *utf8file);
117 #endif