mirror of
https://github.com/ChronosX88/psyced.git
synced 2024-12-05 00:22:19 +00:00
support for XEP-0203
This commit is contained in:
parent
f4542adc8b
commit
13b4af8098
@ -189,7 +189,7 @@ _message_echo_public_action_possessive
|
||||
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me 's [_action_possessive]</body></message>
|
||||
|
||||
_message_public_history
|
||||
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>[_data]</body><x xmlns='jabber:x:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_place_jabber]'/></message>
|
||||
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>[_data]</body><x xmlns='jabber:x:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_place_jabber_legacy]'/><x xmlns='urn:xmpp:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_place_jabber]'/></message>
|
||||
|
||||
_message_public_action
|
||||
|<message to='[_INTERNAL_target_jabber]' type='groupchat' from='[_INTERNAL_source_jabber]'><body>/me [_action]</body></message>
|
||||
@ -473,10 +473,10 @@ _status_description_vCard
|
||||
|<iq type='result' from='[_INTERNAL_source_jabber]' to='[_INTERNAL_target_jabber]' id='[_tag_reply]'>[_INTERNAL_data_XML]</iq>
|
||||
|
||||
_status_person_present
|
||||
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><x from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber]' xmlns='jabber:x:delay'/></presence>
|
||||
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><x xmlns='jabber:x:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber_legacy]'/><x xmlns='urn:xmpp:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber]'/></presence>
|
||||
|
||||
_status_person_present_implied
|
||||
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><x from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber]' xmlns='jabber:x:delay'/></presence>
|
||||
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><x xmlns='jabber:x:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber_legacy]'/><x xmlns='urn:xmpp:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber]'/></presence>
|
||||
|
||||
_status_person_present_action
|
||||
|{_status_person_present}
|
||||
@ -491,7 +491,7 @@ _status_person_present_netburp_action
|
||||
|{_status_person_present_netburp}
|
||||
|
||||
_status_person_away
|
||||
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_action]</status><x from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber]' xmlns='jabber:x:delay'/></presence>
|
||||
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]'><show>away</show><status>[_action]</status><x xmlns='jabber:x:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber_legacy]'/><x xmlns='urn:xmpp:delay' from='[_INTERNAL_source_jabber]' stamp='[_INTERNAL_time_jabber]'/></presence>
|
||||
|
||||
_status_person_absent
|
||||
|<presence to='[_INTERNAL_target_jabber]' from='[_INTERNAL_source_jabber]' type='unavailable'><status>Offline</status></presence>
|
||||
|
@ -42,7 +42,11 @@ virtual inherit JABBER_PATH "common";
|
||||
|
||||
#define IMPLODE_XML(list, tag) pointerp(list) ? tag + implode(list, "</" + tag[1..] + tag) + "</" + tag[1..] : tag[..<2] + "/>"
|
||||
|
||||
#define JABBERTIME(gm) sprintf("%d%02d%02dT%02d:%02d:%02d", gm[TM_YEAR], gm[TM_MON] + 1, gm[TM_MDAY], gm[TM_HOUR], gm[TM_MIN], gm[TM_SEC])
|
||||
// http://xmpp.org/extensions/xep-0203.html
|
||||
#define JABBERTIME(gm) sprintf("%d-%02d-%02dT%02d:%02d:%02dZ", gm[TM_YEAR], gm[TM_MON] + 1, gm[TM_MDAY], gm[TM_HOUR], gm[TM_MIN], gm[TM_SEC])
|
||||
// http://xmpp.org/extensions/xep-0091.html
|
||||
#define JABBERTIMELEGACY(gm) sprintf("%d%02d%02dT%02d:%02d:%02d", gm[TM_YEAR], gm[TM_MON] + 1, gm[TM_MDAY], gm[TM_HOUR], gm[TM_MIN], gm[TM_SEC])
|
||||
// "Implementations that support XEP-0091 should support the protocol defined herein as soon as possible, but should continue to support the protocol defined in XEP-0091 for backwards compatibility until the status of that specification is changed to Obsolete."
|
||||
|
||||
#define xbuddylist v("peoplegroups")
|
||||
|
||||
|
@ -214,17 +214,26 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
|
||||
vars["_nick_place"] = vars["_INTERNAL_identification"] || origin;
|
||||
|
||||
#if __EFUN_DEFINED__(mktime)
|
||||
if (helper = getchild(node, "x", "jabber:x:delay")) {
|
||||
if ((helper = getchild(node, "x", "jabber:x:delay")) || (helper = getchild(node, "x", "urn:xmpp:delay")) {
|
||||
string fmt = helper["@stamp"];
|
||||
int *time = allocate(TM_MAX);
|
||||
int res;
|
||||
|
||||
// xep 0091 style CCYYMMDDThh:mm:ss
|
||||
// 20080410T19:12:22
|
||||
res = sscanf(fmt, "%4d%2d%2dT%2d:%2d:%2d",
|
||||
time[TM_YEAR], time[TM_MON],
|
||||
time[TM_MDAY], time[TM_HOUR],
|
||||
time[TM_MIN], time[TM_SEC]);
|
||||
if (helper["@xmlns"] == "jabber:x:delay") {
|
||||
// xep 0091 style CCYYMMDDThh:mm:ss
|
||||
// 20080410T19:12:22
|
||||
res = sscanf(fmt, "%4d%2d%2dT%2d:%2d:%2d",
|
||||
time[TM_YEAR], time[TM_MON],
|
||||
time[TM_MDAY], time[TM_HOUR],
|
||||
time[TM_MIN], time[TM_SEC]);
|
||||
} else {
|
||||
// xep 0203 style CC-YY-MMDDThh:mm:ssZ
|
||||
// 2002-09-10T23:05:37Z
|
||||
res = sscanf(fmt, "%d-%2d-%2dT%2d:%2d:%2dZ",
|
||||
time[TM_YEAR], time[TM_MON],
|
||||
time[TM_MDAY], time[TM_HOUR],
|
||||
time[TM_MIN], time[TM_SEC]);
|
||||
}
|
||||
if (res == 6) {
|
||||
// mktime uses month from 0 to 11, december error fixed
|
||||
time[TM_MON]--;
|
||||
@ -690,10 +699,10 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
|
||||
int isstatus;
|
||||
/* see http://www.psyc.eu/presence */
|
||||
// if the node contains a x element in the
|
||||
// jabber:x:delay namespace this is a
|
||||
// _status_presence_here
|
||||
// jabber:x:delay namespace or the urm:xmpp:delay namespace
|
||||
// this is a _status_presence
|
||||
o = summon_person(tu[UUser]);
|
||||
if (helper = getchild(node, "x", "jabber:x:delay")) {
|
||||
if ((helper = getchild(node, "x", "jabber:x:delay")) || (helper = getchild(node, "x", "urn:xmpp:delay"))) {
|
||||
isstatus = 1;
|
||||
}
|
||||
// if (!intp(isstatus)) {
|
||||
|
@ -28,6 +28,7 @@ int msg(string source, string mc, string data,
|
||||
PT(("_time_idle %O == %O, right?\n", vars["_time_idle"], t))
|
||||
}
|
||||
t = gmtime(time() - t);
|
||||
vars["_INTERNAL_time_jabber_legacy"] = JABBERTIMELEGACY(t);
|
||||
vars["_INTERNAL_time_jabber"] = JABBERTIME(t);
|
||||
} else {
|
||||
return 1;
|
||||
@ -385,6 +386,7 @@ int msg(string source, string mc, string data,
|
||||
// and JEP-0091 Delayed Delivery
|
||||
mc = "_message_public_history";
|
||||
t = gmtime(vars["_time_place"]);
|
||||
vars["_INTERNAL_time_place_jabber_legacy"] = JABBERTIMELEGACY(t);
|
||||
vars["_INTERNAL_time_place_jabber"] = JABBERTIME(t);
|
||||
} else if (!vars["_context"]) {
|
||||
mc = "_request_message_public";
|
||||
|
@ -144,8 +144,10 @@ msg(source, mc, data, mapping vars, showingLog) {
|
||||
P2(("_time_idle %O == %O, right?\n", vars["_time_idle"], t))
|
||||
}
|
||||
t = gmtime(time() - t);
|
||||
vars["_INTERNAL_time_jabber_legacy"] = JABBERTIMELEGACY(t);
|
||||
vars["_INTERNAL_time_jabber"] = JABBERTIME(t);
|
||||
} else {
|
||||
vars["_INTERNAL_time_jabber_legacy"] = JABBERTIMELEGACY(gmtime(time()));
|
||||
vars["_INTERNAL_time_jabber"] = JABBERTIME(gmtime(time()));
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user