Changes

→‎Collaboration: AccountManager
Line 449: Line 449:  
'''Note:''' ''The [[#Presence|Presence Service]] (which was a wrapper around Telepathy in earlier Sugar releases) has been deprecated. Activities need to use Telepathy directly.''
 
'''Note:''' ''The [[#Presence|Presence Service]] (which was a wrapper around Telepathy in earlier Sugar releases) has been deprecated. Activities need to use Telepathy directly.''
   −
== Sharing ==
+
== Telepathy ==
 +
 
 +
For details, please refer to the [http://telepathy.freedesktop.org/spec/ Telepathy Specification].
 +
 
 +
The entry point to Telepathy is the AccountManager:
 +
 
 +
Service:    org.freedesktop.Telepathy.AccountManager
 +
Interface:  org.freedesktop.Telepathy.AccountManager
 +
Object Path: /org/freedesktop/Telepathy/AccountManager
 +
 
 +
It has a list of valid Accounts. Each account has a Connection property, which is valid if its D-Bus path is not '/', and connected if the account's ConnectionStatus property is 0 (1 means connecting, 2 disconnected).
 +
 
 +
accounts = accountManager.Get('ValidAccounts')
 +
for account in accounts:
 +
    connection = account.Get('Connection')
 +
    if connection.path != '/' && account.Get('ConnectionStatus') == 0:
 +
        connections.add(connection)
 +
 
 +
There may be more than one valid connection.
 +
 
 +
== Startup ==
 +
 
 +
On startup, an activity needs to check if there is already a "room" for it. If so, it needs to be joined (see [[#Joining|below]]). The GetActivity method checks for the room given an activity_id:
 +
 
 +
for connection in connections:
 +
    room_handle = connection.GetActivity(activityId)              # may fail
 +
 
 +
It is provided by the non-standard ActivityProperties interface:
 +
 
 +
INTERFACE org.laptop.Telepathy.ActivityProperties
 +
METHOD GetActivity(activity_id:s) => (room:u)
 +
METHOD GetProperties(room:u) => (properties:a{sv})
 +
METHOD SetProperties(room:u, properties:a{sv}) => ()
 +
SIGNAL ActivityPropertiesChanged(room:u, properties:a{sv})
 +
 
 +
== Joining ==
 +
 
 +
If the activity finds itself to be shared already on startup, or the user chooses to enable sharing later, it needs to "join" the room used for communication:
 +
 
 +
* create text channel
 +
* create tubes channel
 +
* add self to group
 +
 
 +
''to be documented''
 +
 
 +
== Leaving ==
    
''to be documented''
 
''to be documented''
Line 457: Line 502:  
''to be documented''
 
''to be documented''
   −
== Joining ==
+
== Communicating ==
   −
''to be documented''
+
This depends on the needs of the activity, but in general it would
   −
== Leaving ==
+
* create a tube in tubes channel
 +
* use the tube for communication
    
''to be documented''
 
''to be documented''
132

edits