[pan2] option to enable/disable gkr in prefs



commit ec96cd28fbbd522e8fa5b3a09e47d30b7fb75520
Author: Heinrich MÃlller <henmull src gnome org>
Date:   Sat May 26 09:37:43 2012 +0200

    option to enable/disable gkr in prefs

 pan/data-impl/Makefile.am   |    4 +-
 pan/data-impl/add-server.cc |    2 +-
 pan/data-impl/data-impl.cc  |    3 +-
 pan/data-impl/data-impl.h   |   12 +++++++---
 pan/data-impl/server.cc     |   48 ++++++++++++++++++++++++++++--------------
 pan/data/data.h             |    6 +++-
 pan/data/server-info.h      |    6 +++-
 pan/gui/gui.cc              |    4 +-
 pan/gui/pan.cc              |    6 ++--
 pan/gui/prefs-ui.cc         |   11 ++++++++-
 pan/gui/server-ui.cc        |   30 ++++++++++++++------------
 pan/gui/server-ui.h         |    6 ++--
 pan/tasks/Makefile.am       |    2 +-
 pan/tasks/nntp-pool.cc      |    4 ++-
 pan/tasks/nntp-pool.h       |    4 ++-
 pan/tasks/queue.cc          |    4 ++-
 pan/tasks/queue.h           |    4 ++-
 uulib/uunconc.c             |    2 +-
 18 files changed, 100 insertions(+), 58 deletions(-)
---
diff --git a/pan/data-impl/Makefile.am b/pan/data-impl/Makefile.am
index 3fa7af6..b038814 100644
--- a/pan/data-impl/Makefile.am
+++ b/pan/data-impl/Makefile.am
@@ -1,7 +1,7 @@
 AM_CPPFLAGS = -I top_srcdir@ @GMIME_CFLAGS@ @GLIB_CFLAGS@ @GNUTLS_CFLAGS@ \
-						@LIBGNOME_KEYRING_1_CFLAGS@
+						@LIBGNOME_KEYRING_1_CFLAGS@ @GTK_CFLAGS@
 
-AM_LDFLAGS = @LIBGNOME_KEYRING_1_LIBS@
+AM_LDFLAGS = @LIBGNOME_KEYRING_1_LIBS@ @GTK_LIBS@
 
 noinst_LIBRARIES = libpandata.a
 
diff --git a/pan/data-impl/add-server.cc b/pan/data-impl/add-server.cc
index 38f973b..92d8797 100644
--- a/pan/data-impl/add-server.cc
+++ b/pan/data-impl/add-server.cc
@@ -55,7 +55,7 @@ int main (int argc, char *argv[])
   if (have_password) password = argv[4];
   if (have_username || have_password) {
     std::cerr << "Username [" << username << "], password [" << password << "]\n";
-    data.set_server_auth (servername, username, password.str);
+    data.set_server_auth (servername, username, password.str, false);
   }
 
   // initialize the queue
diff --git a/pan/data-impl/data-impl.cc b/pan/data-impl/data-impl.cc
index ca2fc1b..e204f5c 100644
--- a/pan/data-impl/data-impl.cc
+++ b/pan/data-impl/data-impl.cc
@@ -67,13 +67,14 @@ namespace
 
 }
 
-DataImpl :: DataImpl (const StringView& cache_ext, bool unit_test, int cache_megs, DataIO * io):
+DataImpl :: DataImpl (const StringView& cache_ext, Prefs& prefs, bool unit_test, int cache_megs, DataIO * io):
   ProfilesImpl (*io),
   _cache (get_cache_path(), cache_ext, cache_megs),
   _encode_cache (get_encode_cache_path(), cache_megs),
   _certstore(*this),
   _unit_test (unit_test),
   _data_io (io),
+  _prefs (prefs),
   _descriptions_loaded (false),
   newsrc_autosave_id (0),
   newsrc_autosave_timeout (0)
diff --git a/pan/data-impl/data-impl.h b/pan/data-impl/data-impl.h
index cfe9d1e..5859bd6 100644
--- a/pan/data-impl/data-impl.h
+++ b/pan/data-impl/data-impl.h
@@ -44,6 +44,7 @@
 #include <pan/data-impl/rules-filter.h>
 #include <pan/data-impl/profiles.h>
 #include <pan/data-impl/memchunk.h>
+#include <pan/gui/prefs.h>
 
 #ifdef HAVE_GNUTLS
   #include <pan/data/cert-store.h>
@@ -74,7 +75,7 @@ namespace pan
     **/
 
     public:
-      DataImpl (const StringView& cache_ext, bool unit_test=false, int cache_megs=10, DataIO * source=new DataIO());
+      DataImpl (const StringView& cache_ext, Prefs& prefs, bool unit_test=false, int cache_megs=10, DataIO * source=new DataIO());
       virtual ~DataImpl ();
       virtual void save_state ();
 
@@ -103,6 +104,7 @@ namespace pan
       void rebuild_backend ();
       const bool _unit_test;
       DataIO * _data_io;
+      Prefs& _prefs;
 
     /**
     *** SERVERS
@@ -112,7 +114,7 @@ namespace pan
 
       void load_server_properties (const DataIO&);
 
-      void save_server_properties (DataIO&);
+      void save_server_properties (DataIO&, Prefs&);
 
       typedef Loki::AssocVector<Quark,Server> servers_t;
 
@@ -132,7 +134,8 @@ namespace pan
 
       virtual void set_server_auth (const Quark       & server,
                                     const StringView  & username,
-                                    gchar             *&password);
+                                    gchar             *&password,
+                                    bool                use_gkr);
 
       virtual void set_server_trust (const Quark      & servername,
                                      int                setme);
@@ -166,7 +169,8 @@ namespace pan
 
       virtual bool get_server_auth (const Quark   & server,
                                     std::string   & setme_username,
-                                    gchar         *&setme_password);
+                                    gchar         *&setme_password,
+                                    bool            use_gkr);
 
       virtual bool get_server_trust (const Quark  & servername, int&) const;
 
diff --git a/pan/data-impl/server.cc b/pan/data-impl/server.cc
index 39fc479..f58b9c0 100644
--- a/pan/data-impl/server.cc
+++ b/pan/data-impl/server.cc
@@ -51,7 +51,7 @@ DataImpl :: delete_server (const Quark& server_in)
   {
     const std::string newsrc_filename (_servers[server].newsrc_filename);
     _servers.erase (server);
-    save_server_properties (*_data_io);
+    save_server_properties (*_data_io, _prefs);
     std::remove (newsrc_filename.c_str());
     rebuild_backend ();
   }
@@ -121,7 +121,8 @@ DataImpl :: set_server_article_expiration_age  (const Quark  & server,
 void
 DataImpl :: set_server_auth (const Quark       & server,
                              const StringView  & username,
-                             gchar             *&password)
+                             gchar             *&password,
+                             bool                use_gkr)
 {
   Server * s (find_server (server));
   assert (s);
@@ -130,11 +131,18 @@ DataImpl :: set_server_auth (const Quark       & server,
 #ifndef HAVE_GKR
   s->password = password;
 #else
-  PasswordData pw;
-  pw.server = s->host;
-  pw.user = username;
-  pw.pw = password;
-  password_encrypt(pw);
+  if (use_gkr)
+  {
+    PasswordData pw;
+    pw.server = s->host;
+    pw.user = username;
+    pw.pw = password;
+    password_encrypt(pw);
+  }
+  else
+  {
+    s->password = password;
+  }
 #endif
 
 }
@@ -207,7 +215,7 @@ DataImpl :: save_server_info (const Quark& server)
 {
   Server * s (find_server (server));
   assert (s);
-  save_server_properties (*_data_io);
+  save_server_properties (*_data_io, _prefs);
 
 }
 
@@ -215,16 +223,21 @@ DataImpl :: save_server_info (const Quark& server)
 bool
 DataImpl :: get_server_auth (const Quark   & server,
                              std::string   & setme_username,
-                             gchar         *&setme_password)
+                             gchar         *&setme_password,
+                             bool            use_gkr)
 {
   Server * s (find_server (server));
   bool found (s);
   if (found) {
     setme_username = s->username;
 #ifndef HAVE_GKR
-    setme_password = (gchar*)s->password.c_str();
+      setme_password = (gchar*)s->password.c_str();
 #else
-    if (s->gkr_pw)
+    if (!use_gkr)
+    {
+      setme_password = (gchar*)s->password.c_str();
+    }
+    else if (s->gkr_pw)
     {
       setme_password = s->gkr_pw;
     }
@@ -491,7 +504,7 @@ namespace
 }
 
 void
-DataImpl :: save_server_properties (DataIO& data_io)
+DataImpl :: save_server_properties (DataIO& data_io, Prefs& prefs)
 {
   int depth (0);
   std::ostream * out = data_io.write_server_properties ();
@@ -510,15 +523,18 @@ DataImpl :: save_server_properties (DataIO& data_io)
     const Server* s (find_server (*it));
     std::string user;
     gchar* pass(NULL);
-    get_server_auth(*it, user, pass);
+    get_server_auth(*it, user, pass, prefs.get_flag("use-gnome-keyring",false));
     *out << indent(depth++) << "<server id=\"" << escaped(it->to_string()) << "\">\n";
     *out << indent(depth) << "<host>" << escaped(s->host) << "</host>\n"
          << indent(depth) << "<port>" << s->port << "</port>\n"
-         << indent(depth) << "<username>" << escaped(user) << "</username>\n"
+         << indent(depth) << "<username>" << escaped(user) << "</username>\n";
 #ifdef HAVE_GKR
-         << indent(depth) << "<password>" << "HANDLED_BY_GNOME_KEYRING" << "</password>\n"
+if (prefs.get_flag("use-gnome-keyring", false))
+    *out << indent(depth) << "<password>" << "HANDLED_BY_GNOME_KEYRING" << "</password>\n";
+else
+    *out << indent(depth) << "<password>" << escaped(pass) << "</password>\n"
 #else
-         << indent(depth) << "<password>" << escaped(pass) << "</password>\n"
+    *out << indent(depth) << "<password>" << escaped(pass) << "</password>\n"
 #endif
          << indent(depth) << "<expire-articles-n-days-old>" << s->article_expiration_age << "</expire-articles-n-days-old>\n"
          << indent(depth) << "<connection-limit>" << s->max_connections << "</connection-limit>\n"
diff --git a/pan/data/data.h b/pan/data/data.h
index fe3fdb4..e76a26a 100644
--- a/pan/data/data.h
+++ b/pan/data/data.h
@@ -244,7 +244,8 @@ namespace pan
 
       virtual void set_server_auth (const Quark       & server,
                                     const StringView  & username,
-                                    gchar             *&password) = 0;
+                                    gchar             *&password,
+                                    bool                use_gkr) = 0;
 
       virtual void set_server_trust (const Quark      & servername,
                                      const int          setme) = 0;
@@ -262,7 +263,8 @@ namespace pan
 
       virtual bool get_server_auth (const Quark   & server,
                                     std::string   & setme_username,
-                                    gchar         *& setme_password) = 0;
+                                    gchar         *& setme_password,
+                                    bool            use_gkr) = 0;
 
       virtual bool get_server_trust (const Quark  & servername, int&) const = 0;
 
diff --git a/pan/data/server-info.h b/pan/data/server-info.h
index 9930d4a..7f4f6a9 100644
--- a/pan/data/server-info.h
+++ b/pan/data/server-info.h
@@ -46,7 +46,8 @@ namespace pan
 
       virtual void set_server_auth (const Quark       & servername,
                                     const StringView  & username,
-                                    gchar             *&password) = 0;
+                                    gchar             *&password,
+                                    bool                use_gkr) = 0;
 
       virtual void set_server_trust (const Quark       & servername,
                                      const int           setme) = 0;
@@ -75,7 +76,8 @@ namespace pan
 
       virtual bool get_server_auth (const Quark   & servername,
                                     std::string   & setme_username,
-                                    gchar         *&setme_password) = 0;
+                                    gchar         *&setme_password,
+                                    bool            use_gkr) = 0;
 
       virtual bool get_server_trust (const Quark  & servername, int&) const = 0;
 
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index c39c753..737ae4a 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -1092,7 +1092,7 @@ void GUI :: prefs_dialog_destroyed (GtkWidget *)
 
 void GUI :: do_show_servers_dialog ()
 {
-  GtkWidget * w = server_list_dialog_new (_data, _queue, get_window(_root));
+  GtkWidget * w = server_list_dialog_new (_data, _queue, _prefs, get_window(_root));
   gtk_widget_show_all (w);
   g_signal_connect (w, "destroy", G_CALLBACK(server_list_dialog_destroyed_cb), this);
 }
@@ -1101,7 +1101,7 @@ void GUI :: do_show_servers_dialog ()
 void GUI :: do_show_sec_dialog ()
 {
 #ifdef HAVE_GNUTLS
-  GtkWidget * w = sec_dialog_new (_data, _queue, get_window(_root));
+  GtkWidget * w = sec_dialog_new (_data, _queue, _prefs, get_window(_root));
   g_signal_connect (w, "destroy", G_CALLBACK(sec_dialog_destroyed_cb), this);
   gtk_widget_show_all (w);
 #endif
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index 9f20a89..0c39e64 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -516,7 +516,7 @@ namespace
     if (servers.empty())
     {
       const Quark empty_server;
-      GtkWidget * w = server_edit_dialog_new (data, queue, window, empty_server);
+      GtkWidget * w = server_edit_dialog_new (data, queue, prefs, window, empty_server);
       gtk_widget_show_all (w);
       GtkWidget * msg = gtk_message_dialog_new (GTK_WINDOW(w),
                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -898,7 +898,7 @@ main (int argc, char *argv[])
 
     // instantiate the backend...
     const int cache_megs = prefs.get_int ("cache-size-megs", 10);
-    DataImpl data (prefs.get_string("cache-file-extension","msg"), false, cache_megs);
+    DataImpl data (prefs.get_string("cache-file-extension","msg"), prefs, false, cache_megs);
     ArticleCache& cache (data.get_cache ());
     EncodeCache& encode_cache (data.get_encode_cache());
     CertStore& certstore (data.get_certstore());
@@ -912,7 +912,7 @@ main (int argc, char *argv[])
     // instantiate the queue...
     WorkerPool worker_pool (4, true);
     SocketCreator socket_creator(data, certstore);
-    Queue queue (data, data, &socket_creator, certstore, worker_pool, false, 32768);
+    Queue queue (data, data, &socket_creator, certstore, prefs, worker_pool, false, 32768);
     data.set_queue (&queue);
 
 #ifdef HAVE_DBUS
diff --git a/pan/gui/prefs-ui.cc b/pan/gui/prefs-ui.cc
index a09ab1d..b160d24 100644
--- a/pan/gui/prefs-ui.cc
+++ b/pan/gui/prefs-ui.cc
@@ -1022,6 +1022,12 @@ PrefsDialog :: PrefsDialog (Prefs& prefs, GtkWindow* parent):
     gtk_label_set_mnemonic_widget(GTK_LABEL(l), w);
     HIG::workarea_add_row (t, &row, l, w);
 
+    // Gnome Keyring Option
+    HIG :: workarea_add_section_spacer (t, row, 2);
+    HIG :: workarea_add_section_title (t, &row, _("Gnome Keyring Options"));
+    w = new_check_button (_("Store Passwords in Gnome Keyring"), "use-gnome-keyring", false, prefs);
+    HIG :: workarea_add_wide_control (t, &row, w);
+
   HIG :: workarea_finish (t, &row);
   gtk_notebook_append_page (GTK_NOTEBOOK(notebook), t, new_label_with_icon(_("_Miscellaneous"), _("Miscellaneous"), icon_prefs_extras, prefs));
 
@@ -1119,9 +1125,10 @@ PrefsDialog :: PrefsDialog (Prefs& prefs, GtkWindow* parent):
   // Colors
   GdkColor def_color, def_color_bg;
   GtkStyle *style = gtk_rc_get_style(dialog);
-  if(!gtk_style_lookup_color(style, "text_color", &def_color))
+
+  if(!style || !gtk_style_lookup_color(style, "text_color", &def_color))
     gdk_color_parse("black", &def_color);
-  if(!gtk_style_lookup_color(style, "bg_color", &def_color_bg))
+  if(!style || !gtk_style_lookup_color(style, "bg_color", &def_color_bg))
     gdk_color_parse("white", &def_color_bg);
 
   std::string def_color_str (GroupPrefs::color_to_string(def_color));
diff --git a/pan/gui/server-ui.cc b/pan/gui/server-ui.cc
index 535edcb..9eb7ff9 100644
--- a/pan/gui/server-ui.cc
+++ b/pan/gui/server-ui.cc
@@ -56,6 +56,7 @@ namespace
   {
     Data& data;
     Queue& queue;
+    Prefs& prefs;
     Quark server;
     StringView cert;
     GtkWidget * dialog;
@@ -68,7 +69,7 @@ namespace
     GtkWidget * rank_combo;
     GtkWidget * ssl_combo;
     GtkWidget * always_trust_checkbox;
-    ServerEditDialog (Data& d, Queue& q): data(d), queue(q) {}
+    ServerEditDialog (Data& d, Queue& q, Prefs& p): data(d), queue(q), prefs(p) {}
   };
 
   void pan_entry_set_text (GtkWidget * w, const StringView& v)
@@ -107,7 +108,7 @@ namespace
   }
 
   void
-  edit_dialog_populate (Data&, const Quark& server, ServerEditDialog * d)
+  edit_dialog_populate (Data&, Prefs& prefs, const Quark& server, ServerEditDialog * d)
   {
     // sanity clause
     g_return_if_fail (d!=0);
@@ -120,7 +121,7 @@ namespace
     gchar* pass(NULL);
     if (!server.empty()) {
       d->data.get_server_addr (server, addr, port);
-      d->data.get_server_auth (server, user, pass);
+      d->data.get_server_auth (server, user, pass, prefs.get_flag("use-gnome-keyring",false));
       age = d->data.get_server_article_expiration_age (server);
       rank = d->data.get_server_rank (server);
       max_conn = d->data.get_server_limits (server);
@@ -237,7 +238,7 @@ namespace
         if (d->server.empty())
           d->server = d->data.add_new_server ();
         d->data.set_server_addr (d->server, addr, port);
-        d->data.set_server_auth (d->server, user, pass);
+        d->data.set_server_auth (d->server, user, pass, d->prefs.get_flag("use-gnome-keyring",false));
         d->data.set_server_limits (d->server, max_conn);
         d->data.set_server_article_expiration_age (d->server, age);
         d->data.set_server_rank (d->server, rank);
@@ -287,9 +288,9 @@ pan :: import_sec_from_disk_dialog_new (Data& data, Queue& queue, GtkWindow * wi
 }
 
 GtkWidget*
-pan :: server_edit_dialog_new (Data& data, Queue& queue, GtkWindow * window, const Quark& server)
+pan :: server_edit_dialog_new (Data& data, Queue& queue, Prefs& prefs, GtkWindow * window, const Quark& server)
 {
-  ServerEditDialog * d (new ServerEditDialog (data, queue));
+  ServerEditDialog * d (new ServerEditDialog (data, queue, prefs));
 
   // create the dialog
   char * title = g_strdup_printf ("Pan: %s", server.empty() ? _("Add a Server") : _("Edit a Server's Settings"));
@@ -436,7 +437,7 @@ pan :: server_edit_dialog_new (Data& data, Queue& queue, GtkWindow * window, con
 #endif
 
   d->server = server;
-  edit_dialog_populate (data, server, d);
+  edit_dialog_populate (data, prefs, server, d);
   gtk_widget_show_all (d->dialog);
   return d->dialog;
 }
@@ -478,12 +479,13 @@ namespace
   {
     Data& data;
     Queue& queue;
+    Prefs& prefs;
     GtkWidget * server_tree_view;
     GtkWidget * dialog;
     GtkListStore * servers_store;
     GtkWidget * remove_button;
     GtkWidget * edit_button;
-    ServerListDialog (Data& d, Queue& q): data(d), queue(q) {}
+    ServerListDialog (Data& d, Queue& q, Prefs& p): data(d), queue(q), prefs(p) {}
   };
 
 
@@ -637,7 +639,7 @@ namespace
     const Quark empty_quark;
     GtkWidget * list_dialog = GTK_WIDGET (user_data);
     ServerListDialog * d = (ServerListDialog*) g_object_get_data (G_OBJECT(list_dialog), "dialog");
-    GtkWidget * edit_dialog = server_edit_dialog_new (d->data, d->queue, GTK_WINDOW(list_dialog), empty_quark);
+    GtkWidget * edit_dialog = server_edit_dialog_new (d->data, d->queue, d->prefs, GTK_WINDOW(list_dialog), empty_quark);
     g_signal_connect (edit_dialog, "destroy", G_CALLBACK(server_edit_dialog_destroy_cb), list_dialog);
     gtk_widget_show_all (edit_dialog);
   }
@@ -649,7 +651,7 @@ namespace
     ServerListDialog * d = (ServerListDialog*) g_object_get_data (G_OBJECT(list_dialog), "dialog");
     Quark selected_server (get_selected_server (d));
     if (!selected_server.empty()) {
-      GtkWidget * edit_dialog = server_edit_dialog_new (d->data, d->queue, GTK_WINDOW(list_dialog), selected_server);
+      GtkWidget * edit_dialog = server_edit_dialog_new (d->data, d->queue, d->prefs, GTK_WINDOW(list_dialog), selected_server);
       g_signal_connect (GTK_OBJECT(edit_dialog), "destroy", G_CALLBACK(server_edit_dialog_destroy_cb), list_dialog);
       gtk_widget_show_all (edit_dialog);
     }
@@ -824,9 +826,9 @@ namespace
 #endif
 
 GtkWidget*
-pan :: server_list_dialog_new (Data& data, Queue& queue, GtkWindow* parent)
+pan :: server_list_dialog_new (Data& data, Queue& queue, Prefs& prefs, GtkWindow* parent)
 {
-  ServerListDialog * d = new ServerListDialog (data, queue);
+  ServerListDialog * d = new ServerListDialog (data, queue, prefs);
 
   // dialog
   char * title = g_strdup_printf ("Pan: %s", _("Servers"));
@@ -913,10 +915,10 @@ pan :: render_cert_flag (GtkTreeViewColumn * ,
 
 
 GtkWidget*
-pan :: sec_dialog_new (Data& data, Queue& queue, GtkWindow* parent)
+pan :: sec_dialog_new (Data& data, Queue& queue, Prefs& prefs, GtkWindow* parent)
 {
 #ifdef HAVE_GNUTLS
-  ServerListDialog * d = new ServerListDialog (data, queue);
+  ServerListDialog * d = new ServerListDialog (data, queue, prefs);
 
   for (guint i=0; i<ICON_QTY; ++i)
     _icons[i].pixbuf = gdk_pixbuf_new_from_inline (-1, _icons[i].pixbuf_txt, FALSE, 0);
diff --git a/pan/gui/server-ui.h b/pan/gui/server-ui.h
index 12211ea..ec24feb 100644
--- a/pan/gui/server-ui.h
+++ b/pan/gui/server-ui.h
@@ -31,13 +31,13 @@ namespace pan
   typedef std::set<std::string> strings_t;
 
   /** @ingroup GUI */
-  GtkWidget* server_edit_dialog_new (Data&, Queue&, GtkWindow*, const Quark& server);
+  GtkWidget* server_edit_dialog_new (Data&, Queue&, Prefs&, GtkWindow*, const Quark& server);
 
   /** @ingroup GUI */
-  GtkWidget* server_list_dialog_new (Data&, Queue&, GtkWindow*);
+  GtkWidget* server_list_dialog_new (Data&, Queue&, Prefs&, GtkWindow*);
 
   /** @ingroup GUI */
-  GtkWidget* sec_dialog_new (Data& data, Queue& queue, GtkWindow* parent);
+  GtkWidget* sec_dialog_new (Data& data, Queue& queue, Prefs&, GtkWindow* parent);
 
   /** @ingroup GUI */
   std::string
diff --git a/pan/tasks/Makefile.am b/pan/tasks/Makefile.am
index df282b1..f120e77 100644
--- a/pan/tasks/Makefile.am
+++ b/pan/tasks/Makefile.am
@@ -1,6 +1,6 @@
 AM_CPPFLAGS = -I top_srcdir@ @GMIME_CFLAGS@ @GLIB_CFLAGS@ @GNUTLS_CFLAGS@ @GTK_CFLAGS@
 
-AM_LDFLAGS = ../../uulib/libuu.a @GNUTLS_LIBS@
+AM_LDFLAGS = ../../uulib/libuu.a @GNUTLS_LIBS@ @GTK_LIBS@
 
 noinst_LIBRARIES = libtasks.a
 
diff --git a/pan/tasks/nntp-pool.cc b/pan/tasks/nntp-pool.cc
index 40e6010..f4ddc0d 100644
--- a/pan/tasks/nntp-pool.cc
+++ b/pan/tasks/nntp-pool.cc
@@ -39,10 +39,12 @@ namespace
 
 NNTP_Pool :: NNTP_Pool (const Quark        & server,
                         ServerInfo         & server_info,
+                        Prefs              & prefs,
                         SocketCreator      * creator,
                         CertStore          & store):
 
   _server_info (server_info),
+  _prefs (prefs),
   _server (server),
   _socket_creator (creator),
   _pending_connections (0),
@@ -173,7 +175,7 @@ NNTP_Pool :: on_socket_created (const StringView  & host,
 {
   std::string user;
   gchar* pass(NULL);
-  ok = ok && _server_info.get_server_auth (_server, user, pass);
+  ok = ok && _server_info.get_server_auth (_server, user, pass, _prefs.get_flag("use-gnome-keyring", false));
   debug("on socket created "<<host<<" "<<ok<<" "<<socket);
   if (!ok)
   {
diff --git a/pan/tasks/nntp-pool.h b/pan/tasks/nntp-pool.h
index 17a56dd..7399b72 100644
--- a/pan/tasks/nntp-pool.h
+++ b/pan/tasks/nntp-pool.h
@@ -27,6 +27,7 @@
 #include <pan/tasks/socket.h>
 #include <pan/tasks/nntp.h>
 #include <pan/tasks/socket-impl-main.h>
+#include <pan/gui/prefs.h>
 
 #ifdef HAVE_GNUTLS
 #include <pan/data/cert-store.h>
@@ -46,7 +47,7 @@ class NNTP_Pool: public NNTP::Source,
 		private CertStore::Listener {
 public:
 
-	NNTP_Pool(const Quark & server, ServerInfo & server_info, SocketCreator *,
+	NNTP_Pool(const Quark & server, ServerInfo & server_info, Prefs& prefs, SocketCreator *,
 			CertStore &);
 	virtual ~NNTP_Pool();
 
@@ -114,6 +115,7 @@ private:
 	SocketCreator * _socket_creator;
 	int _pending_connections;
 	CertStore& _certstore;
+	Prefs& _prefs;
 
 	struct PoolItem {
 		NNTP * nntp;
diff --git a/pan/tasks/queue.cc b/pan/tasks/queue.cc
index 30d2fd6..2d89221 100644
--- a/pan/tasks/queue.cc
+++ b/pan/tasks/queue.cc
@@ -37,10 +37,12 @@ Queue :: Queue (ServerInfo         & server_info,
                 TaskArchive        & archive,
                 SocketCreator      * socket_creator,
                 CertStore          & certstore,
+                Prefs              & prefs,
                 WorkerPool         & pool,
                 bool                 online,
                 int                  save_delay_secs):
   _server_info (server_info),
+  _prefs (prefs),
   _is_online (online),
   _socket_creator (socket_creator),
   _worker_pool (pool),
@@ -104,7 +106,7 @@ Queue :: get_pool (const Quark& servername)
   }
   else // have to build one
   {
-    pool = new NNTP_Pool (servername, _server_info, _socket_creator, _certstore);
+    pool = new NNTP_Pool (servername, _server_info, _prefs, _socket_creator, _certstore);
     pool->add_listener (this);
     _pools[servername] = pool;
   }
diff --git a/pan/tasks/queue.h b/pan/tasks/queue.h
index d2b2862..04e3b8a 100644
--- a/pan/tasks/queue.h
+++ b/pan/tasks/queue.h
@@ -35,6 +35,7 @@
 #include <pan/tasks/encoder.h>
 #include <pan/tasks/task-weak-ordering.h>
 #include <pan/tasks/socket-impl-main.h>
+#include <pan/gui/prefs.h>
 
 #ifdef HAVE_GNUTLS
   #include <pan/data/cert-store.h>
@@ -74,7 +75,7 @@ namespace pan
     private AdaptableSet<Task*, TaskWeakOrdering>::Listener
   {
     public:
-      Queue (ServerInfo&, TaskArchive&, SocketCreator*, CertStore&, WorkerPool&,
+      Queue (ServerInfo&, TaskArchive&, SocketCreator*, CertStore&, Prefs&, WorkerPool&,
              bool online, int save_delay_secs);
       virtual ~Queue ();
 
@@ -253,6 +254,7 @@ namespace pan
       void clean_n_save ();
       int _uploads_total, _downloads_total;
       CertStore& _certstore;
+      Prefs& _prefs;
 
     private:
       typedef AdaptableSet<Task*, TaskWeakOrdering> TaskSet;
diff --git a/uulib/uunconc.c b/uulib/uunconc.c
index 42f9753..fc2b6c6 100644
--- a/uulib/uunconc.c
+++ b/uulib/uunconc.c
@@ -1558,7 +1558,7 @@ UUDecode (uulist *data)
     r[0] = fgetc (datain);
     hb   = (int) r[0] + 22;
     fseek (datain, (int) r[0] + 12, SEEK_SET);
-    fread (r, 1, 8, datain);
+    size_t res = fread (r, 1, 8, datain);
 
     dsize = (((long) 1 << 24) * (long) r[0]) +
             (((long) 1 << 16) * (long) r[1]) +



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]