Merge lp:~ken-vandine/telepathy-indicator/lp_926072 into lp:telepathy-indicator

Proposed by Ken VanDine
Status: Merged
Merged at revision: 56
Proposed branch: lp:~ken-vandine/telepathy-indicator/lp_926072
Merge into: lp:telepathy-indicator
Diff against target: 113 lines (+39/-18)
1 file modified
src/indicator-approver.c (+39/-18)
To merge this branch: bzr merge lp:~ken-vandine/telepathy-indicator/lp_926072
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+98719@code.launchpad.net

Description of the change

 * use get_requested to determine if we should get the contact with get_initiator_contact or get_target_contact (LP: #926072)
 * don't observe chat room channels, it seems there is no way to sanely determine if we should get notified. The observer in gnome-shell doesn't observe chat room channels either.

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

This will also fix (LP: #910785)

Revision history for this message
Ken VanDine (ken-vandine) wrote :

This will also fix (LP: #929002)

Revision history for this message
Sebastien Bacher (seb128) wrote :

looks fine to me!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/indicator-approver.c'
--- src/indicator-approver.c 2012-02-16 18:37:01 +0000
+++ src/indicator-approver.c 2012-03-21 20:09:17 +0000
@@ -217,6 +217,19 @@
217 return FALSE;217 return FALSE;
218}218}
219219
220static TpContact *
221get_contact_from_channel (TpChannel * channel)
222{
223 g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
224 TpContact *contact = NULL;
225 if (tp_channel_get_requested (TP_CHANNEL (channel)))
226 contact = tp_channel_get_target_contact (TP_CHANNEL (channel));
227 else
228 contact = tp_channel_get_initiator_contact (TP_CHANNEL (channel));
229 return TP_CONTACT (contact);
230}
231
232
220static void233static void
221handle_contacts_pending_add_indicator_cb (TpConnection *connection, guint n_contacts, TpContact * const *contacts, guint n_failed, const TpHandle *failed, const GError *err, gpointer user_data, GObject *weak_object)234handle_contacts_pending_add_indicator_cb (TpConnection *connection, guint n_contacts, TpContact * const *contacts, guint n_failed, const TpHandle *failed, const GError *err, gpointer user_data, GObject *weak_object)
222{235{
@@ -227,9 +240,22 @@
227 const gchar *alias = "";240 const gchar *alias = "";
228 GFile *avatar = NULL;241 GFile *avatar = NULL;
229 GdkPixbuf *pixbuf = NULL;242 GdkPixbuf *pixbuf = NULL;
230 TpContact *contact = contacts[0];243 TpContact *contact = NULL;
231 alias = tp_contact_get_alias (contact);244
232 avatar = tp_contact_get_avatar_file (contact);245 contact = get_contact_from_channel (channel);
246
247 if (contact)
248 {
249 alias = tp_contact_get_alias (contact);
250 avatar = tp_contact_get_avatar_file (contact);
251 g_debug ("handle_contacts_pending_add_indicator_cb HAS CONTACT alias: %s", alias);
252 } else
253 {
254 alias = tp_channel_get_initiator_identifier (channel);
255 g_debug ("handle_contacts_pending_add_indicator_cb NO CONTACT alias: %s", alias);
256 }
257 g_debug ("handle_contacts_pending_add_indicator_cb alias: %s", alias);
258
233 id = tp_channel_get_identifier (TP_CHANNEL (channel));259 id = tp_channel_get_identifier (TP_CHANNEL (channel));
234 IndicateIndicator *indicator;260 IndicateIndicator *indicator;
235 indicator = indicate_indicator_new ();261 indicator = indicate_indicator_new ();
@@ -316,7 +342,6 @@
316message_received_cb (TpTextChannel *channel, TpMessage *message, gpointer user_data)342message_received_cb (TpTextChannel *channel, TpMessage *message, gpointer user_data)
317{343{
318 g_debug ("message_received_cb: %s", tp_channel_get_identifier (TP_CHANNEL (channel)));344 g_debug ("message_received_cb: %s", tp_channel_get_identifier (TP_CHANNEL (channel)));
319
320 g_timeout_add (100, check_pending_messages, channel);345 g_timeout_add (100, check_pending_messages, channel);
321}346}
322347
@@ -324,6 +349,7 @@
324handle_contacts_add_indicator_cb (TpConnection *connection, guint n_contacts, TpContact * const *contacts, guint n_failed, const TpHandle *failed, const GError *err, gpointer user_data, GObject *weak_object)349handle_contacts_add_indicator_cb (TpConnection *connection, guint n_contacts, TpContact * const *contacts, guint n_failed, const TpHandle *failed, const GError *err, gpointer user_data, GObject *weak_object)
325{350{
326 IndicateIndicator *indicator = NULL;351 IndicateIndicator *indicator = NULL;
352 TpContact *contact = NULL;
327 const gchar *id = "";353 const gchar *id = "";
328 const gchar *alias = "";354 const gchar *alias = "";
329 GTimeVal time;355 GTimeVal time;
@@ -338,17 +364,19 @@
338 channels = tp_channel_dispatch_operation_borrow_channels (dispatch_op);364 channels = tp_channel_dispatch_operation_borrow_channels (dispatch_op);
339 channel = g_ptr_array_index (channels, 0);365 channel = g_ptr_array_index (channels, 0);
340366
341 if (TP_IS_CHANNEL (channel))367 contact = get_contact_from_channel (channel);
368
369 if (contact)
370 {
371 alias = tp_contact_get_alias (contact);
372 avatar = tp_contact_get_avatar_file (contact);
373 } else
342 {374 {
343 alias = tp_channel_get_initiator_identifier (channel);375 alias = tp_channel_get_initiator_identifier (channel);
344 id = tp_channel_get_identifier (TP_CHANNEL (channel));
345 }376 }
377 g_debug ("handle_contacts_add_indicator_cb alias: %s", alias);
346378
347 if (contacts)379 id = tp_channel_get_identifier (TP_CHANNEL (channel));
348 {
349 alias = tp_contact_get_alias (contacts[0]);
350 avatar = tp_contact_get_avatar_file (contacts[0]);
351 }
352380
353 if (check_indicator (id))381 if (check_indicator (id))
354 {382 {
@@ -445,7 +473,6 @@
445 G_CALLBACK (pending_message_removed_cb), NULL);473 G_CALLBACK (pending_message_removed_cb), NULL);
446474
447 check_pending_messages (TP_CHANNEL (channel));475 check_pending_messages (TP_CHANNEL (channel));
448
449 }476 }
450 }477 }
451 g_list_free(itr);478 g_list_free(itr);
@@ -934,12 +961,6 @@
934 TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,961 TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
935 NULL));962 NULL));
936963
937 /* room text chat */
938 tp_base_client_take_observer_filter (observer, tp_asv_new (
939 TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT,
940 TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_ROOM,
941 NULL));
942
943 if (!tp_base_client_register (observer, &error))964 if (!tp_base_client_register (observer, &error))
944 {965 {
945 if (error)966 if (error)

Subscribers

People subscribed via source and target branches

to all changes: