Merge lp:~jeremy-whiting/zeitgeist-datasources/telepathyuris into lp:zeitgeist-datasources/0.8

Proposed by Jeremy Whiting
Status: Merged
Merged at revision: 153
Proposed branch: lp:~jeremy-whiting/zeitgeist-datasources/telepathyuris
Merge into: lp:zeitgeist-datasources/0.8
Diff against target: 157 lines (+18/-18)
1 file modified
telepathy/zeitgeist-telepathy-observer (+18/-18)
To merge this branch: bzr merge lp:~jeremy-whiting/zeitgeist-datasources/telepathyuris
Reviewer Review Type Date Requested Status
Zeitgeist Data-Sources Team Pending
Review via email: mp+69718@code.launchpad.net

Description of the change

This sets the subject uris for telepathy subjects to be telepathy://account_path/target_id so they can be queried with a standard query.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'telepathy/zeitgeist-telepathy-observer'
--- telepathy/zeitgeist-telepathy-observer 2010-12-05 10:15:39 +0000
+++ telepathy/zeitgeist-telepathy-observer 2011-07-28 20:57:07 +0000
@@ -97,7 +97,7 @@
97 'ContactAttributeInterfaces',97 'ContactAttributeInterfaces',
98 reply_handler=interfaces,98 reply_handler=interfaces,
99 error_handler=error)99 error_handler=error)
100 100
101 self.signals.append(self[CONNECTION].connect_to_signal(101 self.signals.append(self[CONNECTION].connect_to_signal(
102 'StatusChanged', self._status_changed))102 'StatusChanged', self._status_changed))
103103
@@ -118,7 +118,7 @@
118 properties: Properties of the channel we're proxying, from ObserveChannels118 properties: Properties of the channel we're proxying, from ObserveChannels
119 ready_handler: Callback function run once we're done setting up object119 ready_handler: Callback function run once we're done setting up object
120 """120 """
121 __gsignals__ = { 121 __gsignals__ = {
122 'closed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),122 'closed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
123 }123 }
124124
@@ -159,7 +159,7 @@
159 '/alias']159 '/alias']
160 except KeyError:160 except KeyError:
161 self._target_alias = self._target_id161 self._target_alias = self._target_id
162 162
163 self._connect_to_signals()163 self._connect_to_signals()
164 self._default_operations_finished()164 self._default_operations_finished()
165165
@@ -182,14 +182,14 @@
182182
183 def _connect_to_signals(self):183 def _connect_to_signals(self):
184 # Connect to signals184 # Connect to signals
185 self.signals.append(self[CHANNEL].connect_to_signal('Closed', 185 self.signals.append(self[CHANNEL].connect_to_signal('Closed',
186 self._channel_closed_cb))186 self._channel_closed_cb))
187187
188 # Called when channel proxy becomes ready. Chains method calls so actions188 # Called when channel proxy becomes ready. Chains method calls so actions
189 # which depend on each other are executed in order.189 # which depend on each other are executed in order.
190 def _channel_ready(self, channel):190 def _channel_ready(self, channel):
191 self._target_id = self.properties[CHANNEL + '.TargetID']191 self._target_id = self.properties[CHANNEL + '.TargetID']
192 192
193 # Get contact attribute interfaces193 # Get contact attribute interfaces
194 self[dbus.PROPERTIES_IFACE].Get(CHANNEL,194 self[dbus.PROPERTIES_IFACE].Get(CHANNEL,
195 'Requested',195 'Requested',
@@ -217,7 +217,7 @@
217 # Report to zeitgeist217 # Report to zeitgeist
218 if not self._subject:218 if not self._subject:
219 self._subject = [Subject.new_for_values(219 self._subject = [Subject.new_for_values(
220 uri = self._target_id,220 uri = "telepathy://" + self._account_path + "/" + self._target_id,
221 interpretation = unicode(Interpretation.IMMESSAGE),221 interpretation = unicode(Interpretation.IMMESSAGE),
222 manifestation = unicode(Manifestation.SOFTWARE_SERVICE),222 manifestation = unicode(Manifestation.SOFTWARE_SERVICE),
223 origin = self.account_path,223 origin = self.account_path,
@@ -258,7 +258,7 @@
258 def _get_pending_messages_cb(self, messages):258 def _get_pending_messages_cb(self, messages):
259 for message in messages:259 for message in messages:
260 self._message_received_cb(*message)260 self._message_received_cb(*message)
261 261
262 self._release_channel()262 self._release_channel()
263263
264 def _default_operations_finished(self):264 def _default_operations_finished(self):
@@ -272,13 +272,13 @@
272 logging.debug("Message received")272 logging.debug("Message received")
273 if not self._subject:273 if not self._subject:
274 self._subject = [Subject.new_for_values(274 self._subject = [Subject.new_for_values(
275 uri = self._target_id,275 uri = "telepathy://" + self._account_path + "/" + self._target_id,
276 interpretation = unicode(Interpretation.IMMESSAGE),276 interpretation = unicode(Interpretation.IMMESSAGE),
277 manifestation = unicode(Manifestation.SOFTWARE_SERVICE),277 manifestation = unicode(Manifestation.SOFTWARE_SERVICE),
278 origin = self.account_path,278 origin = self.account_path,
279 mimetype = "text/plain",279 mimetype = "text/plain",
280 text = self._target_alias)]280 text = self._target_alias)]
281 281
282 timestamp = timestamp * 1000282 timestamp = timestamp * 1000
283283
284 event = Event.new_for_values(284 event = Event.new_for_values(
@@ -308,7 +308,7 @@
308 self._message_sent_cb))308 self._message_sent_cb))
309 self.signals.append(self[CHANNEL_TYPE_TEXT].connect_to_signal('Received',309 self.signals.append(self[CHANNEL_TYPE_TEXT].connect_to_signal('Received',
310 self._message_received_cb))310 self._message_received_cb))
311 self.signals.append(self[CHANNEL].connect_to_signal('Closed', 311 self.signals.append(self[CHANNEL].connect_to_signal('Closed',
312 self._channel_closed_cb))312 self._channel_closed_cb))
313313
314class ZStreamedMediaChannel(ZChannel):314class ZStreamedMediaChannel(ZChannel):
@@ -335,7 +335,7 @@
335335
336 if not self._audio_subject:336 if not self._audio_subject:
337 self._audio_subject = [Subject.new_for_values(337 self._audio_subject = [Subject.new_for_values(
338 uri = self._target_id,338 uri = "telepathy://" + self._account_path + "/" + self._target_id,
339 interpretation = unicode(Interpretation.AUDIO),339 interpretation = unicode(Interpretation.AUDIO),
340 manifestation = unicode(Manifestation.MEDIA_STREAM),340 manifestation = unicode(Manifestation.MEDIA_STREAM),
341 origin = self.account_path,341 origin = self.account_path,
@@ -344,7 +344,7 @@
344344
345 if not self._video_subject:345 if not self._video_subject:
346 self._video_subject = [Subject.new_for_values(346 self._video_subject = [Subject.new_for_values(
347 uri = self._target_id,347 uri = "telepathy://" + self._account_path + "/" + self._target_id,
348 interpretation = unicode(Interpretation.VIDEO),348 interpretation = unicode(Interpretation.VIDEO),
349 manifestation = unicode(Manifestation.MEDIA_STREAM),349 manifestation = unicode(Manifestation.MEDIA_STREAM),
350 origin = self.account_path,350 origin = self.account_path,
@@ -408,7 +408,7 @@
408 self._stream_added_cb))408 self._stream_added_cb))
409 self.signals.append(self[CHANNEL_TYPE_STREAMED_MEDIA].connect_to_signal('StreamRemoved',409 self.signals.append(self[CHANNEL_TYPE_STREAMED_MEDIA].connect_to_signal('StreamRemoved',
410 self._stream_removed_cb))410 self._stream_removed_cb))
411 self.signals.append(self[CHANNEL].connect_to_signal('Closed', 411 self.signals.append(self[CHANNEL].connect_to_signal('Closed',
412 self._channel_closed_cb))412 self._channel_closed_cb))
413413
414class ZObserver(telepathy.server.Observer,414class ZObserver(telepathy.server.Observer,
@@ -456,13 +456,13 @@
456 'ObserverChannelFilter': lambda: filter_array})456 'ObserverChannelFilter': lambda: filter_array})
457457
458 self.connection_cache = {}458 self.connection_cache = {}
459 self.channel_cache = {} 459 self.channel_cache = {}
460460
461 # Set async callbacks so ObserveChannels won't return until we're finished461 # Set async callbacks so ObserveChannels won't return until we're finished
462 @dbus.service.method(CLIENT_OBSERVER,462 @dbus.service.method(CLIENT_OBSERVER,
463 in_signature='ooa(oa{sv})oaoa{sv}', out_signature='',463 in_signature='ooa(oa{sv})oaoa{sv}', out_signature='',
464 async_callbacks=('_success', '_error'))464 async_callbacks=('_success', '_error'))
465 def ObserveChannels(self, account, conn, channels, dispatch_operation, 465 def ObserveChannels(self, account, conn, channels, dispatch_operation,
466 requests_satisfied, observer_info, _success, _error):466 requests_satisfied, observer_info, _success, _error):
467467
468 # List of channels we're waiting to finish before we release the bus468 # List of channels we're waiting to finish before we release the bus
@@ -487,20 +487,20 @@
487487
488 # Called when the channel proxy is invalidated488 # Called when the channel proxy is invalidated
489 def channel_closed(chan):489 def channel_closed(chan):
490 try: 490 try:
491 del self.channel_cache[chan.object_path]491 del self.channel_cache[chan.object_path]
492 logging.debug("Channel closed: %s" % chan)492 logging.debug("Channel closed: %s" % chan)
493 except:493 except:
494 logging.error("Couldn't delete channel: %s" % chan)494 logging.error("Couldn't delete channel: %s" % chan)
495495
496 # No more channels means we aren't needed. 496 # No more channels means we aren't needed.
497 # Telepathy will restart us when we are497 # Telepathy will restart us when we are
498 if not self.channel_cache:498 if not self.channel_cache:
499 logging.warning("No channels left in list. Exiting")499 logging.warning("No channels left in list. Exiting")
500 sys.exit()500 sys.exit()
501501
502 # Called when ZChannel object has finished its tasks502 # Called when ZChannel object has finished its tasks
503 # Removes channel from pending queue, and releases the connection 503 # Removes channel from pending queue, and releases the connection
504 # if all channeled have been processed504 # if all channeled have been processed
505 def channel_ready(chan):505 def channel_ready(chan):
506 logging.debug("Channel ready: %s" % chan)506 logging.debug("Channel ready: %s" % chan)

Subscribers

People subscribed via source and target branches