[pan2/testing: 234/279] added session resume



commit bb1a7d9116816125f166c99dbe6af14dd7556782
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date:   Mon Nov 7 17:29:19 2011 +0100

    added session resume

 pan/gui/post-ui.cc               |   47 +++++++++----------------------------
 pan/gui/task-pane.cc             |    7 +++++
 pan/tasks/socket-impl-openssl.cc |   12 ++++-----
 3 files changed, 24 insertions(+), 42 deletions(-)
---
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 74feee7..9ffca00 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -173,28 +173,6 @@ PostUI:: update_filequeue_label (GtkTreeSelection *selection)
 ****
 ***/
 
-//* only used if the encode mode has changed, would be too expensive for repetitive calls */
-//void
-//PostUI :: update_filequeue_tab()
-//{
-//   GtkListStore *store = GTK_LIST_STORE(
-//                      gtk_tree_view_get_model(GTK_TREE_VIEW(_filequeue_store)));
-//   gtk_list_store_clear(store);
-//   GtkTreeIter iter;
-//   int i(0);
-//   TaskUpload * task;
-//   while (task = dynamic_cast<TaskUpload*>(_upload_queue[i++]))
-//   {
-//       gtk_list_store_insert (store, &iter, i);
-//       gtk_list_store_set (store, &iter,
-//                          0, i+1,
-//                          1, task->_subject.c_str(),
-//                          2, task,
-//                          3, task->_bytes/1024
-//                          -1);
-//   }
-//}
-
 void
 PostUI :: on_queue_tasks_added (UploadQueue& queue, int index, int count)
 {
@@ -202,6 +180,10 @@ PostUI :: on_queue_tasks_added (UploadQueue& queue, int index, int count)
   GtkListStore *store = GTK_LIST_STORE(
                       gtk_tree_view_get_model(GTK_TREE_VIEW(_filequeue_store)));
 
+  GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(_filequeue_store));
+  g_object_ref(model);
+  gtk_tree_view_set_model(GTK_TREE_VIEW(_filequeue_store), NULL);
+
   for (int i=0; i<count; ++i)
   {
     const int pos (index + i);
@@ -216,6 +198,8 @@ PostUI :: on_queue_tasks_added (UploadQueue& queue, int index, int count)
                       3, task->_bytes/1024.0f,
                       -1);
   }
+  gtk_tree_view_set_model(GTK_TREE_VIEW(_filequeue_store), model);
+  g_object_unref(model);
 
   update_filequeue_label();
 }
@@ -586,7 +570,6 @@ PostUI :: add_actions (GtkWidget * box)
                                 _prefs.get_flag ("spellcheck-enabled", DEFAULT_SPELLCHECK_FLAG));
   gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (gtk_action_group_get_action (_agroup, "wrap")),
                                 _prefs.get_flag ("compose-wrap-enabled", true));
-//  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (gtk_action_group_get_action (_agroup, "inline-or-bulk")), false);
 
    //add popup actions
   gtk_action_group_add_actions (_agroup, filequeue_popup_entries, G_N_ELEMENTS(filequeue_popup_entries), this);
@@ -3095,7 +3078,6 @@ PostUI :: prompt_user_for_queueable_files (GtkWindow * parent, const Prefs& pref
   const Profile profile (get_current_profile ());
   PostUI::tasks_t tasks;
   GMimeMessage * tmp (new_message_from_ui (UPLOADING));
-
   if (!check_message(profile.posting_server, tmp, true))
   {
     g_object_unref (G_OBJECT(tmp));
@@ -3103,7 +3085,6 @@ PostUI :: prompt_user_for_queueable_files (GtkWindow * parent, const Prefs& pref
   }
 
   std::string prev_path = prefs.get_string ("default-save-attachments-path", g_get_home_dir ());
-
   GtkWidget * w = gtk_file_chooser_dialog_new (_("Add files to queue"),
 				      parent,
 				      GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -3138,36 +3119,32 @@ PostUI :: prompt_user_for_queueable_files (GtkWindow * parent, const Prefs& pref
     }
 
     GSList * cur = g_slist_nth (tmp_list,0);
+    std::vector<Task*> uploads;
     for (; cur; cur = cur->next)
     {
       GMimeMessage * msg (new_message_from_ui (UPLOADING));
-
-      //for nzb handling
+      TaskUpload* tmp;
       Article a;
+      struct stat sb;
       a.subject = subject;
       a.author = author;
       foreach_const (quarks_t, groups, git)
          a.xref.insert (profile.posting_server, *git,0);
-
-      struct stat sb;
       ui.total = get_total_parts((const char*)cur->data);
-      TaskUpload* tmp = new TaskUpload(std::string((const char*)cur->data),
+      tmp = new TaskUpload(std::string((const char*)cur->data),
                         profile.posting_server, _cache, a, ui, msg);
 
       // insert wanted parts to upload
       for (int i=1;i<=ui.total; ++i)
         tmp->_wanted.insert(i);
-
-      _upload_queue.add_task(tmp);
+      uploads.push_back(tmp);
     }
 
+     _upload_queue.add_tasks(uploads);
     if (_file_queue_empty) _file_queue_empty= false;
     g_slist_free (tmp_list);
-
   } else
-
     gtk_widget_destroy (w);
-
   g_object_unref (G_OBJECT(tmp));
 
 }
diff --git a/pan/gui/task-pane.cc b/pan/gui/task-pane.cc
index 98c2c80..e51f9ae 100644
--- a/pan/gui/task-pane.cc
+++ b/pan/gui/task-pane.cc
@@ -319,6 +319,10 @@ TaskPane :: on_queue_tasks_added (Queue& queue, int index, int count)
   task_states_t states;
   queue.get_all_task_states (states);
 
+  GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(_store));
+  g_object_ref(model);
+  gtk_tree_view_set_model(GTK_TREE_VIEW(_store), NULL);
+
   for (int i=0; i<count; ++i)
   {
     const int pos (index + i);
@@ -330,6 +334,9 @@ TaskPane :: on_queue_tasks_added (Queue& queue, int index, int count)
                         COL_TASK_STATE, (int)states.get_state(task),
                         -1);
   }
+  gtk_tree_view_set_model(GTK_TREE_VIEW(_store), model);
+  g_object_unref(model);
+
 }
 
 void
diff --git a/pan/tasks/socket-impl-openssl.cc b/pan/tasks/socket-impl-openssl.cc
index 59a79a1..851d12c 100644
--- a/pan/tasks/socket-impl-openssl.cc
+++ b/pan/tasks/socket-impl-openssl.cc
@@ -379,8 +379,8 @@ namespace
   {
 
     GIOSSLChannel *chan = (GIOSSLChannel *)handle;
-    int ret;
-    int err;
+    int ret(0);
+    int err(0);
     X509 *cert;
     const char *errstr;
 
@@ -394,8 +394,9 @@ namespace
     SSL_set_ex_data(chan->ssl, SSL_get_fd(chan->ssl), &mydata);
 
 
-    std::cerr<<"resuming session "<<session<<" for "<<chan->ssl<<std::endl;
-    if (session) SSL_set_session(chan->ssl, session);
+//    std::cerr<<"resuming session "<<session<<" for "<<chan->ssl<<", result ";
+    if (session) ret = SSL_set_session(chan->ssl, session);
+    std::cerr<<ret<<std::endl;
 
     ret = SSL_connect(chan->ssl);
     if (ret <= 0) {
@@ -511,9 +512,6 @@ namespace
   {
     GIOSSLChannel *chan = (GIOSSLChannel *)handle;
     g_io_channel_close(chan->giochan);
-
-    std::cerr<<"ssl close\n";
-
     return G_IO_STATUS_NORMAL;
   }
 



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