[pan2/testing: 261/279] forgot to add icons for status icon



commit 2c240db97862fdf9a226b2161202a1d3d7676868
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date:   Sun Nov 27 15:55:29 2011 +0100

    forgot to add icons for status icon

 pan.cbp                                |    3 ---
 pan/data/data.h                        |    2 ++
 pan/data/server-info.h                 |    2 ++
 pan/gui/gui.cc                         |    8 ++++----
 pan/gui/server-ui.cc                   |    4 +---
 pan/icons/icon_status_active.png       |  Bin 0 -> 1824 bytes
 pan/icons/icon_status_error.png        |  Bin 0 -> 1772 bytes
 pan/icons/icon_status_idle.png         |  Bin 0 -> 1481 bytes
 pan/icons/icon_status_new_articles.png |  Bin 0 -> 1590 bytes
 pan/icons/icon_status_offline.png      |  Bin 0 -> 1945 bytes
 pan/icons/icon_status_online.png       |  Bin 0 -> 1783 bytes
 pan/icons/icon_status_queue_empty.png  |  Bin 0 -> 1704 bytes
 pan/tasks/nntp-pool.cc                 |    2 +-
 pan/tasks/socket-impl-main.cc          |   25 ++++++++++---------------
 pan/tasks/socket-impl-main.h           |    3 ++-
 pan/tasks/socket-impl-openssl.cc       |   16 ++++++++++------
 pan/tasks/socket-impl-openssl.h        |    3 ++-
 pan/tasks/socket.h                     |    3 ++-
 18 files changed, 36 insertions(+), 35 deletions(-)
---
diff --git a/pan.cbp b/pan.cbp
index 3ed50e5..e165e09 100644
--- a/pan.cbp
+++ b/pan.cbp
@@ -75,9 +75,6 @@
 		<Unit filename="pan/data-impl/article-filter.h">
 			<Option target="all_linux" />
 		</Unit>
-		<Unit filename="pan/data-impl/cert-store.cc">
-			<Option target="all_linux" />
-		</Unit>
 		<Unit filename="pan/data-impl/cert-store.h">
 			<Option target="all_linux" />
 		</Unit>
diff --git a/pan/data/data.h b/pan/data/data.h
index aea5eaa..2182b64 100644
--- a/pan/data/data.h
+++ b/pan/data/data.h
@@ -235,6 +235,8 @@ namespace pan
                                     std::string   & setme_username,
                                     std::string   & setme_password) const = 0;
 
+      virtual std::string get_server_cert (const Quark & server) const = 0;
+
       virtual int get_server_limits (const Quark & server) const = 0;
 
     /*****************************************************************
diff --git a/pan/data/server-info.h b/pan/data/server-info.h
index cdcf73e..81796e8 100644
--- a/pan/data/server-info.h
+++ b/pan/data/server-info.h
@@ -89,6 +89,8 @@ namespace pan
       virtual int get_server_limits (const Quark & server) const = 0;
 
       virtual int get_server_article_expiration_age  (const Quark  & server) const = 0;
+
+      virtual bool find_server_by_hn (const Quark& server, Quark& setme) const = 0;
   };
 }
 
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 18f7fc7..628ee9a 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -2104,12 +2104,12 @@ GUI :: on_verify_cert_failed(X509* cert, std::string server, std::string cert_na
 
   if (GUI::confirm_accept_new_cert_dialog(get_window(_root),cert,server))
     if (!_certstore.add(cert, server))
-//      Log::add_urgent_va("Error adding certificate of server '%s' to Certificate Store",server.c_str());
-//    else
-//    {
+      Log::add_urgent_va("Error adding certificate of server '%s' to Certificate Store",server.c_str());
+    else
+    {
       _data.set_server_cert(server, cert_name);
       _data.save_server_info(server);
-//    }
+    }
 }
 
 void
diff --git a/pan/gui/server-ui.cc b/pan/gui/server-ui.cc
index d65b1e5..6b06112 100644
--- a/pan/gui/server-ui.cc
+++ b/pan/gui/server-ui.cc
@@ -798,9 +798,7 @@ namespace
       gtk_dialog_set_default_response (GTK_DIALOG(w), GTK_RESPONSE_NO);
       const int response (gtk_dialog_run (GTK_DIALOG (w)));
       gtk_widget_destroy (w);
-
-      d->data.get_server_addr (selected_server, addr, port);
-      store.remove(addr);
+      store.remove(selected_server);
 
       if (response == GTK_RESPONSE_YES)
         sec_tree_view_refresh (d);
diff --git a/pan/icons/icon_status_active.png b/pan/icons/icon_status_active.png
new file mode 100644
index 0000000..54cc0a4
Binary files /dev/null and b/pan/icons/icon_status_active.png differ
diff --git a/pan/icons/icon_status_error.png b/pan/icons/icon_status_error.png
new file mode 100644
index 0000000..5abdae7
Binary files /dev/null and b/pan/icons/icon_status_error.png differ
diff --git a/pan/icons/icon_status_idle.png b/pan/icons/icon_status_idle.png
new file mode 100644
index 0000000..ac71641
Binary files /dev/null and b/pan/icons/icon_status_idle.png differ
diff --git a/pan/icons/icon_status_new_articles.png b/pan/icons/icon_status_new_articles.png
new file mode 100644
index 0000000..e371813
Binary files /dev/null and b/pan/icons/icon_status_new_articles.png differ
diff --git a/pan/icons/icon_status_offline.png b/pan/icons/icon_status_offline.png
new file mode 100644
index 0000000..224efba
Binary files /dev/null and b/pan/icons/icon_status_offline.png differ
diff --git a/pan/icons/icon_status_online.png b/pan/icons/icon_status_online.png
new file mode 100644
index 0000000..2c7d3b7
Binary files /dev/null and b/pan/icons/icon_status_online.png differ
diff --git a/pan/icons/icon_status_queue_empty.png b/pan/icons/icon_status_queue_empty.png
new file mode 100644
index 0000000..17c6e06
Binary files /dev/null and b/pan/icons/icon_status_queue_empty.png differ
diff --git a/pan/tasks/nntp-pool.cc b/pan/tasks/nntp-pool.cc
index f0b85ae..bf7ece7 100644
--- a/pan/tasks/nntp-pool.cc
+++ b/pan/tasks/nntp-pool.cc
@@ -288,7 +288,7 @@ NNTP_Pool :: request_nntp (WorkerPool& threadpool)
     {
       ++_pending_connections;
       const bool ssl(_server_info.get_server_ssl_support(_server));
-      _socket_creator->create_socket (address, port, threadpool, this, ssl);
+      _socket_creator->create_socket (_server_info,address, port, threadpool, this, ssl);
     }
   }
 }
diff --git a/pan/tasks/socket-impl-main.cc b/pan/tasks/socket-impl-main.cc
index d08089c..21aefbd 100644
--- a/pan/tasks/socket-impl-main.cc
+++ b/pan/tasks/socket-impl-main.cc
@@ -67,6 +67,7 @@ namespace
     Socket::Creator::Listener * listener;
 
     bool ok;
+    ServerInfo& data;
     Socket * socket;
     std::string err;
     bool use_ssl;
@@ -75,27 +76,20 @@ namespace
     std::multimap<std::string, Socket*>& socket_map;
     SSL_CTX * context;
     CertStore& store;
-    ThreadWorker (const Quark& s, const StringView& h, int p, Socket::Creator::Listener *l,
+    ThreadWorker (ServerInfo& d, const Quark& s, const StringView& h, int p, Socket::Creator::Listener *l,
                   bool ssl, SSL_CTX* ctx, CertStore& cs, std::multimap<std::string, Socket*>& m):
-      server(s), host(h), port(p), listener(l), ok(false), socket(0), use_ssl(ssl), context(ctx), store(cs), socket_map(m) {}
+      data(d), server(s), host(h), port(p), listener(l), ok(false), socket(0), use_ssl(ssl), context(ctx), store(cs), socket_map(m) {}
 #else
-    ThreadWorker (const Quark& s, const StringView& h, int p, Socket::Creator::Listener *l):
-      server(s), host(h), port(p), listener(l), ok(false), socket(0), use_ssl(false) {}
+    ThreadWorker (ServerInfo& d, const Quark& s, const StringView& h, int p, Socket::Creator::Listener *l):
+      data(d), server(s), host(h), port(p), listener(l), ok(false), socket(0), use_ssl(false) {}
 #endif
 
-    static gboolean handshake_done_cb(gpointer g)
-    {
-      GIOChannelSocketSSL* ssl (static_cast<GIOChannelSocketSSL*>(g));
-      if (ssl->get_done()) return false;
-      return true;
-    }
-
     void do_work ()
     {
 #ifdef HAVE_OPENSSL
         if (use_ssl)
         {
-          socket = new GIOChannelSocketSSL (server, context, store);
+          socket = new GIOChannelSocketSSL (data, server, context, store);
           socket_map.insert(std::pair<std::string, Socket*>(host, socket));
         }
         else
@@ -193,7 +187,8 @@ SocketCreator :: ~SocketCreator()
 }
 
 void
-SocketCreator :: create_socket (const StringView & host,
+SocketCreator :: create_socket (ServerInfo& info,
+                                const StringView & host,
                                 int                port,
                                 WorkerPool       & threadpool,
                                 Socket::Creator::Listener * listener,
@@ -204,9 +199,9 @@ SocketCreator :: create_socket (const StringView & host,
     ensure_module_init ();
     if (store.in_blacklist(server)) return;
 #ifdef HAVE_OPENSSL
-    ThreadWorker * w = new ThreadWorker (server, host, port, listener, use_ssl, ssl_ctx, store, socket_map);
+    ThreadWorker * w = new ThreadWorker (info, server, host, port, listener, use_ssl, ssl_ctx, store, socket_map);
 #else
-    ThreadWorker * w = new ThreadWorker (server, host, port, listener);
+    ThreadWorker * w = new ThreadWorker (info, server, host, port, listener);
 #endif
     threadpool.push_work (w, w, true);
 }
diff --git a/pan/tasks/socket-impl-main.h b/pan/tasks/socket-impl-main.h
index d76bcf0..b0db92c 100644
--- a/pan/tasks/socket-impl-main.h
+++ b/pan/tasks/socket-impl-main.h
@@ -150,7 +150,8 @@ namespace pan
       Data& data;
 
     public:
-      virtual void create_socket (const StringView & host,
+      virtual void create_socket (ServerInfo&,
+                                  const StringView & host,
                                   int                port,
                                   WorkerPool       & threadpool,
                                   Socket::Creator::Listener * listener,
diff --git a/pan/tasks/socket-impl-openssl.cc b/pan/tasks/socket-impl-openssl.cc
index 31b0dc4..debb549 100644
--- a/pan/tasks/socket-impl-openssl.cc
+++ b/pan/tasks/socket-impl-openssl.cc
@@ -118,7 +118,7 @@ extern t_freeaddrinfo p_freeaddrinfo;
 
 #ifdef HAVE_OPENSSL // without libssl this class is just a stub....
 
-GIOChannelSocketSSL :: GIOChannelSocketSSL (const Quark& server, SSL_CTX* ctx, CertStore& cs):
+GIOChannelSocketSSL :: GIOChannelSocketSSL (ServerInfo& data, const Quark& server, SSL_CTX* ctx, CertStore& cs):
    _channel (0),
    _tag_watch (0),
    _tag_timeout (0),
@@ -131,7 +131,8 @@ GIOChannelSocketSSL :: GIOChannelSocketSSL (const Quark& server, SSL_CTX* ctx, C
    _certstore(cs),
    _rehandshake(false),
    _server(server),
-   _done(false)
+   _done(false),
+   _data(data)
 {
   debug ("GIOChannelSocketSSL ctor " << (void*)this);
   cs.add_listener(this);
@@ -409,7 +410,7 @@ namespace
   }
 
 
-  int ssl_handshake(const Quark& server, GIOChannel *handle, CertStore::Listener* listener,
+  int ssl_handshake(ServerInfo& data, const Quark& server, GIOChannel *handle, CertStore::Listener* listener,
                     CertStore* cs, std::string host, SSL_SESSION* session, bool rehandshake)
   {
 
@@ -426,10 +427,12 @@ namespace
     mydata.ignore_all = 0;
     mydata.l = listener;
     /* build cert name from scratch or from Server* */
-    mydata.cert_name = CertStore::build_cert_name(host);
+    Quark setme;
+    data.find_server_by_hn(host, setme);
+    mydata.cert_name = data.get_server_cert(setme);
+    std::cerr<<"ssl handshake "<<mydata.cert_name<<"\n";
     mydata.server = server;
     SSL_set_ex_data(chan->ssl, SSL_get_fd(chan->ssl), &mydata);
-    SSL_set_verify(chan->ssl,SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,0);
 
     if (session) ret = SSL_set_session(chan->ssl, session);
 //    if (rehandshake)
@@ -813,6 +816,7 @@ GIOChannelSocketSSL :: ssl_get_iochannel(GIOChannel *handle, gboolean verify)
 		g_warning("Failed to allocate SSL structure");
 		return 0;
 	}
+	SSL_set_verify(ssl,SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,0);
 
 	if(!(err = SSL_set_fd(ssl, fd)))
 	{
@@ -837,7 +841,7 @@ GIOChannelSocketSSL :: ssl_get_iochannel(GIOChannel *handle, gboolean verify)
 
   int ret;
   set_blocking(ssl, true);
-  if (ssl_handshake(_server, gchan, this, &_certstore,_host, _session,_rehandshake) == 0)
+  if (ssl_handshake(_data, _server, gchan, this, &_certstore,_host, _session,_rehandshake) == 0)
   {
     set_blocking(chan->ssl, false);
     return gchan;
diff --git a/pan/tasks/socket-impl-openssl.h b/pan/tasks/socket-impl-openssl.h
index ddacd0c..fbb877a 100644
--- a/pan/tasks/socket-impl-openssl.h
+++ b/pan/tasks/socket-impl-openssl.h
@@ -57,13 +57,14 @@ namespace pan
   {
     public:
       virtual ~GIOChannelSocketSSL ();
-      GIOChannelSocketSSL (const Quark&, SSL_CTX* ctx, CertStore& cs);
+      GIOChannelSocketSSL (ServerInfo&, const Quark&, SSL_CTX* ctx, CertStore& cs);
 
       virtual bool open (const StringView& address, int port, std::string& setme_err);
       virtual void write_command (const StringView& chars, Socket::Listener *);
       virtual void get_host (std::string& setme) const;
 
     private:
+      ServerInfo& _data;
       GIOChannel * _channel;
       unsigned int _tag_watch;
       unsigned int _tag_timeout;
diff --git a/pan/tasks/socket.h b/pan/tasks/socket.h
index 6ddc9cd..efdf1f8 100644
--- a/pan/tasks/socket.h
+++ b/pan/tasks/socket.h
@@ -36,6 +36,7 @@ namespace pan
 {
   class StringView;
   class WorkerPool;
+  class Data;
 
   /**
    * Defines primitive interactions with a remote server:
@@ -97,7 +98,7 @@ namespace pan
         };
 
         virtual ~Creator () { }
-        virtual void create_socket (const StringView& host, int port, WorkerPool&, Listener*, bool) = 0;
+        virtual void create_socket (Data&, const StringView& host, int port, WorkerPool&, Listener*, bool) = 0;
       };
   };
 }



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