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
1=== modified file 'telepathy/zeitgeist-telepathy-observer'
2--- telepathy/zeitgeist-telepathy-observer 2010-12-05 10:15:39 +0000
3+++ telepathy/zeitgeist-telepathy-observer 2011-07-28 20:57:07 +0000
4@@ -97,7 +97,7 @@
5 'ContactAttributeInterfaces',
6 reply_handler=interfaces,
7 error_handler=error)
8-
9+
10 self.signals.append(self[CONNECTION].connect_to_signal(
11 'StatusChanged', self._status_changed))
12
13@@ -118,7 +118,7 @@
14 properties: Properties of the channel we're proxying, from ObserveChannels
15 ready_handler: Callback function run once we're done setting up object
16 """
17- __gsignals__ = {
18+ __gsignals__ = {
19 'closed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
20 }
21
22@@ -159,7 +159,7 @@
23 '/alias']
24 except KeyError:
25 self._target_alias = self._target_id
26-
27+
28 self._connect_to_signals()
29 self._default_operations_finished()
30
31@@ -182,14 +182,14 @@
32
33 def _connect_to_signals(self):
34 # Connect to signals
35- self.signals.append(self[CHANNEL].connect_to_signal('Closed',
36+ self.signals.append(self[CHANNEL].connect_to_signal('Closed',
37 self._channel_closed_cb))
38
39 # Called when channel proxy becomes ready. Chains method calls so actions
40 # which depend on each other are executed in order.
41 def _channel_ready(self, channel):
42 self._target_id = self.properties[CHANNEL + '.TargetID']
43-
44+
45 # Get contact attribute interfaces
46 self[dbus.PROPERTIES_IFACE].Get(CHANNEL,
47 'Requested',
48@@ -217,7 +217,7 @@
49 # Report to zeitgeist
50 if not self._subject:
51 self._subject = [Subject.new_for_values(
52- uri = self._target_id,
53+ uri = "telepathy://" + self._account_path + "/" + self._target_id,
54 interpretation = unicode(Interpretation.IMMESSAGE),
55 manifestation = unicode(Manifestation.SOFTWARE_SERVICE),
56 origin = self.account_path,
57@@ -258,7 +258,7 @@
58 def _get_pending_messages_cb(self, messages):
59 for message in messages:
60 self._message_received_cb(*message)
61-
62+
63 self._release_channel()
64
65 def _default_operations_finished(self):
66@@ -272,13 +272,13 @@
67 logging.debug("Message received")
68 if not self._subject:
69 self._subject = [Subject.new_for_values(
70- uri = self._target_id,
71+ uri = "telepathy://" + self._account_path + "/" + self._target_id,
72 interpretation = unicode(Interpretation.IMMESSAGE),
73 manifestation = unicode(Manifestation.SOFTWARE_SERVICE),
74 origin = self.account_path,
75 mimetype = "text/plain",
76 text = self._target_alias)]
77-
78+
79 timestamp = timestamp * 1000
80
81 event = Event.new_for_values(
82@@ -308,7 +308,7 @@
83 self._message_sent_cb))
84 self.signals.append(self[CHANNEL_TYPE_TEXT].connect_to_signal('Received',
85 self._message_received_cb))
86- self.signals.append(self[CHANNEL].connect_to_signal('Closed',
87+ self.signals.append(self[CHANNEL].connect_to_signal('Closed',
88 self._channel_closed_cb))
89
90 class ZStreamedMediaChannel(ZChannel):
91@@ -335,7 +335,7 @@
92
93 if not self._audio_subject:
94 self._audio_subject = [Subject.new_for_values(
95- uri = self._target_id,
96+ uri = "telepathy://" + self._account_path + "/" + self._target_id,
97 interpretation = unicode(Interpretation.AUDIO),
98 manifestation = unicode(Manifestation.MEDIA_STREAM),
99 origin = self.account_path,
100@@ -344,7 +344,7 @@
101
102 if not self._video_subject:
103 self._video_subject = [Subject.new_for_values(
104- uri = self._target_id,
105+ uri = "telepathy://" + self._account_path + "/" + self._target_id,
106 interpretation = unicode(Interpretation.VIDEO),
107 manifestation = unicode(Manifestation.MEDIA_STREAM),
108 origin = self.account_path,
109@@ -408,7 +408,7 @@
110 self._stream_added_cb))
111 self.signals.append(self[CHANNEL_TYPE_STREAMED_MEDIA].connect_to_signal('StreamRemoved',
112 self._stream_removed_cb))
113- self.signals.append(self[CHANNEL].connect_to_signal('Closed',
114+ self.signals.append(self[CHANNEL].connect_to_signal('Closed',
115 self._channel_closed_cb))
116
117 class ZObserver(telepathy.server.Observer,
118@@ -456,13 +456,13 @@
119 'ObserverChannelFilter': lambda: filter_array})
120
121 self.connection_cache = {}
122- self.channel_cache = {}
123+ self.channel_cache = {}
124
125 # Set async callbacks so ObserveChannels won't return until we're finished
126 @dbus.service.method(CLIENT_OBSERVER,
127 in_signature='ooa(oa{sv})oaoa{sv}', out_signature='',
128 async_callbacks=('_success', '_error'))
129- def ObserveChannels(self, account, conn, channels, dispatch_operation,
130+ def ObserveChannels(self, account, conn, channels, dispatch_operation,
131 requests_satisfied, observer_info, _success, _error):
132
133 # List of channels we're waiting to finish before we release the bus
134@@ -487,20 +487,20 @@
135
136 # Called when the channel proxy is invalidated
137 def channel_closed(chan):
138- try:
139+ try:
140 del self.channel_cache[chan.object_path]
141 logging.debug("Channel closed: %s" % chan)
142 except:
143 logging.error("Couldn't delete channel: %s" % chan)
144
145- # No more channels means we aren't needed.
146+ # No more channels means we aren't needed.
147 # Telepathy will restart us when we are
148 if not self.channel_cache:
149 logging.warning("No channels left in list. Exiting")
150 sys.exit()
151
152 # Called when ZChannel object has finished its tasks
153- # Removes channel from pending queue, and releases the connection
154+ # Removes channel from pending queue, and releases the connection
155 # if all channeled have been processed
156 def channel_ready(chan):
157 logging.debug("Channel ready: %s" % chan)

Subscribers

People subscribed via source and target branches