2 ** CxClient - Improved Citadel/UX Client
3 ** Copyright (c) 2000, SCCG/Flaming Sword Productions
8 ** Last Revision: 2000-12-14
9 ** Description: Global CxClient library header.
12 #ifndef __CXCLIENT_H__
13 #define __CXCLIENT_H__
15 #define CXREVISION "$Id$"
17 #define RC_LISTING 100 // LISTING_FOLLOWS
18 #define RC_OK 200 // OK
19 #define RC_MOREDATA 300 // MORE_DATA
20 #define RC_SENDLIST 400 // SEND_LISTING
21 #define RC_ERROR 500 // ERROR
22 #define RC_RECVBIN 600 // BINARY_FOLLOWS
23 #define RC_SENDBIN 700 // SEND_BINARY
24 #define RC_STARTCHAT 800 // START_CHAT_MODE
25 #define RC_ASYNCMSG 900 // Asynchronous Message
26 #define RC_AEXPMSG 901 // Express Message Follows
27 #define RC_MESGWAIT 1000 // Message Waiting
30 ** The CHECKRC() macro is used to compare a Result Code 'x' with
31 ** the expected result 'y'.
33 #define CHECKRC(x,y) ((x - (x % y)) == y)
37 #define DFA __FILE__,__LINE__,__FUNCTION__
38 #define DPF(a) CxDebug a
56 ** Reserved for future use. Cit/UX may not
57 ** support this yet....
67 ** Linked-List Structure
69 typedef struct _linked_list {
74 typedef CLIST* CXLIST;
77 struct _message_info {
91 ** struct ROOMINFO: This structure contains all information related
114 ** struct USERINFO: This structure contains all information related
115 ** to a user account.
124 ** USERINFO.addr: Address information.
134 ** USERINFO.contact: Contact information.
142 ** USERINFO.system: System information. Should not be modified.
156 ** struct _Cmd_Callback: This record contains information regarding Server->Client
157 ** message callbacks. The general rule is such: IF the client wishes to handle
158 ** certain types of Server-to-Client traffic [currently unimplemented], the author
159 ** should register a Callback function to handle the command sent by the server.
160 ** The client can register a callback function for a single message type, or for
161 ** a specific data session (like, to handle a file download). Similarly, if a
162 ** client wishes to stop processing a certain type of message, the client can
163 ** deregister the command's callback.
165 ** Any messages received which do not have an attached callback function will be
169 struct _Cmd_Callback {
171 int cmd; // Command sent from server. [9xx]
172 char session[10]; // Optional session id.
173 void (*Function)(void *); // Function to call upon success.
175 struct _Cmd_Callback *next;
178 typedef CXCSCALLBACK* CXCBHNDL;
185 void CxSerialize(const char *, char **);
188 ** Client/Server Communications
190 void CxClRegClient(const char *);
191 int CxClConnect(const char *);
192 void CxClDisconnect();
194 void CxClSend(const char *s);
195 int CxClRecv(char *s);
197 void CxClChatShutdown();
198 int CxClCbRegister(int, void *);
199 void CxClCbShutdown();
200 void CxClCbRemove(int);
201 CXCBHNDL CxClCbExists(int);
207 int CxFiPut(FILEINFO, int);
208 char *CxFiGet(const char *);
211 ** Message Input/Output
213 CXLIST CxMsInfo(CXLIST);
215 int CxMsLoad(const char *, int, MESGINFO *);
216 int CxMsSaveOk(const char *);
217 int CxMsSave(MESGINFO);
220 ** Room/Floor Commands
222 ROOMINFO *CxRmGoto(const char *, int);
225 int CxRmCreate(ROOMINFO);
228 ** Miscellaneous Commands
230 int CxMiExpSend(const char *, const char *);
233 void CxMiExpHook(void (*)(const char *, const char*));
234 char *CxMiMessage(const char *);
235 char *CxMiImage(const char *);
238 ** Linked-List Handlers
240 CXLIST CxLlInsert(CXLIST, char *);
241 CXLIST CxLlRemove(CXLIST, unsigned int);
242 CXLIST CxLlFlush(CXLIST);
245 ** User Info Commands
247 CXLIST CxUsOnline(int);
249 int CxUsCreate(USERINFO);
250 USERINFO *CxUsAuth(const char *, const char *);