Mercurial > pidgin
diff libpurple/protocols/msn/object.c @ 16031:7873f314fadf
Patch in Trac ticket #113 from Simom.
"Continued from patch #1693706 in SF tracker:
Newer Live Messenger -versions doesn't always send SHA1C-field in msnobj's and
so Pidgin discards them. This new version of patch uses sha1c as icon checksum
if it exists, otherwise it falls back to using sha1d, as datallah suggested."
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 23 Apr 2007 16:28:04 +0000 |
parents | 32c366eeeb99 |
children | 4fc51a87ce42 1122d47583a1 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/object.c Mon Apr 09 13:02:46 2007 +0000 +++ b/libpurple/protocols/msn/object.c Mon Apr 23 16:28:04 2007 +0000 @@ -92,9 +92,10 @@ GET_STRING_TAG(sha1c, "SHA1C"); /* If we are missing any of the required elements then discard the object */ + /* SHA1C is not always sent anymore */ if (obj->creator == NULL || obj->size == 0 || obj->type == 0 || obj->location == NULL || obj->friendly == NULL - || obj->sha1d == NULL || obj->sha1c == NULL) { + || obj->sha1d == NULL /*|| obj->sha1c == NULL*/) { purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); msn_object_destroy(obj); obj = NULL; @@ -274,18 +275,30 @@ return obj->sha1c; } +const char * +msn_object_get_sha1(const MsnObject *obj) +{ + g_return_val_if_fail(obj != NULL, NULL); + + if(obj->sha1c != NULL) { + return obj->sha1c; + } else { + return obj->sha1d; + } +} + static MsnObject * -msn_object_find_local(const char *sha1c) +msn_object_find_local(const char *sha1) { GList *l; - g_return_val_if_fail(sha1c != NULL, NULL); + g_return_val_if_fail(sha1 != NULL, NULL); for (l = local_objs; l != NULL; l = l->next) { MsnObject *local_obj = l->data; - if (!strcmp(msn_object_get_sha1c(local_obj), sha1c)) + if (!strcmp(msn_object_get_sha1(local_obj), sha1)) return local_obj; } @@ -324,7 +337,7 @@ g_return_val_if_fail(obj != NULL, NULL); - local_obj = msn_object_find_local(msn_object_get_sha1c(obj)); + local_obj = msn_object_find_local(msn_object_get_sha1(obj)); if (local_obj != NULL) return local_obj->real_location;