changeset 241:78fa66a3ba64

- Enabled proxy_user in preferences.
author jcid
date Mon, 26 May 2008 15:10:01 +0200
parents 58ba2d741a85
children 780c94021515
files ChangeLog src/IO/Url.h src/IO/http.c src/dialog.cc src/dialog.hh src/dillo.cc src/uicmd.cc src/uicmd.hh
diffstat 8 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon May 26 14:49:17 2008 +0200
+++ b/ChangeLog	Mon May 26 15:10:01 2008 +0200
@@ -57,7 +57,7 @@
    Patches: Jorge Arellano Cid
 +- Connected signals to <li> elements (fixes links within lists).
  - Enabled text, background-color, panel_size, geometry, fullscreen,
-   start_page, geometry offset and limit_text_width in preferences.
+   start_page, geometry offset, proxy_user and limit_text_width in preferences.
  - Enabled clicking over image links.
  - Improved notification upon leaving links.
  - Implemented image-link URL showing in status bar.
--- a/src/IO/Url.h	Mon May 26 14:49:17 2008 +0200
+++ b/src/IO/Url.h	Mon May 26 15:10:01 2008 +0200
@@ -15,7 +15,7 @@
 extern void a_Http_freeall(void);
 int a_Http_init(void);
 int a_Http_proxy_auth(void);
-void a_Http_set_proxy_passwd(char *str);
+void a_Http_set_proxy_passwd(const char *str);
 Dstr *a_Http_make_query_str(const DilloUrl *url, bool_t use_proxy);
 
 void a_Http_ccc (int Op, int Branch, int Dir, ChainLink *Info,
--- a/src/IO/http.c	Mon May 26 14:49:17 2008 +0200
+++ b/src/IO/http.c	Mon May 26 15:10:01 2008 +0200
@@ -106,7 +106,7 @@
 /*
  * Activate entered proxy password for HTTP.
  */
-void a_Http_set_proxy_passwd(char *str)
+void a_Http_set_proxy_passwd(const char *str)
 {
    char *http_proxyauth = dStrconcat(prefs.http_proxyuser, ":", str, NULL);
    HTTP_Proxy_Auth_base64 = a_Misc_encode_base64(http_proxyauth);
--- a/src/dialog.cc	Mon May 26 14:49:17 2008 +0200
+++ b/src/dialog.cc	Mon May 26 15:10:01 2008 +0200
@@ -65,6 +65,14 @@
 }
 
 /*
+ * Dialog for password
+ */
+const char *a_Dialog_passwd(const char *msg)
+{
+   return password("%s", "", msg);
+}
+
+/*
  * Show the save file dialog.
  *
  * Return: pointer to chosen filename, or NULL on Cancel.
--- a/src/dialog.hh	Mon May 26 14:49:17 2008 +0200
+++ b/src/dialog.hh	Mon May 26 15:10:01 2008 +0200
@@ -12,6 +12,7 @@
                      const char *alt1, const char *alt2, const char *alt3,
                      const char *alt4, const char *alt5);
 const char *a_Dialog_input(const char *msg);
+const char *a_Dialog_passwd(const char *msg);
 const char *a_Dialog_save_file(const char *msg,
                                const char *pattern, const char *fname);
 const char *a_Dialog_select_file(const char *msg,
--- a/src/dillo.cc	Mon May 26 14:49:17 2008 +0200
+++ b/src/dillo.cc	Mon May 26 15:10:01 2008 +0200
@@ -104,6 +104,15 @@
    // Create a new UI/bw pair
    BrowserWindow *bw = a_UIcmd_browser_window_new(0, 0, NULL);
 
+   if (prefs.http_proxyuser && !a_Http_proxy_auth()) {
+      const char *passwd = a_UIcmd_get_passwd(prefs.http_proxyuser);
+      if (passwd) {
+         a_Http_set_proxy_passwd(passwd);
+      } else {
+         MSG_WARN("Not using proxy authentication.\n");
+      }
+   }
+
    if (argc == 2) {
       DilloUrl *url = Dillo_make_start_url(argv[1]);
       a_UIcmd_open_urlstr(bw, URL_STR(url));
--- a/src/uicmd.cc	Mon May 26 14:49:17 2008 +0200
+++ b/src/uicmd.cc	Mon May 26 15:10:01 2008 +0200
@@ -402,6 +402,18 @@
 }
 
 /*
+ * Get password for user
+ */
+const char *a_UIcmd_get_passwd(const char *user)
+{
+   const char *passwd;
+   char *prompt = dStrconcat("Password for user \"", user, "\"", NULL);
+   passwd = a_Dialog_passwd(prompt);
+   dFree(prompt);
+   return passwd;
+}
+
+/*
  * Save link URL
  */
 void a_UIcmd_save_link(BrowserWindow *bw, const DilloUrl *url)
--- a/src/uicmd.hh	Mon May 26 14:49:17 2008 +0200
+++ b/src/uicmd.hh	Mon May 26 15:10:01 2008 +0200
@@ -24,6 +24,7 @@
 void a_UIcmd_open_file(void *vbw);
 const char *a_UIcmd_select_file();
 void a_UIcmd_search_dialog(void *vbw);
+const char *a_UIcmd_get_passwd(const char *user);
 void a_UIcmd_book(void *vbw);
 void a_UIcmd_add_bookmark(BrowserWindow *bw, const DilloUrl *url);
 void a_UIcmd_fullscreen_toggle(BrowserWindow *bw);