merge 15658 - remove network-utils ...

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/module-cleanup@15665 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Peter McAlpine
2007-02-25 22:22:19 +00:00
parent 9e5ec83418
commit 369de12aff
21 changed files with 8 additions and 1110 deletions

View File

@@ -1969,14 +1969,8 @@ GNUCASH_APP_UTILS_LIBS="${GNUCASH_ENGINE_LIBS} -lgncmod-calculation -lgncmod-app
AC_SUBST(GNUCASH_APP_UTILS_CFLAGS)
AC_SUBST(GNUCASH_APP_UTILS_LIBS)
GNUCASH_NETWORK_UTILS_CFLAGS="${GLIB_CFLAGS} ${GHTTP_CFLAGS} ${GNOME_INCLUDEDIR}"
GNUCASH_NETWORK_UTILS_LIBS="${GHTTP_LIBS} ${GNOME_LIBDIR} ${GNOME_LIBS} ${GNOMEUI_LIBS} -lgncmod-network-utils"
AC_SUBST(GNUCASH_NETWORK_UTILS_CFLAGS)
AC_SUBST(GNUCASH_NETWORK_UTILS_LIBS)
GNUCASH_GNOME_UTILS_CFLAGS="${GNUCASH_APP_UTILS_CFLAGS} ${GNUCASH_NETWORK_UTILS_CFLAGS} ${GNOME_PRINT_CFLAGS} ${GNOME_INCLUDEDIR} ${GDK_PIXBUF_CFLAGS}"
GNUCASH_GNOME_UTILS_LIBS="${GNUCASH_APP_UTILS_LIBS} ${GNUCASH_NETWORK_UTILS_LIBS} ${GNOME_LIBDIR} ${GNOMEUI_LIBS} ${GNOME_PRINT_LIBS} ${GTKHTML_LIBS} ${GLADE_LIBS} ${GDK_PIXBUF_LIBS} -lgncmod-gnome-utils"
GNUCASH_GNOME_UTILS_CFLAGS="${GNUCASH_APP_UTILS_CFLAGS} ${GNOME_PRINT_CFLAGS} ${GNOME_INCLUDEDIR} ${GDK_PIXBUF_CFLAGS}"
GNUCASH_GNOME_UTILS_LIBS="${GNUCASH_APP_UTILS_LIBS} ${GNOME_LIBDIR} ${GNOMEUI_LIBS} ${GNOME_PRINT_LIBS} ${GTKHTML_LIBS} ${GLADE_LIBS} ${GDK_PIXBUF_LIBS} -lgncmod-gnome-utils"
AC_SUBST(GNUCASH_GNOME_UTILS_CFLAGS)
AC_SUBST(GNUCASH_GNOME_UTILS_LIBS)
@@ -2207,8 +2201,6 @@ AC_CONFIG_FILES(po/Makefile.in
src/import-export/hbci/glade/Makefile
src/import-export/hbci/schemas/Makefile
src/import-export/hbci/test/Makefile
src/network-utils/Makefile
src/network-utils/test/Makefile
src/optional/Makefile
src/optional/xsl/Makefile
src/pixmaps/Makefile

View File

@@ -10,7 +10,6 @@ NONGUI_SUBDIRS = \
quotes
GUI_SUBDIRS_1 = \
network-utils \
calculation \
tax \
app-utils \

View File

@@ -9,7 +9,6 @@ AM_CFLAGS = \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/backend/file \
-I${top_srcdir}/src/network-utils \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src \
-I${top_builddir}/src \
@@ -176,7 +175,6 @@ libgncmod_gnome_utils_la_LIBADD = \
${top_builddir}/src/engine/libgncmod-engine.la \
${top_builddir}/src/backend/file/libgnc-backend-file-utils.la \
${top_builddir}/src/calculation/libgnc-calculation.la \
${top_builddir}/src/network-utils/libgncmod-network-utils.la \
${top_builddir}/src/app-utils/libgncmod-app-utils.la \
$(top_builddir)/lib/libc/libc-missing.la \
${GNOME_LIBS} \

View File

@@ -49,7 +49,6 @@
#include "gnc-engine.h"
#include "gnc-gui-query.h"
#include "gnc-html.h"
#include "gnc-http.h"
#include "gnc-html-history.h"
#include "gnc-html-graph-gog.h"
#include "gnc-ui.h"
@@ -65,7 +64,7 @@ struct gnc_html_struct {
URLType base_type; /* base of URL (path - filename) */
gchar * base_location;
gnc_http * http; /* handles HTTP requests */
//gnc_http * http; /* handles HTTP requests */
GHashTable * request_info; /* hash uri to GList of GtkHTMLStream * */
/* callbacks */
@@ -541,9 +540,7 @@ gnc_html_start_request(gnc_html * html, gchar * uri, GtkHTMLStream * handle)
g_hash_table_insert(html->request_info, uri, handles);
if(need_request) {
gnc_set_busy_cursor (html->html, FALSE);
gnc_http_start_request(html->http, uri, gnc_html_http_request_cb,
(gpointer)html);
g_critical("we've not supported network requests for years");
}
}
@@ -898,13 +895,8 @@ gnc_html_submit_cb(GtkHTML * html, const gchar * method,
DEBUG(" ");
form_data = gnc_html_unpack_form_data(encoded_form_data);
type = gnc_html_parse_url(gnchtml, action, &location, &label);
if(!strcasecmp(method, "get")) {
gnc_html_generic_get_submit(gnchtml, action, form_data);
}
else if(!strcasecmp(method, "post")) {
gnc_html_generic_post_submit(gnchtml, action, form_data);
}
g_critical("form submission hasn't been supported in years.");
g_free(location);
g_free(label);
@@ -1149,7 +1141,7 @@ gnc_html_new( GtkWindow *parent )
GTK_WIDGET(retval->html));
retval->request_info = g_hash_table_new(g_str_hash, g_str_equal);
retval->http = gnc_http_new();
//retval->http = gnc_http_new();
retval->history = gnc_html_history_new();
g_object_ref (retval->container);
@@ -1209,7 +1201,7 @@ void
gnc_html_cancel(gnc_html * html)
{
/* remove our own references to requests */
gnc_http_cancel_requests(html->http);
//gnc_http_cancel_requests(html->http);
g_hash_table_foreach_remove(html->request_info, html_cancel_helper, NULL);
}
@@ -1613,94 +1605,3 @@ gnc_html_escape_newlines(const gchar * in)
g_string_free(escaped, FALSE);
return out;
}
/********************************************************************
* gnc_html_generic_get_submit() : normal 'get' submit method.
********************************************************************/
void
gnc_html_generic_get_submit(gnc_html * html, const char * action,
GHashTable * form_data)
{
URLType type;
char * location = NULL;
char * label = NULL;
char * fullurl = NULL;
char * encoded = gnc_html_pack_form_data(form_data);
type = gnc_html_parse_url(html, action, &location, &label);
fullurl = g_strconcat(location, "?", encoded, NULL);
gnc_html_show_url(html, type, fullurl, label, 0);
g_free(encoded);
g_free(location);
g_free(label);
g_free(fullurl);
}
/********************************************************************
* gnc_html_generic_post_submit() : normal 'post' submit method.
********************************************************************/
void
gnc_html_generic_post_submit(gnc_html * html, const char * action,
GHashTable * form_data)
{
char * encoded = gnc_html_pack_form_data(form_data);
char * copy = strdup(encoded);
gnc_http_start_post(html->http, action,
"application/x-www-form-urlencoded",
copy, strlen(copy),
gnc_html_http_request_cb, html);
g_free(encoded);
}
/********************************************************************
* gnc_html_multipart_post_submit() : this is really sort of useless
* but I'll make it better later. It's useless because FTMP CGI/php
* don't properly decode the urlencoded values.
********************************************************************/
static void
multipart_post_helper(gpointer key, gpointer val,
gpointer user_data)
{
char * old_str = *(char **)user_data;
char * new_str =
g_strconcat(old_str,
"--XXXgncXXX\r\n",
"Content-Disposition: form-data; name=\"",
(char *)key, "\"\r\n\r\n",
(char *)val, "\r\n",
NULL);
*(char **)user_data = new_str;
g_free(old_str);
}
void
gnc_html_multipart_post_submit(gnc_html * html, const char * action,
GHashTable * form_data)
{
char * htmlstr = g_strdup("");
char * next_htmlstr;
/* encode the arguments from the hash table */
g_hash_table_foreach(form_data, multipart_post_helper, &htmlstr);
/* add the closing boundary marker */
next_htmlstr = g_strconcat(htmlstr, "--XXXgncXXX--\r\n", NULL);
g_free(htmlstr);
htmlstr = next_htmlstr;
next_htmlstr = NULL;
gnc_http_start_post(html->http, action,
"multipart/form-data; boundary=XXXgncXXX",
htmlstr, strlen(htmlstr),
gnc_html_http_request_cb, html);
g_free(htmlstr);
}

View File

@@ -138,16 +138,6 @@ void gnc_html_register_url_handler(URLType url_type,
GncHTMLUrlCB hand);
void gnc_html_unregister_url_handler(URLType url_type);
/* default action handlers for GET and POST methods. 'generic_post'
* is the trivial application/x-www-form-urlencoded submit,
* multipart-post is a multipart/form-data submit. */
void gnc_html_generic_get_submit(gnc_html * html, const char * act,
GHashTable * form_data);
void gnc_html_generic_post_submit(gnc_html * html, const char * act,
GHashTable * form_data);
void gnc_html_multipart_post_submit(gnc_html * html, const char * a,
GHashTable * form_data);
URLType gnc_html_parse_url(gnc_html * html, const gchar * url,
char ** url_location, char ** url_label);

View File

@@ -59,12 +59,6 @@ gnc_module_init(int refcount) {
return FALSE;
}
/* load the calculation module (we depend on it) */
if(!gnc_module_load("gnucash/network-utils", 0)) {
return FALSE;
}
/* load the calculation module (we depend on it) */
if(!gnc_module_load("gnucash/app-utils", 0)) {
return FALSE;
}

View File

@@ -18,7 +18,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
--library-dir ${top_builddir}/src/backend/file \
--library-dir ${top_builddir}/src/network-utils \
--library-dir ${top_builddir}/src/calculation \
--library-dir ${top_builddir}/src/app-utils \
--library-dir ${top_builddir}/src/gnome-utils

View File

@@ -108,7 +108,6 @@ AM_CFLAGS = \
-I${top_srcdir}/src/core-utils \
-I${top_srcdir}/src/calculation \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/network-utils \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/backend/file \
-I${top_srcdir}/src/gnome-utils \

View File

@@ -36,7 +36,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \
--gnc-module-dir ${top_srcdir}/src/app-utils \
--gnc-module-dir ${top_srcdir}/src/gnome-utils \
--gnc-module-dir ${top_builddir}/src/gnome-utils \
--gnc-module-dir ${top_builddir}/src/network-utils \
--gnc-module-dir ${top_builddir}/src/gnome \
--guile-load-dir ${top_srcdir}/src/scm \
--guile-load-dir ${top_srcdir}/src/import-export \

View File

@@ -30,7 +30,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
--library-dir ${top_builddir}/src/backend/file \
--library-dir ${top_builddir}/src/network-utils \
--library-dir ${top_builddir}/src/calculation \
--library-dir ${top_builddir}/src/app-utils \
--library-dir ${top_builddir}/src/gnome-utils \

View File

@@ -1,32 +0,0 @@
# 2003-03-11 TomF changes for Gnome-2 branch, 5th batch
# Add src/engine to allow including gnc-engine-util.h
SUBDIRS = . test
pkglib_LTLIBRARIES = libgncmod-network-utils.la
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/engine \
${GLIB_CFLAGS} \
${QOF_CFLAGS} \
${GNOME_CFLAGS} \
${GUILE_INCS}
libgncmod_network_utils_la_SOURCES = \
gnc-http.c \
gncmod-network-utils.c
gncincludedir = ${GNC_INCLUDE_DIR}
gncinclude_HEADERS = \
gnc-http.h
libgncmod_network_utils_la_LDFLAGS = -avoid-version
libgncmod_network_utils_la_LIBADD = \
${top_builddir}/src/gnc-module/libgnc-module.la \
${GNOME_LIBS} ${QOF_LIBS}
INCLUDES = -DG_LOG_DOMAIN=\"gnc.net\"

View File

@@ -1,417 +0,0 @@
/********************************************************************
* gnc-gpg.c -- encrypt/decrypt data using GPG and the gnucash *
* keyrings *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
********************************************************************/
#include "config.h"
#include <glib.h>
#include <gnome.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "gnc-gpg.h"
/********************************************************************
* gnc_gpg_transform(_async) : call GPG with specified input and args
* the _async variety returns immediately and calls a callback when
* complete.
********************************************************************/
struct gpg_transform_data {
GString * str;
gint tag;
GncGPGCb cb;
gpointer data;
};
static void
gnc_gpg_transform_helper(gpointer data, gint fd, GdkInputCondition cond) {
struct gpg_transform_data * td = data;
int bytes_read;
char buf[1025];
char * cstr;
buf[1024] = 0;
if(cond == GDK_INPUT_READ) {
while((bytes_read = read(fd, buf, 1024)) == 1024) {
g_string_append(td->str, buf);
}
if(bytes_read > 0) {
buf[bytes_read] = 0;
g_string_append(td->str, buf);
}
else {
/* we're done. call the callback */
gdk_input_remove(td->tag);
cstr = td->str->str;
g_string_free(td->str, FALSE);
(td->cb)(cstr, td->data);
g_free(td);
}
}
else {
gdk_input_remove(td->tag);
}
}
static void
gnc_gpg_transform_async(const gchar * input, gint input_size,
const char * passphrase, char ** gpg_argv,
GncGPGCb cb, gpointer cb_data) {
int pid;
int to_child[2];
int from_child[2];
int bytes;
int total_bytes;
struct gpg_transform_data * td;
/* create a pipe for talking to the child gpg process */
if((pipe(to_child) != 0) || (pipe(from_child) != 0)) {
return;
}
/* create the process. */
if((pid = fork()) != 0) {
close(to_child[0]);
close(from_child[1]);
/* parent process. write passphrase to pipe first. */
if(passphrase) {
total_bytes = 0;
while(total_bytes < (int)strlen(passphrase)) {
bytes = write(to_child[1],
passphrase+total_bytes,
strlen(passphrase)-total_bytes);
if(bytes < 0) {
break;
}
else {
total_bytes += bytes;
}
}
}
/* now write data */
total_bytes = 0;
while(total_bytes < input_size) {
bytes = write(to_child[1], input+total_bytes, input_size-total_bytes);
if(bytes < 0) break;
else {
total_bytes += bytes;
}
}
close(to_child[1]);
td = g_new0(struct gpg_transform_data, 1);
td->str = g_string_new("");
td->cb = cb;
td->data = cb_data;
/* read transformed data back in the input handler */
td->tag = gdk_input_add(from_child[0], GDK_INPUT_READ,
gnc_gpg_transform_helper, td);
}
else {
close(to_child[1]);
close(from_child[0]);
/* child process. Set up pipes. */
close(0);
close(1);
/* stderr to /dev/null ... gpg is a chatty thing */
close(2);
/* hook up the pipes */
dup(to_child[0]);
dup(from_child[1]);
/* new files aren't readable by anybody but the user */
umask(077);
if(execvp("gpg", gpg_argv)) {
char buf[1024];
/* get data from parent */
while((bytes = read(to_child[0], buf, 1024)) > 0) {
bytes = 0;
}
/* give 'em a little back */
write(from_child[1], "\n", 1);
_exit(0);
}
}
}
static void
gnc_gpg_transform_sync_helper(char * output, gpointer data) {
const char ** status = data;
status[1] = output;
status[0] = (char *)1;
}
static char *
gnc_gpg_transform(const gchar * input, gint input_size,
const char * passphrase, char ** gpg_argv) {
char * out[2] = { NULL, NULL };
gnc_gpg_transform_async(input, input_size, passphrase, gpg_argv,
gnc_gpg_transform_sync_helper, (gpointer)out);
while(!out[0]) {
gtk_main_iteration();
}
return out[1];
}
/********************************************************************
* gnc_gpg_encrypt
* transform a cleartext to a crypted text for the given recipient
********************************************************************/
char *
gnc_gpg_encrypt(const gchar * cleartext, int cleartext_size,
const gchar * recipient, const gchar * passphrase) {
char * retval = NULL;
char * argv[] =
{
"gpg",
"-q",
"--batch",
"-sea",
"--keyring",
"~/.gnucash/gnucash.pub",
"--secret-keyring",
"~/.gnucash/gnucash.sec",
"-r",
NULL,
"--passphrase-fd",
"0",
NULL
};
argv[7] = (char *)recipient;
retval = gnc_gpg_transform(cleartext, cleartext_size, passphrase, argv);
return retval;
}
void
gnc_gpg_encrypt_async(const gchar * cleartext, int cleartext_size,
const gchar * recipient, const gchar * passphrase,
GncGPGCb cb, gpointer data) {
char * argv[] =
{
"gpg",
"-q",
"--batch",
"-sea",
"--keyring",
"~/.gnucash/gnucash.pub",
"--secret-keyring",
"~/.gnucash/gnucash.sec",
"-r",
NULL,
"--passphrase-fd",
"0",
NULL
};
argv[7] = (char *)recipient;
gnc_gpg_transform_async(cleartext, cleartext_size, passphrase, argv,
cb, data);
}
/********************************************************************
* gnc_gpg_decrypt
* transform a crypted text into a cleartext.
********************************************************************/
char *
gnc_gpg_decrypt(const gchar * cryptext, int cryptext_size,
const gchar * passphrase) {
char * retval = NULL;
char * argv[] =
{ "gpg",
"-q",
"--batch",
"-da",
"--keyring",
"~/.gnucash/gnucash.pub",
"--secret-keyring",
"~/.gnucash/gnucash.sec",
"--passphrase-fd",
"0",
NULL
};
retval = gnc_gpg_transform(cryptext, cryptext_size, passphrase, argv);
return retval;
}
void
gnc_gpg_decrypt_async(const gchar * cryptext, int cryptext_size,
const gchar * passphrase,
void (* cb)(char * clrtxt, gpointer d),
gpointer data) {
char * argv[] =
{ "gpg",
"-q",
"--batch",
"-da",
"--keyring",
"~/.gnucash/gnucash.pub",
"--secret-keyring",
"~/.gnucash/gnucash.sec",
"--passphrase-fd",
"0",
NULL
};
gnc_gpg_transform_async(cryptext, cryptext_size, passphrase, argv,
cb, data);
}
/********************************************************************
* gnc_gpg_export
* get a public key (ASCII armored)
********************************************************************/
char *
gnc_gpg_export(const gchar * keyname) {
char * retval;
char * argv[] =
{ "gpg",
"-q",
"--export",
"-a",
"--keyring",
"~/.gnucash/gnucash.pub",
NULL,
NULL
};
argv[6] = g_strdup_printf("(%s)", keyname ? keyname : "");
retval = gnc_gpg_transform(NULL, 0, NULL, argv);
g_free(argv[6]);
return retval;
}
void
gnc_gpg_export_async(const gchar * keyname, GncGPGCb cb, gpointer data) {
char * argv[] =
{ "gpg",
"-q",
"--export",
"-a",
"--keyring",
"~/.gnucash/gnucash.pub",
NULL,
NULL
};
argv[6] = g_strdup_printf("(%s)", keyname ? keyname : "");
gnc_gpg_transform_async(NULL, 0, NULL, argv, cb, data);
g_free(argv[6]);
}
/********************************************************************
* gnc_gpg_make_keypair
* make a keypair for gnucash use
********************************************************************/
char *
gnc_gpg_make_keypair(const gchar * username,
const gchar * idstring,
const gchar * email,
const gchar * passphrase) {
char * gpg_input =
g_strdup_printf("Key-Type: DSA\n"
"Key-Length: 1024\n"
"Subkey-Type: ELG-E\n"
"Subkey-Length: 1024\n"
"Name-Real: %s\n"
"Name-Comment: %s\n"
"Name-Email: %s\n"
"Passphrase: %s\n"
"%%commit\n",
username ? username : "",
idstring ? idstring : "",
email ? email : "",
passphrase ? passphrase : "");
char * argv [] =
{ "gpg",
"--batch",
"-q",
"--gen-key",
"--keyring",
"~/.gnucash/gnucash.pub",
"--secret-keyring",
"~/.gnucash/gnucash.sec",
NULL
};
char * retval = gnc_gpg_transform(gpg_input, strlen(gpg_input), NULL, argv);
g_free(gpg_input);
return retval;
}
void
gnc_gpg_make_keypair_async(const gchar * username,
const gchar * idstring,
const gchar * email,
const gchar * passphrase,
GncGPGCb cb, gpointer data) {
char * gpg_input =
g_strdup_printf("Key-Type: DSA\n"
"Key-Length: 1024\n"
"Subkey-Type: ELG-E\n"
"Subkey-Length: 1024\n"
"Name-Real: %s\n"
"Name-Comment: %s\n"
"Name-Email: %s\n"
"Passphrase: %s\n"
"%%commit\n",
username ? username : "",
idstring ? idstring : "",
email ? email : "",
passphrase ? passphrase : "");
char * argv [] =
{ "gpg",
"--batch",
"-q",
"--gen-key",
"--keyring",
"~/.gnucash/gnucash.pub",
"--secret-keyring",
"~/.gnucash/gnucash.sec",
NULL
};
gnc_gpg_transform_async(gpg_input, strlen(gpg_input), NULL, argv, cb, data);
g_free(gpg_input);
}

View File

@@ -1,54 +0,0 @@
/********************************************************************
* gnc-gpg.h -- encrypt/decrypt data using GPG and the gnucash *
* keyrings *
* Copyright (C) 2000-2001 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
********************************************************************/
#ifndef GNC_GPG_H
#define GNC_GPG_H
#include <glib.h>
typedef void (* GncGPGCb)(char * output, gpointer data);
char * gnc_gpg_export(const gchar * keyname);
void gnc_gpg_export_async(const gchar * keyname, GncGPGCb cb,
gpointer data);
char * gnc_gpg_encrypt(const gchar * cleartext, int cleartext_size,
const gchar * recipient, const gchar * passphrase);
void gnc_gpg_encrypt_async(const gchar * cleartext, int cleartext_size,
const gchar * recipient, const gchar * pp,
GncGPGCb cb, gpointer data);
char * gnc_gpg_decrypt(const gchar * crypttext, int crypttext_size,
const gchar * passphrase);
void gnc_gpg_decrypt_async(const gchar * crypttext, int crypttext_size,
const gchar * passphrase,
GncGPGCb cb, gpointer data);
char * gnc_gpg_make_keypair(const gchar * name, const gchar * id,
const gchar * email, const gchar * passphrase);
void gnc_gpg_make_keypair_async(const gchar * name, const gchar * id,
const gchar * email, const gchar * pp,
GncGPGCb cb, gpointer data);
#endif

View File

@@ -1,334 +0,0 @@
/********************************************************************
* gnc-http.c -- handle processing of HTTP requests via gnome-http *
* Copyright (C) 2001 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
********************************************************************/
/********************************************************************
* 3/11/03 TomF Gnome2 changes for Gnome2 *
* gnc_http.c Disable all functions to bypass missing ghttp *
* include "qof.h" to allow PERR warnings *
* Use long if 0 to make it easy to go back to the original to *
* start developing a ghttp replacement. *
*********************************************************************/
#include "config.h"
#if 0
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#ifdef HAVE_GHTTP_SSL_H
#include <ghttp_ssl.h>
#endif /* HAVE_GHTTP_SSL_H */
#endif /* HAVE_OPENSSL */
#include <ghttp.h>
#include <glib.h>
#include <gtk/gtkmain.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
#include "gnc-http.h"
#include "gnc-engine.h" /* To allow PERR messages */
/* ***Warning*** Find a gnome2 replacement for ghttp ***************/
#if 0
struct _gnc_http {
GList * requests;
guint callback_tag;
gint callback_enabled;
};
struct request_info {
gchar * uri;
ghttp_request * request;
GncHTTPRequestCB callback;
gpointer callback_data;
};
#endif
gnc_http *
gnc_http_new(void) {
return NULL;
}
#if 0
gnc_http *
gnc_http_new(void) {
gnc_http * ret = g_new0(struct _gnc_http, 1);
ret->requests = NULL;
ret->callback_tag = 0;
ret->callback_enabled = FALSE;
return ret;
}
void
gnc_http_destroy(gnc_http * http) {
gnc_http_cancel_requests(http);
g_free(http);
}
void
gnc_http_cancel_requests(gnc_http * http) {
GList * current;
if(http->callback_enabled == TRUE) {
/* FIXME : should replace this with glib idle function -- bg */
gtk_timeout_remove(http->callback_tag);
http->callback_enabled = FALSE;
http->callback_tag = 0;
/* go through and destroy all the requests */
for(current = http->requests; current; current = current->next) {
if(current->data) {
struct request_info * r = current->data;
current->data = NULL;
ghttp_request_destroy(r->request);
r->request = NULL;
g_free(r->uri);
g_free(r);
}
}
/* free the list backbone */
g_list_free(http->requests);
http->requests = NULL;
}
}
static gboolean
ghttp_check_callback(gpointer data) {
gnc_http * http = data;
GList * current = NULL;
ghttp_status status;
struct request_info * req = NULL;
/* walk the request list to deal with any complete requests */
for(current = http->requests; current; current = current->next) {
req = current->data;
if(!req) {
g_warning("NULL request.");
continue;
}
status = ghttp_process(req->request);
switch(status) {
case ghttp_done:
if(req->callback) {
(req->callback)(req->uri, TRUE,
ghttp_get_body(req->request),
ghttp_get_body_len(req->request),
req->callback_data);
}
ghttp_request_destroy(req->request);
req->request = NULL;
current->data = NULL;
g_free(req);
break;
case ghttp_error:
if(req->callback) {
(req->callback)(req->uri, FALSE,
ghttp_get_error(req->request),
strlen(ghttp_get_error(req->request)),
req->callback_data);
}
ghttp_request_destroy(req->request);
req->request = NULL;
current->data = NULL;
g_free(req);
break;
case ghttp_not_done:
break;
}
}
/* walk the list again to remove dead requests */
current = http->requests;
while(current) {
if(current->data == NULL) {
http->requests = g_list_remove_link(http->requests, current);
current = http->requests;
}
else {
current = current->next;
}
}
/* if all requests are done, disable the timeout */
if(http->requests == NULL) {
http->callback_enabled = FALSE;
http->callback_tag = 0;
return FALSE;
}
else {
return TRUE;
}
}
#ifdef HAVE_OPENSSL
static int
gnc_http_certificate_check_cb(ghttp_request * req, X509 * cert,
void * user_data) {
printf("checking SSL certificate...");
X509_print_fp(stdout, cert);
printf(" ... done\n");
return TRUE;
}
#endif
void
gnc_http_start_request(gnc_http * http, const gchar * uri,
GncHTTPRequestCB cb, gpointer user_data) {
struct request_info * info = g_new0(struct request_info, 1);
const gchar *oldlocale;
info->request = ghttp_request_new();
info->uri = g_strdup (uri);
info->callback = cb;
info->callback_data = user_data;
#ifdef HAVE_OPENSSL
ghttp_enable_ssl(info->request);
ghttp_set_ssl_certificate_callback(info->request,
gnc_http_certificate_check_cb,
(void *)http);
#endif
ghttp_set_uri(info->request, strdup(uri));
ghttp_set_header(info->request, http_hdr_User_Agent,
strdup(PACKAGE "/" VERSION " ; http://gnucash.org"));
ghttp_set_sync(info->request, ghttp_async);
ghttp_set_type(info->request, ghttp_type_get);
ghttp_prepare(info->request);
oldlocale = setlocale(LC_NUMERIC, "C");
ghttp_process(info->request);
setlocale(LC_NUMERIC, oldlocale);
http->requests = g_list_append(http->requests, info);
/* start the gtk timeout if not started */
/* FIXME : should replace this with glib idle function -- bg */
if(!http->callback_enabled) {
http->callback_tag =
g_timeout_add(100, ghttp_check_callback, http);
http->callback_enabled = TRUE;
}
}
void
gnc_http_start_post(gnc_http * http, const char * uri,
const char * content_type,
const char * data, int datalen,
GncHTTPRequestCB cb, gpointer user_data) {
struct request_info * info = g_new0(struct request_info, 1);
char * new_body = malloc(datalen);
info->request = ghttp_request_new();
info->uri = g_strdup (uri);
info->callback = cb;
info->callback_data = user_data;
#ifdef HAVE_OPENSSL
ghttp_enable_ssl(info->request);
ghttp_set_ssl_certificate_callback(info->request,
gnc_http_certificate_check_cb,
(void *)http);
#endif
ghttp_set_uri(info->request, strdup(uri));
ghttp_set_header(info->request, http_hdr_User_Agent,
strdup(PACKAGE "/" VERSION " ; http://gnucash.org"));
ghttp_set_header(info->request, http_hdr_Content_Type, content_type);
ghttp_set_sync(info->request, ghttp_async);
ghttp_set_type(info->request, ghttp_type_post);
memcpy(new_body, data, datalen);
ghttp_set_body(info->request, (char*)new_body, datalen);
ghttp_prepare(info->request);
ghttp_process(info->request);
http->requests = g_list_append(http->requests, info);
/* start the gtk timeout if not started */
if(!http->callback_enabled) {
http->callback_tag =
g_timeout_add(100, ghttp_check_callback, http);
http->callback_enabled = TRUE;
}
}
#else
static QofLogModule log_module = GNC_MOD_IO;
/* ***Warning*** Find a gnome2 replacement for ghttp ***************/
void
gnc_http_destroy(gnc_http * http) {
PERR ("***Warning*** Find a gnome2 replacement for ghttp *******");
return;
}
void
gnc_http_cancel_requests(gnc_http * http) {
PERR ("***Warning*** Find a gnome2 replacement for ghttp *******");
return;
}
#ifdef HAVE_OPENSSL
static int
gnc_http_certificate_check_cb(ghttp_request * req, X509 * cert,
void * user_data) {
PERR ("***Warning*** Find a gnome2 replacement for ghttp *******");
return;
}
#endif
void
gnc_http_start_request(gnc_http * http, const gchar * uri,
GncHTTPRequestCB cb, gpointer user_data) {
PERR ("***Warning*** Find a gnome2 replacement for ghttp *******");
return;
}
void
gnc_http_start_post(gnc_http * http, const char * uri,
const char * content_type,
const char * data, int datalen,
GncHTTPRequestCB cb, gpointer user_data) {
PERR ("***Warning*** Find a gnome2 replacement for ghttp *******");
return;
}
/* ***Warning*** Find a gnome2 replacement for ghttp *************/
#endif

View File

@@ -1,43 +0,0 @@
/********************************************************************
* gnc-http.h -- handle HTTP requests. thin wrapper on gnome-http. *
* Copyright (C) 2001 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
********************************************************************/
#ifndef GNC_HTTP_H
#define GNC_HTTP_H
#include <glib.h>
typedef struct _gnc_http gnc_http;
typedef void (* GncHTTPRequestCB)(const char * uri, int completed_ok,
const char * body, int body_len,
gpointer user_data);
gnc_http * gnc_http_new(void);
void gnc_http_destroy(gnc_http * html);
void gnc_http_start_request(gnc_http * http, const char * uri,
GncHTTPRequestCB cb, gpointer user_data);
void gnc_http_start_post(gnc_http * http, const char * uri,
const char * content_type,
const char * body, int body_len,
GncHTTPRequestCB cb, gpointer user_data);
void gnc_http_cancel_requests(gnc_http * http);
#endif

View File

@@ -1,41 +0,0 @@
/*********************************************************************
* gncmod-netword-utils.c
* module definition/initialization for network communication utilities
*
* Copyright (c) 2001 Linux Developers Group, Inc.
*********************************************************************/
#include <gmodule.h>
#include <libguile.h>
#include "gnc-module.h"
#include "gnc-module-api.h"
/* version of the gnc module system interface we require */
int gnc_module_system_interface = 0;
/* module versioning uses libtool semantics. */
int gnc_module_current = 0;
int gnc_module_revision = 0;
int gnc_module_age = 0;
char *
gnc_module_path(void) {
return g_strdup("gnucash/network-utils");
}
char *
gnc_module_description(void) {
return g_strdup("Utilities for performing network communication");
}
int
gnc_module_init(int refcount) {
return TRUE;
}
int
gnc_module_end(int refcount) {
return TRUE;
}

View File

@@ -1,32 +0,0 @@
# 2003-03-11 TomF changes for Gnome-2 branch, 6th batch
# src/network-utils/test/Makefile.am:
# Add libgncmod-engine.la to fix undefined ref to `gnc_should_log'
TESTS = \
test-link-module \
test-load-module
GNC_TEST_DEPS := \
--gnc-module-dir ${top_builddir}/src/network-utils \
--guile-load-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/lib/libqof/qof \
--library-dir ${top_builddir}/src/core-utils \
--library-dir ${top_builddir}/src/gnc-module
TESTS_ENVIRONMENT := \
$(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS})
check_PROGRAMS = \
test-link-module
test_link_module_SOURCES=test-link-module.c
test_link_module_LDADD= \
${top_builddir}/src/engine/libgncmod-engine.la \
../libgncmod-network-utils.la
EXTRA_DIST = test-load-module
AM_CFLAGS = \
-I${top_srcdir}/src/test-core \
-I.. \
${GLIB_CFLAGS}

View File

@@ -1,6 +0,0 @@
#include <stdlib.h>
int
main(int argc, char ** argv) {
exit(0);
}

View File

@@ -1,11 +0,0 @@
#! /bin/sh
exec guile -s $0
!#
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
(display " testing network-utils module load ... ")
(gnc:module-load "gnucash/network-utils" 0)
(display " ok\n")

View File

@@ -13,7 +13,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
--library-dir ${top_builddir}/src/backend/file \
--library-dir ${top_builddir}/src/network-utils \
--library-dir ${top_builddir}/src/calculation \
--library-dir ${top_builddir}/src/app-utils \
--library-dir ${top_builddir}/src/gnome-utils \

View File

@@ -11,7 +11,6 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
--library-dir ${top_builddir}/src/backend/file \
--library-dir ${top_builddir}/src/network-utils \
--library-dir ${top_builddir}/src/calculation \
--library-dir ${top_builddir}/src/app-utils \
--library-dir ${top_builddir}/src/gnome-utils \