[Pidgin] #6607: Public IP detection via entry of DNS name

Pidgin trac at pidgin.im
Sun Jan 10 12:24:54 EST 2010


#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):

 Update from Cygwin 1.5 to 1.7 broke the script because of a path issue.
 Quick fix:

 {{{
 #!/bin/bash
 # This script will launch PidginPortable on Windows using Cygwin after
 writing the external IP address into libpurple's config file
 var_hostname="your.dyndns.org" # Enter your hostname here
 var_path=`cygpath -a $0 | sed -r 's/\/[^\/]*$//'` # This is the path to
 the folder where the script is located
 echo "Resolving ${var_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 "Modifying 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 &
 }}}

-- 
Ticket URL: <http://developer.pidgin.im/ticket/6607#comment:22>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list