From: Christian Fetzer Date: Tue, 24 Sep 2013 11:27:08 +0000 (+0200) Subject: obexd: Fix emitting Type property changed signals for messages X-Git-Tag: android-x86-4.4-r3~7551 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4d96b9beed17138a798ce89b92514888594cdc10;p=android-x86%2Fexternal-bluetooth-bluez.git obexd: Fix emitting Type property changed signals for messages In order to determine if the message Type property has changed, the stored type needs to be compared with the parsed type and not with the raw value received from the MSE. This fixes the issue that the property changed signal for the Type property is emitted for every message on every ListMessage call. --- diff --git a/obexd/client/map.c b/obexd/client/map.c index e1f95f1ed..3feac9060 100644 --- a/obexd/client/map.c +++ b/obexd/client/map.c @@ -923,21 +923,22 @@ static void parse_recipient_address(struct map_msg *msg, const char *value) static void parse_type(struct map_msg *msg, const char *value) { - if (g_strcmp0(msg->type, value) == 0) - return; - - g_free(msg->type); + const char *type = NULL; if (strcasecmp(value, "SMS_GSM") == 0) - msg->type = g_strdup("sms-gsm"); + type = "sms-gsm"; else if (strcasecmp(value, "SMS_CDMA") == 0) - msg->type = g_strdup("sms-cdma"); + type = "sms-cdma"; else if (strcasecmp(value, "EMAIL") == 0) - msg->type = g_strdup("email"); + type = "email"; else if (strcasecmp(value, "MMS") == 0) - msg->type = g_strdup("mms"); - else - msg->type = NULL; + type = "mms"; + + if (g_strcmp0(msg->type, type) == 0) + return; + + g_free(msg->type); + msg->type = g_strdup(type); g_dbus_emit_property_changed(conn, msg->path, MAP_MSG_INTERFACE, "Type");