network/valknut: Added patch.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Kevin Paulus 2014-12-07 00:32:51 +07:00 committed by Willy Sudiarto Raharjo
parent 2ca4eeb064
commit 50da1beac1
4 changed files with 63 additions and 5 deletions

View file

@ -0,0 +1,55 @@
--- valknut/dcoptions.cpp.orig 2014-12-02 20:28:59.039798842 +0100
+++ valknut/dcoptions.cpp 2014-12-02 22:25:06.352312671 +0100
@@ -808,15 +808,18 @@
{
PushButton_GETINTERNETIP->setEnabled(false);
- QHttpRequestHeader header( "GET", "/ip.php" );
- header.setValue( "Host", "wxdcgui.sourceforge.net" );
+ //QHttpRequestHeader header( "GET", "/ip.php" );
+ QHttpRequestHeader header( "GET", "/" );
+ //header.setValue( "Host", "wxdcgui.sourceforge.net" );
+ header.setValue( "Host", "www.myip.se" );
QString useragent = QString("Valknut/") + PACKAGE_VERSION;
//printf("User-Agent=%s\n", useragent.toAscii().constData());
header.setValue( "User-Agent", useragent );
m_pHttp = new QHttp();
connect( m_pHttp, SIGNAL(done(bool)), this, SLOT(slotGotInternetIP(bool)) );
- m_pHttp->setHost( "wxdcgui.sourceforge.net" );
+ //m_pHttp->setHost( "wxdcgui.sourceforge.net" );
+ m_pHttp->setHost( "www.myip.se" );
m_pHttp->request( header );
}
@@ -834,20 +837,25 @@
else
{
QString html = QString(m_pHttp->readAll());
- int start = html.indexOf("&lt;ip&gt;");
- int end = html.indexOf("&lt;/ip&gt;",start);
-
+
+ int start = html.indexOf("<b>");
+ // We need the 2nd "bold" (<b>) attribute
+ start = html.indexOf("<b>",start+3);
+ int end = html.indexOf("</b>",start);
+
if ( ( start == -1 ) || ( end < start ) )
{
QMessageBox::warning(
this,
tr("Get Internet IP"),
- tr("Unexpected response from ") + "http://wxdcgui.sourceforge.net"
+ tr("Unexpected response from ") + "http://www.myip.se"
+ // tr("Unexpected response from ") + "http://wxdcgui.sourceforge.net"
);
}
else
{
- start += 10;
+ //start += 10; // wxgui.sourceforge.net
+ start += 21; // www.myip.se
QString ip = html.mid( start, end - start );
if ( QHostAddress().setAddress(ip) )

View file

@ -1,4 +1,3 @@
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi

View file

@ -24,7 +24,7 @@
PRGNAM=valknut
VERSION=${VERSION:-0.4.9}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -69,7 +69,11 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
patch -p0 < "$CWD"/valknut-0.4.9.patch valknut/main.cpp
# Main patch
patch -p0 < "$CWD"/main.patch valknut/main.cpp
# Dcoptions (myip) patch
patch -p0 < "$CWD"/dcoptions.patch valknut/dcoptions.cpp
CFLAGS="$SLKCFLAGS" \
./configure \
@ -89,14 +93,14 @@ find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING* ChangeLog INSTALL NEWS README TODO "$PKG"/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING* ChangeLog INSTALL NEWS README TODO $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
# Remove misplaced file - this one is already available in usr/doc/$PRGNAM-$VERSION
rm $PKG/usr/share/valknut/COPYING
cd $PKG