2 ** libCxClient - Citadel/UX Extensible Client API
3 ** Copyright (c) 2000, Flaming Sword Productions
4 ** Copyright (c) 2001, The Citadel/UX Consortium
9 ** Last Revision: 2000-11-16
10 ** Description: File directory/transfer functions.
20 static void (*_CxFiFunc)(const char *, void *);
23 ** CxFiIndex(): Retrieve an index of files IN THE
27 ** Success: 1 blank entry + List of files in current room.
28 ** Success, No Files: 1 blank entry
29 ** Failure: NULL list.
36 DPF((DFA,"Retrieving file index."));
39 ** Request directory listing from server.
41 DPF((DFA,"Sending request..."));
46 ** If this room allows directory listings...
48 if(CHECKRC(rc,RC_LISTING)) {
49 DPF((DFA,"LISTING_FOLLOWS..."));
55 flist = CxLlInsert(flist, buf);
58 DPF((DFA,"LISTING_COMPLETE"));
63 ** ...otherwise, there's nothing to see here...
66 DPF((DFA, "No files found"));
72 ** CxFiPut(): Send a file to the server.
75 ** (FILEINFO) f_info: File information
76 ** (int) f_ptr: open() file pointer.
80 ** Failure; Not Here: 1
81 ** Failure; Malformed file information: 2
82 ** Failure; File Exists: 3
83 ** Failure; Nonexistent FILE pointer.
85 int CxFiPut(FILEINFO f_info, int f_ptr) {
90 ** CxFiGet(): Download a file from the server.
93 ** (char *) name: Name of the file we are downloading.
96 ** Success: Ptr to malloc()ed tmp filename containing file data.
99 char *CxFiGet(const char *name) {
103 ** Failed, return NULL.
109 ** _CxFiHook(): We will hook ourselves into the Transport layer to
110 ** handle incoming file transfers.
112 void _CxFiHook(void *data) {
113 DPF((DFA, "Message received"));
117 ** CxFiHook(): The user wishes to provide a hook application to
118 ** handle incoming file transfers.
121 ** func: The function that the user has written to handle file
123 ** void func( const char *FILE_NAME, void *FILE_DATA);
125 void CxFiHook(void *func) {
127 DPF((DFA, "Hooking user func@0x%08x",func));
130 ** If libCxClient has not already hooked this type of
131 ** message, we need to go ahead and hook it to our
132 ** internal routing function.
134 if(!CxClCbExists(902)) {
135 DPF((DFA, "Hooking into RC_902"));
136 CxClCbRegister(902, _CxFiHook);
140 ** Now, register the user's hooked function with
141 ** ourselves. This instructs _CxFiHook() on
142 ** where to route data.
144 DPF((DFA,"Registering user hook"));
147 DPF((DFA,"Ok, at this point, RC_902 messages should be routed to the user."));
148 DPF((DFA,"Don't blame me if it doesn't work. You told me what to do, Brian."));