Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[0.1.1-8] support for iceball:// URLs in the client. iceball:// URL b…

…inder to come (no, that .sh does not work here).
  • Loading branch information...
commit df38567cc32fd910426d8baefb31f89543919b2e 1 parent e145f9a
@iamgreaser authored
View
2  heart/heartbeat.py
@@ -115,7 +115,7 @@ def get_file_index(self):
s += "<tr>"
s += "<td>" + sanestr(d["address"]) + "</td>"
s += "<td>" + sanestr(d["port"]) + "</td>"
- s += "<td>" + sanestr(d["name"]) + "</td>"
+ s += "<td>" + "<a href=\"iceball://" + sanestr(d["address"]) + ":" + sanestr(d["port"]) + "\">" + sanestr(d["name"]) + "</a>" + "</td>"
s += "<td>" + sanestr(d["version"]) + "</td>"
s += "<td>" + sanestr(d["players_current"]) + " / " + sanestr(d["players_max"]) + "</td>"
s += "<td>" + sanestr(d["mode"]) + "</td>"
View
3  include/common.h
@@ -19,7 +19,7 @@
#define VERSION_X 1
#define VERSION_Y 1
#define VERSION_A 0
-#define VERSION_Z 7
+#define VERSION_Z 8
// Remember to bump "Z" basically every time you change the engine!
// Remember to bump the version in Lua too!
// Remember to document API changes in a new version!
@@ -467,6 +467,7 @@ extern int force_redraw;
extern int net_port;
extern char *net_addr;
+extern char net_addr_xbuf[];
extern int boot_mode;
extern char *mod_basedir;
View
22 pkg/base/lib_util.lua
@@ -101,12 +101,15 @@ function string.trim(s, sep)
return string.triml(string.trimr(s, sep), sep)
end
-function parse_commandline_options(options)
- local user_toggles = {} -- toggle options (key is name, value is position)
- local user_settings = {} -- key-value pairs
- local loose = {} -- loose strings, filenames, etc.
+function parse_commandline_options(options, nocheckdash, na, nb, nc)
+ local loose = na or {} -- loose strings, filenames, etc.
+ local user_toggles = nb or {} -- toggle options (key is name, value is position)
+ local user_settings = nc or {} -- key-value pairs
for k, v in pairs(options) do
+ if nocheckdash then
+ v = "-" .. v
+ end
local setting_pair = string.split(v, "=")
local first = string.byte(v,1)
if first==string.byte('-') then -- we are toggling an option or setting a value
@@ -116,6 +119,17 @@ function parse_commandline_options(options)
else
user_toggles[string.triml(v, '-')]=k
end
+ elseif first == string.byte('/') then -- optional extra arg on URI
+ -- look for a ? thing
+ local npair = string.split(v:sub(2), "?")
+ if npair[1] ~= "" then
+ user_settings[" "] = npair[1]
+ end
+ if npair[2] then
+ -- TODO: URI-decode
+ local nopts = string.split(npair[2], "&")
+ parse_commandline_options(nopts, true, loose, user_toggles, user_settings)
+ end
else -- add to the loose values
loose[#loose+1] = v
end
View
7 pkg/base/version.lua
@@ -16,9 +16,9 @@
]]
VERSION_ENGINE = {
- cmp={0,1,1,0,5},
- num=4227072+5,
- str="0.1.1-5",
+ cmp={0,1,1,0,8},
+ num=4227072+8,
+ str="0.1.1-8",
}
-- 0.1: 4194304
@@ -108,5 +108,6 @@ VERSION_BUGS = {
{renderer="softgm", intro=4227072+5, fix=4227072+7, msg="[softgm] Image scaling not supported"},
{intro=4227072+5, fix=4227072+6, msg="Image scaling accidentally only supported integers for scale parameters"},
{intro=4227072+5, fix=4227072+7, msg="Incompatible semantics for image scaling"},
+{intro=nil, fix=4227072+8, msg="iceball:// URL scheme not supported"},
}
View
5 src/lua.c
@@ -289,6 +289,11 @@ int icelua_initfetch(void)
printf("Client loaded! Initialising...\n");
for(i = 0; i < argct; i++)
lua_pushstring(lstate_client, main_argv[i+main_largstart]);
+ if((boot_mode & 1) && net_addr_xbuf[1] != '\x00')
+ {
+ lua_pushstring(lstate_client, net_addr_xbuf);
+ argct++;
+ }
if(lua_pcall(lstate_client, argct, 0, 0) != 0)
{
printf("ERROR running client Lua: %s\n", lua_tostring(lstate_client, -1));
View
46 src/main.c
@@ -46,6 +46,8 @@ int boot_mode = 0;
char *mod_basedir = NULL;
char *net_addr;
+char net_addr_buf[1024];
+char net_addr_xbuf[1024];
int net_port;
int main_argc;
@@ -564,8 +566,10 @@ int print_usage(char *rname)
fprintf(stderr, "usage:\n"
#ifndef DEDI
"\tfor clients:\n"
- "\t\t%s -c address port {clargs} <-- connect via ENet protocol (UDP)\n"
- "\t\t%s -C address port {clargs} <-- connect via TCP protocol\n"
+ "\t\t%s -c iceball://address:port {clargs} <-,_ connect via ENet protocol (UDP)\n"
+ "\t\t%s -c address port {clargs} <-'\n"
+ "\t\t%s -C iceball://address:port {clargs} <-,_ connect via TCP protocol\n"
+ "\t\t%s -C address port {clargs} <-'\n"
"\tfor servers (quick-start, not recommended for anything serious!):\n"
"\t\t%s -s port mod {args}\n"
#endif
@@ -590,7 +594,7 @@ int print_usage(char *rname)
#endif
"\targs: arguments to send to the server Lua script\n"
#ifndef DEDI
- ,rname,rname,rname
+ ,rname,rname,rname,rname,rname
#endif
,rname,rname);
@@ -630,25 +634,45 @@ int main_dbghelper(int argc, char *argv[])
if((!strcmp(argv[1], "-h")) || (!strcmp(argv[1], "/?")) || (!strcmp(argv[1], "-?")) || (!strcmp(argv[1], "--help"))) {
return print_usage(argv[0]);
} else if(!strcmp(argv[1], "-c")) {
- if(argc <= 3)
+ if(argc <= 2 || (argc <= 3 && memcmp(argv[2], "iceball://", 10)))
return print_usage(argv[0]);
- net_addr = argv[2];
- net_port = atoi(argv[3]);
+ net_port = 20737;
+ main_largstart = 3;
+ net_addr = net_addr_buf;
+ net_addr_xbuf[0] = '/';
+ net_addr_xbuf[1] = '\x00';
+ if(sscanf(argv[2], "iceball://%[^:]:%i/%s", net_addr, &net_port, &net_addr_xbuf[1]) < 1)
+ {
+ if(argc <= 3)
+ return print_usage(argv[0]);
+ net_addr = argv[2];
+ net_port = atoi(argv[3]);
+ main_largstart = 4;
+ }
printf("Connecting to \"%s\" port %i (ENet mode)\n", net_addr, net_port);
mod_basedir = NULL;
- main_largstart = 4;
boot_mode = 1 | 16;
} else if(!strcmp(argv[1], "-C")) {
- if(argc <= 3)
+ if(argc <= 2 || (argc <= 3 && memcmp(argv[2], "iceball://", 10)))
return print_usage(argv[0]);
- net_addr = argv[2];
- net_port = atoi(argv[3]);
+ net_port = 20737;
+ main_largstart = 3;
+ net_addr = net_addr_buf;
+ net_addr_xbuf[0] = '/';
+ net_addr_xbuf[1] = '\x00';
+ if(sscanf(argv[2], "iceball://%[^:]:%i/%s", net_addr, &net_port, &net_addr_xbuf[1]) < 1)
+ {
+ if(argc <= 3)
+ return print_usage(argv[0]);
+ net_addr = argv[2];
+ net_port = atoi(argv[3]);
+ main_largstart = 4;
+ }
printf("Connecting to \"%s\" port %i (TCP mode)\n", net_addr, net_port);
mod_basedir = NULL;
- main_largstart = 4;
boot_mode = 1;
//return 101;
View
5 url-set-unix-gnome.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+gconftool-2 -s /desktop/gnome/url-handlers/iceball/command "$(pwd)/iceball-gl -c %s" --type String
+gconftool-2 -s /desktop/gnome/url-handlers/iceball/enabled --type Boolean true
+gconftool-2 -s /desktop/gnome/url-handlers/iceball/needs-terminal --type Boolean true
+
Please sign in to comment.
Something went wrong with that request. Please try again.