comparison 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
comparison
equal deleted inserted replaced
1018:45d022fbce3a 1019:9d5f6e0ea7b3
1237 scr_LogPrint(LPRINT_LOGNORM, 1237 scr_LogPrint(LPRINT_LOGNORM,
1238 "Warning: you're not connected to the server."); 1238 "Warning: you're not connected to the server.");
1239 } 1239 }
1240 1240
1241 // jb_get_storage_rosternotes(barejid) 1241 // jb_get_storage_rosternotes(barejid)
1242 // Return thenote associated to this jid. 1242 // Return the annotation associated with this jid.
1243 // The caller should g_free the string after use. 1243 // The caller should g_free the string and structure after use.
1244 char *jb_get_storage_rosternotes(const char *barejid) 1244 struct annotation *jb_get_storage_rosternotes(const char *barejid)
1245 { 1245 {
1246 xmlnode x; 1246 xmlnode x;
1247 1247
1248 if (!barejid) 1248 if (!barejid)
1249 return NULL; 1249 return NULL;
1266 jid = xmlnode_get_attrib(x, "jid"); 1266 jid = xmlnode_get_attrib(x, "jid");
1267 if (!jid) 1267 if (!jid)
1268 continue; 1268 continue;
1269 if (!strcmp(jid, barejid)) { 1269 if (!strcmp(jid, barejid)) {
1270 // We've found a note for this contact. 1270 // We've found a note for this contact.
1271 return g_strdup(xmlnode_get_data(x)); 1271 struct annotation *note = g_new0(struct annotation, 1);
1272 p = xmlnode_get_attrib(x, "cdate");
1273 if (p)
1274 note->cdate = from_iso8601(p, 1);
1275 p = xmlnode_get_attrib(x, "mdate");
1276 if (p)
1277 note->mdate = from_iso8601(p, 1);
1278 note->text = g_strdup(xmlnode_get_data(x));
1279 return note;
1272 } 1280 }
1273 } 1281 }
1274 } 1282 }
1275 return NULL; // No note found 1283 return NULL; // No note found
1276 } 1284 }