Commit d5f3c5fd authored by Florian Müllner's avatar Florian Müllner
Browse files

accountsMonitor: Manage account-specific settings

Identifying with NickServ and compatible bots requires more information
than just the password, namely the username that is identified and the
name of the bot itself. Account parameters are limited to a fixed set
of settings defined by telepathy itself and the protocol, so use a
relocatable GSettings schema to store the additional parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=709982
parent f00270ad
......@@ -22,4 +22,17 @@
<description>Last active (selected) channel</description>
</key>
</schema>
<schema id="org.gnome.Polari.Account">
<key type="s" name="identify-botname">
<default>"NickServ"</default>
<summary>Identify botname</summary>
<description>Nickname of the bot to identify with</description>
</key>
<key type="s" name="identify-username">
<default>""</default>
<summary>Identify username</summary>
<description>Username to use in identify command</description>
</key>
</schema>
</schemalist>
......@@ -17,6 +17,7 @@ const AccountsMonitor = new Lang.Class({
_init: function() {
this._accounts = new Map();
this._accountSettings = new Map();
this._app = Gio.Application.get_default();
this._app.connect('prepare-shutdown',
......@@ -50,6 +51,19 @@ const AccountsMonitor = new Lang.Class({
return this._accounts.get(accountPath);
},
getAccountSettings: function(account) {
let accountPath = account.object_path;
let settings = this._accountSettings.get(accountPath);
if (settings)
return settings;
let path = '/org/gnome/Polari/Accounts/%s/'.format(account.get_path_suffix());
settings = new Gio.Settings({ schema_id: 'org.gnome.Polari.Account',
path: path });
this._accountSettings.set(accountPath, settings);
return settings;
},
prepare: function(callback) {
let quark = Tp.AccountManager.get_feature_quark_core();
if (this._accountManager.is_prepared(quark))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment