341
|
1 /*****************************************************************************/
|
|
2 /* gftpui.h - UI related functions for gFTP */
|
|
3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */
|
|
4 /* */
|
|
5 /* This program is free software; you can redistribute it and/or modify */
|
|
6 /* it under the terms of the GNU General Public License as published by */
|
|
7 /* the Free Software Foundation; either version 2 of the License, or */
|
|
8 /* (at your option) any later version. */
|
|
9 /* */
|
|
10 /* This program is distributed in the hope that it will be useful, */
|
|
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
13 /* GNU General Public License for more details. */
|
|
14 /* */
|
|
15 /* You should have received a copy of the GNU General Public License */
|
|
16 /* along with this program; if not, write to the Free Software */
|
|
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
|
|
18 /*****************************************************************************/
|
|
19
|
|
20 /* $Id$ */
|
|
21
|
|
22 #ifndef __GFTPUI_H
|
|
23 #define __GFTPUI_H
|
|
24
|
|
25 #include "../../lib/gftp.h"
|
|
26
|
|
27 typedef struct _gftpui_callback_data gftpui_callback_data;
|
|
28
|
|
29 struct _gftpui_callback_data
|
|
30 {
|
|
31 gftp_request * request;
|
|
32 void *uidata;
|
|
33 char *input_string,
|
|
34 *source_string;
|
355
|
35 GList * files;
|
367
|
36 int retries;
|
341
|
37 int (*run_function) (gftpui_callback_data * cdata);
|
451
|
38 unsigned int dont_check_connection : 1;
|
341
|
39 };
|
|
40
|
|
41
|
|
42 typedef enum _gftpui_common_request_type
|
|
43 {
|
|
44 gftpui_common_request_none,
|
|
45 gftpui_common_request_local,
|
|
46 gftpui_common_request_remote
|
|
47 } gftpui_common_request_type;
|
|
48
|
|
49
|
|
50 typedef struct _gftpui_common_methods
|
|
51 {
|
|
52 char *command;
|
|
53 int minlen;
|
377
|
54 int (*func)(void *uidata, gftp_request * request,
|
|
55 void *other_uidata, gftp_request * other_request,
|
|
56 const char *command);
|
341
|
57 gftpui_common_request_type reqtype;
|
|
58 char *cmd_description;
|
374
|
59 int (*subhelp_func) (const char *topic);
|
341
|
60 } gftpui_common_methods;
|
|
61
|
367
|
62 typedef struct _gftpui_common_curtrans_data
|
|
63 {
|
|
64 gftp_transfer * transfer;
|
|
65 GList * curfle;
|
|
66 } gftpui_common_curtrans_data;
|
|
67
|
341
|
68 #define gftpui_common_use_threads(request) (gftp_protocols[(request)->protonum].use_threads)
|
|
69
|
|
70 #define GFTPUI_COMMON_COLOR_BLACK "\033[30m"
|
|
71 #define GFTPUI_COMMON_COLOR_RED "\033[31m"
|
|
72 #define GFTPUI_COMMON_COLOR_GREEN "\033[32m"
|
|
73 #define GFTPUI_COMMON_COLOR_YELLOW "\033[33m"
|
|
74 #define GFTPUI_COMMON_COLOR_BLUE "\033[34m"
|
|
75 #define GFTPUI_COMMON_COLOR_MAGENTA "\033[35m"
|
|
76 #define GFTPUI_COMMON_COLOR_CYAN "\033[36m"
|
|
77 #define GFTPUI_COMMON_COLOR_WHITE "\033[37m"
|
|
78 #define GFTPUI_COMMON_COLOR_GREY "\033[38m"
|
|
79 #define GFTPUI_COMMON_COLOR_DEFAULT "\033[39m"
|
|
80 #define GFTPUI_COMMON_COLOR_NONE ""
|
|
81
|
|
82 extern sigjmp_buf gftpui_common_jmp_environment;
|
|
83 extern volatile int gftpui_common_use_jmp_environment;
|
|
84 extern gftpui_common_methods gftpui_common_commands[];
|
367
|
85 extern GStaticMutex gftpui_common_transfer_mutex;
|
374
|
86 extern volatile sig_atomic_t gftpui_common_child_process_done;
|
341
|
87
|
|
88 /* gftpui.c */
|
|
89 int gftpui_run_callback_function ( gftpui_callback_data * cdata );
|
|
90
|
|
91 int gftpui_common_run_callback_function ( gftpui_callback_data * cdata );
|
|
92
|
374
|
93 void gftpui_common_init ( int *argc,
|
|
94 char ***argv,
|
|
95 gftp_logging_func logfunc );
|
341
|
96
|
|
97 void gftpui_common_about ( gftp_logging_func logging_function,
|
|
98 gpointer logdata );
|
|
99
|
374
|
100 int gftpui_common_process_command ( void *locui,
|
341
|
101 gftp_request * locreq,
|
|
102 void *remui,
|
374
|
103 gftp_request * remreq,
|
|
104 const char *command );
|
341
|
105
|
367
|
106 int gftpui_common_cmd_open ( void *uidata,
|
|
107 gftp_request * request,
|
377
|
108 void *other_uidata,
|
|
109 gftp_request * other_request,
|
374
|
110 const char *command );
|
367
|
111
|
380
|
112 int gftpui_common_cmd_mget_file ( void *uidata,
|
|
113 gftp_request * request,
|
|
114 void *other_uidata,
|
|
115 gftp_request * other_request,
|
|
116 const char *command );
|
|
117
|
|
118 int gftpui_common_cmd_mput_file ( void *uidata,
|
|
119 gftp_request * request,
|
|
120 void *other_uidata,
|
|
121 gftp_request * other_request,
|
|
122 const char *command );
|
|
123
|
367
|
124 gftp_transfer * gftpui_common_add_file_transfer ( gftp_request * fromreq,
|
|
125 gftp_request * toreq,
|
|
126 void *fromuidata,
|
|
127 void *touidata,
|
|
128 GList * files );
|
|
129
|
|
130 int gftpui_common_transfer_files ( gftp_transfer * tdata );
|
|
131
|
341
|
132 /* gftpuicallback.c */
|
|
133 int gftpui_common_run_mkdir ( gftpui_callback_data * cdata );
|
|
134
|
|
135 int gftpui_common_run_rename ( gftpui_callback_data * cdata );
|
|
136
|
|
137 int gftpui_common_run_site ( gftpui_callback_data * cdata );
|
|
138
|
|
139 int gftpui_common_run_chdir ( gftpui_callback_data * cdata );
|
|
140
|
350
|
141 int gftpui_common_run_chmod ( gftpui_callback_data * cdata );
|
|
142
|
355
|
143 int gftpui_common_run_ls ( gftpui_callback_data * cdata );
|
|
144
|
350
|
145 int gftpui_common_run_delete ( gftpui_callback_data * cdata );
|
|
146
|
|
147 int gftpui_common_run_rmdir ( gftpui_callback_data * cdata );
|
|
148
|
367
|
149 int gftpui_common_run_connect ( gftpui_callback_data * cdata );
|
|
150
|
341
|
151 /* UI Functions that must be implemented by each distinct UI */
|
|
152 void gftpui_lookup_file_colors ( gftp_file * fle,
|
|
153 char **start_color,
|
|
154 char ** end_color );
|
|
155
|
|
156 int gftpui_check_reconnect ( gftpui_callback_data * cdata );
|
|
157
|
|
158 void gftpui_refresh ( void *uidata );
|
|
159
|
|
160 void *gftpui_generic_thread ( void *(*run_function)(void *data),
|
|
161 void *data);
|
|
162
|
380
|
163 void gftpui_prompt_username ( void *uidata,
|
356
|
164 gftp_request * request );
|
|
165
|
380
|
166 void gftpui_prompt_password ( void *uidata,
|
356
|
167 gftp_request * request );
|
|
168
|
367
|
169 void gftpui_add_file_to_transfer ( gftp_transfer * tdata,
|
397
|
170 GList * curfle );
|
367
|
171
|
|
172 void gftpui_ask_transfer ( gftp_transfer * tdata );
|
|
173
|
377
|
174 void gftpui_start_current_file_in_transfer ( gftp_transfer * tdata );
|
|
175
|
|
176 void gftpui_update_current_file_in_transfer ( gftp_transfer * tdata );
|
|
177
|
|
178 void gftpui_finish_current_file_in_transfer ( gftp_transfer * tdata );
|
|
179
|
|
180 void gftpui_start_transfer ( gftp_transfer * tdata );
|
|
181
|
380
|
182 void gftpui_disconnect ( void *uidata );
|
|
183
|
|
184
|
341
|
185 #endif
|