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);
|
|
38 };
|
|
39
|
|
40
|
|
41 typedef enum _gftpui_common_request_type
|
|
42 {
|
|
43 gftpui_common_request_none,
|
|
44 gftpui_common_request_local,
|
|
45 gftpui_common_request_remote
|
|
46 } gftpui_common_request_type;
|
|
47
|
|
48
|
|
49 typedef struct _gftpui_common_methods
|
|
50 {
|
|
51 char *command;
|
|
52 int minlen;
|
|
53 int (*func)(void *uidata, gftp_request * request, char *command);
|
|
54 gftpui_common_request_type reqtype;
|
|
55 char *cmd_description;
|
|
56 int (*subhelp_func) (char *topic);
|
|
57 } gftpui_common_methods;
|
|
58
|
367
|
59 typedef struct _gftpui_common_curtrans_data
|
|
60 {
|
|
61 gftp_transfer * transfer;
|
|
62 GList * curfle;
|
|
63 } gftpui_common_curtrans_data;
|
|
64
|
341
|
65 #define gftpui_common_use_threads(request) (gftp_protocols[(request)->protonum].use_threads)
|
|
66
|
|
67 #define GFTPUI_COMMON_COLOR_BLACK "\033[30m"
|
|
68 #define GFTPUI_COMMON_COLOR_RED "\033[31m"
|
|
69 #define GFTPUI_COMMON_COLOR_GREEN "\033[32m"
|
|
70 #define GFTPUI_COMMON_COLOR_YELLOW "\033[33m"
|
|
71 #define GFTPUI_COMMON_COLOR_BLUE "\033[34m"
|
|
72 #define GFTPUI_COMMON_COLOR_MAGENTA "\033[35m"
|
|
73 #define GFTPUI_COMMON_COLOR_CYAN "\033[36m"
|
|
74 #define GFTPUI_COMMON_COLOR_WHITE "\033[37m"
|
|
75 #define GFTPUI_COMMON_COLOR_GREY "\033[38m"
|
|
76 #define GFTPUI_COMMON_COLOR_DEFAULT "\033[39m"
|
|
77 #define GFTPUI_COMMON_COLOR_NONE ""
|
|
78
|
|
79 extern sigjmp_buf gftpui_common_jmp_environment;
|
|
80 extern volatile int gftpui_common_use_jmp_environment;
|
|
81 extern gftpui_common_methods gftpui_common_commands[];
|
367
|
82 extern GStaticMutex gftpui_common_transfer_mutex;
|
341
|
83
|
|
84 /* gftpui.c */
|
|
85 int gftpui_run_callback_function ( gftpui_callback_data * cdata );
|
|
86
|
|
87 int gftpui_common_run_callback_function ( gftpui_callback_data * cdata );
|
|
88
|
|
89 RETSIGTYPE gftpui_common_signal_handler ( int signo );
|
|
90
|
|
91 void gftpui_common_about ( gftp_logging_func logging_function,
|
|
92 gpointer logdata );
|
|
93
|
|
94 int gftpui_common_init ( void *locui,
|
|
95 gftp_request * locreq,
|
|
96 void *remui,
|
|
97 gftp_request * remreq );
|
|
98
|
|
99 int gftpui_common_process_command ( const char *command );
|
|
100
|
367
|
101 int gftpui_common_cmd_open ( void *uidata,
|
|
102 gftp_request * request,
|
|
103 char *command );
|
|
104
|
|
105 gftp_transfer * gftpui_common_add_file_transfer ( gftp_request * fromreq,
|
|
106 gftp_request * toreq,
|
|
107 void *fromuidata,
|
|
108 void *touidata,
|
|
109 GList * files );
|
|
110
|
|
111 int gftpui_common_transfer_files ( gftp_transfer * tdata );
|
|
112
|
341
|
113 /* gftpuicallback.c */
|
|
114 int gftpui_common_run_mkdir ( gftpui_callback_data * cdata );
|
|
115
|
|
116 int gftpui_common_run_rename ( gftpui_callback_data * cdata );
|
|
117
|
|
118 int gftpui_common_run_site ( gftpui_callback_data * cdata );
|
|
119
|
|
120 int gftpui_common_run_chdir ( gftpui_callback_data * cdata );
|
|
121
|
350
|
122 int gftpui_common_run_chmod ( gftpui_callback_data * cdata );
|
|
123
|
355
|
124 int gftpui_common_run_ls ( gftpui_callback_data * cdata );
|
|
125
|
350
|
126 int gftpui_common_run_delete ( gftpui_callback_data * cdata );
|
|
127
|
|
128 int gftpui_common_run_rmdir ( gftpui_callback_data * cdata );
|
|
129
|
367
|
130 int gftpui_common_run_connect ( gftpui_callback_data * cdata );
|
|
131
|
341
|
132 /* UI Functions that must be implemented by each distinct UI */
|
|
133 void gftpui_lookup_file_colors ( gftp_file * fle,
|
|
134 char **start_color,
|
|
135 char ** end_color );
|
|
136
|
|
137 int gftpui_check_reconnect ( gftpui_callback_data * cdata );
|
|
138
|
|
139 void gftpui_refresh ( void *uidata );
|
|
140
|
|
141 void *gftpui_generic_thread ( void *(*run_function)(void *data),
|
|
142 void *data);
|
|
143
|
356
|
144 char *gftpui_prompt_username ( void *uidata,
|
|
145 gftp_request * request );
|
|
146
|
|
147 char *gftpui_prompt_password ( void *uidata,
|
|
148 gftp_request * request );
|
|
149
|
367
|
150 void gftpui_add_file_to_transfer ( gftp_transfer * tdata,
|
|
151 GList * curfle,
|
|
152 char *filepos );
|
|
153
|
|
154 void gftpui_ask_transfer ( gftp_transfer * tdata );
|
|
155
|
341
|
156 #endif
|