summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorSebastian Nowicki <sebnow@gmail.com>2009-04-04 10:17:30 +0200
committerDan McGee <dan@archlinux.org>2009-07-23 04:27:46 +0200
commit30c4d53ce5c16cbbb17a88fe1ad14faf53d91999 (patch)
treeb2f41fd8fc49733f6487c3a4ecf7dbc919fdde43 /lib/libalpm/handle.c
parent1d19f0896ccc1560a7e2f5b93cfe095b4aefe84a (diff)
downloadpacman-30c4d53ce5c16cbbb17a88fe1ad14faf53d91999.tar.gz
pacman-30c4d53ce5c16cbbb17a88fe1ad14faf53d91999.tar.xz
Add a fetch callback to allow front-end download support
This allows a frontend to define its own download algorithm so that the libfetch dependency can be omitted without using an external process. The callback will be used when if it is defined, otherwise the old behavior applies. Signed-off-by: Sebastian Nowicki <sebnow@gmail.com> [Dan: minor cleanups] Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 34115b38..d1a35ad9 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -79,7 +79,6 @@ void _alpm_handle_free(pmhandle_t *handle)
FREELIST(handle->cachedirs);
FREE(handle->logfile);
FREE(handle->lockfile);
- FREE(handle->xfercommand);
FREELIST(handle->dbs_sync);
FREELIST(handle->noupgrade);
FREELIST(handle->noextract);
@@ -106,6 +105,15 @@ alpm_cb_download SYMEXPORT alpm_option_get_dlcb()
return handle->dlcb;
}
+alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb()
+{
+ if (handle == NULL) {
+ pm_errno = PM_ERR_HANDLE_NULL;
+ return NULL;
+ }
+ return handle->fetchcb;
+}
+
alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb()
{
if (handle == NULL) {
@@ -205,15 +213,6 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
return handle->ignoregrp;
}
-const char SYMEXPORT *alpm_option_get_xfercommand()
-{
- if (handle == NULL) {
- pm_errno = PM_ERR_HANDLE_NULL;
- return NULL;
- }
- return handle->xfercommand;
-}
-
unsigned short SYMEXPORT alpm_option_get_nopassiveftp()
{
if (handle == NULL) {
@@ -259,6 +258,15 @@ void SYMEXPORT alpm_option_set_dlcb(alpm_cb_download cb)
handle->dlcb = cb;
}
+void SYMEXPORT alpm_option_set_fetchcb(alpm_cb_fetch cb)
+{
+ if (handle == NULL) {
+ pm_errno = PM_ERR_HANDLE_NULL;
+ return;
+ }
+ handle->fetchcb = cb;
+}
+
void SYMEXPORT alpm_option_set_totaldlcb(alpm_cb_totaldl cb)
{
if (handle == NULL) {
@@ -521,12 +529,6 @@ int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
return(0);
}
-void SYMEXPORT alpm_option_set_xfercommand(const char *cmd)
-{
- if(handle->xfercommand) FREE(handle->xfercommand);
- if(cmd) handle->xfercommand = strdup(cmd);
-}
-
void SYMEXPORT alpm_option_set_nopassiveftp(unsigned short nopasv)
{
handle->nopassiveftp = nopasv;