diff mcabber/src/jabglue.c @ 1019:9d5f6e0ea7b3

XEP-0145: display note dates Display note creation/modification dates (if available) in /roster note.
author Mikael Berthe <mikael@lilotux.net>
date Wed, 15 Nov 2006 22:24:20 +0100
parents 45d022fbce3a
children 4c8d7b558e83
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Wed Nov 15 19:27:59 2006 +0100
+++ b/mcabber/src/jabglue.c	Wed Nov 15 22:24:20 2006 +0100
@@ -1239,9 +1239,9 @@
 }
 
 //  jb_get_storage_rosternotes(barejid)
-// Return thenote associated to this jid.
-// The caller should g_free the string after use.
-char *jb_get_storage_rosternotes(const char *barejid)
+// Return the annotation associated with this jid.
+// The caller should g_free the string and structure after use.
+struct annotation *jb_get_storage_rosternotes(const char *barejid)
 {
   xmlnode x;
 
@@ -1268,7 +1268,15 @@
         continue;
       if (!strcmp(jid, barejid)) {
         // We've found a note for this contact.
-        return g_strdup(xmlnode_get_data(x));
+        struct annotation *note = g_new0(struct annotation, 1);
+        p = xmlnode_get_attrib(x, "cdate");
+        if (p)
+          note->cdate = from_iso8601(p, 1);
+        p = xmlnode_get_attrib(x, "mdate");
+        if (p)
+          note->mdate = from_iso8601(p, 1);
+        note->text = g_strdup(xmlnode_get_data(x));
+        return note;
       }
     }
   }