return NULL;
}
+#if defined TIZEN_EXT
+#define SENDER_PREFIX ",sender='%s'"
+#define PATH_PREFIX ",path='%s'"
+#define IFACE_PREFIX ",interface='%s'"
+#define MEMBER_PREFIX ",member='%s'"
+#define ARG0_PREFIX ",arg0='%s'"
+
+static gboolean check_rule_length(int remains, const char *prefix, const char *data)
+{
+ if (!prefix || !data)
+ return FALSE;
+
+ return strlen(prefix) - 4 + strlen(data) < remains;
+}
+
+static void format_rule(struct filter_data *data, char *rule, size_t size)
+{
+ const char *sender;
+ int offset;
+
+ offset = snprintf(rule, size, "type='signal'");
+ sender = data->name ? : data->owner;
+
+ if (sender &&
+ check_rule_length(size - offset, SENDER_PREFIX, sender))
+ offset += snprintf(rule + offset, size - offset,
+ SENDER_PREFIX, sender);
+ if (data->path &&
+ check_rule_length(size - offset, PATH_PREFIX, data->path))
+ offset += snprintf(rule + offset, size - offset,
+ PATH_PREFIX, data->path);
+ if (data->interface &&
+ check_rule_length(size - offset, IFACE_PREFIX, data->interface))
+ offset += snprintf(rule + offset, size - offset,
+ IFACE_PREFIX, data->interface);
+ if (data->member &&
+ check_rule_length(size - offset, MEMBER_PREFIX, data->member))
+ offset += snprintf(rule + offset, size - offset,
+ MEMBER_PREFIX, data->member);
+ if (data->argument &&
+ check_rule_length(size - offset, ARG0_PREFIX, data->argument))
+ snprintf(rule + offset, size - offset,
+ ARG0_PREFIX, data->argument);
+}
+#else
static void format_rule(struct filter_data *data, char *rule, size_t size)
{
const char *sender;
snprintf(rule + offset, size - offset,
",arg0='%s'", data->argument);
}
+#endif
static gboolean add_match(struct filter_data *data,
DBusHandleMessageFunction filter)