diff options
author | npmccallum <npmccallum@c587cffe-e639-0410-9787-d7902ae8ed56> | 2007-11-07 16:59:04 +0000 |
---|---|---|
committer | npmccallum <npmccallum@c587cffe-e639-0410-9787-d7902ae8ed56> | 2007-11-07 16:59:04 +0000 |
commit | 7d7d7156372abaeaef1e7b47e2048b1fe517e414 (patch) | |
tree | fde3b8733fd231c72899b6c39c77589adacf3c93 | |
parent | 56bf831f6d7d68a4633f1f0bde545ce98bf7a58d (diff) | |
download | libproxy-7d7d7156372abaeaef1e7b47e2048b1fe517e414.tar.gz |
initial skeleton of file plugin
git-svn-id: http://libproxy.googlecode.com/svn/trunk@37 c587cffe-e639-0410-9787-d7902ae8ed56
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/plugins/Makefile.am | 8 | ||||
-rw-r--r-- | src/plugins/file.c | 56 |
3 files changed, 64 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 76cf3ec..198bd5f 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,7 @@ echo echo "------------------------------------------------------" echo -e "\tPlugins to build..." echo -e "\t\tenvvar\t\t\tyes" +echo -e "\t\tfile\t\t\tyes" echo -e "\t\tmozjs\t\t\t$with_mozjs" echo -e "\t\tgnome\t\t\t$with_gnome" echo -e "\t\tnetworkmanager\t\t$with_networkmanager" diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index cb50d71..9879754 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -1,7 +1,7 @@ plugindir = @PLUGINDIR@ # Which modules to build -plugin_LTLIBRARIES = envvar.la +plugin_LTLIBRARIES = envvar.la file.la if WITH_MOZJS plugin_LTLIBRARIES += mozjs.la endif @@ -18,6 +18,12 @@ envvar_la_CFLAGS = -I../lib envvar_la_LIBADD = ../lib/libproxy.la envvar_la_LDFLAGS = -module -avoid-version +# File Config Plugin +file_la_SOURCES = file.c +file_la_CFLAGS = -I../lib +file_la_LIBADD = ../lib/libproxy.la +file_la_LDFLAGS = -module -avoid-version + # Mozilla (Spidermonkey) based PAC runner mozjs_la_SOURCES = mozjs.c mozjs_la_CFLAGS = -I../lib @MOZJS_CFLAGS@ diff --git a/src/plugins/file.c b/src/plugins/file.c new file mode 100644 index 0000000..2551e4f --- /dev/null +++ b/src/plugins/file.c @@ -0,0 +1,56 @@ +/******************************************************************************* + * libproxy - A library for proxy configuration + * Copyright (C) 2006 Nathaniel McCallum <nathaniel@natemccallum.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + ******************************************************************************/ + +#include <stdlib.h> +#include <string.h> + +#include <misc.h> +#include <proxy_factory.h> + + +pxConfig *get_config_from_file(char *filename) +{ + return NULL; +} + +pxConfig *system_get_config_cb(pxProxyFactory *self) +{ + return get_config_from_file("/etc/proxy.conf"); +} + +pxConfig *user_get_config_cb(pxProxyFactory *self) +{ + return get_config_from_file("~/.proxy.conf"); +} + +bool on_proxy_factory_instantiate(pxProxyFactory *self) +{ + bool a, b; + a = px_proxy_factory_config_add(self, "file_system", PX_CONFIG_CATEGORY_SYSTEM, + (pxProxyFactoryPtrCallback) system_get_config_cb); + b = px_proxy_factory_config_add(self, "file_user", PX_CONFIG_CATEGORY_USER, + (pxProxyFactoryPtrCallback) user_get_config_cb); + return (a || b); +} + +void on_proxy_factory_destantiate(pxProxyFactory *self) +{ + px_proxy_factory_config_del(self, "file_system"); + px_proxy_factory_config_del(self, "file_user"); +} |