Skip to content

Commit

Permalink
Merge pull request #162 from illwieckz/savage-hack
Browse files Browse the repository at this point in the history
re-enabling the savage hack, ref #110
  • Loading branch information
illwieckz committed Jun 22, 2015
2 parents 359270d + 4d277b7 commit 173dc12
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ add_custom_command (TARGET translation
# Executable
install (TARGETS xqf DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

# Query script
install (PROGRAMS ${CMAKE_SOURCE_DIR}/src/script/qstat_savage.sh DESTINATION "${PACKAGE_DATA_DIR}/script")

# UI
install (FILES ${CMAKE_SOURCE_DIR}/src/xqf.ui DESTINATION ${PACKAGE_DATA_DIR}/ui)

Expand All @@ -380,7 +383,7 @@ endforeach (SIZE ${icon_SIZE})
install (FILES ${CMAKE_SOURCE_DIR}/pixmaps/scalable/xqf.svg DESTINATION ${PIXMAPS_ENTRY_PATH}/scalable/apps)

# Config
install (FILES ${CMAKE_SOURCE_DIR}/src/qstat.cfg ${CMAKE_SOURCE_DIR}/src/qstat_savage.sh DESTINATION ${PACKAGE_DATA_DIR})
install (FILES ${CMAKE_SOURCE_DIR}/src/qstat.cfg DESTINATION ${PACKAGE_DATA_DIR})

# Man pages
install (FILES ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.6 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man6)
Expand Down
18 changes: 15 additions & 3 deletions src/qstat_savage.sh → src/script/qstat_savage.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#! /bin/sh

#url="http://masterserver.savage.s2games.com/gamelist_full.dat"
url="$1"
if [ "x${1}" = 'x' -o "x${1}" = 'x--help' ]
then
printf 'Usage: %s -sam http://masterserver.savage.s2games.com/gamelist_full.dat\n' "${0}"
exit
fi

if [ "x${2}" = 'x' ]
then
printf 'missing argument for "%s"\n' "${1}"
exit
fi

if [ "x${url}" = 'x' ]
if [ "x${1}" != 'x-sam' ]
then
printf 'unknown option "%s"\n' "${1}"
exit
fi

url="${2}"

http_helper="wget -t 1 -T 20 -q -e robots=off --user-agent=XQF -O -"
server_type="SAS"
header="7e4103"
Expand Down
5 changes: 3 additions & 2 deletions src/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,9 +1061,10 @@ static struct stat_conn *stat_update_master_qstat (struct stat_job *job, struct

/* savage hack */
if (m->type == SAS_SERVER) {
argv[argi++] = "sh";
argv[argi++] = QSTAT_SAVAGE_SCRIPT;
argv[argi++] = PACKAGE_DATA_DIR "/script/qstat_savage.sh";
argv[argi++] = "-sam";
argv[argi++] = m->url;
argv[argi++] = NULL;
}
else if (m->master_type == MASTER_GSLIST) {
int ret = 0;
Expand Down
4 changes: 0 additions & 4 deletions src/stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
# define HTTP_HELPER "wget -t 1 -T 20 -q -e robots=off --user-agent=XQF/" XQF_VERSION " -O -"
#endif

#ifndef QSTAT_SAVAGE_SCRIPT
#define QSTAT_SAVAGE_SCRIPT "qstat_savage.sh"
#endif

#define QSTAT_DELIM '\t'
#define QSTAT_DELIM_STR "\t"
#define QSTAT_MASTER_DELIM ' '
Expand Down

0 comments on commit 173dc12

Please sign in to comment.