mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-24 10:02:29 +01:00
50da1beac1
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
--- 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("<ip>");
|
|
- int end = html.indexOf("</ip>",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) )
|