From dc812f80a378cfb70cb447128648999d4efeb647 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Wed, 14 Nov 2012 20:32:38 +0000 Subject: [PATCH] Version update. Hexchat bug fix/workaround, worked around dev decision to start popping up a gtk dialogue when running hexchat -v or --version command. Now reads the actual user config files, hopefully anyway. Since trusting config files that are in the user ~./hexchat directory for version information is quite unreliable, this is just a quick hack, but that's fine, inxi is always happy to hack around bad developer ideas to provide the most accurate, or best guess, at the answer. --- inxi | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/inxi b/inxi index c22ceab..84d16e9 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.8.20 -#### Date: October 19 2012 +#### version: 1.8.21 +#### Date: November 14 2012 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -2382,7 +2382,7 @@ get_start_client() { eval $LOGFS local irc_client_path='' irc_client_path_lower='' non_native_konvi='' i='' - local b_non_native_app='false' pppid='' app_working_name='' + local b_non_native_app='false' pppid='' app_working_name='' file_data='' local b_qt4_konvi='false' if [[ $B_RUNNING_IN_SHELL == 'true' ]];then @@ -2410,6 +2410,7 @@ get_start_client() fi ;; esac + # replacing loose detection with tight detection, bugs will be handled with app names # as they appear. case $app_working_name in @@ -2450,9 +2451,32 @@ get_start_client() IRC_CLIENT="Gaim" ;; hexchat) - IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { - print $2 - }' )" + # the hexchat author decided to make --version/-v return a gtk dialogue box, lol... + # so we need to read the actual config file for hexchat. Note that older hexchats + # used xchat config file, so test first for default, then legacy. Because it's possible + # for this file to be use edited, doing some extra checks here. + if [[ -f ~/.config/hexchat/hexchat.conf ]];then + file_data="$( cat ~/.config/hexchat/hexchat.conf )" + elif [[ -f ~/.config/hexchat/xchat.conf ]];then + file_data="$( cat ~/.config/hexchat/xchat.conf )" + fi + if [[ -n $file_data ]];then + IRC_CLIENT_VERSION=$( gawk ' + BEGIN { + IGNORECASE=1 + FS="=" + } + /^[[:space:]]*version/ { + # get rid of the space if present + gsub(/[[:space:]]*/, "", $2 ) + print $2 + exit # usually this is the first line, no point in continuing + }' <<< "$file_data" ) + + IRC_CLIENT_VERSION=" $IRC_CLIENT_VERSION" + else + IRC_CLIENT_VERSION=' N/A' + fi IRC_CLIENT="HexChat" ;; ircii)