comparison src/uicommon/gftpui.c @ 356:7cb3327f96f7

2003-1-5 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/misc.c src/gtk/gftpui.c - added GFTP_URL_USAGE that is the sytax for a valid URL. * lib/protocols.c (gftp_set_password) - allow the password to be NULL * src/gtk/gtkui.c src/text/textui.c src/uicommon/gftpui.h - added gftpui_prompt_username() and gftpui_promot_password() to each UI * src/text/gftp-text.c (gftp_text_ask_question) - don't display a : at the end of the question here. * src/text/gftp-text.h - added declaration of gftp_text_ask_question() * src/uicommon/gftpui.c - added gftpui_common_cmd_open(). This still needs a little bit more work done to it.
author masneyb
date Tue, 06 Jan 2004 02:42:30 +0000
parents 60d3da6ab336
children d5409bf03ff1
comparison
equal deleted inserted replaced
355:60d3da6ab336 356:7cb3327f96f7
538 538
539 539
540 if (cdata->files != NULL) 540 if (cdata->files != NULL)
541 g_list_free (cdata->files); 541 g_list_free (cdata->files);
542 g_free (cdata); 542 g_free (cdata);
543
544 return (1);
545 }
546
547
548 static int
549 gftpui_common_cmd_open (void *uidata, gftp_request * request, char *command)
550 {
551 char *tempstr;
552
553 if (GFTP_IS_CONNECTED (request))
554 {
555 gftp_disconnect (request); /* FIXME */
556 }
557
558 if (*command == '\0')
559 {
560 request->logging_function (gftp_logging_error, request,
561 _("usage: open " GFTP_URL_USAGE "\n"));
562 return (1);
563 }
564
565 if (gftp_parse_url (request, command) < 0)
566 return (1);
567
568 if (request->need_userpass)
569 {
570 if (request->username == NULL || *request->username == '\0')
571 {
572 if ((tempstr = gftpui_prompt_username (uidata, request)) != NULL)
573 {
574 gftp_set_username (request, tempstr);
575 gftp_set_password (request, NULL);
576 g_free (tempstr);
577 }
578 }
579
580 if (request->username != NULL &&
581 strcmp (request->username, "anonymous") != 0 &&
582 (request->password == NULL || *request->password == '\0'))
583 {
584 if ((tempstr = gftpui_prompt_password (uidata, request)) != NULL)
585 {
586 gftp_set_password (request, tempstr);
587 g_free (tempstr);
588 }
589 }
590 }
591
592 /* FIXME gftp_connect (request); */
543 593
544 return (1); 594 return (1);
545 } 595 }
546 596
547 597
747 {N_("mkdir"), 2, gftpui_common_cmd_mkdir, gftpui_common_request_remote, 797 {N_("mkdir"), 2, gftpui_common_cmd_mkdir, gftpui_common_request_remote,
748 N_("Creates a remote directory"), NULL}, 798 N_("Creates a remote directory"), NULL},
749 /* FIXME 799 /* FIXME
750 {N_("mput"), 2, gftp_text_mput_file, gftpui_common_request_none, 800 {N_("mput"), 2, gftp_text_mput_file, gftpui_common_request_none,
751 N_("Uploads local file(s)"), NULL}, 801 N_("Uploads local file(s)"), NULL},
752 {N_("open"), 1, gftp_text_open, gftpui_common_request_remote, 802 */
803 {N_("open"), 1, gftpui_common_cmd_open, gftpui_common_request_remote,
753 N_("Opens a connection to a remote site"), NULL}, 804 N_("Opens a connection to a remote site"), NULL},
805 /* FIXME
754 {N_("put"), 2, gftp_text_mput_file, gftpui_common_request_none, 806 {N_("put"), 2, gftp_text_mput_file, gftpui_common_request_none,
755 N_("Uploads local file(s)"), NULL}, 807 N_("Uploads local file(s)"), NULL},
756 */ 808 */
757 {N_("pwd"), 2, gftpui_common_cmd_pwd, gftpui_common_request_remote, 809 {N_("pwd"), 2, gftpui_common_cmd_pwd, gftpui_common_request_remote,
758 N_("Show current remote directory"), NULL}, 810 N_("Show current remote directory"), NULL},