From a36ded25eb9bdea5b73c33f993820b657f9e6623 Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Sun, 9 Oct 2005 06:09:57 +0000 Subject: added conversation callback support for transactions --- src/pacman/trans.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src/pacman/trans.c') diff --git a/src/pacman/trans.c b/src/pacman/trans.c index 90341770..2840fca2 100644 --- a/src/pacman/trans.c +++ b/src/pacman/trans.c @@ -36,7 +36,7 @@ /* Callback to handle transaction events */ -void cb_trans(unsigned char event, void *data1, void *data2) +void cb_trans_evt(unsigned char event, void *data1, void *data2) { char str[LOG_STR_LEN] = ""; @@ -93,4 +93,37 @@ void cb_trans(unsigned char event, void *data1, void *data2) } } +void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, int *response) +{ + char str[LOG_STR_LEN] = ""; + + switch(event) { + case PM_TRANS_CONV_INSTALL_IGNOREPKG: + snprintf(str, LOG_STR_LEN, ":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] ", + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME)); + *response = yesno(str); + break; + case PM_TRANS_CONV_REPLACE_PKG: + snprintf(str, LOG_STR_LEN, ":: Replace %s with %s from \"%s\"? [Y/n] ", + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data2, PM_PKG_NAME), + (char *)data3); + *response = yesno(str); + break; + case PM_TRANS_CONV_LOCAL_NEWER: + snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is newer. Upgrade anyway? [Y/n] ", + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); + *response = yesno(str); + break; + case PM_TRANS_CONV_LOCAL_UPTODATE: + snprintf(str, LOG_STR_LEN, ":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] ", + (char *)alpm_pkg_getinfo(data1, PM_PKG_NAME), + (char *)alpm_pkg_getinfo(data1, PM_PKG_VERSION)); + *response = yesno(str); + break; + } +} + /* vim: set ts=2 sw=2 noet: */ -- cgit v1.2.3