Hello. Here's my mostly functional patch to add code to send in patches to the central debtags database with HTTP POST instead of mailing them.
I took the liberty of refactoring most of update-tags.pl to UpdateTags.pm. At the same time I moved config.pl to it's own Cfg.pm. IMHO it would be a good idea to make proper modules from commonly used code, even if it was never submitted to CPAN. I didn't patch the rest of those "require '../config.pl';" calls to "use CentralDatabase::Cfg;" yet. Feel free to put my code to use a require too if you want. I failed to get the $entity = $parser->parse_data($q->param('POSTDATA')); call to parse the query correctly in patch-submit.cgi. I'm going to have to ask someone else to sort that one out. $entity->dump_skeleton just shows: Content-type: multipart/mixed Effective-type: multipart/mixed Body-file: NONE Num-parts: 1 -- Content-type: text/plain Effective-type: text/plain Body-file: NONE -- AFAIK Body-file should contain the debtags diff, not be NONE. Other than this, I've patched debtags-editor to show in a menu an option to submit patches via HTTP POST and to show the results in a Gtk::Dialog. Unlike email, this way of submitting patches is synchronous and the program's showing the result of the submission right away. The patch to debtags-edit requires patching libapt-front too, whose patch I sent to its mailing list. See http://lists.alioth.debian.org/pipermail/libapt-front-devel/2006-March/000786.html
central-database.tar.gz
Description: Binary data
--- debtags/debtags-edit/trunk/src/DebtagsDocument.cc 2006-02-26 00:34:52.016957000 +0200 +++ debtags-edit/trunk/src/DebtagsDocument.cc 2006-03-29 15:33:54.941584554 +0300 @@ -359,6 +359,11 @@ debtags().sendPatch(); } +void DebtagsDocument::sendHTTP(FILE* reply) throw (FileException) +{ + debtags().sendPatchHTTP(reply); +} + /* template<class T> OpSet<T> DebtagsDocument<T>::handlesToItems(const OpSet<int>& handles) const throw () --- debtags/debtags-edit/trunk/src/DebtagsDocument.h 2006-02-26 00:34:52.020957000 +0200 +++ debtags-edit/trunk/src/DebtagsDocument.h 2006-03-29 15:43:13.467361388 +0300 @@ -166,6 +166,7 @@ //void load() throw (FileException, ParserException); void save() throw (Tagcoll::FileException); void send() throw (Tagcoll::FileException); + void sendHTTP(FILE*) throw (Tagcoll::FileException); //void output(TagcollConsumer<T>& consumer) throw (); //void output(TagcollConsumer<int>& consumer) throw (); --- debtags/debtags-edit/trunk/src/DebtagsEditor.cc 2006-02-26 00:34:52.020957000 +0200 +++ debtags-edit/trunk/src/DebtagsEditor.cc 2006-03-31 02:48:40.758248843 +0300 @@ -144,6 +144,9 @@ fileMenu.items().push_back(Gtk::Menu_Helpers::MenuElem("_Mail changes to central database", sigc::mem_fun(*this, &DebtagsEditor::on_send))); + + fileMenu.items().push_back(Gtk::Menu_Helpers::MenuElem("_Submit changes to central database with HTTP POST", + sigc::mem_fun(*this, &DebtagsEditor::on_send_http))); /* saveMenuItem = &(fileMenu.items().back()); @@ -363,6 +366,35 @@ } } +template<class DOC> +void DebtagsEditor<DOC>::on_send_http() +{ + try { + FILE* reply = tmpfile(); + doc.sendHTTP(reply); + rewind(reply); + Glib::RefPtr<Gtk::TextBuffer> reply_buf = Gtk::TextBuffer::create(); + char buf[1024]; + size_t bytes_read; + do { + bytes_read = fread(buf, 1, 1024, reply); + printf("read %i bytes\n", bytes_read); + reply_buf->insert(reply_buf->end(), buf, buf+bytes_read); + } while (bytes_read == 1024); + Gtk::TextView reply_view(reply_buf); + reply_view.set_editable(false); + Gtk::Dialog oki("Server reply", true); + oki.add_button(Gtk::Stock::OK, 0); + oki.get_vbox()->pack_end(reply_view); + oki.get_vbox()->show_all(); + oki.run(); + } catch (Exception& e) { + Gtk::MessageDialog err(string("Send failed: ") + e.desc() + " (" + e.type() + ")", + false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); + err.run(); + } +} + /* template<class DOC> void DebtagsEditor<DOC>::on_save_as() --- debtags/debtags-edit/trunk/src/DebtagsEditor.h 2006-02-26 00:34:52.020957000 +0200 +++ debtags-edit/trunk/src/DebtagsEditor.h 2006-03-29 01:59:03.622656346 +0300 @@ -127,6 +127,7 @@ //void on_open_debtags(); void on_save(); void on_send(); + void on_send_http(); //void on_save_as(); void on_quit(); void on_compute_intensive_data();