comparison libpurple/protocols/msn/object.c @ 32819:2c6510167895 default tip

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24) to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 Jun 2012 02:30:49 +0000
parents 60d879806964
children
comparison
equal deleted inserted replaced
32818:01ff09d4a463 32819:2c6510167895
101 101
102 /* If we are missing any of the required elements then discard the object */ 102 /* If we are missing any of the required elements then discard the object */
103 if (obj->creator == NULL || obj->size == 0 || obj->type == 0 103 if (obj->creator == NULL || obj->size == 0 || obj->type == 0
104 || obj->sha1d == NULL) { 104 || obj->sha1d == NULL) {
105 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); 105 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
106 msn_object_destroy(obj); 106 msn_object_destroy(obj, FALSE);
107 return NULL; 107 return NULL;
108 } 108 }
109 109
110 if (obj->location == NULL || obj->friendly == NULL) { 110 if (obj->location == NULL || obj->friendly == NULL) {
111 /* Location/friendly are required for non-buddyicon objects */ 111 /* Location/friendly are required for non-buddyicon objects */
112 if (obj->type != MSN_OBJECT_USERTILE) { 112 if (obj->type != MSN_OBJECT_USERTILE) {
113 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); 113 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
114 msn_object_destroy(obj); 114 msn_object_destroy(obj, FALSE);
115 return NULL; 115 return NULL;
116 /* Buddy icon object can contain Url/Url1 instead */ 116 /* Buddy icon object can contain Url/Url1 instead */
117 } else if (obj->url == NULL || obj->url1 == NULL) { 117 } else if (obj->url == NULL || obj->url1 == NULL) {
118 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); 118 purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str);
119 msn_object_destroy(obj); 119 msn_object_destroy(obj, FALSE);
120 return NULL; 120 return NULL;
121 } 121 }
122 } 122 }
123 123
124 return obj; 124 return obj;
191 191
192 return msnobj; 192 return msnobj;
193 } 193 }
194 194
195 void 195 void
196 msn_object_destroy(MsnObject *obj) 196 msn_object_destroy(MsnObject *obj, gboolean only_remote)
197 { 197 {
198 g_return_if_fail(obj != NULL); 198 g_return_if_fail(obj != NULL);
199
200 if (only_remote && obj->local)
201 return;
199 202
200 g_free(obj->creator); 203 g_free(obj->creator);
201 g_free(obj->location); 204 g_free(obj->location);
202 g_free(obj->friendly); 205 g_free(obj->friendly);
203 g_free(obj->sha1d); 206 g_free(obj->sha1d);