[pan2/testing: 125/279] added yenc, base64 and plain encoding, please test
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 125/279] added yenc, base64 and plain encoding, please test
- Date: Sat, 3 Dec 2011 22:32:41 +0000 (UTC)
commit 003f781cf084aac38f12ca1f754207bacd8160d9
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Wed Jun 29 09:59:41 2011 +0200
added yenc, base64 and plain encoding, please test
pan.cbp | 3 -
pan/gui/post-ui.cc | 291 ++++++++++++++++++----------------------
pan/gui/post-ui.h | 28 +++--
pan/gui/post.ui.h | 4 +
pan/tasks/encoder.cc | 41 +++++-
pan/tasks/encoder.h | 5 +-
pan/tasks/nzb.cc | 18 ++--
pan/tasks/task-upload.cc | 112 +++++-----------
pan/tasks/task-upload.h | 43 ++++--
pan/tasks/task-xover.cc | 27 +----
pan/tasks/task-xover.h | 5 +-
pan/tasks/upload-queue.cc | 9 ++
pan/tasks/upload-queue.h | 6 +-
pan/usenet-utils/mime-utils.cc | 12 ++-
pan/usenet-utils/mime-utils.h | 4 +-
uulib/uudeview.h | 10 +-
uulib/uuencode.c | 57 ++-------
17 files changed, 308 insertions(+), 367 deletions(-)
---
diff --git a/pan.cbp b/pan.cbp
index 73aba9e..5b49d1f 100644
--- a/pan.cbp
+++ b/pan.cbp
@@ -232,7 +232,6 @@
<Unit filename="pan/tasks/task-weak-ordering.h" />
<Unit filename="pan/tasks/task-xover.cc" />
<Unit filename="pan/tasks/task-xover.h" />
- <Unit filename="pan/tasks/task-xzver-test.h" />
<Unit filename="pan/tasks/task.cc" />
<Unit filename="pan/tasks/task.h" />
<Unit filename="pan/tasks/upload-queue.cc" />
@@ -244,8 +243,6 @@
<Unit filename="pan/usenet-utils/gnksa-test.cc" />
<Unit filename="pan/usenet-utils/gnksa.cc" />
<Unit filename="pan/usenet-utils/gnksa.h" />
- <Unit filename="pan/usenet-utils/gzstream.cc" />
- <Unit filename="pan/usenet-utils/gzstream.h" />
<Unit filename="pan/usenet-utils/message-check-test.cc" />
<Unit filename="pan/usenet-utils/message-check.cc" />
<Unit filename="pan/usenet-utils/message-check.h" />
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 2a64861..acbb705 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -135,6 +135,28 @@ namespace
}
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 = _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->get_byte_count()/1024,
+ 4, task->encode_mode().c_str(),
+ -1);
+ }
+}
+
+void
PostUI :: on_queue_tasks_added (UploadQueue& queue, int index, int count)
{
@@ -153,6 +175,7 @@ PostUI :: on_queue_tasks_added (UploadQueue& queue, int index, int count)
1, task->subject().c_str(),
2, task,
3, task->get_byte_count()/1024,
+ 4, task->encode_mode().c_str(),
-1);
}
}
@@ -339,6 +362,7 @@ namespace
void do_move_down (GtkAction*, gpointer p) { static_cast<PostUI*>(p)->move_down(); }
void do_move_top (GtkAction*, gpointer p) { static_cast<PostUI*>(p)->move_top(); }
void do_move_bottom (GtkAction*, gpointer p) { static_cast<PostUI*>(p)->move_bottom(); }
+ void do_select_encode (GtkAction* a, gpointer p) { static_cast<PostUI*>(p)->select_encode(a); }
GtkActionEntry filequeue_popup_entries[] =
{
@@ -376,7 +400,22 @@ namespace
{ "move-bottom", NULL,
N_("Move to Bottom"), "",
N_("Move to Bottom"),
- G_CALLBACK(do_move_bottom) }
+ G_CALLBACK(do_move_bottom) },
+
+ { "yenc", NULL,
+ N_("yEnc-Encode"), "",
+ N_("yEnc-Encode"),
+ G_CALLBACK(do_select_encode) },
+
+ { "plain", NULL,
+ N_("No encoding (plain)"), "",
+ N_("No encoding (plain)"),
+ G_CALLBACK(do_select_encode) },
+
+ { "base64", NULL,
+ N_("BASE64-Encode"), "",
+ N_("BASE64-Encode"),
+ G_CALLBACK(do_select_encode) }
};
GtkToggleActionEntry toggle_entries[] =
@@ -440,24 +479,21 @@ PostUI :: on_button_pressed (GtkWidget *treeview, GdkEventButton *event, gpointe
{
if (event->type == GDK_BUTTON_PRESS && event->button == 3)
{
- if (1)
+ GtkTreeSelection *selection;
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+ if (gtk_tree_selection_count_selected_rows(selection) <= 1)
{
- GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
- if (gtk_tree_selection_count_selected_rows(selection) <= 1)
- {
- GtkTreePath *path;
- /* Get tree path for row that was clicked */
- if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview),
- (gint) event->x,
- (gint) event->y,
- &path, NULL, NULL, NULL))
- {
- gtk_tree_selection_unselect_all(selection);
- gtk_tree_selection_select_path(selection, path);
- gtk_tree_path_free(path);
- }
- }
+ GtkTreePath *path;
+ /* Get tree path for row that was clicked */
+ if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview),
+ (gint) event->x,
+ (gint) event->y,
+ &path, NULL, NULL, NULL))
+ {
+ gtk_tree_selection_unselect_all(selection);
+ gtk_tree_selection_select_path(selection, path);
+ gtk_tree_path_free(path);
+ }
}
do_popup_menu(treeview, event, userdata);
return TRUE;
@@ -727,19 +763,6 @@ PostUI :: send_now ()
g_object_unref (G_OBJECT(message));
}
-std::string
-PostUI :: get_domain(const StringView& mid)
-{
- const char * pch = mid.strchr ('@');
- StringView domain;
- if (pch) domain = mid.substr (pch+1, NULL);
- if (pch) pch = domain.strchr ('>');
- if (pch) domain = domain.substr (NULL, pch);
- domain.trim ();
-
- return domain.to_string();
-}
-
void
PostUI :: send_and_save_now ()
{
@@ -750,35 +773,16 @@ PostUI :: send_and_save_now ()
if (!check_charset())
return;
- if (_file_queue_empty || !_prefs.get_flag(MESSAGE_ID_PREFS_KEY,false))
+ if (_file_queue_empty)
{
GtkWidget * d = gtk_message_dialog_new (GTK_WINDOW(_root),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, NULL);
- if (_file_queue_empty)
- {
HIG :: message_dialog_set_text (GTK_MESSAGE_DIALOG(d),
_("The file queue is empty, so no files can be saved."),"");
gtk_dialog_add_button (GTK_DIALOG(d), _("Go Back"), GTK_RESPONSE_CANCEL);
- }
- else if (!_prefs.get_flag(MESSAGE_ID_PREFS_KEY,false))
- {
- HIG :: message_dialog_set_text (GTK_MESSAGE_DIALOG(d),
- _("You wanted to save the queue, but the option for custom Message-IDs is disabled. \nCan`t continue because I need this data for the NZB file. \nEnable this option ?"),"");
- gtk_dialog_add_button (GTK_DIALOG(d), _("Go Back"), GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG(d), _("Enable"), GTK_RESPONSE_APPLY);
- }
- const int response = gtk_dialog_run (GTK_DIALOG(d));
- gtk_widget_destroy (d);
- if (response == GTK_RESPONSE_APPLY)
- update_queue_mids();
- else
- return;
-
}
- if (!update_queue_save_file ()) return;
-
GMimeMessage * message (new_message_from_ui (POSTING));
if (!maybe_post_message (message))
g_object_unref (G_OBJECT(message));
@@ -1021,10 +1025,46 @@ PostUI :: maybe_post_message (GMimeMessage * message)
PostUI::tasks_t tasks;
_upload_queue.get_all_tasks(tasks);
int cnt(0);
+ char buf[2048];
+ int lpf = _prefs.get_int("upload-option-lpf",4000);
+ struct stat sb;
_running_uploads = tasks.size();
+ // generate domain name for upload if the flag is set
+ bool custom_mid(_prefs.get_flag(MESSAGE_ID_PREFS_KEY,false));
+ std::string d;
+ if (custom_mid)
+ d = !profile.fqdn.empty()
+ ? GNKSA::generate_message_id (profile.fqdn)
+ : GNKSA::generate_message_id_from_email_address (profile.address);
+ StringView domain(d);
+
foreach (PostUI::tasks_t, tasks, it)
{
+ const char* basename = (*it)->filename().c_str();
+ TaskUpload::Needed n;
+
+ stat (basename,&sb);
+
+ int total = std::max(1, (int) (((long)sb.st_size + (lpf*bpl[(*it)->_encode_mode]-1)) /
+ (lpf*bpl[(*it)->_encode_mode])));
+
+ for (int i = 1; i <= total; ++i)
+ {
+ if (custom_mid)
+ {
+ std::string out;
+ generate_unique_id(domain, i,out);
+ n.mid = out;
+ }
+
+ g_snprintf(buf,sizeof(buf),"%s.%d", basename, i);
+ n.message_id = buf;
+ n.partno = i;
+ (*it)->needed().insert(std::pair<int,TaskUpload::Needed>(i,n));
+ }
+ (*it)->build_needed_tasks();
+
(*it)->_queue_pos = cnt++;
_queue.add_task (*it, Queue::BOTTOM);
(*it)->add_listener(this);
@@ -1308,17 +1348,6 @@ namespace
&& (name.strstr ("X-Draft-") != name.str);
return keep;
}
-
- /**
- * Works around a GMime bug that uses `Message-Id' rather than `Message-ID'
- */
- void pan_g_mime_message_set_message_id (GMimeMessage *msg, const char *mid)
- {
- g_mime_object_append_header ((GMimeObject *) msg, "Message-ID", mid);
- char * bracketed = g_strdup_printf ("<%s>", mid);
- g_mime_header_list_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
- g_free (bracketed);
- }
}
GMimeMessage*
@@ -2195,7 +2224,6 @@ PostUI :: create_main_tab ()
gtk_table_attach (GTK_TABLE(t), w, 1, 2, row, row+1, fill, fill, 0, 0);
// Body
-
w = create_body_widget (_body_buf, _body_view, _prefs);
set_spellcheck_enabled (_prefs.get_flag ("spellcheck-enabled", DEFAULT_SPELLCHECK_FLAG));
_body_changed_id = g_signal_connect (_body_buf, "changed", G_CALLBACK(body_changed_cb), this);
@@ -2207,54 +2235,11 @@ PostUI :: create_main_tab ()
return v;
}
-bool
-PostUI :: update_queue_mids (bool enable)
-{
- PostUI::tasks_t tasks;
- _upload_queue.get_all_tasks(tasks);
-
- bool mid(enable);
-
- if (mid)
- {
- const Profile profile (get_current_profile ());
- std::string d = !profile.fqdn.empty()
- ? GNKSA::generate_message_id (profile.fqdn)
- : GNKSA::generate_message_id_from_email_address (profile.address);
-
- std::string domain(get_domain(StringView(d)));
- foreach (tasks_t, tasks, it)
- (*it)->_domain = domain;
- return true;
- } else
- {
- foreach (tasks_t, tasks, it)
- (*it)->_domain.clear();
- return false;
- }
-
-}
-
-bool
-PostUI :: update_queue_save_file ()
-{
- PostUI::tasks_t tasks;
- _upload_queue.get_all_tasks(tasks);
- _save_file.clear();
- _save_file = prompt_user_for_upload_nzb_dir (GTK_WINDOW (gtk_widget_get_toplevel(_root)), _prefs);
-
- if (_save_file.empty()) return false;
- foreach (tasks_t, tasks, it)
- (*it)->_save_file = _save_file;
- return true;
-}
-
void
PostUI :: message_id_toggled_cb (GtkToggleButton * tb, gpointer pointer)
{
PostUI* post = static_cast<PostUI*>(pointer);
post->_prefs.set_flag (MESSAGE_ID_PREFS_KEY, gtk_toggle_button_get_active(tb));
- post->update_queue_mids(gtk_toggle_button_get_active(tb));
}
namespace
@@ -2338,7 +2323,7 @@ PostUI :: create_filequeue_tab ()
gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), false, false, 0);
//add filestore
- list_store = gtk_list_store_new (4, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT);
+ list_store = gtk_list_store_new (5, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_STRING);
w = _filequeue_store = gtk_tree_view_new_with_model (GTK_TREE_MODEL(list_store));
// add columns
@@ -2351,6 +2336,8 @@ PostUI :: create_filequeue_tab ()
gtk_tree_view_insert_column_with_data_func(t, 2, (_("Filename")), renderer, render_filename, 0, 0);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (t, 3, (_("Size (kB)")),renderer,"text", 3,NULL);
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes (t, 4, (_("Encode Mode")),renderer,"text", 4,NULL);
// connect signals for popup menu
g_signal_connect (w, "popup-menu", G_CALLBACK(on_popup_menu), this);
@@ -2619,6 +2606,26 @@ PostUI :: move_bottom (void)
}
void
+PostUI :: select_encode (GtkAction* a)
+{
+ tasks_t tasks = get_selected_files();
+ const gchar* name = gtk_action_get_name(a);
+
+ TaskUpload::EncodeMode tmp;
+ if (!strcmp(name, "yenc"))
+ tmp = TaskUpload::YENC;
+ if (!strcmp(name, "plain"))
+ tmp = TaskUpload::PLAIN;
+ if (!strcmp(name, "base64"))
+ tmp = TaskUpload::BASE64;
+
+ foreach(tasks_t, tasks, it)
+ (*it)->_encode_mode = tmp;
+
+ update_filequeue_tab();
+}
+
+void
PostUI :: clear_list (void)
{
_upload_queue.clear();
@@ -2671,8 +2678,8 @@ PostUI :: select_parts ()
if (!_upload_ptr) return;
- int lpf = lpf = _prefs.get_int("upload-option-lpf",4000);
- _total_parts = std::max(1, (int) (((long)_upload_ptr->get_byte_count() + (lpf*YENC_HALF_LINE_LEN-1)) / (lpf*YENC_HALF_LINE_LEN)));
+ int lpf = _prefs.get_int("upload-option-lpf",4000);
+ _total_parts = std::max(1, (int) (((long)_upload_ptr->get_byte_count() + (lpf*bpl[_upload_ptr->_encode_mode]-1)) / (lpf*bpl[_upload_ptr->_encode_mode])));
GtkWidget * w;
GtkTreeIter iter;
@@ -2713,9 +2720,9 @@ PostUI :: update_parts_tab()
gtk_list_store_append (store, &iter);
res = (_upload_ptr->_needed.find(i) != _upload_ptr->_needed.end()) ? TRUE : FALSE;
gtk_list_store_set (store, &iter,
- 0, i,
- 1, res,
- 2, _upload_ptr->basename().c_str(), -1);
+ 0, i,
+ 1, res,
+ 2, _upload_ptr->basename().c_str(), -1);
}
}
@@ -2872,19 +2879,16 @@ PostUI :: create_window (GtkWindow * parent,
void
PostUI :: prompt_user_for_queueable_files (GtkWindow * parent, const Prefs& prefs)
{
- char buf[4096];
- struct stat sb;
-
const Profile profile (get_current_profile ());
+ PostUI::tasks_t tasks;
GMimeMessage * tmp (new_message_from_ui (POSTING));
+
if (!check_message(profile.posting_server, tmp, true))
{
g_object_unref (G_OBJECT(tmp));
return;
}
- PostUI::tasks_t tasks;
-
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"),
@@ -2908,15 +2912,6 @@ PostUI :: prompt_user_for_queueable_files (GtkWindow * parent, const Prefs& pref
// query lines per file value
ui.lpf = _prefs.get_int("upload-option-lpf",4000);
- // generate domain name for upload if the flag is set
- bool custom_mid(_prefs.get_flag(MESSAGE_ID_PREFS_KEY,false));
- std::string d;
- if (custom_mid)
- d = !profile.fqdn.empty()
- ? GNKSA::generate_message_id (profile.fqdn)
- : GNKSA::generate_message_id_from_email_address (profile.address);
- StringView domain(d);
-
GSList * cur = g_slist_nth (tmp_list,0);
for (; cur; cur = cur->next)
{
@@ -2929,41 +2924,21 @@ PostUI :: prompt_user_for_queueable_files (GtkWindow * parent, const Prefs& pref
profile.get_from_header(s);
a.author = s;
- stat ((const char*)cur->data,&sb);
- int lpf = _prefs.get_int("upload-option-lpf",4000);
- int total = std::max(1, (int) (((long)sb.st_size + (lpf*YENC_HALF_LINE_LEN-1)) /
- (lpf*YENC_HALF_LINE_LEN)));
-
-
- char* basename = g_path_get_basename((const char*)cur->data);
-
- // build needed parts
- TaskUpload::needed_t import;
- TaskUpload::Needed n;
-///TODO for nzb.cc
-// foreach_const (quarks_t, groups, git)
-// a.xref.insert (profile.posting_server, *git,0);
-
- for (int i = 1; i <= total; ++i)
- {
- if (custom_mid)
- {
- std::string out;
- generate_unique_id(domain, i,out);
- n.mid = out;
- }
-
- g_snprintf(buf,sizeof(buf),"%s.%d", basename, i);
- n.message_id = buf;
- n.partno = i;
- import.insert(std::pair<int,TaskUpload::Needed>(i,n));
+ // insert groups info into article struct
+ quarks_t groups;
+ StringView line (g_mime_object_get_header ((GMimeObject *) msg, "Newsgroups"));
+ StringView groupname;
+ while (line.pop_token (groupname, ',')) {
+ groupname.trim ();
+ if (!groupname.empty())
+ groups.insert(Quark(groupname));
}
- g_free(basename);
+ foreach_const (quarks_t, groups, git)
+ a.xref.insert (profile.posting_server, *git,0);
- TaskUpload* tmp = new TaskUpload(std::string((const char*)cur->data),
+ TaskUpload* tmp = new TaskUpload(std::string((const char*)cur->data),
profile.posting_server, _cache,
- ///TODO implement custom encode mode options
- a, ui, import, msg,0, TaskUpload::YENC);
+ a, ui, msg,0, TaskUpload::YENC);
_upload_queue.add_task(tmp);
}
diff --git a/pan/gui/post-ui.h b/pan/gui/post-ui.h
index 0b53c74..f6e13de 100644
--- a/pan/gui/post-ui.h
+++ b/pan/gui/post-ui.h
@@ -33,6 +33,13 @@
namespace pan
{
+ /*
+ #define B64ENCODED (2)
+ #define PT_ENCODED (5)
+ #define YENC_ENCODED 7) */
+
+ static int bpl[3] = { 45, 45, 128 };
+
class Profiles;
class TaskPost;
class UploadQueue;
@@ -87,13 +94,14 @@ namespace pan
void update_parts_tab();
//popup action entries
- void remove_files ();
- void clear_list ();
- void select_parts ();
- void move_up ();
- void move_down ();
- void move_top ();
- void move_bottom ();
+ void remove_files ();
+ void clear_list ();
+ void select_parts ();
+ void move_up ();
+ void move_down ();
+ void move_top ();
+ void move_bottom ();
+ void select_encode (GtkAction*);
static void do_popup_menu (GtkWidget*, GdkEventButton *event, gpointer pane_g);
static gboolean on_button_pressed (GtkWidget * treeview, GdkEventButton *event, gpointer userdata);
@@ -144,7 +152,7 @@ namespace pan
std::string _charset;
TextMassager _tm;
GtkUIManager * _uim;
- GtkActionGroup * _agroup, * _pgroup;
+ GtkActionGroup * _agroup, * _pgroup, * _epgroup;
std::string _current_signature;
GtkWidget * _post_dialog;
TaskPost * _post_task;
@@ -181,6 +189,7 @@ namespace pan
GtkWidget* create_main_tab ();
GtkWidget* create_extras_tab ();
GtkWidget* create_filequeue_tab ();
+ void update_filequeue_tab();
GtkWidget* create_parts_tab ();
GtkWidget* create_log_tab ();
@@ -232,9 +241,6 @@ namespace pan
int _running_uploads;
std::ofstream _out;
static void message_id_toggled_cb (GtkToggleButton * tb, gpointer prefs_gpointer);
- std::string get_domain(const StringView& mid);
- bool update_queue_mids (bool enable=true);
- bool update_queue_save_file ();
void generate_unique_id (StringView& mid, int cnt, std::string& s);
MTRand mtrand;
diff --git a/pan/gui/post.ui.h b/pan/gui/post.ui.h
index 3213a12..7b8494e 100644
--- a/pan/gui/post.ui.h
+++ b/pan/gui/post.ui.h
@@ -56,6 +56,10 @@ const char * fallback_post_ui =
" <separator />\n"
" <menuitem action='move-top' />\n"
" <menuitem action='move-bottom' />\n"
+" <separator />\n"
+" <menuitem action='yenc' />\n"
+" <menuitem action='plain' />\n"
+" <menuitem action='base64' />\n"
" </popup>\n"
"\n"
"</ui>\n";
diff --git a/pan/tasks/encoder.cc b/pan/tasks/encoder.cc
index c9438af..7115ebd 100644
--- a/pan/tasks/encoder.cc
+++ b/pan/tasks/encoder.cc
@@ -65,8 +65,9 @@ Encoder :: enqueue (TaskUpload * task,
Article * article,
std::string & filename,
std::string & basename,
+ std::string & subject,
int lpf,
- const TaskUpload::EncodeMode & enc)
+ const TaskUpload::EncodeMode enc)
{
disable_progress_update ();
@@ -74,11 +75,12 @@ Encoder :: enqueue (TaskUpload * task,
this->task = task;
this->basename = basename;
this->filename = filename;
- this->encode_mode = encode_mode;
+ this->encode_mode = enc;
this->needed = &task->_needed;
this->cache = cache;
this->article = article;
this->lpf = lpf;
+ this->subject = subject;
percent = 0;
current_file.clear ();
@@ -119,10 +121,7 @@ Encoder :: do_work()
batch.init(StringView(basename), needed->size(), 0);
/* build real subject line for article*/
- ///TODO should this be here??
- g_snprintf(buf, sizeof(buf), "\"%s\" - %s (/%03d)", basename.c_str(), article->subject.to_string().c_str(), (int)needed->size());
- tmp->subject = buf;
-
+ tmp->subject = subject;
for (TaskUpload::needed_t::iterator it = needed->begin(); it != needed->end(); ++it, ++cnt)
{
@@ -135,8 +134,36 @@ Encoder :: do_work()
}
crc32_t crc;
- res = UUEncodePartial (fp, NULL, (char*)filename.c_str(),YENC_ENCODED, (char*)basename.c_str(), NULL, 0644, cnt, lpf,&crc);
+ int enc(YENC_ENCODED);
+ std::ofstream out;
+ std::string txt;
+ /* (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&&
+ encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) { */
+ switch (encode_mode)
+ {
+ case TaskUpload::YENC:
+ enc = YENC_ENCODED;
+ break;
+ case TaskUpload::PLAIN:
+ file :: get_text_file_contents (filename, txt);
+ cache->get_filename(cachename, Quark(it->second.message_id));
+ out.open(cachename, std::ios::out);
+ out << txt;
+ out.close();
+ res = UURET_OK;
+ goto _no_encode;
+ break;
+ case TaskUpload::BASE64:
+ enc = B64ENCODED;
+ break;
+ default:
+ enc = YENC_ENCODED;
+ break;
+ }
+
+ res = UUEncodePartial (fp, NULL, (char*)filename.c_str(), enc , (char*)basename.c_str(), NULL, 0644, cnt, lpf,&crc);
+_no_encode:
if (fp) fclose(fp);
if (res != UURET_CONT && res != UURET_OK) break;
cache->finalize(it->second.message_id);
diff --git a/pan/tasks/encoder.h b/pan/tasks/encoder.h
index dd5ef4c..1b27a14 100644
--- a/pan/tasks/encoder.h
+++ b/pan/tasks/encoder.h
@@ -65,8 +65,9 @@ namespace pan
Article * article,
std::string & filename,
std::string & basename,
+ std::string & subject,
int lpf,
- const TaskUpload::EncodeMode & enc = TaskUpload::YENC);
+ const TaskUpload::EncodeMode enc = TaskUpload::YENC);
public:
@@ -83,7 +84,7 @@ namespace pan
int parts;
TaskUpload * task;
TaskUpload::EncodeMode encode_mode;
- std::string basename, filename;
+ std::string basename, filename, subject;
int lpf;
EncodeCache * cache;
TaskUpload::needed_t * needed;
diff --git a/pan/tasks/nzb.cc b/pan/tasks/nzb.cc
index 501025a..4ba70b0 100644
--- a/pan/tasks/nzb.cc
+++ b/pan/tasks/nzb.cc
@@ -366,24 +366,24 @@ NZB :: nzb_to_xml (std::ostream & out,
escaped (out, task->_subject);
out << "\" server=\"";
escaped (out, task->_server.to_string());
- out << "\" queue=\"";
- escaped (out, task->_save_file);
+
+ ///TODO
+// out << "\" queue=\"";
+// escaped (out, task->_save_file);
out << "\" lpf=\"";
char buf[256];
g_snprintf(buf,sizeof(buf),"%d",task->_lpf);
escaped (out, buf);
- out << "\" domain=\"nospam@";
- escaped (out, task->_domain) << "\">\n";
++depth;
out << indent(depth)
<< "<path>" << task->_filename << "</path>\n";
out << indent(depth) << "<groups>\n";
-
- ++depth;
- foreach_const (quarks_t, task->_groups, git)
- out << indent(depth) << "<group>" << *git << "</group>\n";
- --depth;
+ ///TODO
+// ++depth;
+// foreach_const (quarks_t, task->_groups, git)
+// out << indent(depth) << "<group>" << *git << "</group>\n";
+// --depth;
out << indent(--depth) << "</groups>\n";
out << indent(depth) << "<parts>\n";
diff --git a/pan/tasks/task-upload.cc b/pan/tasks/task-upload.cc
index 9e35d16..9f0644b 100644
--- a/pan/tasks/task-upload.cc
+++ b/pan/tasks/task-upload.cc
@@ -73,7 +73,6 @@ TaskUpload :: TaskUpload (const std::string & filename,
EncodeCache & cache,
Article article,
UploadInfo format,
- needed_t & imported,
GMimeMessage * msg,
Progress::Listener * listener,
const TaskUpload::EncodeMode enc):
@@ -90,45 +89,36 @@ TaskUpload :: TaskUpload (const std::string & filename,
_encode_mode(enc),
_all_bytes(0),
_format(format),
- _save_file(format.save_file),
_lpf(format.lpf),
_queue_pos(0),
_msg (msg)
{
-// char * pch = g_mime_object_to_string ((GMimeObject *) _msg);
-// std::cerr<<"gmimemessage:\n"<<pch<<std::endl;
-// g_free(pch);
-
- if (!imported.empty())
- foreach (needed_t, imported, nit)
- _needed.insert(*nit);
-
struct stat sb;
stat(filename.c_str(),&sb);
_bytes = sb.st_size;
- build_needed_tasks(!imported.empty());
-
update_work ();
}
void
-TaskUpload :: build_needed_tasks(bool imported)
+TaskUpload :: build_needed_tasks()
{
- quarks_t groups;
- foreach_const (Xref, _article.xref, it)
- _groups.insert (it->group);
-
foreach (needed_t, _needed, it)
{
_mids.push_back(Quark(it->second.message_id));
_cache.add(Quark(it->second.message_id));
}
_cache.reserve(_mids);
+
_needed_parts = _needed.size();
- //dbg
_total_parts = _needed_parts;
+
+ /* build new master subject */
+ char sub[2048];
+ g_snprintf(sub,2048,"%s - \"%s\" - (%03d/%03d)", _subject.c_str(), _basename.c_str(), 1, _total_parts);
+ _master_subject = sub;
+
}
void
@@ -146,23 +136,18 @@ TaskUpload :: update_work (NNTP* checkin_pending)
/* only need encode if mode is NOT plain */
if (!_encoder && !_encoder_has_run)
{
- std::cerr<<"need encoder\n";
_state.set_need_encoder();
}
else if(working)
{
- std::cerr<<"working\n";
_state.set_working();
}
else if (_encoder_has_run && !_needed.empty())
{
- std::cerr<<"need nntp\n";
_state.set_need_nntp(_server);
}
else if (_needed.empty())
{
-
- std::cerr<<"completed\n";
_state.set_completed();
set_finished(_queue_pos);
}
@@ -172,32 +157,25 @@ TaskUpload :: update_work (NNTP* checkin_pending)
****
***/
-namespace
+void
+TaskUpload :: prepend_headers(GMimeMessage* msg, TaskUpload::Needed * n, std::string& d)
{
- void pan_g_mime_message_set_message_id (GMimeMessage *msg, const char *mid)
- {
- g_mime_object_append_header ((GMimeObject *) msg, "Message-ID", mid);
- char * bracketed = g_strdup_printf ("<%s>", mid);
- g_mime_header_list_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
- g_free (bracketed);
- }
-
- void prepend_headers(GMimeMessage* msg, TaskUpload::Needed * n, std::string& d)
- {
- std::stringstream out;
-
- //add headers to gmimemessage
- if (!n->mid.empty()) pan_g_mime_message_set_message_id (msg, n->mid.c_str());
-
- //extract body from gmimemessage
- gboolean unused;
- char * body (g_mime_object_to_string ((GMimeObject *) msg));
- out<< body<<"\r\n";
- std::cerr<<"message:\n"<<out.str()<<std::endl;
- out<<d;
- d = out.str();
- std::cerr<<"message:\n"<<out.str()<<std::endl;
- }
+ std::stringstream out;
+
+ //add headers
+ if (!n->mid.empty()) pan_g_mime_message_set_message_id (msg, n->mid.c_str());
+
+ //modify subject
+ char buf[2048];
+ g_snprintf(buf, sizeof(buf), "%s - \"%s\" - (%03d/%03d)", _subject.c_str(), _basename.c_str(), n->partno, _total_parts);
+ g_mime_message_set_subject (msg, buf);
+
+ //extract body
+ gboolean unused;
+ char * body (g_mime_object_to_string ((GMimeObject *) msg));
+ out<< body<<"\r\n";
+ out<<d;
+ d = out.str();
}
void
@@ -239,9 +217,7 @@ TaskUpload :: use_nntp (NNTP * nntp)
void
TaskUpload :: on_nntp_line (NNTP * nntp,
- const StringView & line_in)
-{
-}
+ const StringView & line_in) {}
void
TaskUpload :: on_nntp_done (NNTP * nntp,
@@ -253,8 +229,6 @@ TaskUpload :: on_nntp_done (NNTP * nntp,
tmp.date = time(NULL);
tmp.is_child = true;
- std::cerr<<"nntp done : "<<response<<std::endl;
-
needed_t::iterator it;
for (it=_needed.begin(); it!=_needed.end(); ++it)
if (it->second.nntp == nntp)
@@ -301,7 +275,8 @@ TaskUpload :: on_nntp_done (NNTP * nntp,
_basename.c_str(), it->second.partno, _total_parts, response.str);
tmp.message = buf;
_logfile.push_front(tmp);
- } else if (post_ok && _needed.empty())
+ }
+ else if (post_ok && _needed.empty())
{
g_snprintf(buf,sizeof(buf), _("Posting of file %s (Part %d of %d) succesful: %s"),
_basename.c_str(), it->second.partno, _total_parts, response.str);
@@ -368,24 +343,9 @@ TaskUpload :: use_encoder (Encoder* encoder)
_encoder = encoder;
init_steps(100);
_state.set_working();
- // build group name
- std::string groups;
- quarks_t::iterator it = _groups.begin();
- int i(0);
- for (; it != _groups.end(); it, ++it, ++i)
- {
- if (i<_groups.size()&& i>0 && _groups.size()>1) groups += ",";
- groups += (*it).to_string();
- }
- /* build format string for yEnc */
- std::stringstream format_s;
- format_s << (_format.comment1 ? _subject : "");
- format_s << (_format.comment1 ? " - " : "");
- format_s << "\"%s\""; // will be filled in by uuencode
- format_s << " (%d/%d) yEnc"; // will be filled in by uuencode
- std::string format(format_s.str());
- _encoder->enqueue (this, &_cache, &_article, _filename, _basename, _lpf, YENC);//_encode_mode);
+ ///TODO support other encode modes by choice of user
+ _encoder->enqueue (this, &_cache, &_article, _filename, _basename, _master_subject, _lpf, _encode_mode);
debug ("encoder thread was free, enqueued work");
}
@@ -415,8 +375,9 @@ TaskUpload :: on_worker_done (bool cancelled)
foreach_const(Encoder::log_t, _encoder->log_infos, it)
Log :: add_info(it->c_str());
- if (!_encoder->log_errors.empty())
- set_error (_encoder->log_errors.front());
+ if (!_encoder->log_errors.empty()) {
+ _needed.clear(); //update_work will then set the status to complete
+ }
if (!_encoder->log_severe.empty())
_state.set_health (ERR_LOCAL);
@@ -442,7 +403,6 @@ TaskUpload :: ~TaskUpload ()
_encoder->cancel_silently();
g_object_unref (G_OBJECT(_msg));
-
- _cache.release(_mids);
- _cache.resize();
+// _cache.release(_mids);
+// _cache.resize();
}
diff --git a/pan/tasks/task-upload.h b/pan/tasks/task-upload.h
index e7fa4b7..a8cb278 100644
--- a/pan/tasks/task-upload.h
+++ b/pan/tasks/task-upload.h
@@ -83,13 +83,9 @@ namespace pan
enum EncodeMode
{
- UUENC = UU_ENCODED,
- YENC = YENC_ENCODED,
- BASE64 = B64ENCODED,
- PLAIN = PT_ENCODED,
- XXENC = XX_ENCODED,
- QPENC = QP_ENCODED,
- BHENC = BH_ENCODED
+ BASE64,
+ PLAIN,
+ YENC,
};
// life cycle
@@ -98,10 +94,9 @@ namespace pan
EncodeCache & cache,
Article article,
UploadInfo format,
- needed_t & imported,
GMimeMessage * msg,
Progress::Listener * listener= 0,
- TaskUpload::EncodeMode enc= YENC);
+ EncodeMode enc= YENC);
virtual ~TaskUpload ();
@@ -113,6 +108,27 @@ namespace pan
const std::string& subject () { return _subject; }
unsigned long get_byte_count() { return _bytes; }
needed_t& needed() { return _needed; }
+ std::string enc_mode_to_str(EncodeMode& e)
+ {
+ std::string res;
+ switch (e)
+ {
+ case YENC:
+ res += "yEnc";
+ break;
+ case BASE64:
+ res += "BASE64";
+ break;
+ case PLAIN:
+ break;
+ default:
+ res += "yEnc";
+ break;
+ }
+ return res;
+ }
+
+ std::string encode_mode() { return enc_mode_to_str(_encode_mode); }
/** only call this for tasks in the NEED_ENCODE state
* attempts to acquire the encoder thread and start encoding
@@ -144,29 +160,26 @@ namespace pan
std::string _filename;
std::string _basename;
TaskUpload::EncodeMode _encode_mode;
- quarks_t _groups;
- std::string _subject, _author;
+ std::string _subject, _master_subject, _author;
UploadInfo _format;
int _total_parts, _needed_parts;
unsigned long _bytes;
EncodeCache& _cache;
std::deque<Log::Entry> _logfile; // for intermediate updates
Article _article;
- std::string _domain;
unsigned long _all_bytes;
std::vector<Article*> _upload_list;
- std::string _save_file;
Article::mid_sequence_t _mids;
int _queue_pos;
- std::string _agent;
int _lpf;
private:
needed_t _needed;
void update_work (NNTP * checkin_pending = 0);
- void build_needed_tasks(bool);
+ void build_needed_tasks();
GMimeMessage * _msg;
+ void prepend_headers(GMimeMessage* msg, TaskUpload::Needed * n, std::string& d);
};
}
diff --git a/pan/tasks/task-xover.cc b/pan/tasks/task-xover.cc
index b195c7b..c2a6943 100644
--- a/pan/tasks/task-xover.cc
+++ b/pan/tasks/task-xover.cc
@@ -84,14 +84,6 @@ namespace
}
}
-//namespace
-//{
-// void create_cachename(char* in, size_t len, const char* add)
-// {
-// g_snprintf(in, len, "%s%c%s",file::get_pan_home().c_str(), G_DIR_SEPARATOR , add);
-// }
-//}
-
TaskXOver :: TaskXOver (Data & data,
const Quark & group,
Mode mode,
@@ -108,16 +100,11 @@ TaskXOver :: TaskXOver (Data & data,
_parts_so_far (0ul),
_articles_so_far (0ul),
_lines_so_far (0ul),
- _total_minitasks (0),
- _working(0)
+ _total_minitasks (0)
{
debug ("ctor for " << group);
-// char buf[2048];
-// create_cachename (buf,sizeof(buf), "headers");
-// _headers.open(buf, std::ios::out | std::ios::trunc);
-
// add a ``GROUP'' MiniTask for each server that has this group
// initialize the _high lookup table to boundaries
const MiniTask group_minitask (MiniTask::GROUP);
@@ -390,18 +377,6 @@ TaskXOver :: on_nntp_done (NNTP * nntp,
{
update_work (true);
check_in (nntp, health);
-
-// --_working;
-//
-// if (_working == 0)
-// {
-// char buf[2048];
-// create_cachename(buf,2048,"headers");
-// _headers.close();
-// _headers.open(buf, std::ifstream::in);
-// while (_headers.getline(buf,2048))
-// on_nntp_line_process(nntp,StringView(buf));
-// }
}
void
diff --git a/pan/tasks/task-xover.h b/pan/tasks/task-xover.h
index c4f3d47..26633a6 100644
--- a/pan/tasks/task-xover.h
+++ b/pan/tasks/task-xover.h
@@ -84,10 +84,7 @@ namespace pan
unsigned long _parts_so_far;
unsigned long _articles_so_far;
unsigned long _lines_so_far;
- unsigned long _total_minitasks, _working;
-
-
- std::fstream _headers;
+ unsigned long _total_minitasks;
};
}
diff --git a/pan/tasks/upload-queue.cc b/pan/tasks/upload-queue.cc
index 9a8a855..db71848 100644
--- a/pan/tasks/upload-queue.cc
+++ b/pan/tasks/upload-queue.cc
@@ -152,6 +152,15 @@ UploadQueue :: move_bottom (const tasks_t& tasks)
}
void
+UploadQueue :: select_encode (const tasks_t& tasks)
+{
+// foreach_const (tasks_t, tasks, it) {
+// TaskUpload * task (*it);
+//
+// }
+}
+
+void
UploadQueue :: fire_tasks_added (int pos, int count)
{
for (lit it(_listeners.begin()), end(_listeners.end()); it!=end; )
diff --git a/pan/tasks/upload-queue.h b/pan/tasks/upload-queue.h
index f60e961..38bd357 100644
--- a/pan/tasks/upload-queue.h
+++ b/pan/tasks/upload-queue.h
@@ -59,6 +59,8 @@ namespace pan
void move_top (const tasks_t&);
void move_bottom (const tasks_t&);
+ void select_encode (const tasks_t&);
+
enum AddMode { TOP, BOTTOM };
void add_tasks (const tasks_t&, AddMode=BOTTOM);
@@ -97,8 +99,8 @@ namespace pan
listeners_t _listeners;
public:
- TaskUpload* operator[](size_t i) { return _tasks[i]; }
- const TaskUpload* operator[](size_t i) const { return _tasks[i]; }
+ TaskUpload* operator[](size_t i) { if (i>=_tasks.size() || i<0) return NULL; return _tasks[i]; }
+ const TaskUpload* operator[](size_t i) const { if (i>=_tasks.size() || i<0) return NULL; return _tasks[i]; }
private:
TaskSet _tasks;
diff --git a/pan/usenet-utils/mime-utils.cc b/pan/usenet-utils/mime-utils.cc
index 5677efd..f013f3c 100644
--- a/pan/usenet-utils/mime-utils.cc
+++ b/pan/usenet-utils/mime-utils.cc
@@ -1237,7 +1237,6 @@ char *pan::pan_g_mime_message_get_body (GMimeMessage *message, gboolean *is_html
if (mime_part != NULL) {
body = pan_g_mime_part_get_content (GMIME_PART (mime_part), &len);
}
-
return body;
}
@@ -1252,3 +1251,14 @@ void pan::pan_g_mime_message_add_recipients_from_string (GMimeMessage *message,
}
}
}
+
+/**
+* Works around a GMime bug that uses `Message-Id' rather than `Message-ID'
+*/
+void pan::pan_g_mime_message_set_message_id (GMimeMessage *msg, const char *mid)
+{
+ g_mime_object_append_header ((GMimeObject *) msg, "Message-ID", mid);
+ char * bracketed = g_strdup_printf ("<%s>", mid);
+ g_mime_header_list_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
+ g_free (bracketed);
+}
diff --git a/pan/usenet-utils/mime-utils.h b/pan/usenet-utils/mime-utils.h
index 956e0db..fff1b47 100644
--- a/pan/usenet-utils/mime-utils.h
+++ b/pan/usenet-utils/mime-utils.h
@@ -47,7 +47,6 @@
#define YENC_TAG_CRC32 " crc32="
#define YENC_FULL_LINE_LEN 256
#define YENC_HALF_LINE_LEN 128
-//#define YENC_LINES_PER_FILE 4000
#define YENC_ESC_NULL "=@"
#define YENC_ESC_TAB "=I"
#define YENC_ESC_LF "=J"
@@ -59,7 +58,7 @@
namespace pan
{
/**
- * Utilities to build and parse GMimeMesasges.
+ * Utilities to build and parse GMimeMessages.
*
* Most of nastiness this is to handle Usenet's use of chainging together
* multiple articles as parts of a whole. This code tries to build
@@ -94,6 +93,7 @@ namespace pan
char *pan_g_mime_message_get_body (GMimeMessage *message, gboolean *is_html);
void pan_g_mime_message_add_recipients_from_string (GMimeMessage *message, GMimeRecipientType type, const char *string);
+ void pan_g_mime_message_set_message_id (GMimeMessage *msg, const char *mid);
}
diff --git a/uulib/uudeview.h b/uulib/uudeview.h
index 9209f2c..428eaa1 100644
--- a/uulib/uudeview.h
+++ b/uulib/uudeview.h
@@ -237,25 +237,25 @@ int UUEXPORT UUEncodeToFile _ANSI_ARGS_((FILE *, char *, int,
int UUEXPORT UUE_PrepSingle _ANSI_ARGS_((FILE *, FILE *,
char *, int,
char *, int,
- char *, char *, char*, char*, char*, char*,
+ char *, char *,
char *, int));
int UUEXPORT UUE_PrepPartial _ANSI_ARGS_((FILE *, FILE *,
char *, int,
char *, int,
int, long, long,
- char *, char *, char*, char*, char*, char*, char*, int));
+ char *, char*, char*, int));
int UUEXPORT UUE_PrepSingleExt _ANSI_ARGS_((FILE *, FILE *,
char *, int,
char *, int,
char *, char *,
- char *, char *, char*, char*, char*, char*,
+ char *, char *,
int));
int UUEXPORT UUE_PrepPartialExt _ANSI_ARGS_((FILE *, FILE *,
char *, int,
char *, int,
- int, long, long, char *, char*,
- char *, char *, char *,char*, char*, char*,
+ int, long, long, char *,
+ char *, char *, char *,
int));
#ifdef __cplusplus
}
diff --git a/uulib/uuencode.c b/uulib/uuencode.c
index f2df1c9..20e1f37 100644
--- a/uulib/uuencode.c
+++ b/uulib/uuencode.c
@@ -805,8 +805,8 @@ UUEncodePartial (FILE *outfile, FILE *infile,
(infile == NULL&&infname==NULL) || outfile==NULL ||
(encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&&
encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) {
- UUMessage (uuencode_id, __LINE__, UUMSG_ERROR,
- uustring (S_PARM_CHECK), "UUEncodePartial()");
+// UUMessage (uuencode_id, __LINE__, UUMSG_ERROR,
+// uustring (S_PARM_CHECK), "UUEncodePartial()");
return UURET_ILLVAL;
}
@@ -1491,13 +1491,13 @@ UUE_PrepSingle (FILE *outfile, FILE *infile,
char *infname, int encoding,
char *outfname, int filemode,
char *destination, char *from,
- char *subject, char* mid, char* format, char* agent, char* buffer, int isemail)
+ char *subject, int isemail)
{
return UUE_PrepSingleExt (outfile, infile,
infname, encoding,
outfname, filemode,
destination, from,
- subject, mid, NULL, format, agent, buffer,
+ subject, NULL,
isemail);
}
@@ -1506,7 +1506,7 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile,
char *infname, int encoding,
char *outfname, int filemode,
char *destination, char *from,
- char *subject, char* mid, char *replyto, char* format, char* agent, char* buffer,
+ char *subject, char *replyto,
int isemail)
{
mimemap *miter=mimetable;
@@ -1569,18 +1569,6 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile,
fprintf (outfile, "Subject: %s%s", subline, eolstring);
- // pan change (imhotep) : add unique mid for saving the upload queue to hdd, add user agent
- if (mid)
- {
- fprintf(outfile, "Message-ID: <%s>%s", mid, eolstring);
- }
-
- if (agent)
- {
- fprintf(outfile, "User-Agent: %s%s", agent, eolstring);
- }
-
-
if (replyto) {
fprintf (outfile, "Reply-To: %s%s", replyto, eolstring);
}
@@ -1597,10 +1585,6 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile,
fprintf (outfile, "%s", eolstring);
- // pan change (imhotep) : add preamble text
- if (buffer)
- fprintf (outfile, "%s%s%s%s", eolstring, buffer, eolstring, eolstring);
-
res = UUEncodeToStream (outfile, infile, infname, encoding,
outfname, filemode);
@@ -1613,16 +1597,14 @@ UUE_PrepPartial (FILE *outfile, FILE *infile,
char *infname, int encoding,
char *outfname, int filemode,
int partno, long linperfile, long filesize,
- char *destination, char *from, char *subject, char* mid, char* format, char* agent, char* buffer,
- int isemail)
+ char *destination, char *from, char *subject, int isemail)
{
return UUE_PrepPartialExt (outfile, infile,
infname, encoding,
outfname, filemode,
partno, linperfile, filesize,
destination,
- from, subject, mid, NULL, format, agent, buffer,
- isemail);
+ from, subject, NULL, isemail);
}
int UUEXPORT
@@ -1631,7 +1613,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
char *outfname, int filemode,
int partno, long linperfile, long filesize,
char *destination,
- char *from, char *subject, char* mid, char *replyto, char* format, char* agent, char* buffer,
+ char *from, char *subject, char *replyto,
int isemail)
{
static int numparts, themode;
@@ -1728,7 +1710,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
if (infile==NULL) fclose (theifile);
return UUE_PrepSingleExt (outfile, infile, infname, encoding,
outfname, filemode, destination,
- from, subject, mid, replyto, format, agent, buffer, isemail);
+ from, subject, replyto, isemail);
}
/*
@@ -1753,10 +1735,8 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
if (partno == 1)
crc = crc32(0L, Z_NULL, 0);
crcptr = &crc;
- sprintf (subline, format, oname, partno, numparts);
-// else
-// sprintf (subline, "\"%s\" - (%03d/%03d)", oname,
-// partno, numparts);
+ sprintf (subline, "\"%s\" - (%03d/%03d)", oname,
+ partno, numparts);
}
else {
if (subject)
@@ -1779,17 +1759,6 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
fprintf (outfile, "Subject: %s%s", subline, eolstring);
- // pan change (imhotep) : add unique mid for saving the upload queue to hdd, add user agent
- if (mid)
- {
- fprintf(outfile, "Message-ID: <%s>%s", mid, eolstring);
- }
-
- if (agent)
- {
- fprintf(outfile, "User-Agent: %s%s", agent, eolstring);
- }
-
if (replyto) {
fprintf (outfile, "Reply-To: %s%s", replyto, eolstring);
}
@@ -1804,10 +1773,6 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
fprintf (outfile, "%s", eolstring);
- // pan change (imhotep) : add preamble text
- if (buffer)
- fprintf (outfile, "%s%s%s%s", eolstring, buffer, eolstring, eolstring);
-
res = UUEncodePartial (outfile, theifile,
infname, encoding,
(outfname)?outfname:infname, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]