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

xmlquote status updates, minor irc fix

This commit is contained in:
psyc://psyced.org/~lynX 2009-10-15 11:48:35 +02:00
parent b3563e692c
commit 90ad3e7be4
6 changed files with 41 additions and 16 deletions

View file

@ -364,28 +364,28 @@ _notice_place_leave
|<presence type='unavailable' to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]' id='[_tag]'><x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='none' role='none'/></x></presence> |<presence type='unavailable' to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]' id='[_tag]'><x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='none' role='none'/></x></presence>
_status_presence_here _status_presence_here
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_here_talkative _status_presence_here_talkative
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>chat</show><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>chat</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_here_busy _status_presence_here_busy
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>dnd</show><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>dnd</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_away _status_presence_away
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_absent_vacation _status_presence_absent_vacation
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_absent _status_presence_absent
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_status_presence_here_quiet _status_presence_here_quiet
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'/> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'/>
_notice_presence_here _notice_presence_here
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]'><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]'><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_here_plain _notice_presence_here_plain
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'/> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'/>
@ -394,19 +394,19 @@ _notice_presence_here_quiet
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'/> |<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'/>
_notice_presence_here_talkative _notice_presence_here_talkative
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]'><show>chat</show><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber_bare]'><show>chat</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_here_busy _notice_presence_here_busy
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>dnd</show><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>dnd</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_away _notice_presence_away
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_absent_vacation _notice_presence_absent_vacation
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_presence_absent _notice_presence_absent
|<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>[_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence> |<presence to='[_INTERNAL_target_jabber_bare]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>[_XML_description_presence]</status><mood xmlns='http://jabber.org/protocol/mood'><[_INTERNAL_mood_jabber]/></mood></presence>
_notice_person_absent_netburp _notice_person_absent_netburp
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>{_notice_person_absent_netburp}</status></presence> |<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>xa</show><status>{_notice_person_absent_netburp}</status></presence>

View file

@ -395,6 +395,9 @@ w(string mc, string data, mapping vars, mixed source) {
} else if (abbrev("_echo_place_enter", mc)) { } else if (abbrev("_echo_place_enter", mc)) {
vars["_INTERNAL_source_IRC"] = MYNICK + "!" + MYNICK + "@" SERVER_HOST; vars["_INTERNAL_source_IRC"] = MYNICK + "!" + MYNICK + "@" SERVER_HOST;
#endif #endif
} else if (source == "/") { // new style server root message
vars["_INTERNAL_source_IRC"] = SERVER_HOST;
nick2 = source = SERVER_UNIFORM;
} else { } else {
#ifdef GHOST //{{{ #ifdef GHOST //{{{
// in S2S mode we are not supposed to deliver nick!user@host // in S2S mode we are not supposed to deliver nick!user@host

View file

@ -296,12 +296,24 @@ render(string mc, string data, mapping vars, mixed source) {
log_file("XMPP_TODO", "%O %s %s\n", ME, mc, output); log_file("XMPP_TODO", "%O %s %s\n", ME, mc, output);
#endif #endif
} else { } else {
// hack for a special case where status update contains <, >
// if this kind of problem recurrs, we should quote every
// single damn variable
if (vars["_description_presence"])
vars["_XML_description_presence"] =
xmlquote(vars["_description_presence"]);
if (stringp(data)) data = xmlquote(data); if (stringp(data)) data = xmlquote(data);
else if (vars["_action"]) else if (vars["_action"])
data = "/me " + xmlquote(vars["_action"]); data = "/me " + xmlquote(vars["_action"]);
output = psyctext(template, vars, data, source); output = psyctext(template, vars, data, source);
if (!stringp(output) || output=="") if (!stringp(output) || output=="")
return P2(("jabber:w() no output\n")); return P2(("jabber:w() no output\n"));
#if 0
if (strstr(output, "r00t") >= 0) {
P0(("common:render(%O, %O, %O, %O) -> %O\n", mc,
data, vars, source, output))
}
#endif
} }
#if __EFUN_DEFINED__(convert_charset) && SYSTEM_CHARSET != "UTF-8" #if __EFUN_DEFINED__(convert_charset) && SYSTEM_CHARSET != "UTF-8"
if (catch(output = convert_charset(output, if (catch(output = convert_charset(output,

View file

@ -550,6 +550,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
vars["_description_presence"] = vars["_description_presence"] =
(node["/status"] && node["/status"][Cdata]) ? (node["/status"] && node["/status"][Cdata]) ?
node["/status"][Cdata] : ""; // "Get psyced!"; node["/status"][Cdata] : ""; // "Get psyced!";
vars["_XML_description_presence"] =
xmlquote(vars["_description_presence"]);
vars["_INTERNAL_mood_jabber"] = "neutral"; vars["_INTERNAL_mood_jabber"] = "neutral";
sendmsg(o, "_notice_presence_absent", 0, sendmsg(o, "_notice_presence_absent", 0,
vars, origin); vars, origin);
@ -693,6 +695,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
vars["_description_presence"] = vars["_description_presence"] =
(node["/status"] && node["/status"][Cdata]) ? (node["/status"] && node["/status"][Cdata]) ?
node["/status"][Cdata] : ""; // "Get psyced!"; node["/status"][Cdata] : ""; // "Get psyced!";
vars["_XML_description_presence"] =
xmlquote(vars["_description_presence"]);
vars["_degree_availability"] = jabber2avail[node["/show"] vars["_degree_availability"] = jabber2avail[node["/show"]
&& node["/show"][Cdata]]; && node["/show"][Cdata]];
// this message is too verbose, let's put in into // this message is too verbose, let's put in into

View file

@ -250,11 +250,12 @@ showFriends() {
"_INTERNAL_target_jabber" : myjid, "_INTERNAL_target_jabber" : myjid,
"_INTERNAL_source_jabber" : mkjid(person), "_INTERNAL_source_jabber" : mkjid(person),
"_description_presence" : "", // TODO: get these from state "_description_presence" : "", // TODO: get these from state
"_XML_description_presence" : "",
"_INTERNAL_mood_jabber" : "neutral" "_INTERNAL_mood_jabber" : "neutral"
])); ]));
} }
if (strlen(packet)) emit(packet); if (strlen(packet)) emit(packet);
PT(("%O jabberish showFriends: %O outputs as %O\n", ME, friends, packet)) P2(("%O jabberish showFriends: %O outputs as %O\n", ME, friends, packet))
} }
logon() { logon() {
@ -1212,6 +1213,7 @@ varargs string mkjid(mixed who, mixed vars, mixed ignore_nick, mixed ignore_cont
// message rendering a la jabber // message rendering a la jabber
w(string mc, string data, mapping vars, mixed source) { w(string mc, string data, mapping vars, mixed source) {
mixed t; mixed t;
unless (mappingp(vars)) vars = ([]); unless (mappingp(vars)) vars = ([]);
else if (vars["_nick_verbatim"]) vars["_nick"] = vars["_nick_verbatim"]; else if (vars["_nick_verbatim"]) vars["_nick"] = vars["_nick_verbatim"];
// ^^ this is a temporary workaround until we fix the real problem! // ^^ this is a temporary workaround until we fix the real problem!
@ -1284,7 +1286,11 @@ w(string mc, string data, mapping vars, mixed source) {
unless (vars["_tag_reply"]) vars["_tag_reply"] = tag; unless (vars["_tag_reply"]) vars["_tag_reply"] = tag;
if (vars["_list_groups"]) if (vars["_list_groups"])
vars["_list_groups"] = IMPLODE_XML(vars["_list_groups"], "<group>"); vars["_list_groups"] = IMPLODE_XML(vars["_list_groups"], "<group>");
#if 0
if (stringp(data) && strstr(data, "r00t") >= 0) {
P0(("user:w(%O, %O, %O, %O)\n", mc, data, vars, source))
}
#endif
unless (interactive(ME)) { unless (interactive(ME)) {
P1(("%O not interactive. w(%O) from %O.\n", ME, mc, source)) P1(("%O not interactive. w(%O) from %O.\n", ME, mc, source))
return; return;

View file

@ -50,7 +50,7 @@ parse(string body, mapping headers) {
return; return;
} }
lastid = wurst[0]["id"]; lastid = wurst[0]["id"];
P1(("%O -- new lastid %O\n", ME, lastid)) P2(("%O -- new lastid %O\n", ME, lastid))
save_object(DATA_PATH "twitter"); save_object(DATA_PATH "twitter");
for (i=sizeof(wurst)-1; i>=0; i--) { for (i=sizeof(wurst)-1; i>=0; i--) {
d = wurst[i]; d = wurst[i];
@ -110,7 +110,7 @@ parse(string body, mapping headers) {
} }
fetch() { fetch() {
P1(("%O going to fetch from %O since %O\n", ME, feed, lastid)) P2(("%O going to fetch from %O since %O\n", ME, feed, lastid))
call_out( #'fetch, 4 * 59 ); // odd is better call_out( #'fetch, 4 * 59 ); // odd is better
feed -> content( #'parse, 1, 1 ); feed -> content( #'parse, 1, 1 );
// twitter ignores since_id if count is present. stupid. // twitter ignores since_id if count is present. stupid.