From 90ad3e7be4fe5752d8001dcbb57475c38a649df9 Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Thu, 15 Oct 2009 11:48:35 +0200 Subject: [PATCH] xmlquote status updates, minor irc fix --- world/default/en/jabber.textdb | 24 ++++++++++++------------ world/net/irc/user.c | 3 +++ world/net/jabber/common.c | 12 ++++++++++++ world/net/jabber/mixin_parse.c | 4 ++++ world/net/jabber/user.c | 10 ++++++++-- world/net/twitter/polly.c | 4 ++-- 6 files changed, 41 insertions(+), 16 deletions(-) diff --git a/world/default/en/jabber.textdb b/world/default/en/jabber.textdb index 5d8dd52..1faf120 100644 --- a/world/default/en/jabber.textdb +++ b/world/default/en/jabber.textdb @@ -364,28 +364,28 @@ _notice_place_leave | _status_presence_here -|[_description_presence]<[_INTERNAL_mood_jabber]/> +|[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_here_talkative -|chat[_description_presence]<[_INTERNAL_mood_jabber]/> +|chat[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_here_busy -|dnd[_description_presence]<[_INTERNAL_mood_jabber]/> +|dnd[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_away -|away[_description_presence]<[_INTERNAL_mood_jabber]/> +|away[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_absent_vacation -|xa[_description_presence]<[_INTERNAL_mood_jabber]/> +|xa[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_absent -|[_description_presence]<[_INTERNAL_mood_jabber]/> +|[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _status_presence_here_quiet | _notice_presence_here -|[_description_presence]<[_INTERNAL_mood_jabber]/> +|[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_here_plain | @@ -394,19 +394,19 @@ _notice_presence_here_quiet | _notice_presence_here_talkative -|chat[_description_presence]<[_INTERNAL_mood_jabber]/> +|chat[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_here_busy -|dnd[_description_presence]<[_INTERNAL_mood_jabber]/> +|dnd[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_away -|away[_description_presence]<[_INTERNAL_mood_jabber]/> +|away[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_absent_vacation -|xa[_description_presence]<[_INTERNAL_mood_jabber]/> +|xa[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_presence_absent -|[_description_presence]<[_INTERNAL_mood_jabber]/> +|[_XML_description_presence]<[_INTERNAL_mood_jabber]/> _notice_person_absent_netburp |xa{_notice_person_absent_netburp} diff --git a/world/net/irc/user.c b/world/net/irc/user.c index c735e49..862f06d 100644 --- a/world/net/irc/user.c +++ b/world/net/irc/user.c @@ -395,6 +395,9 @@ w(string mc, string data, mapping vars, mixed source) { } else if (abbrev("_echo_place_enter", mc)) { vars["_INTERNAL_source_IRC"] = MYNICK + "!" + MYNICK + "@" SERVER_HOST; #endif + } else if (source == "/") { // new style server root message + vars["_INTERNAL_source_IRC"] = SERVER_HOST; + nick2 = source = SERVER_UNIFORM; } else { #ifdef GHOST //{{{ // in S2S mode we are not supposed to deliver nick!user@host diff --git a/world/net/jabber/common.c b/world/net/jabber/common.c index 85319fa..2f2141b 100644 --- a/world/net/jabber/common.c +++ b/world/net/jabber/common.c @@ -296,12 +296,24 @@ render(string mc, string data, mapping vars, mixed source) { log_file("XMPP_TODO", "%O %s %s\n", ME, mc, output); #endif } 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); else if (vars["_action"]) data = "/me " + xmlquote(vars["_action"]); output = psyctext(template, vars, data, source); if (!stringp(output) || output=="") 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 (catch(output = convert_charset(output, diff --git a/world/net/jabber/mixin_parse.c b/world/net/jabber/mixin_parse.c index 8ff4984..bdd2e28 100644 --- a/world/net/jabber/mixin_parse.c +++ b/world/net/jabber/mixin_parse.c @@ -550,6 +550,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) { vars["_description_presence"] = (node["/status"] && node["/status"][Cdata]) ? node["/status"][Cdata] : ""; // "Get psyced!"; + vars["_XML_description_presence"] = + xmlquote(vars["_description_presence"]); vars["_INTERNAL_mood_jabber"] = "neutral"; sendmsg(o, "_notice_presence_absent", 0, vars, origin); @@ -693,6 +695,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) { vars["_description_presence"] = (node["/status"] && node["/status"][Cdata]) ? node["/status"][Cdata] : ""; // "Get psyced!"; + vars["_XML_description_presence"] = + xmlquote(vars["_description_presence"]); vars["_degree_availability"] = jabber2avail[node["/show"] && node["/show"][Cdata]]; // this message is too verbose, let's put in into diff --git a/world/net/jabber/user.c b/world/net/jabber/user.c index 2de8123..a0e7ef2 100644 --- a/world/net/jabber/user.c +++ b/world/net/jabber/user.c @@ -250,11 +250,12 @@ showFriends() { "_INTERNAL_target_jabber" : myjid, "_INTERNAL_source_jabber" : mkjid(person), "_description_presence" : "", // TODO: get these from state + "_XML_description_presence" : "", "_INTERNAL_mood_jabber" : "neutral" ])); } 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() { @@ -1212,6 +1213,7 @@ varargs string mkjid(mixed who, mixed vars, mixed ignore_nick, mixed ignore_cont // message rendering a la jabber w(string mc, string data, mapping vars, mixed source) { mixed t; + unless (mappingp(vars)) vars = ([]); else if (vars["_nick_verbatim"]) vars["_nick"] = vars["_nick_verbatim"]; // ^^ 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; if (vars["_list_groups"]) vars["_list_groups"] = IMPLODE_XML(vars["_list_groups"], ""); - +#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)) { P1(("%O not interactive. w(%O) from %O.\n", ME, mc, source)) return; diff --git a/world/net/twitter/polly.c b/world/net/twitter/polly.c index b34dbf9..2fd03a1 100644 --- a/world/net/twitter/polly.c +++ b/world/net/twitter/polly.c @@ -50,7 +50,7 @@ parse(string body, mapping headers) { return; } 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"); for (i=sizeof(wurst)-1; i>=0; i--) { d = wurst[i]; @@ -110,7 +110,7 @@ parse(string body, mapping headers) { } 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 feed -> content( #'parse, 1, 1 ); // twitter ignores since_id if count is present. stupid.