[pan2: 116/268] bugfix
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2: 116/268] bugfix
- Date: Mon, 2 Jan 2012 15:47:45 +0000 (UTC)
commit b1d749751ae6003e43d710def6c0e933992689bd
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Thu Jul 7 11:33:01 2011 +0200
bugfix
pan/data-impl/headers-test.cc | 6 ++--
pan/data-impl/headers.cc | 5 ++-
pan/data-impl/xover.cc | 2 +
pan/data/article.cc | 7 +++++-
pan/gui/post-ui.cc | 19 ++++++-----------
pan/tasks/nntp.cc | 1 +
pan/tasks/task-upload.cc | 25 ++++-------------------
pan/tasks/task-xover.cc | 36 +++++----------------------------
pan/usenet-utils/Makefile.am | 43 ++++++++++++++++++++---------------------
9 files changed, 54 insertions(+), 90 deletions(-)
---
diff --git a/pan/data-impl/headers-test.cc b/pan/data-impl/headers-test.cc
index f2ca460..cc1abcb 100644
--- a/pan/data-impl/headers-test.cc
+++ b/pan/data-impl/headers-test.cc
@@ -127,7 +127,7 @@ int main ()
check (part != 0)
check (part->xref.find (server, group, ul))
check (ul == 10033)
-
+
// TEST: does xover add articles and thread them right to existing grandparents when their parents can't be found?
data.xover_add (server, group, "10034 Re: it is all a dream again. \"Bob Barker\" <bob wtf com> Wed, 27 Apr 2005 16:53:02 GMT <wftmid2 newsread1 news pas earthlink net> <article1 foo com> <article2b blah com> 999 90 Xref: news.netfront.net alt.zen:175095 alt.religion.buddhism:10034 talk.religion.buddhism:170168");
//check (data.group_get_article_count(group) == 5ul)
@@ -138,7 +138,7 @@ int main ()
//check (data.article_get_parent (group, tmp.message_id, q))
//check (q == a1.message_id)
Article floating_child (tmp);
-
+
// TEST: and when the parent shows up, does the child get reparented right?
data.xover_add (server, group, "10035 Re: it is all a dream again. \"Bob Barker\" <bob wtf com> Wed, 27 Apr 2005 16:53:02 GMT <article2b blah com> <article1 foo com> 2487 31 Xref: news.netfront.net alt.zen:175096 alt.religion.buddhism:10035 talk.religion.buddhism:170169");
//check (data.group_get_article_count(group) == 6ul)
@@ -200,7 +200,7 @@ int main ()
check (ul == 10035)
check (part->xref.find (server2, group, ul))
check (ul == 6666)
-
+
#if 0
TimeElapsed xover_timer;
std::ifstream in ("header-impl-test.dat");
diff --git a/pan/data-impl/headers.cc b/pan/data-impl/headers.cc
index 47193c3..0fcbc5f 100644
--- a/pan/data-impl/headers.cc
+++ b/pan/data-impl/headers.cc
@@ -536,6 +536,7 @@ DataImpl :: load_headers (const DataIO & data_io,
// found parts...
part_batch.init (a.message_id, total_part_count, found_part_count);
+ std::cerr<<"article "<<a.message_id<<" "<<total_part_count<<" "<<found_part_count<<std::endl;
for (int i(0), count(found_part_count); i<count; ++i)
{
const bool gotline (in->getline (s));
@@ -887,7 +888,7 @@ DataImpl :: mark_read (const Article ** articles,
fire_group_counts (group, g._unread_count, g._article_count);
on_articles_changed (group, it->second, false);
}
-
+
if( !newsrc_autosave_id && newsrc_autosave_timeout )
newsrc_autosave_id = g_timeout_add_seconds( newsrc_autosave_timeout * 60, nrc_as_cb, this);
}
@@ -1108,7 +1109,7 @@ DataImpl :: delete_articles (const unique_articles_t& articles)
// remove the articles from our lookup table...
GroupHeaders * h (get_group_headers (group));
- if (h)
+ if (h)
h->remove_articles (it->second.mids);
}
diff --git a/pan/data-impl/xover.cc b/pan/data-impl/xover.cc
index 36a20f6..d5777fc 100644
--- a/pan/data-impl/xover.cc
+++ b/pan/data-impl/xover.cc
@@ -242,6 +242,8 @@ DataImpl :: xover_add (const Quark & server,
return 0;
}
+ std::cerr<<"xover add "<<subject<<" "<<author<<" "<<message_id<<" lines "<<line_count<<" bytes "<<byte_count<<std::endl;
+
const Article* new_article (0);
h->_dirty = true;
XOverEntry& workarea (xover_get_workarea (group));
diff --git a/pan/data/article.cc b/pan/data/article.cc
index 218957b..053c8a6 100644
--- a/pan/data/article.cc
+++ b/pan/data/article.cc
@@ -38,7 +38,8 @@ Article :: get_part_state () const
part_state = SINGLE;
// someone's posted a followup to a multipart
- else if (!is_line_count_ge(250) && has_reply_leader(subject.to_view()))
+ ///TODO magic number??
+ else if (!is_line_count_ge(4000) && has_reply_leader(subject.to_view()))
part_state = SINGLE;
else {
@@ -50,6 +51,10 @@ Article :: get_part_state () const
part_state = total==found ? COMPLETE : INCOMPLETE;
}
+ std::cerr<<message_id<<" is "<<(is_binary ? "binary" : "text")<<".\n";
+
+// if (strstr(message_id, "pan.2011")) return SINGLE;
+
return part_state;
}
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 0ebcc4b..b2b8747 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -1095,8 +1095,6 @@ PostUI :: maybe_post_message (GMimeMessage * message)
int total = get_total_parts(t->_filename.c_str(), t);
- std::string last_mid;
-
StringView d;
const char * pch = domain.strchr ('@');
if (pch != NULL)
@@ -1111,9 +1109,6 @@ PostUI :: maybe_post_message (GMimeMessage * message)
std::string out;
generate_unique_id(d, *pit,out);
n.mid = out;
- n.last_mid = last_mid;
- // set father mid to first part of upload
- if (last_mid.empty()) last_mid = out;
}
g_snprintf(buf,sizeof(buf),"%s.%d", basename, *pit);
@@ -1494,11 +1489,7 @@ PostUI :: new_message_from_ui (Mode mode)
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 == POSTING || mode == DRAFTING)
- pch = g_strdup_printf ("text/plain; charset=%s", charset.c_str());
-// else
-// // http://tools.ietf.org/html/rfc2046#section-5.1.3
-// pch = g_strdup_printf ("multipart/mixed; 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);
@@ -1509,6 +1500,9 @@ PostUI :: new_message_from_ui (Mode mode)
g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
g_object_unref (part);
+ //dbg
+// set_message(msg);
+
return msg;
}
@@ -1532,7 +1526,8 @@ PostUI :: save_draft ()
if (gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_ACCEPT)
{
- GMimeMessage * msg = new_message_from_ui (DRAFTING);
+ //dbg DRAFTING
+ GMimeMessage * msg = new_message_from_ui (UPLOADING);
char * filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(d));
draft_filename = filename;
@@ -2991,7 +2986,7 @@ 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));
+ GMimeMessage * tmp (new_message_from_ui (POSTING));
if (!check_message(profile.posting_server, tmp, true))
{
diff --git a/pan/tasks/nntp.cc b/pan/tasks/nntp.cc
index 2b6da4c..385b2aa 100644
--- a/pan/tasks/nntp.cc
+++ b/pan/tasks/nntp.cc
@@ -449,6 +449,7 @@ NNTP :: post (const StringView & msg,
}
else
{
+ std::cerr<<s<<std::endl;
_post = s;
_commands.push_back ("POST\r\n");
write_next_command ();
diff --git a/pan/tasks/task-upload.cc b/pan/tasks/task-upload.cc
index d6e7296..c6c25d9 100644
--- a/pan/tasks/task-upload.cc
+++ b/pan/tasks/task-upload.cc
@@ -157,25 +157,11 @@ TaskUpload :: update_work (NNTP* checkin_pending)
}
void
-TaskUpload :: add_reference_to_list(std::string s)
-{
- char buf[4096];
- std::cerr<<"references old : "<<_references<<std::endl;
-
- std::string res = GNKSA::generate_references (StringView(_references), s);
- GNKSA::trim_references(res);
-
- std::cerr<<"references new : "<<buf<<std::endl;
- g_mime_object_set_header ((GMimeObject *)_msg, "References", res.c_str());
- std::cerr<<"references msg : "<<g_mime_object_get_header((GMimeObject*)_msg,"References")<<std::endl;
-}
-
-void
TaskUpload :: prepend_headers(GMimeMessage* msg, TaskUpload::Needed * n, std::string& d)
{
std::stringstream out;
- //add headers
+ //add message-id created from mt-rng
if (!n->mid.empty()) pan_g_mime_message_set_message_id (msg, n->mid.c_str());
//modify subject
@@ -187,9 +173,6 @@ TaskUpload :: prepend_headers(GMimeMessage* msg, TaskUpload::Needed * n, std::st
n->partno, _total_parts);
g_mime_message_set_subject (msg, buf);
-// if (!n->last_mid.empty())
-// add_reference_to_list(n->last_mid);
-
//extract body
char * body (g_mime_object_to_string ((GMimeObject *) msg));
std::cerr<<"\n"<<body<<"\n--------------------------\n\n";
@@ -252,6 +235,8 @@ TaskUpload :: on_nntp_done (NNTP * nntp,
tmp.date = time(NULL);
tmp.is_child = true;
+ std::cerr<<response<<std::endl;
+
needed_t::iterator it;
for (it=_needed.begin(); it!=_needed.end(); ++it)
if (it->second.nntp == nntp)
@@ -426,6 +411,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-xover.cc b/pan/tasks/task-xover.cc
index c2a6943..40b292f 100644
--- a/pan/tasks/task-xover.cc
+++ b/pan/tasks/task-xover.cc
@@ -21,20 +21,13 @@
#include <cassert>
#include <cerrno>
extern "C" {
- #define PROTOTYPES
- #include <stdio.h>
- #include <uulib/uudeview.h>
#include <glib/gi18n.h>
#include <gmime/gmime-utils.h>
-
}
-#include <fstream>
-#include <iostream>
#include <pan/general/debug.h>
#include <pan/general/macros.h>
#include <pan/general/messages.h>
#include <pan/general/utf8-utils.h>
-#include <pan/general/file-util.h>
#include <pan/data/data.h>
#include "nntp.h"
#include "task-xover.h"
@@ -99,10 +92,8 @@ TaskXOver :: TaskXOver (Data & data,
_bytes_so_far (0),
_parts_so_far (0ul),
_articles_so_far (0ul),
- _lines_so_far (0ul),
_total_minitasks (0)
{
-
debug ("ctor for " << group);
// add a ``GROUP'' MiniTask for each server that has this group
@@ -233,7 +224,6 @@ TaskXOver :: on_nntp_group (NNTP * nntp,
//std::cerr << LINE_ID << " nothing new here..." << std::endl;
_high[nntp->_server] = high;
}
-// _working = _total_minitasks;
}
namespace
@@ -274,24 +264,9 @@ namespace
}
void
-TaskXOver :: on_nntp_line (NNTP * nntp,
- const StringView & line)
-//{
-// _headers<<line<<"\r\n";
-// increment_step(1);
-// ++_lines_so_far;
-// _bytes_so_far += line.len;
-//
-// if (!(_lines_so_far % 500))
-// set_status_va (_("%s (%lu Header Lines)"), _short_group_name.c_str(), _lines_so_far);
-//
-//}
-//
-//void
-//TaskXOver :: on_nntp_line_process (NNTP * nntp,
-// const StringView & line)
+TaskXOver :: on_nntp_line (NNTP * nntp,
+ const StringView & line)
{
-
pan_return_if_fail (nntp != 0);
pan_return_if_fail (!nntp->_server.empty());
pan_return_if_fail (!nntp->_group.empty());
@@ -359,7 +334,7 @@ TaskXOver :: on_nntp_line (NNTP * nntp,
if (article)
++_articles_so_far;
-// emit a status update
+ // emit a status update
uint64_t& prev = _last_xover_number[nntp];
increment_step (number - prev);
prev = number;
@@ -375,6 +350,7 @@ TaskXOver :: on_nntp_done (NNTP * nntp,
Health health,
const StringView & response UNUSED)
{
+ //std::cerr << LINE_ID << " nntp " << nntp->_server << " (" << nntp << ") done; checking in. health==" << health << std::endl;
update_work (true);
check_in (nntp, health);
}
@@ -399,8 +375,8 @@ TaskXOver :: update_work (bool subtract_one_from_nntp_count)
else if (nntp_count)
_state.set_working ();
else {
- _state.set_completed();
- set_finished(OK);
+ _state.set_completed ();
+ set_finished (OK);
}
}
diff --git a/pan/usenet-utils/Makefile.am b/pan/usenet-utils/Makefile.am
index 65c45d8..5df4edb 100644
--- a/pan/usenet-utils/Makefile.am
+++ b/pan/usenet-utils/Makefile.am
@@ -25,27 +25,26 @@ noinst_HEADERS = \
url-find.h \
rng.h
-#noinst_PROGRAMS = \
-# gnksa-test \
-# message-check-test \
-# numbers-test \
-# scorefile-test \
-# text-massager-test \
-# url-find-test
+noinst_PROGRAMS = \
+ gnksa-test \
+ message-check-test \
+ numbers-test \
+ scorefile-test \
+ text-massager-test \
+ url-find-test
-#TESTS = $(noinst_PROGRAMS)
-#TEST_LDADD = ./libusenetutils.a ../general/libgeneralutils.a @GMIME_LIBS@
-# GLIB_LIBS@
-#gnksa_test_SOURCES = gnksa-test.cc
-#gnksa_test_LDADD = $(TEST_LDADD)
-#message_check_test_SOURCES = message-check-test.cc
-#message_check_test_LDADD = $(TEST_LDADD)
-#numbers_test_SOURCES = numbers-test.cc
-#numbers_test_LDADD = $(TEST_LDADD)
-#scorefile_test_SOURCES = scorefile-test.cc
-#scorefile_test_LDADD = $(TEST_LDADD)
-#text_massager_test_SOURCES = text-massager-test.cc
-#text_massager_test_LDADD = $(TEST_LDADD)
-#url_find_test_SOURCES = url-find-test.cc
-#url_find_test_LDADD = $(TEST_LDADD)
+TESTS = $(noinst_PROGRAMS)
+TEST_LDADD = ./libusenetutils.a ../general/libgeneralutils.a @GMIME_LIBS@ @GLIB_LIBS@
+gnksa_test_SOURCES = gnksa-test.cc
+gnksa_test_LDADD = $(TEST_LDADD)
+message_check_test_SOURCES = message-check-test.cc
+message_check_test_LDADD = $(TEST_LDADD)
+numbers_test_SOURCES = numbers-test.cc
+numbers_test_LDADD = $(TEST_LDADD)
+scorefile_test_SOURCES = scorefile-test.cc
+scorefile_test_LDADD = $(TEST_LDADD)
+text_massager_test_SOURCES = text-massager-test.cc
+text_massager_test_LDADD = $(TEST_LDADD)
+url_find_test_SOURCES = url-find-test.cc
+url_find_test_LDADD = $(TEST_LDADD)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]