summaryrefslogtreecommitdiff
path: root/obexd
diff options
context:
space:
mode:
authorChristian Fetzer <christian.fetzer@bmw-carit.de>2013-09-24 13:27:08 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-10-02 15:27:22 +0300
commit4d96b9beed17138a798ce89b92514888594cdc10 (patch)
tree6df062018839db2276f64c44bf618a9b2da18af6 /obexd
parent15954a450ec67b257f745ce2885d7639fff504e3 (diff)
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.
Diffstat (limited to 'obexd')
-rw-r--r--obexd/client/map.c21
1 files changed, 11 insertions, 10 deletions
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");