1616package login1
1717
1818import (
19+ "context"
1920 "fmt"
2021 "os"
2122 "strconv"
@@ -253,10 +254,15 @@ func (c *Conn) GetSession(id string) (dbus.ObjectPath, error) {
253254 return ret , nil
254255}
255256
256- // ListSessions returns an array with all current sessions .
257+ // Deprecated: use ListSessionsContext instead .
257258func (c * Conn ) ListSessions () ([]Session , error ) {
259+ return c .ListSessionsContext (context .Background ())
260+ }
261+
262+ // ListSessionsContext returns an array with all current sessions.
263+ func (c * Conn ) ListSessionsContext (ctx context.Context ) ([]Session , error ) {
258264 out := [][]interface {}{}
259- if err := c .object .Call ( dbusInterface + ".ListSessions" , 0 ).Store (& out ); err != nil {
265+ if err := c .object .CallWithContext ( ctx , dbusInterface + ".ListSessions" , 0 ).Store (& out ); err != nil {
260266 return nil , err
261267 }
262268
@@ -271,10 +277,15 @@ func (c *Conn) ListSessions() ([]Session, error) {
271277 return ret , nil
272278}
273279
274- // ListUsers returns an array with all currently logged in users .
280+ // Deprecated: use ListUsersContext instead .
275281func (c * Conn ) ListUsers () ([]User , error ) {
282+ return c .ListUsersContext (context .Background ())
283+ }
284+
285+ // ListUsersContext returns an array with all currently logged-in users.
286+ func (c * Conn ) ListUsersContext (ctx context.Context ) ([]User , error ) {
276287 out := [][]interface {}{}
277- if err := c .object .Call ( dbusInterface + ".ListUsers" , 0 ).Store (& out ); err != nil {
288+ if err := c .object .CallWithContext ( ctx , dbusInterface + ".ListUsers" , 0 ).Store (& out ); err != nil {
278289 return nil , err
279290 }
280291
0 commit comments