# HG changeset patch # User Myhailo Danylenko # Date 1257951478 -7200 # Node ID a838a4ecf8342d0663544ba8aae36b0fb73c4e89 # Parent e7dcbcbb8dbcc14288180ce128eb47c163ed585f Send metadata request on missing avatar diff -r e7dcbcbb8dbc -r a838a4ecf834 TODO --- a/TODO Wed Nov 11 15:21:36 2009 +0200 +++ b/TODO Wed Nov 11 16:57:58 2009 +0200 @@ -1,5 +1,4 @@ -Send metadata request instead of data request? Add avatar_aa_options? Handle url avatars? (needs common image loading library (sdl-image? imlib?) and web-retrieving library (curl?)) Report no-avatar diff -r e7dcbcbb8dbc -r a838a4ecf834 avatar.c --- a/avatar.c Wed Nov 11 15:21:36 2009 +0200 +++ b/avatar.c Wed Nov 11 16:57:58 2009 +0200 @@ -561,10 +561,9 @@ struct stat buf; if (stat (file, &buf) == -1) { - gchar *bjid = jidtodisp (jid); - LmMessage *request; - LmMessageNode *node; - LmMessageHandler *dhandler; + gchar *bjid = jidtodisp (jid); + LmMessage *request; + LmMessageNode *node; scr_WriteIncomingMessage (bjid, "No avatar for this buddy yet, sending request.", 0, HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0); // NO conversion from utf-8 @@ -577,20 +576,13 @@ lm_message_node_set_attribute (node, "xmlns", NS_PUBSUB); node = lm_message_node_add_child (node, "items", NULL); - lm_message_node_set_attribute (node, "node", NS_AVATAR_DATA); - - node = lm_message_node_add_child (node, "item", NULL); + lm_message_node_set_attribute (node, "node", NS_AVATAR_METADATA); - // create handler - dhandler = lm_message_handler_new (avatar_retrieve_data_reply_handler, bjid, g_free); - reply_handlers = g_slist_append (reply_handlers, dhandler); + // send, result will be handled by pep + lm_connection_send (lconnection, request, NULL); - // send - lm_connection_send_with_reply (lconnection, request, dhandler, NULL); - - lm_message_handler_unref (dhandler); lm_message_unref (request); - // bjid will be freed on handler destruction + g_free (bjid); return TRUE; } } diff -r e7dcbcbb8dbc -r a838a4ecf834 help/en/hlp_avatar.txt --- a/help/en/hlp_avatar.txt Wed Nov 11 15:21:36 2009 +0200 +++ b/help/en/hlp_avatar.txt Wed Nov 11 16:57:58 2009 +0200 @@ -1,6 +1,6 @@ /AVATAR [filename.png|-] -Publishes filename as your avatar via pep. Specify - to remove avatar. Without argument shows current byddy's avatar. +Publishes filename as your avatar via pep. Specify - to remove avatar. Without argument shows current byddy's avatar (or requests information from buddy). Note: standard states, that avatar MUST be of type image/png, thus, no support for anything alse. Note: url avatars are not supported yet.