# HG changeset patch # User Mikael Berthe # Date 1163615279 -3600 # Node ID 45d022fbce3a2e1a09a50e0a435ff9502d7c7a48 # Parent 41f9a2a4c1de0548cf15aacde7bee59f7b331f50 XEP-0145: Handle dates Save cdate and mdate when creating/updating an annotation. diff -r 41f9a2a4c1de -r 45d022fbce3a mcabber/src/jabglue.c --- a/mcabber/src/jabglue.c Wed Nov 15 19:23:40 2006 +0100 +++ b/mcabber/src/jabglue.c Wed Nov 15 19:27:59 2006 +0100 @@ -1282,6 +1282,7 @@ { xmlnode x; bool changed = FALSE; + const char *cdate = NULL; if (!barejid) return; @@ -1307,6 +1308,7 @@ if (!strcmp(jid, barejid)) { // We've found a note for this jid. Let's hide it and we'll // create a new one. + cdate = xmlnode_get_attrib(x, "cdate"); xmlnode_hide(x); changed = TRUE; break; @@ -1316,8 +1318,16 @@ // Let's create a node for this jid, if the note is not NULL. if (note) { + char mdate[20]; + time_t now; + time(&now); + to_iso8601(mdate, now); + if (!cdate) + cdate = mdate; x = xmlnode_insert_tag(rosternotes, "note"); xmlnode_put_attrib(x, "jid", barejid); + xmlnode_put_attrib(x, "cdate", cdate); + xmlnode_put_attrib(x, "mdate", mdate); xmlnode_insert_cdata(x, note, -1); changed = TRUE; }