summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-message.c
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2005-06-15 15:59:57 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2005-06-15 15:59:57 +0000
commita93f9c04acedc37277ef60dc7225464b8b62f0ee (patch)
treeffa26a5795e85cbf72379239e234785ca1eb2fd3 /dbus/dbus-message.c
parent5e389fdf499c39926c61b47fcafb5e71291ce1a2 (diff)
* dbus/dbus-message.c:
(dbus_message_has_path): New method (dbus_message_has_interface): New method (dbus_message_has_member): New method * dbus/dbus/dbus-sysdeps.c (_dbus_check_dir_is_private_to_user): New method * dbus/dbus-keyring.c (_dbus_keyring_reload): Check to see that the keyring directory is private to the user * doc/TODO: - The convenience functions in dbus-bus.h should perhaps have the signatures that they would have if they were autogenerated stubs. e.g. the acquire service function. We should also evaluate which of these functions to include, in light of the fact that GLib/Qt native stubs will probably also exist.: Punted - add dbus_message_has_path(), maybe has_member/interface: fixed in this patch - in dbus-keyring.c, enforce that the keyring dir is not world readable/writable: Fixed in this patch
Diffstat (limited to 'dbus/dbus-message.c')
-rw-r--r--dbus/dbus-message.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index cdfdf5f3..983eea93 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -2431,6 +2431,36 @@ dbus_message_get_path (DBusMessage *message)
}
/**
+ * Checks if the message has a path
+ *
+ * @param message the message
+ * @returns #TRUE if there is a path field in the header
+ */
+dbus_bool_t
+dbus_message_has_path (DBusMessage *message,
+ const char *path)
+{
+ const char *msg_path;
+ msg_path = dbus_message_get_path (message);
+
+ if (msg_path == NULL)
+ {
+ if (path == NULL)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ if (path == NULL)
+ return FALSE;
+
+ if (strcmp (msg_path, path) == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
+/**
* Gets the object path this message is being sent to
* (for DBUS_MESSAGE_TYPE_METHOD_CALL) or being emitted
* from (for DBUS_MESSAGE_TYPE_SIGNAL) in a decomposed
@@ -2521,6 +2551,37 @@ dbus_message_get_interface (DBusMessage *message)
}
/**
+ * Checks if the message has an interface
+ *
+ * @param message the message
+ * @returns #TRUE if there is a interface field in the header
+ */
+dbus_bool_t
+dbus_message_has_interface (DBusMessage *message,
+ const char *interface)
+{
+ const char *msg_interface;
+ msg_interface = dbus_message_get_interface (message);
+
+ if (msg_interface == NULL)
+ {
+ if (interface == NULL)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ if (interface == NULL)
+ return FALSE;
+
+ if (strcmp (msg_interface, interface) == 0)
+ return TRUE;
+
+ return FALSE;
+
+}
+
+/**
* Sets the interface member being invoked
* (DBUS_MESSAGE_TYPE_METHOD_CALL) or emitted
* (DBUS_MESSAGE_TYPE_SIGNAL).
@@ -2570,6 +2631,37 @@ dbus_message_get_member (DBusMessage *message)
}
/**
+ * Checks if the message has an interface member
+ *
+ * @param message the message
+ * @returns #TRUE if there is a member field in the header
+ */
+dbus_bool_t
+dbus_message_has_member (DBusMessage *message,
+ const char *member)
+{
+ const char *msg_member;
+ msg_member = dbus_message_get_member (message);
+
+ if (msg_member == NULL)
+ {
+ if (member == NULL)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ if (member == NULL)
+ return FALSE;
+
+ if (strcmp (msg_member, member) == 0)
+ return TRUE;
+
+ return FALSE;
+
+}
+
+/**
* Sets the name of the error (DBUS_MESSAGE_TYPE_ERROR).
* The name is fully-qualified (namespaced).
*