commit:     34130dbd1646b428aa766cb957629ed6e7c270cb
Author:     Alexander Tsoy <alexander <AT> tsoy <DOT> me>
AuthorDate: Sat Aug 10 01:01:18 2019 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Jan 17 06:23:37 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34130dbd

net-p2p/amule: EAPI=7 bump

* add missing pkgconfig dependency
* convert myconf variable to array
* remove obsolete imule blocker
* fix license
* fix build with >=net-libs/libupnp-1.8
* switch to acct-{user,group}

Signed-off-by: Alexander Tsoy <alexander <AT> tsoy.me>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 net-p2p/amule/amule-2.3.2-r4.ebuild               | 126 ++++++++
 net-p2p/amule/files/amule-2.3.2-libupnp-1.6.patch | 350 ++++++++++++++++++++++
 net-p2p/amule/files/amule-2.3.2-libupnp-1.8.patch | 263 ++++++++++++++++
 net-p2p/amule/files/amuled.confd-r1               |   9 +
 net-p2p/amule/files/amuleweb.confd-r1             |  24 ++
 5 files changed, 772 insertions(+)

diff --git a/net-p2p/amule/amule-2.3.2-r4.ebuild 
b/net-p2p/amule/amule-2.3.2-r4.ebuild
new file mode 100644
index 00000000000..8199a8471f0
--- /dev/null
+++ b/net-p2p/amule/amule-2.3.2-r4.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+WX_GTK_VER="3.0-gtk3"
+
+inherit wxwidgets
+
+MY_P="${PN/m/M}-${PV}"
+
+DESCRIPTION="aMule, the all-platform eMule p2p client"
+HOMEPAGE="http://www.amule.org/";
+SRC_URI="https://download.sourceforge.net/${PN}/${MY_P}.tar.xz";
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86"
+IUSE="daemon debug geoip nls remote stats upnp +X"
+
+RDEPEND="
+       dev-libs/boost:=
+       dev-libs/crypto++:=
+       sys-libs/binutils-libs:0=
+       sys-libs/zlib
+       >=x11-libs/wxGTK-3.0.4:${WX_GTK_VER}[X?]
+       daemon? ( acct-user/amule )
+       geoip? ( dev-libs/geoip )
+       remote? (
+               acct-user/amule
+               media-libs/libpng:0=
+       )
+       stats? ( media-libs/gd:=[jpeg,png] )
+       upnp? ( net-libs/libupnp:0 )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-2.3.2-fix-crash-shared-dir-utf8.patch"
+       "${FILESDIR}/${PN}-2.3.2-fix-crash-closing-last-search-tab-1.patch"
+       "${FILESDIR}/${PN}-2.3.2-fix-crash-closing-last-search-tab-2.patch"
+       "${FILESDIR}/${PN}-2.3.2-cryptopp-6.patch"
+       "${FILESDIR}/${PN}-2.3.2-disable-version-check.patch"
+       "${FILESDIR}/${PN}-2.3.2-fix-crash-when-shared-files-changed.patch"
+       "${FILESDIR}/${PN}-2.3.2-libupnp-1.8.patch"
+       "${FILESDIR}/${PN}-2.3.2-libupnp-1.6.patch"
+)
+
+pkg_setup() {
+       setup-wxwidgets
+}
+
+src_configure() {
+       local myconf=(
+               --with-denoise-level=0
+               --with-wx-config="${WX_CONFIG}"
+               --enable-amulecmd
+               --with-boost
+               $(use_enable debug)
+               $(use_enable daemon amule-daemon)
+               $(use_enable geoip)
+               $(use_enable nls)
+               $(use_enable remote webserver)
+               $(use_enable stats cas)
+               $(use_enable stats alcc)
+               $(use_enable upnp)
+       )
+
+       if use X; then
+               myconf+=(
+                       $(use_enable remote amule-gui)
+                       $(use_enable stats alc)
+                       $(use_enable stats wxcas)
+               )
+       else
+               myconf+=(
+                       --disable-monolithic
+                       --disable-amule-gui
+                       --disable-alc
+                       --disable-wxcas
+               )
+       fi
+
+       econf "${myconf[@]}"
+}
+
+src_install() {
+       default
+
+       if use daemon; then
+               newconfd "${FILESDIR}"/amuled.confd-r1 amuled
+               newinitd "${FILESDIR}"/amuled.initd amuled
+       fi
+       if use remote; then
+               newconfd "${FILESDIR}"/amuleweb.confd-r1 amuleweb
+               newinitd "${FILESDIR}"/amuleweb.initd amuleweb
+       fi
+
+       if use daemon || use remote; then
+               keepdir /var/lib/${PN}
+               fowners amule:amule /var/lib/${PN}
+               fperms 0750 /var/lib/${PN}
+       fi
+}
+
+pkg_postinst() {
+       local ver
+
+       if use daemon || use remote; then
+               for ver in ${REPLACING_VERSIONS}; do
+                       if ver_test ${ver} -lt "2.3.2-r4"; then
+                               elog "Default user under which amuled and 
amuleweb daemons are started"
+                               elog "have been changed from p2p to amule. 
Default home directory have been"
+                               elog "changed as well."
+                               echo
+                               elog "If you want to preserve old 
download/share location, you can create"
+                               elog "symlink /var/lib/amule/.aMule pointing to 
the old location and adjust"
+                               elog "files ownership *or* restore AMULEUSER 
and AMULEHOME variables in"
+                               elog "/etc/conf.d/{amuled,amuleweb} to the old 
values."
+
+                               break
+                       fi
+               done
+       fi
+}

diff --git a/net-p2p/amule/files/amule-2.3.2-libupnp-1.6.patch 
b/net-p2p/amule/files/amule-2.3.2-libupnp-1.6.patch
new file mode 100644
index 00000000000..0fd0edfbd8f
--- /dev/null
+++ b/net-p2p/amule/files/amule-2.3.2-libupnp-1.6.patch
@@ -0,0 +1,350 @@
+From cb30875bd4e45736ff4ee1137ff97316295ff7be Mon Sep 17 00:00:00 2001
+From: Pablo Barciela <s...@riseup.net>
+Date: Sat, 24 Nov 2018 01:23:58 +0100
+Subject: [PATCH] Fix build with libupnp 1.6
+
+---
+ src/UPnPBase.cpp | 138 ++++++++++++++++++++++++++++++++++++++++++++++-
+ src/UPnPBase.h   |   6 +++
+ 2 files changed, 142 insertions(+), 2 deletions(-)
+
+diff --git a/src/UPnPBase.cpp b/src/UPnPBase.cpp
+index d4063a136..774ebfc32 100644
+--- a/src/UPnPBase.cpp
++++ b/src/UPnPBase.cpp
+@@ -1127,7 +1127,11 @@ bool CUPnPControlPoint::PrivateDeletePortMapping(
+ 
+ 
+ // This function is static
++#if UPNP_VERSION >= 10800
+ int CUPnPControlPoint::Callback(Upnp_EventType_e EventType, const void 
*Event, void * /*Cookie*/)
++#else
++int CUPnPControlPoint::Callback(Upnp_EventType EventType, void *Event, void * 
/*Cookie*/)
++#endif
+ {
+       std::ostringstream msg;
+       std::ostringstream msg2;
+@@ -1149,25 +1153,47 @@ int CUPnPControlPoint::Callback(Upnp_EventType_e 
EventType, const void *Event, v
+               msg2<< "UPNP_DISCOVERY_SEARCH_RESULT: ";
+               // UPnP Discovery
+ upnpDiscovery:
++#if UPNP_VERSION >= 10800
+               UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
++#else
++              struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
++#endif
+               IXML_Document *doc = NULL;
++#if UPNP_VERSION >= 10800
+               int errCode = UpnpDiscovery_get_ErrCode(d_event);
+               if (errCode != UPNP_E_SUCCESS) {
+                       msg << UpnpGetErrorMessage(errCode) << ".";
++#else
++              int ret;
++              if (d_event->ErrCode != UPNP_E_SUCCESS) {
++                      msg << UpnpGetErrorMessage(d_event->ErrCode) << ".";
++#endif
+                       AddDebugLogLineC(logUPnP, msg);
+               }
+               // Get the XML tree device description in doc
++#if UPNP_VERSION >= 10800
+               const char *location = UpnpDiscovery_get_Location_cstr(d_event);
+               int ret = UpnpDownloadXmlDoc(location, &doc);
++#else
++              ret = UpnpDownloadXmlDoc(d_event->Location, &doc);
++#endif
+               if (ret != UPNP_E_SUCCESS) {
+                       msg << "Error retrieving device description from " <<
++#if UPNP_VERSION >= 10800
+                               location << ": " <<
++#else
++                              d_event->Location << ": " <<
++#endif
+                               UpnpGetErrorMessage(ret) <<
+                               "(" << ret << ").";
+                       AddDebugLogLineC(logUPnP, msg);
+               } else {
+                       msg2 << "Retrieving device description from " <<
++#if UPNP_VERSION >= 10800
+                               location << ".";
++#else
++                              d_event->Location << ".";
++#endif
+                       AddDebugLogLineN(logUPnP, msg2);
+               }
+               if (doc) {
+@@ -1195,9 +1221,14 @@ upnpDiscovery:
+                                       AddDebugLogLineC(logUPnP, msg);
+                               }
+                               // Add the root device to our list
++#if UPNP_VERSION >= 10800
+                               int expires = 
UpnpDiscovery_get_Expires(d_event);
+                               upnpCP->AddRootDevice(rootDevice, urlBase,
+                                       location, expires);
++#else
++                              upnpCP->AddRootDevice(rootDevice, urlBase,
++                                      d_event->Location, d_event->Expires);
++#endif
+                       }
+                       // Free the XML doc tree
+                       IXML::Document::Free(doc);
+@@ -1218,35 +1249,62 @@ upnpDiscovery:
+       case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
+               //fprintf(stderr, "Callback: 
UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE\n");
+               // UPnP Device Removed
++#if UPNP_VERSION >= 10800
+               UpnpDiscovery *dab_event = (UpnpDiscovery *)Event;
+               int errCode = UpnpDiscovery_get_ErrCode(dab_event);
+               if (errCode != UPNP_E_SUCCESS) {
++#else
++              struct Upnp_Discovery *dab_event = (struct Upnp_Discovery 
*)Event;
++              if (dab_event->ErrCode != UPNP_E_SUCCESS) {
++#endif
+                       msg << "error(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE): " <<
++#if UPNP_VERSION >= 10800
+                               UpnpGetErrorMessage(errCode) <<
++#else
++                              UpnpGetErrorMessage(dab_event->ErrCode) <<
++#endif
+                               ".";
+                       AddDebugLogLineC(logUPnP, msg);
+               }
++#if UPNP_VERSION >= 10800
+               std::string devType = 
UpnpDiscovery_get_DeviceType_cstr(dab_event);
++#else
++              std::string devType = dab_event->DeviceType;
++#endif
+               // Check for an InternetGatewayDevice and removes it from the 
list
+-              std::transform(devType.begin(), devType.end(),
+-                      devType.begin(), tolower);
++
++              std::transform(devType.begin(), devType.end(), devType.begin(), 
tolower);
++
+               if (stdStringIsEqualCI(devType, UPnP::Device::IGW)) {
++#if UPNP_VERSION >= 10800
+                       const char *deviceID =
+                               UpnpDiscovery_get_DeviceID_cstr(dab_event);
+                       upnpCP->RemoveRootDevice(deviceID);
++#else
++                      upnpCP->RemoveRootDevice(dab_event->DeviceId);
++#endif
+               }
+               break;
+       }
+       case UPNP_EVENT_RECEIVED: {
+               //fprintf(stderr, "Callback: UPNP_EVENT_RECEIVED\n");
+               // Event reveived
++#if UPNP_VERSION >= 10800
+               UpnpEvent *e_event = (UpnpEvent *)Event;
+               int eventKey = UpnpEvent_get_EventKey(e_event);
+               IXML_Document *changedVariables =
+                       UpnpEvent_get_ChangedVariables(e_event);
+               const std::string sid = UpnpEvent_get_SID_cstr(e_event);
++#else
++              struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
++              const std::string Sid = e_event->Sid;
++#endif
+               // Parses the event
++#if UPNP_VERSION >= 10800
+               upnpCP->OnEventReceived(sid, eventKey, changedVariables);
++#else
++              upnpCP->OnEventReceived(Sid, e_event->EventKey, 
e_event->ChangedVariables);
++#endif
+               break;
+       }
+       case UPNP_EVENT_SUBSCRIBE_COMPLETE:
+@@ -1261,19 +1319,38 @@ upnpDiscovery:
+               //fprintf(stderr, "Callback: UPNP_EVENT_RENEWAL_COMPLETE\n");
+               msg << "error(UPNP_EVENT_RENEWAL_COMPLETE): ";
+ upnpEventRenewalComplete:
++#if UPNP_VERSION >= 10800
+               UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
+               int errCode = UpnpEventSubscribe_get_ErrCode(es_event);
+               if (errCode != UPNP_E_SUCCESS) {
++#else
++              struct Upnp_Event_Subscribe *es_event =
++                      (struct Upnp_Event_Subscribe *)Event;
++              if (es_event->ErrCode != UPNP_E_SUCCESS) {
++#endif
+                       msg << "Error in Event Subscribe Callback";
++#if UPNP_VERSION >= 10800
+                       UPnP::ProcessErrorMessage(msg.str(), errCode, NULL, 
NULL);
++#else
++                      UPnP::ProcessErrorMessage(
++                              msg.str(), es_event->ErrCode, NULL, NULL);
++#endif
+               } else {
+ #if 0
++#if UPNP_VERSION >= 10800
++
+                       const UpnpString *publisherUrl =
+                               UpnpEventSubscribe_get_PublisherUrl(es_event);
+                       const char *sid = UpnpEvent_get_SID_cstr(es_event);
+                       int timeOut = UpnpEvent_get_TimeOut(es_event);
+                       TvCtrlPointHandleSubscribeUpdate(
+                               publisherUrl, sid, timeOut);
++#else
++                      TvCtrlPointHandleSubscribeUpdate(
++                              GET_UPNP_STRING(es_event->PublisherUrl),
++                              es_event->Sid,
++                              es_event->TimeOut );
++#endif
+ #endif
+               }
+               break;
+@@ -1288,31 +1365,56 @@ upnpEventRenewalComplete:
+               msg << "error(UPNP_EVENT_SUBSCRIPTION_EXPIRED): ";
+               msg2 << "UPNP_EVENT_SUBSCRIPTION_EXPIRED: ";
+ upnpEventSubscriptionExpired:
++#if UPNP_VERSION >= 10800
+               UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
++#else
++              struct Upnp_Event_Subscribe *es_event =
++                      (struct Upnp_Event_Subscribe *)Event;
++#endif
+               Upnp_SID newSID;
+               memset(newSID, 0, sizeof(Upnp_SID));
+               int TimeOut = 1801;
++#if UPNP_VERSION >= 10800
+               const char *publisherUrl =
+                       UpnpEventSubscribe_get_PublisherUrl_cstr(es_event);
++#endif
+               int ret = UpnpSubscribe(
+                       upnpCP->m_UPnPClientHandle,
++#if UPNP_VERSION >= 10800
+                       publisherUrl,
++#else
++                      GET_UPNP_STRING(es_event->PublisherUrl),
++#endif
+                       &TimeOut,
+                       newSID);
+               if (ret != UPNP_E_SUCCESS) {
+                       msg << "Error Subscribing to EventURL";
++#if UPNP_VERSION >= 10800
+                       int errCode = UpnpEventSubscribe_get_ErrCode(es_event);
++#endif
+                       UPnP::ProcessErrorMessage(
++#if UPNP_VERSION >= 10800
+                               msg.str(), errCode, NULL, NULL);
++#else
++                              msg.str(), es_event->ErrCode, NULL, NULL);
++#endif
+               } else {
+                       ServiceMap::iterator it =
++#if UPNP_VERSION >= 10800
+                               upnpCP->m_ServiceMap.find(publisherUrl);
++#else
++                              
upnpCP->m_ServiceMap.find(GET_UPNP_STRING(es_event->PublisherUrl));
++#endif
+                       if (it != upnpCP->m_ServiceMap.end()) {
+                               CUPnPService &service = *(it->second);
+                               service.SetTimeout(TimeOut);
+                               service.SetSID(newSID);
+                               msg2 << "Re-subscribed to EventURL '" <<
++#if UPNP_VERSION >= 10800
+                                       publisherUrl <<
++#else
++                                      GET_UPNP_STRING(es_event->PublisherUrl) 
<<
++#endif
+                                       "' with SID == '" <<
+                                       newSID << "'.";
+                               AddDebugLogLineC(logUPnP, msg2);
+@@ -1331,19 +1433,34 @@ upnpEventSubscriptionExpired:
+       case UPNP_CONTROL_ACTION_COMPLETE: {
+               //fprintf(stderr, "Callback: UPNP_CONTROL_ACTION_COMPLETE\n");
+               // This is here if we choose to do this asynchronously
++#if UPNP_VERSION >= 10800
+               UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
+               int errCode = UpnpActionComplete_get_ErrCode(a_event);
+               IXML_Document *actionResult =
+                       UpnpActionComplete_get_ActionResult(a_event);
+               if (errCode != UPNP_E_SUCCESS) {
++#else
++              struct Upnp_Action_Complete *a_event =
++                      (struct Upnp_Action_Complete *)Event;
++              if (a_event->ErrCode != UPNP_E_SUCCESS) {
++#endif
+                       UPnP::ProcessErrorMessage(
+                               "UpnpSendActionAsync",
++#if UPNP_VERSION >= 10800
+                               errCode, NULL,
+                               actionResult);
++#else
++                              a_event->ErrCode, NULL,
++                              a_event->ActionResult);
++#endif
+               } else {
+                       // Check the response document
+                       UPnP::ProcessActionResponse(
++#if UPNP_VERSION >= 10800
+                               actionResult,
++#else
++                              a_event->ActionResult,
++#endif
+                               "<UpnpSendActionAsync>");
+               }
+               /* No need for any processing here, just print out results.
+@@ -1354,17 +1471,28 @@ upnpEventSubscriptionExpired:
+       case UPNP_CONTROL_GET_VAR_COMPLETE: {
+               //fprintf(stderr, "Callback: UPNP_CONTROL_GET_VAR_COMPLETE\n");
+               msg << "error(UPNP_CONTROL_GET_VAR_COMPLETE): ";
++#if UPNP_VERSION >= 10800
+               UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
+               int errCode = UpnpStateVarComplete_get_ErrCode(sv_event);
+               if (errCode != UPNP_E_SUCCESS) {
++#else
++              struct Upnp_State_Var_Complete *sv_event =
++                      (struct Upnp_State_Var_Complete *)Event;
++              if (sv_event->ErrCode != UPNP_E_SUCCESS) {
++#endif
+                       msg << "m_UpnpGetServiceVarStatusAsync";
+                       UPnP::ProcessErrorMessage(
++#if UPNP_VERSION >= 10800
+                               msg.str(), errCode, NULL, NULL);
++#else
++                              msg.str(), sv_event->ErrCode, NULL, NULL);
++#endif
+               } else {
+ #if 0
+                       // Warning: The use of UpnpGetServiceVarStatus and
+                       // UpnpGetServiceVarStatusAsync is deprecated by the
+                       // UPnP forum.
++#if UPNP_VERSION >= 10800
+                       const char *ctrlUrl =
+                               UpnpStateVarComplete_get_CtrlUrl(sv_event);
+                       const char *stateVarName =
+@@ -1373,6 +1501,12 @@ upnpEventSubscriptionExpired:
+                               UpnpStateVarComplete_get_CurrentVal(sv_event);
+                       TvCtrlPointHandleGetVar(
+                               ctrlUrl, stateVarName, currentVal);
++#else
++                      TvCtrlPointHandleGetVar(
++                              sv_event->CtrlUrl,
++                              sv_event->StateVarName,
++                              sv_event->CurrentVal );
++#endif
+ #endif
+               }
+               break;
+diff --git a/src/UPnPBase.h b/src/UPnPBase.h
+index 92753b86a..efe63bf0f 100644
+--- a/src/UPnPBase.h
++++ b/src/UPnPBase.h
+@@ -489,9 +489,15 @@ public:
+ 
+       // Callback function
+       static int Callback(
++#if UPNP_VERSION >= 10800
+               Upnp_EventType_e EventType,
+               const void *Event,
+               void *Cookie);
++#else
++              Upnp_EventType EventType,
++              void* Event,
++              void* Cookie);
++#endif
+ 
+ private:
+       void OnEventReceived(
+-- 
+2.24.1
+

diff --git a/net-p2p/amule/files/amule-2.3.2-libupnp-1.8.patch 
b/net-p2p/amule/files/amule-2.3.2-libupnp-1.8.patch
new file mode 100644
index 00000000000..42672a85a6a
--- /dev/null
+++ b/net-p2p/amule/files/amule-2.3.2-libupnp-1.8.patch
@@ -0,0 +1,263 @@
+From f6dccde218fed8dabd3c61efce02d29b320858fe Mon Sep 17 00:00:00 2001
+From: Marcelo Roberto Jimenez <marcelo.jime...@gmail.com>
+Date: Tue, 2 Oct 2018 18:17:43 -0300
+Subject: [PATCH] Make aMule compatible with libupnp 1.8
+
+---
+ src/UPnPBase.cpp | 110 +++++++++++++++++++++++++++--------------------
+ src/UPnPBase.h   |   6 +--
+ 2 files changed, 66 insertions(+), 50 deletions(-)
+
+diff --git a/src/UPnPBase.cpp b/src/UPnPBase.cpp
+index 01a7c3a05..d4063a136 100644
+--- a/src/UPnPBase.cpp
++++ b/src/UPnPBase.cpp
+@@ -1127,7 +1127,7 @@ bool CUPnPControlPoint::PrivateDeletePortMapping(
+ 
+ 
+ // This function is static
+-int CUPnPControlPoint::Callback(Upnp_EventType EventType, void *Event, void * 
/*Cookie*/)
++int CUPnPControlPoint::Callback(Upnp_EventType_e EventType, const void 
*Event, void * /*Cookie*/)
+ {
+       std::ostringstream msg;
+       std::ostringstream msg2;
+@@ -1149,24 +1149,25 @@ int CUPnPControlPoint::Callback(Upnp_EventType 
EventType, void *Event, void * /*
+               msg2<< "UPNP_DISCOVERY_SEARCH_RESULT: ";
+               // UPnP Discovery
+ upnpDiscovery:
+-              struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
++              UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
+               IXML_Document *doc = NULL;
+-              int ret;
+-              if (d_event->ErrCode != UPNP_E_SUCCESS) {
+-                      msg << UpnpGetErrorMessage(d_event->ErrCode) << ".";
++              int errCode = UpnpDiscovery_get_ErrCode(d_event);
++              if (errCode != UPNP_E_SUCCESS) {
++                      msg << UpnpGetErrorMessage(errCode) << ".";
+                       AddDebugLogLineC(logUPnP, msg);
+               }
+               // Get the XML tree device description in doc
+-              ret = UpnpDownloadXmlDoc(d_event->Location, &doc);
++              const char *location = UpnpDiscovery_get_Location_cstr(d_event);
++              int ret = UpnpDownloadXmlDoc(location, &doc);
+               if (ret != UPNP_E_SUCCESS) {
+                       msg << "Error retrieving device description from " <<
+-                              d_event->Location << ": " <<
++                              location << ": " <<
+                               UpnpGetErrorMessage(ret) <<
+                               "(" << ret << ").";
+                       AddDebugLogLineC(logUPnP, msg);
+               } else {
+                       msg2 << "Retrieving device description from " <<
+-                              d_event->Location << ".";
++                              location << ".";
+                       AddDebugLogLineN(logUPnP, msg2);
+               }
+               if (doc) {
+@@ -1194,8 +1195,9 @@ upnpDiscovery:
+                                       AddDebugLogLineC(logUPnP, msg);
+                               }
+                               // Add the root device to our list
++                              int expires = 
UpnpDiscovery_get_Expires(d_event);
+                               upnpCP->AddRootDevice(rootDevice, urlBase,
+-                                      d_event->Location, d_event->Expires);
++                                      location, expires);
+                       }
+                       // Free the XML doc tree
+                       IXML::Document::Free(doc);
+@@ -1216,28 +1218,35 @@ upnpDiscovery:
+       case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
+               //fprintf(stderr, "Callback: 
UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE\n");
+               // UPnP Device Removed
+-              struct Upnp_Discovery *dab_event = (struct Upnp_Discovery 
*)Event;
+-              if (dab_event->ErrCode != UPNP_E_SUCCESS) {
++              UpnpDiscovery *dab_event = (UpnpDiscovery *)Event;
++              int errCode = UpnpDiscovery_get_ErrCode(dab_event);
++              if (errCode != UPNP_E_SUCCESS) {
+                       msg << "error(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE): " <<
+-                              UpnpGetErrorMessage(dab_event->ErrCode) <<
++                              UpnpGetErrorMessage(errCode) <<
+                               ".";
+                       AddDebugLogLineC(logUPnP, msg);
+               }
+-              std::string devType = dab_event->DeviceType;
++              std::string devType = 
UpnpDiscovery_get_DeviceType_cstr(dab_event);
+               // Check for an InternetGatewayDevice and removes it from the 
list
+-              std::transform(devType.begin(), devType.end(), devType.begin(), 
tolower);
++              std::transform(devType.begin(), devType.end(),
++                      devType.begin(), tolower);
+               if (stdStringIsEqualCI(devType, UPnP::Device::IGW)) {
+-                      upnpCP->RemoveRootDevice(dab_event->DeviceId);
++                      const char *deviceID =
++                              UpnpDiscovery_get_DeviceID_cstr(dab_event);
++                      upnpCP->RemoveRootDevice(deviceID);
+               }
+               break;
+       }
+       case UPNP_EVENT_RECEIVED: {
+               //fprintf(stderr, "Callback: UPNP_EVENT_RECEIVED\n");
+               // Event reveived
+-              struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
+-              const std::string Sid = e_event->Sid;
++              UpnpEvent *e_event = (UpnpEvent *)Event;
++              int eventKey = UpnpEvent_get_EventKey(e_event);
++              IXML_Document *changedVariables =
++                      UpnpEvent_get_ChangedVariables(e_event);
++              const std::string sid = UpnpEvent_get_SID_cstr(e_event);
+               // Parses the event
+-              upnpCP->OnEventReceived(Sid, e_event->EventKey, 
e_event->ChangedVariables);
++              upnpCP->OnEventReceived(sid, eventKey, changedVariables);
+               break;
+       }
+       case UPNP_EVENT_SUBSCRIBE_COMPLETE:
+@@ -1252,24 +1261,23 @@ upnpDiscovery:
+               //fprintf(stderr, "Callback: UPNP_EVENT_RENEWAL_COMPLETE\n");
+               msg << "error(UPNP_EVENT_RENEWAL_COMPLETE): ";
+ upnpEventRenewalComplete:
+-              struct Upnp_Event_Subscribe *es_event =
+-                      (struct Upnp_Event_Subscribe *)Event;
+-              if (es_event->ErrCode != UPNP_E_SUCCESS) {
++              UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
++              int errCode = UpnpEventSubscribe_get_ErrCode(es_event);
++              if (errCode != UPNP_E_SUCCESS) {
+                       msg << "Error in Event Subscribe Callback";
+-                      UPnP::ProcessErrorMessage(
+-                              msg.str(), es_event->ErrCode, NULL, NULL);
++                      UPnP::ProcessErrorMessage(msg.str(), errCode, NULL, 
NULL);
+               } else {
+ #if 0
++                      const UpnpString *publisherUrl =
++                              UpnpEventSubscribe_get_PublisherUrl(es_event);
++                      const char *sid = UpnpEvent_get_SID_cstr(es_event);
++                      int timeOut = UpnpEvent_get_TimeOut(es_event);
+                       TvCtrlPointHandleSubscribeUpdate(
+-                              GET_UPNP_STRING(es_event->PublisherUrl),
+-                              es_event->Sid,
+-                              es_event->TimeOut );
++                              publisherUrl, sid, timeOut);
+ #endif
+               }
+-
+               break;
+       }
+-
+       case UPNP_EVENT_AUTORENEWAL_FAILED:
+               //fprintf(stderr, "Callback: UPNP_EVENT_AUTORENEWAL_FAILED\n");
+               msg << "error(UPNP_EVENT_AUTORENEWAL_FAILED): ";
+@@ -1280,29 +1288,31 @@ upnpEventRenewalComplete:
+               msg << "error(UPNP_EVENT_SUBSCRIPTION_EXPIRED): ";
+               msg2 << "UPNP_EVENT_SUBSCRIPTION_EXPIRED: ";
+ upnpEventSubscriptionExpired:
+-              struct Upnp_Event_Subscribe *es_event =
+-                      (struct Upnp_Event_Subscribe *)Event;
++              UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
+               Upnp_SID newSID;
+               memset(newSID, 0, sizeof(Upnp_SID));
+               int TimeOut = 1801;
++              const char *publisherUrl =
++                      UpnpEventSubscribe_get_PublisherUrl_cstr(es_event);
+               int ret = UpnpSubscribe(
+                       upnpCP->m_UPnPClientHandle,
+-                      GET_UPNP_STRING(es_event->PublisherUrl),
++                      publisherUrl,
+                       &TimeOut,
+                       newSID);
+               if (ret != UPNP_E_SUCCESS) {
+                       msg << "Error Subscribing to EventURL";
++                      int errCode = UpnpEventSubscribe_get_ErrCode(es_event);
+                       UPnP::ProcessErrorMessage(
+-                              msg.str(), es_event->ErrCode, NULL, NULL);
++                              msg.str(), errCode, NULL, NULL);
+               } else {
+                       ServiceMap::iterator it =
+-                              
upnpCP->m_ServiceMap.find(GET_UPNP_STRING(es_event->PublisherUrl));
++                              upnpCP->m_ServiceMap.find(publisherUrl);
+                       if (it != upnpCP->m_ServiceMap.end()) {
+                               CUPnPService &service = *(it->second);
+                               service.SetTimeout(TimeOut);
+                               service.SetSID(newSID);
+                               msg2 << "Re-subscribed to EventURL '" <<
+-                                      GET_UPNP_STRING(es_event->PublisherUrl) 
<<
++                                      publisherUrl <<
+                                       "' with SID == '" <<
+                                       newSID << "'.";
+                               AddDebugLogLineC(logUPnP, msg2);
+@@ -1321,17 +1331,19 @@ upnpEventSubscriptionExpired:
+       case UPNP_CONTROL_ACTION_COMPLETE: {
+               //fprintf(stderr, "Callback: UPNP_CONTROL_ACTION_COMPLETE\n");
+               // This is here if we choose to do this asynchronously
+-              struct Upnp_Action_Complete *a_event =
+-                      (struct Upnp_Action_Complete *)Event;
+-              if (a_event->ErrCode != UPNP_E_SUCCESS) {
++              UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
++              int errCode = UpnpActionComplete_get_ErrCode(a_event);
++              IXML_Document *actionResult =
++                      UpnpActionComplete_get_ActionResult(a_event);
++              if (errCode != UPNP_E_SUCCESS) {
+                       UPnP::ProcessErrorMessage(
+                               "UpnpSendActionAsync",
+-                              a_event->ErrCode, NULL,
+-                              a_event->ActionResult);
++                              errCode, NULL,
++                              actionResult);
+               } else {
+                       // Check the response document
+                       UPnP::ProcessActionResponse(
+-                              a_event->ActionResult,
++                              actionResult,
+                               "<UpnpSendActionAsync>");
+               }
+               /* No need for any processing here, just print out results.
+@@ -1342,21 +1354,25 @@ upnpEventSubscriptionExpired:
+       case UPNP_CONTROL_GET_VAR_COMPLETE: {
+               //fprintf(stderr, "Callback: UPNP_CONTROL_GET_VAR_COMPLETE\n");
+               msg << "error(UPNP_CONTROL_GET_VAR_COMPLETE): ";
+-              struct Upnp_State_Var_Complete *sv_event =
+-                      (struct Upnp_State_Var_Complete *)Event;
+-              if (sv_event->ErrCode != UPNP_E_SUCCESS) {
++              UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
++              int errCode = UpnpStateVarComplete_get_ErrCode(sv_event);
++              if (errCode != UPNP_E_SUCCESS) {
+                       msg << "m_UpnpGetServiceVarStatusAsync";
+                       UPnP::ProcessErrorMessage(
+-                              msg.str(), sv_event->ErrCode, NULL, NULL);
++                              msg.str(), errCode, NULL, NULL);
+               } else {
+ #if 0
+                       // Warning: The use of UpnpGetServiceVarStatus and
+                       // UpnpGetServiceVarStatusAsync is deprecated by the
+                       // UPnP forum.
++                      const char *ctrlUrl =
++                              UpnpStateVarComplete_get_CtrlUrl(sv_event);
++                      const char *stateVarName =
++                              UpnpStateVarComplete_get_StateVarName(sv_event);
++                      const DOMString currentVal =
++                              UpnpStateVarComplete_get_CurrentVal(sv_event);
+                       TvCtrlPointHandleGetVar(
+-                              sv_event->CtrlUrl,
+-                              sv_event->StateVarName,
+-                              sv_event->CurrentVal );
++                              ctrlUrl, stateVarName, currentVal);
+ #endif
+               }
+               break;
+diff --git a/src/UPnPBase.h b/src/UPnPBase.h
+index 9eafbd143..92753b86a 100644
+--- a/src/UPnPBase.h
++++ b/src/UPnPBase.h
+@@ -489,9 +489,9 @@ public:
+ 
+       // Callback function
+       static int Callback(
+-              Upnp_EventType EventType,
+-              void* Event,
+-              void* Cookie);
++              Upnp_EventType_e EventType,
++              const void *Event,
++              void *Cookie);
+ 
+ private:
+       void OnEventReceived(
+-- 
+2.24.1
+

diff --git a/net-p2p/amule/files/amuled.confd-r1 
b/net-p2p/amule/files/amuled.confd-r1
new file mode 100644
index 00000000000..2f018dd3b88
--- /dev/null
+++ b/net-p2p/amule/files/amuled.confd-r1
@@ -0,0 +1,9 @@
+# owner of amuled process (must be existing)
+AMULEUSER="amule"
+
+# home directory for amuled (must be existing)
+AMULEHOME="/var/lib/amule"
+
+# log file (/dev/null for nowhere)
+LOG=/var/log/amuled.log
+

diff --git a/net-p2p/amule/files/amuleweb.confd-r1 
b/net-p2p/amule/files/amuleweb.confd-r1
new file mode 100644
index 00000000000..1bb754a2f04
--- /dev/null
+++ b/net-p2p/amule/files/amuleweb.confd-r1
@@ -0,0 +1,24 @@
+# owner of amuleweb process (must be existing)
+AMULEUSER="amule"
+
+# home directory for amuleweb (from where to read configuration) (must be 
existing)
+AMULEHOME="/var/lib/amule"
+
+# log file (/dev/null for nowhere)
+LOG=/var/log/amuleweb.log
+
+# aMule password (note: not your webserver password, but the external
+# connection one)
+AMULEPWD="secret"
+
+# Full (admin) access password for webserver
+WEBPWD="secret2"
+
+# aMule host (this could be a remote host or usually localhost)
+AMULEHOST="localhost"
+
+# aMule external connection port
+AMULEPORT="4712"
+
+# aMuleweb template (default, php-default, chicane)
+TEMPLATE="default"

Reply via email to