1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

babeldos magicos

This commit is contained in:
psyc://psyced.org/~lynX 2009-12-10 11:42:58 +01:00
parent 0221131dc3
commit a10d36ba5b
3 changed files with 35 additions and 14 deletions

View file

@ -382,6 +382,8 @@ TWITTER
________________________________________________________________________ ________________________________________________________________________
== OTHER MAJOR TODOS =================================================== == OTHER MAJOR TODOS ===================================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- occasionally double data sets for psyc://ve.symlynx.com/~nick and nick
+ provide a tuning for ACTIVE server-side PING (keepalive) ? + provide a tuning for ACTIVE server-side PING (keepalive) ?
see http://about.psyc.eu/Ping for explanations. see http://about.psyc.eu/Ping for explanations.
@ -1581,6 +1583,11 @@ ________________________________________________________________________
look at: http://freshmeat.net/projects/pyvoicechat/ look at: http://freshmeat.net/projects/pyvoicechat/
dormant since 2004.. oops dormant since 2004.. oops
+ tycho proposes /log reply of new messages should not necessarily
show automatically, in case you are connecting with a client on a
mobile phone, especially if you have permanent context subscriptions
flowing into your log nonstop.
RELAYING RELAYING
+ net/spyc needs relaying (without parsing even), see TODO in parse_content() + net/spyc needs relaying (without parsing even), see TODO in parse_content()
? relaying doesn't work for psyc clients (xmpp: in particular) ? relaying doesn't work for psyc clients (xmpp: in particular)

View file

@ -58,3 +58,6 @@ local/all.ls:
.links: .links:
(cd world;../bin/findlinks */de/* */en/*) >$@ (cd world;../bin/findlinks */de/* */en/*) >$@
exefix:
chmod +x bin/* run/* config/psyced.settings install.sh utility/multipatcher

View file

@ -10,13 +10,17 @@
#include <input_to.h> #include <input_to.h>
#include <ht/http.h> #include <ht/http.h>
#include <net.h>
#define INHERIT_CONNECT #define INHERIT_CONNECT
start(); start();
babel(); babel();
#define CRESET start(); #define CREATE qInit(ME, 1000, 100);
inherit "net/connect";
// too aggressive to connect babelfish on every reset!!
//efine CRESET start();
inherit NET_PATH "connect";
#include <place.gen> #include <place.gen>
#define emit binary_message #define emit binary_message
@ -26,10 +30,9 @@ volatile mixed *current;
volatile string krank, buffer; volatile string krank, buffer;
start() { start() {
qInit(ME, 1000, 100);
unless (has_con || is_con) { unless (has_con || is_con) {
is_con = 1; is_con = 1;
call_out(#'connect, 0, "babelfish.altavista.com", 80); call_out(#'connect, 0, "babelfish.yahoo.com", 80);
} }
} }
@ -37,21 +40,24 @@ escape(data) {
return regreplace(data, "[^a-zA-Z0-9]", (: return sprintf("%%%x", $1[0]); :), 1); return regreplace(data, "[^a-zA-Z0-9]", (: return sprintf("%%%x", $1[0]); :), 1);
} }
disconnect() { disconnected() {
has_con = 0;
switch (pointerp(current) ? current[0] : "") {
string k; string k;
//efine FMT "%~s<td bgcolor=white class=s><div style=padding:10px;>%s</div></td>%~s"
#define FMT "%~s<input type=\"hidden\" name=\"p\" value=\"%s\">%~s"
has_con = 0;
P0(("%O received %O bytes of buffer for %O\n", ME, sizeof(buffer), current))
switch (pointerp(current) ? current[0] : "") {
case TRANSLATION: case TRANSLATION:
if (sscanf(buffer, "%~s<td bgcolor=white class=s><div style=padding:10px;>%s</div></td>%~s", k)) { if (sscanf(buffer, FMT, k)) krank = k;
krank = k; else krank = "und es geschah ihr als sei es von der ferne";
}
#ifdef TRANSLATION2 #ifdef TRANSLATION2
babel(TRANSLATION2, current[1], current[2], krank, current[4]); babel(TRANSLATION2, current[1], current[2], krank, current[4]);
break; break;
case TRANSLATION2: case TRANSLATION2:
if (sscanf(buffer, "%~s<td bgcolor=white class=s><div style=padding:10px;>%s</div></td>%~s", k)) { if (sscanf(buffer, FMT, k)) krank = k;
krank = k; else krank = "und sie sah fern als sei es ein geschehen";
}
#endif #endif
::msg(current[1], current[2], replace(krank, "&quot;", "\""), current[4]); ::msg(current[1], current[2], replace(krank, "&quot;", "\""), current[4]);
default: default:
@ -103,8 +109,13 @@ babel(mode, source, mc, data, mapping vars) {
buffer = ""; buffer = "";
krank = 0; krank = 0;
current = ({ mode, source, mc, data, vars }); current = ({ mode, source, mc, data, vars });
emit("GET /tr?lp=" + mode + "&urltext=" + escape(data) + " HTTP/1.1\r\n" // old API
"Host: babelfish.altavista.com\r\n\r\n"); // emit("GET /tr?lp=" + mode + "&urltext=" + escape(data) + " HTTP/1.1\r\n"
// "Host: babelfish.altavista.com\r\n\r\n");
// new API
emit("GET /translate_txt?ei=UTF-8&doit=done&fr=bf-res&intl=1&lp="+
mode +"&tt=urltext&trtext="+
escape(data) +" HTTP/1.1\r\nHost: babelfish.yahoo.com\r\n\r\n");
} }
msg(source, mc, data, mapping vars) { msg(source, mc, data, mapping vars) {