1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.4.4.1'

This commit is contained in:
gnosygnu
2016-04-24 22:05:38 -04:00
parent ad140a93fe
commit 5ce4ea2a08
103 changed files with 1767 additions and 340 deletions

View File

@@ -0,0 +1,47 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.servers.https; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*;
public class Http_long_poll_cmd implements gplx.xowa.htmls.bridges.Bridge_cmd_itm {
private final List_adp msgs = List_adp_.new_();
private long send_time_prv = 0;
public int Sleep_interval = 100;
public int Send_interval = 1000;
public void Send_msg(String msg) {
msgs.Add(msg);
}
public String Exec(gplx.langs.jsons.Json_nde data) {
while (true) {
if (msgs.Len() == 0) {
gplx.core.threads.Thread_adp_.Sleep(Sleep_interval);
}
else {
long send_time_cur = gplx.core.envs.Env_.TickCount();
if (send_time_cur - send_time_prv > Send_interval) {
send_time_prv = send_time_cur;
break;
}
}
}
return String_.Concat_lines_nl(msgs.To_str_ary_and_clear());
}
public byte[] Key() {return BRIDGE_KEY;}
public static final byte[] BRIDGE_KEY = Bry_.new_a7("long_poll");
public static final Http_long_poll_cmd Instance = new Http_long_poll_cmd(); Http_long_poll_cmd() {}
}

View File

@@ -0,0 +1,28 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.servers.https; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*;
public class Http_send_msg_cmd implements gplx.xowa.htmls.bridges.Bridge_cmd_itm {
public String Exec(gplx.langs.jsons.Json_nde data) {
gplx.langs.jsons.Json_nde jnde = (gplx.langs.jsons.Json_nde)data.Get_as_itm_or_null(Bry_.new_a7("msg"));
Http_long_poll_cmd.Instance.Send_msg(jnde.Print_as_json());
return "{}";
}
public byte[] Key() {return BRIDGE_KEY;}
public static final byte[] BRIDGE_KEY = Bry_.new_a7("send_msg");
}

View File

@@ -0,0 +1,31 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.servers.https; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*;
import gplx.xowa.bldrs.wkrs.*;
import gplx.xowa.htmls.bridges.*;
public class Xoax_long_poll_addon implements Xoax_addon_itm, Xoax_addon_itm__json {
public Bridge_cmd_itm[] Json__cmds() {
return new Bridge_cmd_itm[]
{ Http_long_poll_cmd.Instance
, new Http_send_msg_cmd()
};
}
public static final byte[] ADDON_KEY = Bry_.new_a7("xowa.servers.https.long_poll");
public byte[] Addon__key() {return ADDON_KEY;}
}

View File

@@ -0,0 +1,25 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.addons.servers.https; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.servers.*;
import gplx.xowa.guis.cbks.*;
public class Xog_cbk_wkr__http implements Xog_cbk_wkr {
public void Send_prog(String head) {
Http_long_poll_cmd.Instance.Send_msg(head);
}
public static final Xog_cbk_wkr__http Instance = new Xog_cbk_wkr__http(); Xog_cbk_wkr__http() {}
}