From beeea117bf7be849ffb1a02bd4d284b2c627215d Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Mon, 2 Mar 2009 19:34:31 +0100 Subject: [PATCH] jabber/user: fixed outgoing presence support (announce) --- CHANGESTODO | 2 +- world/net/jabber/user.c | 38 ++++++++++++++------------------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/CHANGESTODO b/CHANGESTODO index 644a8bd..ac0c04e 100644 --- a/CHANGESTODO +++ b/CHANGESTODO @@ -3921,4 +3921,4 @@ archetype + when joe says "/nick joe" it is understood as removing the /nick jabber/user - fixed major bug in output of presence state (showFriends) - +- fixed outgoing presence support (announce) diff --git a/world/net/jabber/user.c b/world/net/jabber/user.c index b29df77..1ab8e5b 100644 --- a/world/net/jabber/user.c +++ b/world/net/jabber/user.c @@ -19,7 +19,8 @@ volatile int isplacemsg; volatile int hasroster = 0; // client has requested roster -volatile mapping affiliations = ([ ]); // hack to support affiliations +volatile mapping jabber2avail, + affiliations = ([ ]); // hack to support affiliations #include JABBER_PATH "disco.c" // #include NET_PATH "members.i" // isn't this include redundant? @@ -30,6 +31,11 @@ qResource() { return resource; } qHasCurrentPlace() { return 0; } +void create() { + jabber2avail = shared_memory("jabber2avail"); + return ::create(); +} + /* it should be posible to do some things in a way that can be shared between * user and active/gateway... mostly stuff like MUC-support, version requests * and such -- TODO @@ -400,32 +406,16 @@ presence(XMLNode node) { } } /* end of directed presence handling */ #endif // _flag_disable_presence_directed_XMPP -#ifdef AVAILABILITY_AWAY - else if (node["/show"]) { - // else this is one of the so-called "presence broadcasts" - // we will never support stupid broadcasts although we could - // do some fancy castmsg now - switch (node["/show"][Cdata]) { - case "away": - case "xa": - case "dnd": - // we simply map them to away - vSet("me", (node["/status"] && - node["/status"][Cdata]) || "away"); - announce(AVAILABILITY_AWAY); - break; - case "chat": - // chattativ? ab in den flirt-raum mit dir! - break; - default: - // away loeschen wenn gesetzt - break; - } - } else if (node["@type"] == "unavailable") { - // hey... we should logout those guys ;) + else if (node["@type"] == "unavailable") { // announce OFFLINE manually here? no.. see comment in person:quit() // _flag_enable_manual_announce_XMPP is nothing we really need.. i think return quit(); + } +#ifdef AVAILABILITY_AWAY + else if (node["/show"]) { + // this is one of the so-called "presence broadcasts" + announce(jabber2avail[node["/show"] && node["/show"][Cdata]], 0, 0, + node["/status"] && node["/status"][Cdata]); } else { // TODO: quiet? announce(AVAILABILITY_HERE);