aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/dbus.go
diff options
context:
space:
mode:
Diffstat (limited to 'hst/dbus.go')
-rw-r--r--hst/dbus.go46
1 files changed, 24 insertions, 22 deletions
diff --git a/hst/dbus.go b/hst/dbus.go
index 6dd1a2c3..5c4620cc 100644
--- a/hst/dbus.go
+++ b/hst/dbus.go
@@ -5,8 +5,26 @@ import (
"strings"
)
-// BadInterfaceError is returned when Interface fails an undocumented check in xdg-dbus-proxy,
-// which would have cause a silent failure.
+// BadInterfaceError is returned when Interface fails an undocumented check in
+// xdg-dbus-proxy, which would have cause a silent failure.
+//
+// xdg-dbus-proxy fails without output when this condition is not met:
+//
+// char *dot = strrchr (filter->interface, '.');
+// if (dot != NULL)
+// {
+// *dot = 0;
+// if (strcmp (dot + 1, "*") != 0)
+// filter->member = g_strdup (dot + 1);
+// }
+//
+// trim ".*" since they are removed before searching for '.':
+//
+// if (g_str_has_suffix (name, ".*"))
+// {
+// name[strlen (name) - 2] = 0;
+// wildcard = TRUE;
+// }
type BadInterfaceError struct {
// Interface is the offending interface string.
Interface string
@@ -19,7 +37,8 @@ func (e *BadInterfaceError) Error() string {
if e == nil {
return "<nil>"
}
- return "bad interface string " + strconv.Quote(e.Interface) + " in " + e.Segment + " bus configuration"
+ return "bad interface string " + strconv.Quote(e.Interface) +
+ " in " + e.Segment + " bus configuration"
}
// BusConfig configures the xdg-dbus-proxy process.
@@ -76,31 +95,14 @@ func (c *BusConfig) Interfaces(yield func(string) bool) {
}
}
-// CheckInterfaces checks for invalid interface strings based on an undocumented check in xdg-dbus-error,
-// returning [BadInterfaceError] if one is encountered.
+// CheckInterfaces checks for invalid interface strings based on an undocumented
+// check in xdg-dbus-error, returning [BadInterfaceError] if one is encountered.
func (c *BusConfig) CheckInterfaces(segment string) error {
if c == nil {
return nil
}
for iface := range c.Interfaces {
- /*
- xdg-dbus-proxy fails without output when this condition is not met:
- char *dot = strrchr (filter->interface, '.');
- if (dot != NULL)
- {
- *dot = 0;
- if (strcmp (dot + 1, "*") != 0)
- filter->member = g_strdup (dot + 1);
- }
-
- trim ".*" since they are removed before searching for '.':
- if (g_str_has_suffix (name, ".*"))
- {
- name[strlen (name) - 2] = 0;
- wildcard = TRUE;
- }
- */
if strings.IndexByte(strings.TrimSuffix(iface, ".*"), '.') == -1 {
return &BadInterfaceError{iface, segment}
}