add GetReactions D-Bus method
This commit is contained in:
parent
8c7dba5cf7
commit
35cc360b08
13
dbus.go
13
dbus.go
|
|
@ -391,6 +391,18 @@ func (a *DBusAdapter) SetConfig(sessionID, key, value string) (bool, *dbus.Error
|
|||
return true, nil
|
||||
}
|
||||
|
||||
func (a *DBusAdapter) GetReactions(sessionID string) (string, *dbus.Error) {
|
||||
sess := a.mgr.Session(sessionID)
|
||||
if sess == nil {
|
||||
return "{}", nil
|
||||
}
|
||||
data, err := json.Marshal(sess.Core.Reactions())
|
||||
if err != nil {
|
||||
return "", dbus.MakeFailedError(err)
|
||||
}
|
||||
return string(data), nil
|
||||
}
|
||||
|
||||
func (a *DBusAdapter) GetContext(sessionID string) (string, *dbus.Error) {
|
||||
sess := a.mgr.Session(sessionID)
|
||||
if sess == nil {
|
||||
|
|
@ -707,6 +719,7 @@ var introspectXML = `<node>
|
|||
<method name="GetConfig"><arg direction="in" type="s" name="sessionID"/><arg direction="out" type="s"/></method>
|
||||
<method name="SetConfig"><arg direction="in" type="s" name="sessionID"/><arg direction="in" type="s" name="key"/><arg direction="in" type="s" name="value"/><arg direction="out" type="b"/></method>
|
||||
<method name="GetContext"><arg direction="in" type="s" name="sessionID"/><arg direction="out" type="s"/></method>
|
||||
<method name="GetReactions"><arg direction="in" type="s" name="sessionID"/><arg direction="out" type="s"/></method>
|
||||
<method name="ListBackends"><arg direction="out" type="as"/></method>
|
||||
<method name="ListModelsByBackend"><arg direction="in" type="s" name="backend"/><arg direction="out" type="as"/></method>
|
||||
<method name="ListModels"><arg direction="in" type="s" name="sessionID"/><arg direction="out" type="as"/></method>
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ func (c *stubCore) SignalDetached(int, int) error
|
|||
func (c *stubCore) GetDetachedOutput(int) (string, error) { return "", nil }
|
||||
func (c *stubCore) DismissDetached(int) bool { return false }
|
||||
func (c *stubCore) InjectSystemEvent(string) {}
|
||||
func (c *stubCore) Reactions() map[string]string { return nil }
|
||||
func (c *stubCore) React(string) {}
|
||||
func (c *stubCore) ReactTo(responseID, emoji string) error {
|
||||
c.reactResponseID = responseID
|
||||
|
|
|
|||
Reference in New Issue