1
|
1 /*****************************************************************************/
|
33
|
2 /* bookmark.c - functions for connecting to a site via a bookmark */
|
122
|
3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */
|
1
|
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 #include "gftp.h"
|
33
|
21 static const char cvsid[] = "$Id$";
|
1
|
22
|
|
23
|
|
24 static int
|
|
25 bookmark_parse_url (gftp_request * request, const char * url)
|
|
26 {
|
|
27 const char * pos;
|
|
28
|
84
|
29 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
|
|
30 g_return_val_if_fail (url != NULL, GFTP_EFATAL);
|
1
|
31
|
|
32 if ((pos = strstr (url, "://")) != NULL)
|
87
|
33 {
|
|
34 pos += 3;
|
|
35 if (strncmp (url, "bookmark://", 11) != 0)
|
|
36 {
|
186
|
37 request->logging_function (gftp_logging_error, request,
|
87
|
38 _("Invalid URL %s\n"), url);
|
|
39 return (GFTP_EFATAL);
|
|
40 }
|
|
41 }
|
1
|
42 else
|
|
43 pos = url;
|
|
44
|
243
|
45 return (gftp_parse_bookmark (request, NULL, pos));
|
1
|
46 }
|
|
47
|
48
|
48
|
122
|
49 void
|
|
50 bookmark_register_module (void)
|
|
51 {
|
|
52 }
|
|
53
|
|
54
|
173
|
55 int
|
48
|
56 bookmark_init (gftp_request * request)
|
|
57 {
|
173
|
58 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
|
48
|
59
|
|
60 request->protonum = GFTP_BOOKMARK_NUM;
|
|
61 request->init = bookmark_init;
|
168
|
62 request->read_function = NULL;
|
|
63 request->write_function = NULL;
|
48
|
64 request->destroy = NULL;
|
|
65 request->connect = NULL;
|
168
|
66 request->post_connect = NULL;
|
48
|
67 request->disconnect = NULL;
|
|
68 request->get_file = NULL;
|
|
69 request->put_file = NULL;
|
|
70 request->transfer_file = NULL;
|
|
71 request->get_next_file_chunk = NULL;
|
|
72 request->put_next_file_chunk = NULL;
|
|
73 request->end_transfer = NULL;
|
|
74 request->list_files = NULL;
|
|
75 request->get_next_file = NULL;
|
|
76 request->get_file_size = NULL;
|
|
77 request->chdir = NULL;
|
|
78 request->rmdir = NULL;
|
|
79 request->rmfile = NULL;
|
|
80 request->mkdir = NULL;
|
|
81 request->rename = NULL;
|
|
82 request->chmod = NULL;
|
|
83 request->set_file_time = NULL;
|
|
84 request->site = NULL;
|
|
85 request->parse_url = bookmark_parse_url;
|
|
86 request->url_prefix = "bookmark";
|
|
87 request->need_hostport = 0;
|
|
88 request->need_userpass = 0;
|
|
89 request->use_threads = 0;
|
|
90 request->use_cache = 0;
|
|
91 request->always_connected = 0;
|
173
|
92
|
177
|
93 return (gftp_set_config_options (request));
|
48
|
94 }
|
|
95
|