diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2007-02-27 18:08:17 (GMT) |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2007-02-27 18:08:17 (GMT) |
commit | 5535aefc758a50366851f1bc0cf382757d5f8178 (patch) | |
tree | cd00d36e0b4ab2a173a3702847d52b6032135c97 /services | |
parent | d398b37645f5d6c59f243a4e6221a842a8beaafe (diff) |
Add a Server section in the config file and use it to register only when needed
Diffstat (limited to 'services')
-rw-r--r-- | services/presence2/server_plugin.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/services/presence2/server_plugin.py b/services/presence2/server_plugin.py index 613511c..0cce49c 100644 --- a/services/presence2/server_plugin.py +++ b/services/presence2/server_plugin.py @@ -57,9 +57,19 @@ class ServerPlugin(gobject.GObject): self._conn = self._init_connection() def _get_account_info(self): - account_info = {'server': 'olpc.collabora.co.uk'} - + account_info = {} + pubkey = profile.get_pubkey() + + server = profile.get_server() + if not server: + account_info['server'] = 'olpc.collabora.co.uk' + else: + account_info['server'] = server + + registered = profile.get_server_registered() + account_info['register'] = not registered + khash = util.printable_hash(util._sha_data(pubkey)) account_info['account'] = "%s@%s" % (khash, account_info['server']) @@ -88,7 +98,6 @@ class ServerPlugin(gobject.GObject): conn = self._find_existing_connection() if not conn: acct = self._account.copy() - acct['register'] = True # Create a new connection print acct @@ -117,6 +126,10 @@ class ServerPlugin(gobject.GObject): return channel def _connected_cb(self): + if self._account['register']: + # we successfully register this account + profile.set_server_registered() + # the group of contacts who may receive your presence publish = self._request_list_channel('publish') publish_handles, local_pending, remote_pending = publish[CHANNEL_INTERFACE_GROUP].GetAllMembers() |