Commit Graph

468 Commits

Author SHA1 Message Date
Simon McVittie
ee6c1b4283 services/presence/: Have joined Activities track membership via group interface.
This allows us to ignore the (trivially spoofable) PEP info for activities
that we're actually in, in favour of looking at the actual members.
2007-05-30 17:36:42 +01:00
Simon McVittie
87446bfb7f services/presence/buddyiconcache: remove unused import of sugar.util 2007-05-30 17:04:16 +01:00
Simon McVittie
6957446167 services/presence/: Make Activities responsible for tracking their members.
Add a signal to notify the PS when all members have gone away.
2007-05-29 16:12:05 +01:00
Simon McVittie
9d812430bf services/presence/psutils.py: don't bother using sugar.util, it's easier to use hexdigest or sha directly 2007-05-29 16:11:07 +01:00
Simon McVittie
2f8ef7bd3b services/presence/test_psutils: trivial check for pubkey_to_keyid() 2007-05-29 16:10:19 +01:00
Simon McVittie
ea892796ae services/presence/Makefile.am: Include test_psutils.py in "make check" 2007-05-29 14:05:12 +01:00
Marco Pesenti Gritti
53d64a0536 Use the commit id for the snapshot name 2007-05-29 14:16:49 +02:00
Marco Pesenti Gritti
0c77275ba7 Very first go at the object type registry. 2007-05-29 12:39:57 +02:00
Simon McVittie
a4a06206e3 services/presence/: identify Buddies by "key ID" (pubkey hash), not whole key.
This allows us to create Buddy objects as soon as we see a contact on the
server. For contacts not on trusted servers, or seen in anonymous MUCs, we
create a Buddy identified by JID instead (so we have some way to talk
about the anonymous contact within the Sugar API).

The concept of "trusted server" means a server which we trust to validate that
users with a keyID as the username part of their JID do in fact have that key.
Currently we just pretend that olpc.collabora.co.uk does this - in future, the
school servers will do this validation by using key rather than password
authentication.

Also create Buddy object paths based on the keyID or JID (for easier debugging).
2007-05-28 17:25:52 +01:00
Simon McVittie
5dacfdd365 Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar 2007-05-28 17:10:54 +01:00
Simon McVittie
706830c489 services/presence/server_plugin: Don't watch MembersChanged in activities.
My plan is now to do this in the Activity class, once the PS has a reliable
way to map handles to buddies.
2007-05-28 15:56:39 +01:00
Simon McVittie
aad2afdae2 services/presence/server_plugin: Use set operations to update the subscribe set 2007-05-28 15:54:40 +01:00
Simon McVittie
7aee70e047 services/presence/pstest: Add Red Hat/Collabora GPL v2+ notice 2007-05-28 14:46:13 +01:00
Simon McVittie
7583080cd4 services/presence/psutils: Add pubkey_to_keyid() and escape_identifier() 2007-05-28 14:44:49 +01:00
Dan Williams
8c70ff2d86 Fix non-NM IP4 address detection 2007-05-26 14:01:25 -04:00
Dan Williams
c1fc93b2af Fix syntax error 2007-05-26 13:58:12 -04:00
Simon McVittie
3d3e4be65e services/presence/activity: Validate object path early 2007-05-25 16:30:36 +01:00
Simon McVittie
9721436536 services/presence/: Pass the SessionBus around, instead of a BusName object.
Delay making the BusName object until after the PS object has been exported,
to guarantee race-free activation.
2007-05-25 16:21:02 +01:00
Simon McVittie
ad33f7dfdd services/presence/buddy: Improve docstring; remove unused property _object_id 2007-05-25 12:26:53 +01:00
Simon McVittie
1fa97c3d93 services/presence/buddy: Set attributes more concisely, improve docstrings 2007-05-25 12:24:32 +01:00
Simon McVittie
56b95264cf services/presence/psutils, buddy: Track NameOwnerChanged in IP4AddressMonitor
This means Buddy and its subclasses no longer need to care about
NameOwnerChanged at all.

The old code might not have worked anyway, since it was watching for
NameOwnerChanged on the session bus, but invoking NM methods on the system bus.
2007-05-25 12:14:39 +01:00
Simon McVittie
fdd8c315cf services/presence/buddy: Use add_signal_receiver to connect signals.
This means we don't need to care whether the Sugar shell is actually running -
if it is, we'll get its signals, and if it's not, obviously it can't send us
any signals!
2007-05-25 12:06:57 +01:00
Simon McVittie
7b0d65a211 Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar 2007-05-25 11:39:45 +01:00
Simon McVittie
eafd338d09 services/presence/buddy: Stop treating server, key_hash, registered as GObject properties.
They're not handled in the inherited do_set_property()/do_get_property(), so
won't work as properties, and there seems to be no need for them to be
properties at all.
This fixes the following assertion when importing buddy:

Warning: g_object_class_install_property: assertion `pspec->flags & G_PARAM_WRITABLE' failed
  type_register(cls, namespace.get('__gtype_name__'))
2007-05-25 11:34:54 +01:00
Simon McVittie
a868f6eb9c services/presence/psutils: Re-order imports conventionally, without dbus.glib.
Importing dbus.glib has a side-effect (it sets up the default main loop
integration) so it's not something a module should do.
2007-05-25 11:30:36 +01:00
Simon McVittie
5bf10edaee services/presence/buddy: remove trailing whitespace, wrap long lines 2007-05-25 10:56:41 +01:00
Simon McVittie
a5ba8541a4 services/presence/activity: wrap long lines, remove trailing whitespace 2007-05-25 10:56:14 +01:00
Dan Williams
c1346a5303 Retry connections when TP connection attempts fail 2007-05-24 16:40:14 -04:00
Simon McVittie
b96de811d3 services/presence/server_plugin: fix logging of join/share error 2007-05-24 18:59:32 +01:00
Simon McVittie
7b20bacdf5 services/presence/presenceservice: check against None with 'is' 2007-05-24 18:59:25 +01:00
Simon McVittie
0410ed28ba services/presence/presenceservice: add some missing in_signature arguments 2007-05-24 18:59:19 +01:00
Simon McVittie
570a485d84 services/presence/presenceservice: don't use deprecated dbus.glib
Importing dbus.glib has strange magical side-effects. Instead, make it more
explicit that the default dbus-python main loop is being set to the GLib main
loop.
2007-05-24 18:59:13 +01:00
Simon McVittie
2abcd89c1f services/presence/: Move internal_get_activity to TestPresenceService 2007-05-24 18:59:06 +01:00
Simon McVittie
f7ba2aa1e2 services/presence/: separate test code into a separate module 2007-05-24 18:58:58 +01:00
Simon McVittie
f75747015d services/presence/activity: Document constructor arguments 2007-05-24 18:58:50 +01:00
Simon McVittie
e7f10dd2aa services/presence/presenceservice: fix broken syntax 2007-05-24 18:58:43 +01:00
Simon McVittie
4e188059e3 services/presence/server_plugin: Use telepathy-python helper function request_channel()
Also request the subscribe and publish handles at the same time, to reduce
D-Bus roundtrips.
2007-05-24 18:58:35 +01:00
Simon McVittie
a450a82e59 services/presence/server_plugin: Call _handle_connection_status_change with appropriate arguments
Also reduce number of methods by using nested functions for trivial Connect()
reply handlers.
2007-05-24 18:58:28 +01:00
Simon McVittie
e13728f347 services/presence/server_plugin: various cosmetic cleanups
* wrap most long lines at 80 characters
* don't preformat log messages, let the logging framework do it
2007-05-24 18:58:17 +01:00
Simon McVittie
0d5dd24166 services/presence/server_plugin: delete unused InvalidBuddyError 2007-05-24 18:58:10 +01:00
Simon McVittie
e11389d813 services/presence/server_plugin: reformat, document signal definitions 2007-05-24 18:58:02 +01:00
Simon McVittie
1026fce013 services/presence/presenceservice: various cosmetic cleanups
* wrap long lines at 80 characters
* don't preformat log messages, let the logging framework do it
* eradicate trailing whitespace
2007-05-24 18:57:53 +01:00
Simon McVittie
55c0d9cb07 services/presence/server_plugin: remove trailing whitespace 2007-05-24 18:56:42 +01:00
Simon McVittie
2d76475682 services/presence/psutils: Remove bytes_to_string - no longer needed 2007-05-24 18:56:35 +01:00
Simon McVittie
43453124bd services/presence/presenceservice: Make bytes_to_string() unnecessary by requesting a ByteArray from dbus-python 2007-05-24 18:56:29 +01:00
Simon McVittie
c3e54133a4 services/presence/server_plugin: make bytes_to_string() unnecessary by requesting a dbus.ByteArray 2007-05-24 18:56:20 +01:00
Simon McVittie
cb279a1418 services/presence/server_plugin: reorder imports 2007-05-24 18:56:12 +01:00
Simon McVittie
417fd7cc8a services/presence/server_plugin: Use more conventional conditional import for md5 2007-05-24 18:56:06 +01:00
Simon McVittie
71951848a6 services/presence/server_plugin: error_handler always takes exactly 1 argument.
Instead of using lambdas with arbitrary arguments, use a lambda that takes
1 argument.
2007-05-24 18:55:57 +01:00
Simon McVittie
f69e06247f services/presence/server_plugin: Use non-deprecated handle type constants.
(CONNECTION_HANDLE_TYPE_foo is deprecated in favour of HANDLE_TYPE_foo.)
Also rewrap imports to be 80 characters wide.
2007-05-24 18:55:50 +01:00
Simon McVittie
3c2bdfc346 services/presence/server_plugin: implement _new_channel_cb asynchronously 2007-05-24 18:55:31 +01:00
Simon McVittie
3444acae8f services/presence/server_plugin: Stop using private API of telepathy-python and dbus-python 2007-05-24 18:52:26 +01:00
Simon McVittie
b16bb9d6cc services/presence/server_plugin: Fix error logging for RequestHandles 2007-05-24 18:52:15 +01:00
Simon McVittie
f4327759fc services/presence/server_plugin: When creating a room, make it non-anonymous.
Otherwise clients joining the room won't be able to convert other clients'
channel-specific handles into global handles in order to make Buddy objects,
because they're not the moderator of the room.
2007-05-24 18:48:13 +01:00
Simon McVittie
7b1a38af1c services/presence/: keep track of the owner's Telepathy handles 2007-05-24 18:47:55 +01:00
Simon McVittie
10e1daf8c6 services/presence/buddy.py: Don't allow the Owner to disappear, even if they have no handles left 2007-05-24 18:46:16 +01:00
Simon McVittie
a6e809a9ef services/presence/: move more of the handle tracking into the Buddy object 2007-05-24 18:46:09 +01:00
Simon McVittie
161605ccb1 services/presence/server_plugin: Initialize attributes with empty values 2007-05-24 17:45:05 +01:00
Simon McVittie
494e17b3cd Revert "services/presence/: move more of the handle tracking into the Buddy object".
It shouldn't have been applied before "services/presence: buddy: add mapping
to/from Telepathy handles" which has not yet been reviewed.

This reverts commit 78356b1956.

Conflicts:

	services/presence/presenceservice.py
2007-05-24 12:34:36 +01:00
Simon McVittie
1d79d93627 Fix syntax 2007-05-21 11:50:29 +01:00
Simon McVittie
66c5e882f3 Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar 2007-05-21 11:30:38 +01:00
Simon McVittie
8c8dffe662 Merge commit 'origin' into submit 2007-05-21 11:27:47 +01:00
Simon McVittie
78356b1956 services/presence/: move more of the handle tracking into the Buddy object 2007-05-18 15:22:32 +01:00
Simon McVittie
bf84eca102 services/presence/server_plugin.py: Ensure _conn always exists (even if None)
This means cleanup() will not fail on an uninitialized server plugin,
and get_connection() will return None rather than raising AttributeError.
2007-05-18 15:21:36 +01:00
Dan Williams
7b9c59fb9c Correctly send IPv4 address when NM already has a connection 2007-05-17 13:54:26 -04:00
Simon McVittie
f3a2d532f5 services/presence: buddy: add mapping to/from Telepathy handles 2007-05-17 17:41:42 +01:00
Dan Williams
d72ff8c6fb Don't try to shove None through dbus 2007-05-17 09:32:34 -04:00
Simon McVittie
531321740c Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
Conflicts:

	services/presence/server_plugin.py
2007-05-16 12:30:49 +01:00
Simon McVittie
35d190b55e services/presence/server_plugin.py: Handle presence more correctly.
This avoids unnecessary attempts to look up the buddy properties of
channel-specific handles (which doesn't work) by only looking up the buddy
properties of people we're subscribed to.
Also, this approves subscription requests that come in while we're online,
rather than handling them when we next go from offline to online.
2007-05-16 11:39:16 +01:00
Dan Williams
5d9e19a892 Retry getting buddy properties a few times 2007-05-16 01:03:55 -04:00
Dan Williams
82095ea26a Some PS reliability fixes 2007-05-15 15:25:30 -04:00
Simon McVittie
5d77ff680a services/presence: Stop using deprecated keyword argument named_service 2007-05-15 15:20:02 +01:00
Simon McVittie
4b26840333 sugar.presence.presenceservice, services/presence: Use named loggers.
This causes events in the log to be annotated with the module that emitted the
message.

Before: DEBUG - root: Starting up...
After: DEBUG - s-p-s.server_plugin: Starting up...

I've used a log domain of "sugar.presence..." for the client library and
e.g. "s-p-s.activity" for the service internals.
2007-05-15 14:58:15 +01:00
Dan Williams
871828f307 Set alias twice so server actually gets it 2007-05-14 22:48:53 -04:00
Dan Williams
79aad47327 Don't drop buddies on failure to retrieve their activity list 2007-05-14 16:20:23 -04:00
Dan Williams
9b978f014f Fix setting owner OLPC properties 2007-05-14 16:17:33 -04:00
Dan Williams
a05d804949 Make reconnection to the jabber server work again 2007-05-14 13:58:26 -04:00
Dan Williams
9e1e851884 Make deferred connection actually work 2007-05-14 02:46:51 -04:00
Dan Williams
e1b3cde65e Fix uninitialized variable traceback 2007-05-13 21:40:24 -04:00
Dan Williams
5e2ea16e3a Redo PS connection handling; ensure valid network connection before talking to server 2007-05-13 21:34:15 -04:00
Dan Williams
66dfd363ba Log the PS getting kicked off the bus 2007-05-13 21:33:14 -04:00
Dan Williams
fddf101885 Quiet error message when unecessary 2007-05-13 21:31:16 -04:00
Dan Williams
de1796605f Fix member name collision with dbus object superclass 2007-05-13 21:11:19 -04:00
Dan Williams
077b3e3391 Fix debug log statement 2007-05-13 21:08:54 -04:00
Simon McVittie
2216f5095d Use ExportedGObject from dbus-python rather than reimplementing it 2007-05-11 17:27:36 -04:00
Dan Williams
a86293dcb4 Only set our own properties when we're connected 2007-05-11 17:25:44 -04:00
Tomeu Vizoso
929dabd165 Use the new DataStore and remove the old one. 2007-05-10 11:01:32 +02:00
Dan Williams
a67d87c2a6 Fix server-based registration 2007-05-08 16:28:55 -04:00
Dan Williams
d598097994 Fix retrieval of owner's object path 2007-05-07 14:18:20 -04:00
Dan Williams
66b7210481 Ignore network properties for the owner when their jabber contact comes online 2007-05-03 00:43:53 -04:00
Dan Williams
46d97015e6 Fix arguments 2007-05-02 23:20:38 -04:00
Dan Williams
570c7e6052 Add buddy ip4-address property (temporary) 2007-04-30 23:44:39 -04:00
Dafydd Harries
9a8d5ac32a Merge branch 'master' of git://dev.laptop.org/sugar 2007-04-30 18:43:59 +01:00
Dafydd Harries
f6c5b63a58 don't return unused value from D-Bus signal callback 2007-04-30 18:43:43 +01:00
Dan Williams
e432cc91ca Fix split_properties usage 2007-04-30 09:51:35 -04:00
Dan Williams
58a8cfc795 Fix up activity property handling 2007-04-29 21:44:57 -04:00
Dan Williams
e63accc8be Make test buddy attribute randomization optional 2007-04-29 18:01:23 -04:00
Tomeu Vizoso
395d3f5c96 Fix. 2007-04-27 13:01:41 +02:00
Dan Williams
274cc65c4e Use hashlib on python 2.5 2007-04-26 12:34:05 -04:00
Tomeu Vizoso
1c249a216b Fix for using with python 2.4. 2007-04-26 18:25:40 +02:00
Dan Williams
60c9e0ecb8 Let PresenceService._buddy_activities_changed see all joined activities, even invalid ones 2007-04-21 19:20:06 -04:00
Dan Williams
51f56ed7a3 Join/leave activity when its validity changes 2007-04-21 19:09:59 -04:00
Mike C. Fletcher
2848dc97ab Documentation patch from Amanda Yilmaz (services/clipboard/typeregistry.py) 2007-04-21 15:34:39 -04:00
Mike's Primary Account
a0348a565c Initial documentation for psutils and server_plugin 2007-04-20 21:09:51 -04:00
Mike's Primary Account
83a6a2e73e Initial documentation pass for activity by Amanda Yilmaz 2007-04-20 19:07:41 -04:00
Mike's Primary Account
81d9bed0d8 Merge branch 'master' of git+ssh://mcfletch@dev.laptop.org/git/sugar
Conflicts:

	services/presence/buddy.py
2007-04-20 16:42:47 -04:00
Mike's Primary Account
c0c64809a0 Initial documentation pass for buddy objects 2007-04-20 16:25:37 -04:00
Mike's Primary Account
79d17c14f4 Initial documentation of presence service overview.
Fix weird indent in server_plugin module
2007-04-20 13:10:40 -04:00
Dan Williams
2866d3c4c9 Convert more string-named properties to var-named 2007-04-20 12:40:53 -04:00
Dan Williams
68b402cb86 Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar 2007-04-20 12:34:23 -04:00
Dan Williams
37953c47f7 Use well-defined names for properties rather than strings 2007-04-20 12:34:16 -04:00
Tomeu Vizoso
276d374b1a Remove debug message. 2007-04-19 12:20:48 -03:00
Tomeu Vizoso
96b0bd1cfa Recognize downloaded .xo as such. 2007-04-19 12:13:38 -03:00
Dan Williams
8aa84cd69e Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar 2007-04-19 10:35:45 -04:00
Tomeu Vizoso
d223579f22 Recognize images dropped into the clipboard as such. 2007-04-18 18:52:46 -03:00
Dan Williams
cf5ef53070 Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar 2007-04-18 10:17:35 -04:00
Tomeu Vizoso
b7030a74dd Drag images out of mozilla. 2007-04-17 16:53:34 -03:00
Dan Williams
26ed1d1504 Don't leak invalid properties 2007-04-17 13:27:34 -04:00
Dan Williams
99bf82b44f Make TestOwner create more realistic activities and switch between them 2007-04-16 22:44:54 -04:00
Dan Williams
845734eb72 Ignore unknown handles 2007-04-16 22:43:26 -04:00
Dan Williams
d45e6dd1a6 Show which buddy properties were updated 2007-04-16 22:42:35 -04:00
Dan Williams
4449b4e237 Work around server not figuring out conference server address 2007-04-16 22:40:20 -04:00
Dan Williams
5f30901e62 Always set key; new buddy properties replace old ones 2007-04-16 22:39:07 -04:00
Dan Williams
8b47d93ad2 Fix debug output; print handle 2007-04-16 22:37:56 -04:00
Marco Pesenti Gritti
d49b0ed6fb Use sys.path.append, not insert 2007-04-15 12:26:50 +02:00
Dan Williams
879ef9b0e0 Add activity to owner's list after sharing it 2007-04-13 16:59:16 -04:00
Dan Williams
17adb7b58b Add some debug output when sharing activities 2007-04-13 16:00:22 -04:00
Dan Williams
cc2d69e364 Forgot to import logging 2007-04-13 15:59:36 -04:00
Dan Williams
f169628cbd Query non-local activity properties on discovery 2007-04-13 15:42:54 -04:00
Dan Williams
182de3af1c Remove test code 2007-04-13 15:41:19 -04:00
Dan Williams
5015beaaa6 Clean up activity join/leave debug messages 2007-04-13 15:37:12 -04:00
Dan Williams
94431a66eb Ensure local activities emit ActivityAppeared signal when shared 2007-04-13 15:15:09 -04:00
Dan Williams
15febc6620 Correctly handle blank activity list 2007-04-13 15:05:21 -04:00
Dan Williams
02900bbfbb Fix traceback when sharing activity 2007-04-13 14:06:49 -04:00
Dan Williams
773ae4965e Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar 2007-04-13 13:12:04 -04:00
Dan Williams
31000f6c3e Asynchronize activity join/share in the PS 2007-04-13 13:11:59 -04:00
Guillaume Desmottes
6b6b72f9c9 implement org.laptop.Sugar.Presence.GetPreferredConnection 2007-04-13 18:29:50 +02:00
Dan Williams
7b40f9bf60 Asynchronize set_activity_properties 2007-04-12 17:03:30 -04:00
Dan Williams
118e039a8b Remove test activity sharing code 2007-04-12 17:03:14 -04:00
Dan Williams
6e070996c9 Asynchronize setting owner properties 2007-04-12 16:48:40 -04:00
Dan Williams
5970bb6e62 Convert print statements to logging.debug 2007-04-12 14:44:23 -04:00
Dan Williams
3d3dd23390 Randomness tweak 2007-04-12 00:14:29 -04:00
Dan Williams
3f2f609c4a Use different log file for test PS instances 2007-04-11 23:45:45 -04:00
Dan Williams
3d6bff9278 Ignore invalid handles on avatar updates 2007-04-11 23:45:20 -04:00
Dan Williams
162a87f882 Create test owner for presence service
This owner changes properties periodically so we can test out the PS's handling
of property changes.  To execute, run Sugar and then make sure that the D-Bus
address is the one sugar is using (get it from ~/.sugar/default/session.info).
Then run:

build/bin/sugar-presence-service X

where X is a number 1 -> 9 inclusive.  It will generate fake buddy info for that
test buddy and then start up a presence service for that buddy, changing a random
property of the buddy every 10 seconds.
2007-04-11 22:49:14 -04:00
Marco Pesenti Gritti
eeb09294d8 Revert "Start reworking the cliboard services to use the types registry."
This reverts commit fcb57779a2.
2007-04-11 18:22:52 +02:00
Marco Pesenti Gritti
fcb57779a2 Start reworking the cliboard services to use the types registry. 2007-04-11 16:14:58 +02:00
Dan Williams
133a718f28 Really fix cache code this time; revert to previous code plus ensure directory exists 2007-04-10 15:22:28 -04:00
Dan Williams
a4792552f4 Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar 2007-04-10 15:15:30 -04:00
Dan Williams
e49b36c0f5 Cleanup new cache code 2007-04-10 15:15:21 -04:00