--- mcore-src/trunk/mcore-tools/src/modules/citrix/citrix.client.class.in 2014/01/14 10:50:06 2271 +++ mcore-src/trunk/mcore-tools/src/modules/citrix/citrix.client.class.in 2014/01/14 13:20:35 2272 @@ -39,8 +39,8 @@ mecho " Adds or delets a ICA session." mecho " Available actions:" mecho " add - adds a new ica session" - mecho " del - deletes ica session with file name [file]" - mecho " if no [file] given, all sessions will be deleted" + mecho " del - deletes ica session with name [name]" + mecho " if no [name] given, all sessions will be deleted" mecho mecho " Available modes:" mecho " fullscreen - fullscreen session" @@ -64,18 +64,14 @@ local user="${CLASS_ARGV[4]}" local domain="${CLASS_ARGV[5]}" local password="${CLASS_ARGV[6]}" - local serverlist - local server - local server_num - local icafile - local CONFIG local i [[ -z ${action} ]] && help_citrix_session && return 1 - [[ -z ${name} ]] && help_citrix_session && return 1 case "${action}" in add) + # requires name + [[ -z ${name} ]] && help_citrix_session && return 1 # action 'add' need mode too [[ -z ${mode} ]] && help_citrix_session && return 1 # and session @@ -89,84 +85,32 @@ *) help_citrix_session && return 1 esac - icafile="${MCORE_CONFIG_PATH}/citrix/ica/${name}.ica" - CONFIG="${MROOT}/${icafile}" - clearconfig - - addconfig '[WFClient]' - addconfig 'Version=2' - - serverlist=$(NOCOLORS=true get_citrix_serverlist) - declare -i i=0 - for server in ${serverlist} - do - (( i++ )) - server_num="${i}" - [[ ${i} -eq 1 ]] && server_num="" - addconfig "TcpBrowserAddress${server_num}=${server}" - done - addconfig 'ScreenPercent=0' - addconfig '[ApplicationServers]' - addconfig "${session}=" - addconfig "[${session}]" - addconfig "Address=${session}" - addconfig "InitialProgram=#${session}" - - # mapping table xorg -> citrix - # citrix 1 = 16 colors - # citrix 2 = 256 colors - # citrix 4 = 16 bit - # citrix 8 = 32 bit - # try always 16 bit - addconfig "DesiredColor=4" - - addconfig 'TransportDriver=TCP/IP' - addconfig 'WinStationDriver=ICA 3.0' - - [[ -n ${user} ]] && addconfig "Username=${user}" - [[ -n ${domain} ]] && addconfig "Domain=${domain}" - [[ -n ${password} ]] && addconfig "ClearPassword=${password}" - - # use the right display settings - case "${mode}" in - # fullscreen mode - fullscreen) - addconfig 'UseFullScreen=Yes' - addconfig 'NoWindowManager=True' - addconfig "DesiredHRES=65535" - addconfig "DesiredVRES=65535" - ;; - # seamless window mode - seamless) - addconfig 'TWIMode=On' - ;; - # a desired resolution - *x*) - addconfig "DesiredHRES=${mode%x*}" - addconfig "DesiredVRES=${mode#*x}" - ;; - esac + # create citrix session file + ${MCORE_LIBDIR}/citrix-session \ + --add \ + --name "${name}" \ + --session "${session}" \ + --mode "${mode}" \ + --user "${user}" \ + --domain "${domain}" \ + --password "${password}" # generate fluxbox menu entry set_fluxbox_menuitem add "${name}" "wfica ${icafile}" ;; del) - if [ -f ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica/"${name}".ica ] + if [[ -n "${name}" ]] then - rm ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica/"${name}".ica + ${MCORE_LIBDIR}/citrix-session --del --name "${name}" set_fluxbox_menuitem del "${name}" - - elif [[ -z ${file} ]] - then - # delete all items, needed to loop through every session - # or we delete *all* fluxbox menuitem too - for i in $(find ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica -type f) + else + for i in $(NOCOLORS=true ${MCORE_LIBDIR}/citrix-session --print) do - rm ${i} - set_fluxbox_menuitem del "$(basename ${i} .ica)" + ${MCORE_LIBDIR}/citrix-session --del --name "${i}" + set_fluxbox_menuitem del "${name}" done - fi + done ;; *) help_citrix_session && return 1 ;; @@ -176,36 +120,12 @@ get_citrix_session() { local action="${CLASS_ARGV[0]}" - local server="${CLASS_ARGV[1]}" - local sessionlist - local sessioncount - local i - local exclude [[ -z ${action} ]] && help_citrix_serverlist && return 1 case "${action}" in - print) list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/citrix/ica ;; - query) - [[ -n ${PNABROWSE_EXECUTABLE} ]] || eecho "\$PNABROWSE_EXECUTABLE not defined" - [[ -n ${PNABROWSE_CITRIX_BROWSER} ]] || eecho "\$PNABROWSE_CITRIX_BROWSER not defined" - if [ -x ${MROOT}/${PNABROWSE_EXECUTABLE} ] - then - if [[ -n ${PNABROWSE_SESSION_EXCLUDE} ]] - then - exclude="| grep -v '${PNABROWSE_SESSION_EXCLUDE}'" - fi - eval sessionlist=( $(eval ${MROOT}/${PNABROWSE_EXECUTABLE} -A "${PNABROWSE_CITRIX_BROWSER}" ${exclude}) ) - sessioncount="${#sessionlist[*]}" - for (( i=0; i