cpw.darkrain42.obsolete: c09ec70d: Remove obsoleted XEP-0090 (Legacy Entity...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Fri Jun 12 02:05:55 EDT 2009
-----------------------------------------------------------------
Revision: c09ec70d7a13deec0ac8624876b13f027d581846
Ancestor: e151b5d0a3a46d7f502574d1e0ae3200bbf2247e
Author: darkrain42 at pidgin.im
Date: 2009-06-11T22:50:29
Branch: im.pidgin.cpw.darkrain42.obsolete
URL: http://d.pidgin.im/viewmtn/revision/info/c09ec70d7a13deec0ac8624876b13f027d581846
Modified files:
libpurple/protocols/jabber/iq.c
libpurple/protocols/jabber/jabber.c
ChangeLog:
Remove obsoleted XEP-0090 (Legacy Entity Time)
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/iq.c c390da42a3529b5e0264108b3e808979ea547fd2
+++ libpurple/protocols/jabber/iq.c f4f006ecf6bb663e697036070cdae072fb4d5700
@@ -168,28 +168,19 @@ static void jabber_iq_last_parse(JabberS
}
}
-static void jabber_iq_time_parse(JabberStream *js, const char *from,
- JabberIqType type, const char *id,
- xmlnode *child)
+static void jabber_time_parse(JabberStream *js, const char *from,
+ JabberIqType type, const char *id,
+ xmlnode *child)
{
- const char *xmlns;
JabberIq *iq;
time_t now_t;
- struct tm now_local;
- struct tm now_utc;
- struct tm *now;
+ struct tm *tm;
time(&now_t);
- now = localtime(&now_t);
- memcpy(&now_local, now, sizeof(struct tm));
- now = gmtime(&now_t);
- memcpy(&now_utc, now, sizeof(struct tm));
- xmlns = xmlnode_get_namespace(child);
-
if(type == JABBER_IQ_GET) {
- xmlnode *utc;
- const char *date, *tz, *display;
+ xmlnode *tzo, *utc;
+ const char *date, *tz;
iq = jabber_iq_new(js, JABBER_IQ_RESULT);
jabber_iq_set_id(iq, id);
@@ -197,27 +188,23 @@ static void jabber_iq_time_parse(JabberS
xmlnode_set_attrib(iq->node, "to", from);
child = xmlnode_new_child(iq->node, child->name);
- xmlnode_set_namespace(child, xmlns);
- utc = xmlnode_new_child(child, "utc");
+ xmlnode_set_namespace(child, "urn:xmpp:time");
- if(!strcmp("urn:xmpp:time", xmlns)) {
- tz = purple_get_tzoff_str(&now_local, TRUE);
- xmlnode_insert_data(xmlnode_new_child(child, "tzo"), tz, -1);
+ /* <tzo>-06:00</tzo> */
+ tm = localtime(&now_t);
+ tz = purple_get_tzoff_str(tm, TRUE);
+ tzo = xmlnode_new_child(child, "tzo");
+ xmlnode_insert_data(tzo, tz, -1);
- date = purple_utf8_strftime("%FT%TZ", &now_utc);
- xmlnode_insert_data(utc, date, -1);
- } else { /* jabber:iq:time */
- tz = purple_utf8_strftime("%Z", &now_local);
- xmlnode_insert_data(xmlnode_new_child(child, "tz"), tz, -1);
+ /* <utc>2006-12-19T17:58:35Z</utc> */
+ tm = gmtime(&now_t);
+ date = purple_utf8_strftime("%FT%TZ", tm);
+ utc = xmlnode_new_child(child, "utc");
+ xmlnode_insert_data(utc, date, -1);
- date = purple_utf8_strftime("%Y%m%dT%T", &now_utc);
- xmlnode_insert_data(utc, date, -1);
-
- display = purple_utf8_strftime("%d %b %Y %T", &now_local);
- xmlnode_insert_data(xmlnode_new_child(child, "display"), display, -1);
- }
-
jabber_iq_send(iq);
+ } else {
+ /* TODO: Errors */
}
}
@@ -488,7 +475,6 @@ void jabber_iq_init(void)
jabber_register_parse);
jabber_iq_register_handler("query", "jabber:iq:roster",
jabber_roster_parse);
- jabber_iq_register_handler("query", "jabber:iq:time", jabber_iq_time_parse);
jabber_iq_register_handler("query", "jabber:iq:version",
jabber_iq_version_parse);
#ifdef USE_VV
@@ -497,7 +483,7 @@ void jabber_iq_init(void)
#endif
jabber_iq_register_handler("block", "urn:xmpp:blocking", jabber_blocklist_parse_push);
jabber_iq_register_handler("unblock", "urn:xmpp:blocking", jabber_blocklist_parse_push);
- jabber_iq_register_handler("time", "urn:xmpp:time", jabber_iq_time_parse);
+ jabber_iq_register_handler("time", "urn:xmpp:time", jabber_time_parse);
}
============================================================
--- libpurple/protocols/jabber/jabber.c 1149e49ab4217c784cf07e36455ae72d89a28aac
+++ libpurple/protocols/jabber/jabber.c d249ad5e97ce209b9b446a1c285837d3a704f32f
@@ -3443,7 +3443,6 @@ jabber_init_plugin(PurplePlugin *plugin)
/* initialize jabber_features list */
jabber_add_feature("jabber:iq:last", 0);
jabber_add_feature("jabber:iq:oob", 0);
- jabber_add_feature("jabber:iq:time", 0);
jabber_add_feature("urn:xmpp:time", 0);
jabber_add_feature("jabber:iq:version", 0);
jabber_add_feature("jabber:x:conference", 0);
More information about the Commits
mailing list