[Pidgin] #6607: Public IP detection via entry of DNS name
Pidgin
trac at pidgin.im
Mon Nov 9 16:39:57 EST 2009
#6607: Public IP detection via entry of DNS name
------------------------------------+---------------------------------------
Reporter: olmari | Owner:
Type: enhancement | Status: new
Milestone: | Component: libpurple
Version: 2.6.2 | Resolution:
Keywords: public IP, domain name |
------------------------------------+---------------------------------------
Comment(by eomanis):
For anyone still interested, I made up a makeshift bash script that
tampers with the libpurple configuration (using Cygwin). It
a) resolves a hostname to an IP address,[[BR]]
b) writes said address into the prefs.xml file and[[BR]]
c) starts PidginPortable.
It acts relatively to the path where it is located. In my case, I have it
right beneath the PidginPortable.exe and it works from there, accessing
the subfolders. Since I have configured Windows Explorer to open any .sh
file with the Cygwin bash shell, I can double click on it and
PidginPortable starts with the correct external IP set.
I don't know where Pidgin usually stores its configuration on Linux, maybe
you have a .purple folder in your home directory there. You'll have to
change the paths then. Also, I don't think you'll need the "| unix2dos"
part when operating on Linux (I even doubt the Windows Pidgin would mind,
it's just there because the original prefs.xml had CR+LF line endings
too).
{{{
#!/bin/sh
# This script will launch PidginPortable on Windows using Cygwin while
writing the external IP address into libpurple's config file
var_hostname="your.dyndns.org" # Enter your hostname here
var_path=`echo $0 | sed -r 's/[^\/]*$//'` # This is the path to the folder
where the script is located
echo "Resolving hostname..."
var_ip=`nslookup $var_hostname 2> /dev/null | grep Address | tail -n 1 |
sed -r 's/^[^0-9]*//'` # This is the IP the hostname has been resolved to
echo "IP Address is $var_ip"
echo "Tampering with the libpurple configuration..."
# This line generates a new config file from the current one:
sed -r
"s/^([^0-9.]*name='public_ip'[^0-9.]*value=')[0-9.]*('[^0-9.]*)$/\\1${var_ip}\\2/"
"${var_path}Data/settings/.purple/prefs.xml" | unix2dos 1>
"${var_path}Data/settings/.purple/prefs_tmp.xml"
# Yes, I know of the -i option in sed (update file in-place), but
afterwards the prefs.xml file would always be read-only (what the heck?!),
so Pidgin could not save configurations anymore
rm -f "${var_path}Data/settings/.purple/prefs.xml" # Remove the old config
file
mv "${var_path}Data/settings/.purple/prefs_tmp.xml"
"${var_path}Data/settings/.purple/prefs.xml" #Rename the new file
echo "Starting PidginPortable..."
${var_path}PidginPortable &
}}}
Still, it would be nice if I could get rid of that junk script and this
rather mundane feature would find its way into Pidgin. Mind you, people
set up dynamic DNS addresses to NOT depend on complicated external
services like that STUN server.
--
Ticket URL: <http://developer.pidgin.im/ticket/6607#comment:21>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list