User:Wizzup/Telepathy
This page contains my (personal) notes on how Telepathy (and to some degree rtcom) works, in general, and how it works on Fremantle, and how we plan to make it all work.
Accounts
Accounts are stored in /home/user/.rtcom-accounts/accounts.cfg
on Fremantle, and HOME/.local/share/telepathy/mission-control/accounts.cfg
normally in Telepathy.
It looks like Telepathy mission-control (MC) is the one that actually manages the accounts, and mc-tool
can be used to manage the accounts. This means that likely there are no other tools that read accounts.cfg
on Fremantle, and everything that lists/adds/removes accounts goes through Telepathy MC.
telepathy-ring accounts
It is not clear to me what adds the initial "sms" account, but there must be something that configures this account initially.
Logging
Fremantle logs using the rtcom-eventlogger
package, to a SQLite3 database stored at /home/user/.rtcom-eventlogger/el-v1.db
- all communication related events end up here.
The actual logging to the database is done (as far as I understand) by several different processes: rtcom-call-ui
and rtcom-messaging-ui
. These both interface with telepathy and log to the database as appropriate. (This is visible by looking at /proc/pid-of-program/fd
on Fremantle - it will show that both programs have a fd open to the database)
Telepathy does come with a program called "Telepathy Logger" which can log to various database formats (and I guess just log all messages), and it also provides a way to read (not just write) log events. I am not sure if this is useful for us, but we could take a look later. For now, I believe our replacement programs for the call and messaging UI will have to log on their own.
SMS
telepathy-ring is used to communicate with the modem through ofono. This account has the following options set on my device:
[ring/tel/ring] manager=ring protocol=tel param-account=ring Enabled=true HasBeenOnline=true ConnectAutomatically=true AutomaticPresenceType=2 AutomaticPresenceStatus=available Profile=tel NormalizedName=<SelfHandle>
ConnectAutomatically
seems to suggest there is no specific program that starts telepathy-ring (just MC itself), as long as the account is requested (I guess?) by something.
Presence and online accounts
<todo>
Fremantle (rtcom)
TODO:
- discuss various other rtcom components/packages (rtcom notification plugin, rtcom presence plugin)
- rtcom accounts ui, how that works
- discuss how presence works
Telepathy-Qt
Looks like the right way to use telepathy-qt API is to already have accounts created in Telepathy (use mc-tool or some UI).
Then the AccountManager class can be used to get access to the Account classes (or you can make an account class directly from a D-Bus path). Setting the account presence and it's connection state, and then calling reconnect on the accounts will bring them online.
At this point, using a SimpleTextObserver can be used to monitoring incoming and outgoing messages.
TODO:
- Expand on many more classes, which ones are useful and how to use them
Plan
Telepathy basics for SMS
I think the first step is to make basic Telepathy things work in conversations, this entails manually setting up a sms account using mc-tool and then trying to use it from telepathy-qt: for sending and receiving messages. This probably entails:
- Setting up an account manager, finding the ring account
- Creating a connection from the ring account and making sure it is "ready" / "online"
- Setting up signals for receving messages, and adding a method to send a message
- Creating some code class for the above, so that it can be integrated in Conversations
- Conversations to always run (?)
And then look at integrating this in conversations.
Basic logging
This next step will involve logging sent and received SMS messages to rtcom-eventlogger and further osso-abook integration. We should be able to figure out what contact is who in osso-abook and make sure we log that properly as well.
This probably entails:
- Integrating rtcom-eventlogger in Qt/C++
- Looking at (more) name resolving with osso-abook (might be in rtcom-eventlogger library already)
Extend to IRC, XMPP
This step will require some global notion of if the device is "online" mode (like in Maemo Fremantle). We can set up IRC and XMPP accounts and try use them for messaging as well, and also log to rtcom-eventlogger. We won't worry here yet with showing which of the contacts are 'online'.
- telepathy-idle
- telepathy-gabble
rtcom
Well want to (need to?) reverse engineer (in order of dependencies, not necessarily order we should stick to):
- librtcom-accounts-ui-client0 (14KB)
- libaccounts (32KB)
- librtcom-accounts-widgets0 (108KB) (wants librtcom-accounts-ui-client)
- rtcom-accounts-ui (32KB)
- rtcom-accounts-voip-support
- rtcom-presence-ui (76KB + 6.7KB) (wants librtcom-accounts-ui-client, libmcclient.so.6)
- rtcom-notification-ui (208KB) (wants librtcom-accounts-ui-client.so.0, librtcom-el-plugin-call.so.1, librtcom-el-plugin-sms.so.1, librtcom-el-plugin-chat.so.1)
And there are various accounts plugins, we can probably just recreate those:
- rtcom-accounts-plugin-sip (18KB) (wants librtcom-accounts-ui-client.so.0, libaccounts.so.0, libmcclient.so.6, librtcom-accounts-widgets.so.0)
- rtcom-accounts-plugin-facebook
- rtcom-accounts-plugin-gtalk (FOSS: https://github.com/community-ssu/rtcom-accounts-plugin-gtalk)
- rtcom-accounts-plugin-jabber
- rtcom-accounts-plugin-nokiachat
To plan
- If phone is in offline mode, we cannot send SMSes
- If phone is in non-online mode (for irc, xmpp, etc), then we can't send messages for those protocols
Further reading
- Nice resource on telepathy architecture: https://www.aosabook.org/en/telepathy.html
- rtcom-eventlogger API docs: http://maemo.org/api_refs/5.0/5.0-final/eventlogger/