Hookup the new invites implementation. Need to fix

the frame view since that's bitrotten.
This commit is contained in:
Marco Pesenti Gritti 2007-08-31 12:43:10 +02:00
parent e5db6eb971
commit 0d4d74b94f
2 changed files with 17 additions and 5 deletions

View File

@ -66,6 +66,8 @@ class ShellOwner(gobject.GObject):
self._icon_hash = util.printable_hash(digest)
self._pservice = presenceservice.get_instance()
self._pservice.connect('activity-invitation',
self._activity_invitation_cb)
self._invites = Invites()
@ -75,7 +77,6 @@ class ShellOwner(gobject.GObject):
def get_nick(self):
return self._nick
def _handle_invite(self, issuer, bundle_id, activity_id):
"""XMLRPC method, called when the owner is invited to an activity."""
self._invites.add_invite(issuer, bundle_id, activity_id)
return ''
def _activity_invitation_cb(self, pservice, activity, buddy, message):
self._invites.add_invite(buddy, activity.props.type,
activity.props.id)

View File

@ -16,6 +16,9 @@
import gtk
import dbus
import logging
from sugar.presence import presenceservice
import OverlayWindow
@ -62,7 +65,15 @@ class ActivityHost:
return self._model
def invite(self, buddy):
pass
pservice = presenceservice.get_instance()
activity = pservice.get_activity(self.get_id())
if activity is None:
logging.error('Invite failed, %s is unknown.' % self.get_id())
activity.invite(buddy.get_buddy(), '', self._invite_response_cb)
def _invite_response_cb(self, error):
if error:
logging.error('Invite failed: %s' % error)
def present(self):
# wnck.Window.activate() expects a timestamp, but we don't