[pan2/testing: 44/279] added xzver functionality
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 44/279] added xzver functionality
- Date: Sat, 3 Dec 2011 22:28:14 +0000 (UTC)
commit b355518b882629c196bbcfa1e1574af23a5a6ef8
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Wed May 25 07:52:02 2011 +0200
added xzver functionality
pan/gui/dl-headers-ui.cc | 4 +-
pan/gui/gui.cc | 3 --
pan/gui/pan.cc | 18 ++----------
pan/gui/post-ui.cc | 71 +++++++++++++++++++++++++++-------------------
pan/gui/post-ui.h | 4 +-
pan/gui/server-ui.cc | 23 +-------------
6 files changed, 51 insertions(+), 72 deletions(-)
---
diff --git a/pan/gui/dl-headers-ui.cc b/pan/gui/dl-headers-ui.cc
index 383a863..689c0e5 100644
--- a/pan/gui/dl-headers-ui.cc
+++ b/pan/gui/dl-headers-ui.cc
@@ -66,7 +66,7 @@ namespace
if (response == GTK_RESPONSE_ACCEPT)
{
const bool mark_read (state->prefs.get_flag ("mark-group-read-before-xover", false));
-
+ // xzver
foreach_const (quarks_t, state->groups, it) {
Task * task;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(state->all_headers_rb)))
@@ -112,7 +112,7 @@ pan :: headers_dialog (Data& data, Prefs& prefs, Queue& queue,
g_snprintf (buf, sizeof(buf), _("%d Groups"), (int)groups.size());
title += buf;
}
-
+
State * state = new State (data, prefs, queue);
state->groups = groups;
state->dialog = gtk_dialog_new_with_buttons (
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 7606b85..bfce0ae 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -1606,7 +1606,6 @@ void GUI :: do_read_selected_group ()
else if (_prefs.get_flag("get-new-headers-when-entering-group", true)) {
if (_prefs.get_flag ("mark-group-read-before-xover", false))
_data.mark_group_read (group);
-// todo xzver
_queue.add_task (new TaskXOver (_data, group, TaskXOver::NEW), Queue::TOP);
}
}
@@ -1631,7 +1630,6 @@ void GUI :: do_xover_selected_groups ()
foreach_const (quarks_v, groups, it) {
if (mark_read)
_data.mark_group_read (*it);
- //todo xzver
_queue.add_task (new TaskXOver (_data, *it, TaskXOver::NEW), Queue::TOP);
}
}
@@ -1644,7 +1642,6 @@ void GUI :: do_xover_subscribed_groups ()
const bool mark_read (_prefs.get_flag ("mark-group-read-before-xover", false));
foreach_const_r (quarks_v, groups, it) {
if (mark_read)
- //todo xzver
_data.mark_group_read (*it);
_queue.add_task (new TaskXOver (_data, *it, TaskXOver::NEW), Queue::TOP);
}
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index 555c660..5268ef7 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -36,7 +36,6 @@ extern "C" {
#include <pan/tasks/socket-impl-gio.h>
#include <pan/tasks/task-groups.h>
#include <pan/tasks/task-xover.h>
-#include <pan/tasks/task-xzver.h>
#include <pan/tasks/nzb.h>
#include <pan/data-impl/data-impl.h>
#include <pan/icons/pan-pixbufs.h>
@@ -119,15 +118,6 @@ namespace
g_free (foo);
}
- void add_xzver_test_task (GtkObject *, gpointer user_data)
- {
- DataAndQueue * foo (static_cast<DataAndQueue*>(user_data));
- const quarks_t new_servers (foo->data->get_servers());
- foreach (quarks_t, new_servers, it)
- foo->queue->add_task (new TaskXZVer (*it, *foo->data));
- g_free (foo);
- }
-
gboolean queue_upkeep_timer_cb (gpointer queue_gpointer)
{
static_cast<Queue*>(queue_gpointer)->upkeep ();
@@ -165,9 +155,7 @@ namespace
DataAndQueue * foo = g_new0 (DataAndQueue, 1);
foo->data = &data;
foo->queue = &queue;
- g_signal_connect (w, "destroy", G_CALLBACK(add_xzver_test_task), foo);
-// g_signal_connect (w, "destroy", G_CALLBACK(add_grouplist_task), foo);
-
+ g_signal_connect (w, "destroy", G_CALLBACK(add_grouplist_task), foo);
}
register_shutdown_signals ();
@@ -187,7 +175,7 @@ namespace
~PanKiller() { q.remove_listener(this); }
/** Method from Queue::Listener interface: quits program on zero sized Q*/
- void on_queue_size_changed (Queue&, int active, int total)
+ void on_queue_size_changed (Queue&, int active, int total)
{ if (!active && !total) mainloop_quit(); }
// all below methods from Queue::Listener interface are noops
@@ -290,7 +278,7 @@ main (int argc, char *argv[])
nzb = true;
else if (!strcmp (tok, "--version"))
{ std::cerr << "Pan " << VERSION << '\n'; return 0; }
- else if (!strcmp (tok, "-o") && i<argc-1)
+ else if (!strcmp (tok, "-o") && i<argc-1)
nzb_output_path = argv[++i];
else if (!memcmp (tok, "--output=", 9))
nzb_output_path = tok+9;
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 018bd9f..4271798 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -369,6 +369,8 @@ bool
PostUI :: check_message (const Quark& server, GMimeMessage * msg)
{
+ std::cerr<<"check message\n";
+
MessageCheck :: unique_strings_t errors;
MessageCheck :: Goodness goodness;
@@ -484,11 +486,22 @@ PostUI :: send_now ()
{
if (!check_charset())
return;
- GMimeMessage * message (new_message_from_ui (POSTING,get_body()));
+ GMimeMessage * message (new_message_from_ui (POSTING));
if (!maybe_post_message (message))
g_object_unref (G_OBJECT(message));
}
+//void
+//PostUI :: send_binfiles_now()
+//{
+// if (!check_charset())
+// return;
+// GMimeMessage * message (new_message_from_ui (POSTING));
+//
+// //change headers according to
+// g_object_unref (G_OBJECT(message));
+//}
+
void
PostUI :: done_sending_message (GMimeMessage * message, bool ok)
{
@@ -580,18 +593,16 @@ PostUI :: on_progress_finished (Progress&, int status) // posting finished
int bufsz=2048;
char buf[bufsz];
- if (_file_queue_empty) {
- _post_task->remove_listener (this);
- gtk_widget_destroy (_post_dialog);
+ _post_task->remove_listener (this);
+ gtk_widget_destroy (_post_dialog);
+ if (_file_queue_empty) {
+ GMimeMessage * message (((TaskPost*)_post_task)->get_message ());
+ if (status != OK) // error posting.. stop.
+ done_sending_message (message, false);
+ else
+ maybe_mail_message (message);
}
-// if (_file_queue_empty) {
-// GMimeMessage * message (((TaskPost*)_post_task)->get_message ());
-// if (status != OK) // error posting.. stop.
-// done_sending_message (message, false);
-// else
-// maybe_mail_message (message);
-// }
// else
// {
// GMimeMessage * message (((TaskUpload*)_upload_task)->get_message ());
@@ -715,12 +726,13 @@ PostUI :: maybe_post_message (GMimeMessage * message)
FileQueue::articles_it it = _file_queue.begin();
for (; it != _file_queue.end(); it, ++it, ++i) {
- // get message body first, later on the attachment's content is added to the message
- GMimeMessage* msg = new_message_from_ui (BINPOST, get_body());
- TaskUpload* t =new TaskUpload (*it,server,msg,0,TaskUpload::YENC,i);
- _queue.add_task (t,Queue::BOTTOM);
+ GMimeMessage* msg = new_message_from_ui(POSTING);
+ _queue.add_task (new TaskUpload (*it,profile.posting_server,msg
+ ,0,TaskUpload::YENC,i),
+ Queue::BOTTOM);
}
- close_window(true); // dont wait for the upload queue
+ //dbg
+// close_window(true); // dont wait for the upload queue
}
@@ -992,7 +1004,7 @@ namespace
}
GMimeMessage*
-PostUI :: new_message_from_ui (Mode mode, std::string body)
+PostUI :: new_message_from_ui (Mode mode)
{
GMimeMessage * msg (g_mime_message_new (false));
@@ -1051,11 +1063,11 @@ PostUI :: new_message_from_ui (Mode mode, std::string body)
g_free (pch);
// User-Agent
- if ((mode==POSTING || mode == BINPOST ) && _prefs.get_flag (USER_AGENT_PREFS_KEY, true))
+ if (mode==POSTING && _prefs.get_flag (USER_AGENT_PREFS_KEY, true))
g_mime_object_set_header ((GMimeObject *) msg, "User-Agent", get_user_agent());
// Message-ID
- if ((mode==POSTING || mode == BINPOST ) && _prefs.get_flag (MESSAGE_ID_PREFS_KEY, false)) {
+ if (mode==POSTING && _prefs.get_flag (MESSAGE_ID_PREFS_KEY, false)) {
const std::string message_id = !profile.fqdn.empty()
? GNKSA::generate_message_id (profile.fqdn)
: GNKSA::generate_message_id_from_email_address (profile.address);
@@ -1063,9 +1075,10 @@ PostUI :: new_message_from_ui (Mode mode, std::string body)
}
// body & charset
+ std::string body (get_body());
GMimeStream * stream = g_mime_stream_mem_new_with_buffer (body.c_str(), body.size());
const std::string charset ((mode==POSTING && !_charset.empty()) ? _charset : "UTF-8");
- if (charset != "UTF-8") { //dbg (??)
+ if (charset != "UTF-8") {
// add a wrapper to convert from UTF-8 to $charset
GMimeStream * tmp = g_mime_stream_filter_new (stream);
g_object_unref (stream);
@@ -1077,12 +1090,7 @@ PostUI :: new_message_from_ui (Mode mode, std::string body)
GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
g_object_unref (stream);
GMimePart * part = g_mime_part_new ();
-
- if (mode==BINPOST)
- pch = g_strdup_printf ("multipart/mixed; charset=%s", charset.c_str());
- else
- pch = g_strdup_printf ("text/plain; charset=%s", charset.c_str());
-
+ pch = g_strdup_printf ("text/plain; charset=%s", charset.c_str());
GMimeContentType * type = g_mime_content_type_new_from_string (pch);
g_free (pch);
g_mime_object_set_content_type ((GMimeObject *) part, type); // part owns type now. type isn't refcounted.
@@ -1115,7 +1123,7 @@ PostUI :: save_draft ()
if (gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_ACCEPT)
{
- GMimeMessage * msg = new_message_from_ui (DRAFTING, get_body());
+ GMimeMessage * msg = new_message_from_ui (DRAFTING);
char * filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(d));
draft_filename = filename;
@@ -1816,6 +1824,7 @@ PostUI :: create_main_tab ()
// Newsgroup
++row;
+ std::cerr<<" create main tab\n";
g_snprintf (buf, sizeof(buf), "<b>%s:</b>", _("_Newsgroups"));
l = gtk_label_new_with_mnemonic (buf);
gtk_label_set_use_markup (GTK_LABEL(l), true);
@@ -2001,8 +2010,8 @@ PostUI :: update_filequeue_tab()
{
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
- 0, (*it).basename,
- 1, (*it).byte_count/1024,
+ 0, (*it)->basename,
+ 1, (*it)->byte_count,
-1);
}
@@ -2046,6 +2055,7 @@ PostUI :: PostUI (GtkWindow * parent,
_charset (DEFAULT_CHARSET),
_group_entry_changed_id (0),
_group_entry_changed_idle_tag (0),
+ //binpost
_file_queue_empty(true)
{
g_assert (profiles.has_profiles());
@@ -2143,6 +2153,9 @@ PostUI :: prompt_user_for_queueable_files (FileQueue& queue, GtkWindow * parent,
GSList * tmp_list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER (w));
if (_file_queue_empty) _file_queue_empty=!_file_queue_empty;
GSList * cur = g_slist_nth (tmp_list,0);
+ const Profile profile (get_current_profile ());
+ const StringView subject(gtk_entry_get_text (GTK_ENTRY(_subject_entry)));
+ struct stat stat_buf;
for (; cur; cur = cur->next)
{
diff --git a/pan/gui/post-ui.h b/pan/gui/post-ui.h
index 584ecd3..43b16bf 100644
--- a/pan/gui/post-ui.h
+++ b/pan/gui/post-ui.h
@@ -129,8 +129,8 @@ namespace pan
void add_actions (GtkWidget* box);
void apply_profile_to_body ();
void apply_profile_to_headers ();
- enum Mode { DRAFTING, POSTING, BINPOST };
- GMimeMessage * new_message_from_ui (Mode mode, std::string body);
+ enum Mode { DRAFTING, POSTING };
+ GMimeMessage * new_message_from_ui (Mode mode);
Profile get_current_profile ();
bool check_message (const Quark& server, GMimeMessage*);
bool check_charset ();
diff --git a/pan/gui/server-ui.cc b/pan/gui/server-ui.cc
index 7bfa708..ffca9d9 100644
--- a/pan/gui/server-ui.cc
+++ b/pan/gui/server-ui.cc
@@ -91,7 +91,7 @@ namespace
d->server = server;
- int port(119), max_conn(4), age(31*3), rank(1), xzver(0);
+ int port(119), max_conn(4), age(31*3), rank(1);
std::string addr, user, pass;
if (!server.empty()) {
d->data.get_server_addr (server, addr, port);
@@ -99,7 +99,6 @@ namespace
age = d->data.get_server_article_expiration_age (server);
rank = d->data.get_server_rank (server);
max_conn = d->data.get_server_limits (server);
- xzver = d->data.get_server_xzver_support(server);
}
pan_entry_set_text (d->address_entry, addr);
@@ -132,18 +131,6 @@ namespace
break;
}
} while (gtk_tree_model_iter_next(model, &iter));
-
- // set the xzver combo box
- combo = GTK_COMBO_BOX (d->xzver_compression_combo);
- model = gtk_combo_box_get_model (combo);
- if (gtk_tree_model_get_iter_first(model, &iter)) do {
- int that;
- gtk_tree_model_get (model, &iter, 1, &that, -1);
- if (that == xzver) {
- gtk_combo_box_set_active_iter (combo, &iter);
- break;
- }
- } while (gtk_tree_model_iter_next(model, &iter));
}
void
@@ -172,10 +159,6 @@ namespace
combo = GTK_COMBO_BOX (d->rank_combo);
if (gtk_combo_box_get_active_iter (combo, &iter))
gtk_tree_model_get (gtk_combo_box_get_model(combo), &iter, 1, &rank, -1);
- int xzver(0);
- combo = GTK_COMBO_BOX (d->xzver_compression_combo);
- if (gtk_combo_box_get_active_iter (combo, &iter))
- gtk_tree_model_get (gtk_combo_box_get_model(combo), &iter, 1, &xzver, -1);
const char * err_msg (0);
if (addr.empty())
err_msg = _("Please specify the server's address.");
@@ -197,8 +180,6 @@ namespace
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);
- d->data.set_server_xzver_support (d->server, xzver);
- d->data.save_server_info(d->server);
d->queue.upkeep ();
}
}
@@ -338,7 +319,7 @@ pan :: server_edit_dialog_new (Data& data, Queue& queue, GtkWindow * window, con
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), renderer2, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (w), renderer2, "text", 0, NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX(w), 0);
- HIG::workarea_add_row (t, &row, _("_Header-compression support (XZVER) :"), w, NULL);
+ HIG::workarea_add_row (t, &row, _("Serverside _Header-compression support:"), w, NULL);
d->server = server;
edit_dialog_populate (data, server, d);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]