~ubuntu-branches/ubuntu/feisty/gossip-telepathy/feisty

« back to all changes in this revision

Viewing changes to protocols/telepathy/gossip-telepathy-chatrooms.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-12-20 15:09:43 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20061220150943-01hnkptgzfvw5d6e
Tags: 0.21~cvs20061220-0ubuntu1
* New CVS checkout.
* debian/control: Build-Depend on libtelepathy-dev (>= 0.0.40-0ubuntu2).

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include <config.h>
22
22
 
 
23
#include <libtelepathy/tp-helpers.h>
23
24
#include <libtelepathy/tp-conn.h>
24
25
#include <libtelepathy/tp-chan.h>
25
26
#include <libtelepathy/tp-chan-gen.h>
26
 
#include <libtelepathy/tp-chan-iface-group-gen.h>
27
 
#include <libtelepathy/tp-chan-type-text-gen.h>
28
27
#include <libtelepathy/tp-interfaces.h>
29
28
#include <libtelepathy/tp-constants.h>
30
29
 
40
39
#define DEBUG_DOMAIN "TelepathyChatrooms"
41
40
 
42
41
struct _GossipTelepathyChatrooms {
43
 
        GossipTelepathy *telepathy;
44
 
        GHashTable      *room_id_hash;
 
42
        GossipTelepathy        *telepathy;
 
43
        GossipTelepathyMessage *message;
 
44
        GHashTable             *rooms;
45
45
};
46
46
 
47
47
typedef struct {
49
49
        GossipChatroom       *chatroom;
50
50
        GossipTelepathyGroup *group;
51
51
        TpChan               *room_channel;
52
 
 
53
 
        GossipChatroomJoinCb  join_callback;
54
 
        gpointer              join_user_data;
55
52
} TelepathyChatroom;
56
53
 
57
 
static void                telepathy_chatrooms_chatroom_free      (TelepathyChatroom    *room);
58
 
static TelepathyChatroom * telepathy_chatrooms_chatroom_new       (GossipChatroom       *room);
59
 
static void                telepathy_chatrooms_get_rooms_foreach  (gpointer              key,
60
 
                                                                   TelepathyChatroom    *room,
61
 
                                                                   GList               **list);
62
 
static GossipContact *     telepathy_chatrooms_new_contact        (GossipTelepathy      *telepathy,
63
 
                                                                   TelepathyChatroom    *room);
64
 
static void                telepathy_chatrooms_members_added_cb   (GossipTelepathyGroup *group,
65
 
                                                                   GArray               *members,
66
 
                                                                   TelepathyChatroom    *room);
67
 
static void                telepathy_chatrooms_members_removed_cb (GossipTelepathyGroup *group,
68
 
                                                                   GArray               *members,
69
 
                                                                   TelepathyChatroom    *room);
 
54
static void     telepathy_chatrooms_disconnected_cb    (GossipProtocol            *telepathy,
 
55
                                                        GossipAccount             *account,
 
56
                                                        gint                       reason,
 
57
                                                        GossipTelepathyChatrooms  *chatrooms);
 
58
static void     telepathy_chatrooms_closed_cb          (TpChan                    *tp_chan,
 
59
                                                        GossipTelepathyChatrooms  *chatrooms);
 
60
static gboolean telepathy_chatrooms_find_chan          (guint                      key,
 
61
                                                        TelepathyChatroom         *room,
 
62
                                                        TpChan                    *tp_chan);
 
63
static void     telepathy_chatrooms_chatroom_free      (TelepathyChatroom         *room);
 
64
static void     telepathy_chatrooms_get_rooms_foreach  (gpointer                   key,
 
65
                                                        TelepathyChatroom         *room,
 
66
                                                        GList                    **list);
 
67
static void     telepathy_chatrooms_members_added_cb   (GossipTelepathyGroup      *group,
 
68
                                                        GArray                    *members,
 
69
                                                        TelepathyChatroom         *room);
 
70
static void     telepathy_chatrooms_members_removed_cb (GossipTelepathyGroup      *group,
 
71
                                                        GArray                    *members,
 
72
                                                        TelepathyChatroom         *room);
70
73
 
71
74
GossipTelepathyChatrooms *
72
75
gossip_telepathy_chatrooms_init (GossipTelepathy *telepathy)
76
79
        g_return_val_if_fail (GOSSIP_IS_TELEPATHY (telepathy), NULL);
77
80
 
78
81
        chatrooms = g_new0 (GossipTelepathyChatrooms, 1);
79
 
        chatrooms->telepathy = g_object_ref (telepathy);
80
 
        chatrooms->room_id_hash =
81
 
                g_hash_table_new_full (NULL,//g_int_hash,
82
 
                                       NULL,//g_int_equal,
83
 
                                       NULL,
84
 
                                       (GDestroyNotify)
85
 
                                       telepathy_chatrooms_chatroom_free);
 
82
        chatrooms->telepathy = telepathy;
 
83
        chatrooms->rooms = g_hash_table_new_full (g_direct_hash,
 
84
                                                  g_direct_equal,
 
85
                                                  NULL,
 
86
                                                  (GDestroyNotify)
 
87
                                                  telepathy_chatrooms_chatroom_free);
 
88
        chatrooms->message = gossip_telepathy_message_init (telepathy);
 
89
 
 
90
        g_signal_connect (telepathy, "disconnected",
 
91
                          G_CALLBACK (telepathy_chatrooms_disconnected_cb),
 
92
                          chatrooms);
86
93
 
87
94
        return chatrooms;
88
95
}
89
96
 
 
97
static void
 
98
telepathy_chatrooms_disconnected_cb (GossipProtocol           *telepathy,
 
99
                                     GossipAccount            *account,
 
100
                                     gint                      reason,
 
101
                                     GossipTelepathyChatrooms *chatrooms)
 
102
{
 
103
        g_hash_table_remove_all (chatrooms->rooms);
 
104
}
 
105
 
90
106
void
91
107
gossip_telepathy_chatrooms_finalize (GossipTelepathyChatrooms *chatrooms)
92
108
{
93
109
        g_return_if_fail (chatrooms != NULL);
94
110
 
95
 
        g_hash_table_destroy (chatrooms->room_id_hash);
96
 
        g_object_unref (chatrooms->telepathy);
 
111
        gossip_telepathy_message_finalize (chatrooms->message);
 
112
        g_hash_table_destroy (chatrooms->rooms);
97
113
        g_free (chatrooms);
98
114
}
99
115
 
106
122
        GossipChatroomId   room_id;
107
123
        TelepathyChatroom *tp_room;
108
124
 
109
 
        /* Search for existing room, callback with:
110
 
        room = telepathy_chatrooms_chatroom_new (chatrooms, chatroom);
111
 
        existing_room = g_hash_table_lookup (chatrooms->room_jid_hash, room->jid);
112
 
        return existing id
113
 
        */
114
 
 
115
125
        room_id = gossip_chatroom_get_id (room);
116
 
        tp_room = g_hash_table_lookup (chatrooms->room_id_hash,
 
126
        tp_room = g_hash_table_lookup (chatrooms->rooms,
117
127
                                       GINT_TO_POINTER (room_id));
118
128
        if (!tp_room) {
119
129
                const char    *room_names[2] = {NULL, NULL};
122
132
                gchar         *room_object_path;
123
133
                GError        *error = NULL;
124
134
                TpConn        *tp_conn;
 
135
                TpChan        *room_channel;
125
136
                GossipAccount *account;
126
137
                const gchar   *bus_name;
127
138
 
128
 
                tp_room = telepathy_chatrooms_chatroom_new (room);
129
139
                tp_conn = gossip_telepathy_get_connection (chatrooms->telepathy);
130
140
 
131
141
                /*
132
 
                gossip_debug (DEBUG_DOMAIN, "Joining a chatroom: %s@%s",
133
 
                              gossip_chatroom_get_room (room),
134
 
                              gossip_chatroom_get_server (room));
135
 
 
136
142
                room_names[0] = g_strdup_printf ("%s@%s",
137
143
                                                 gossip_chatroom_get_room (room),
138
144
                                                 gossip_chatroom_get_server (room));
139
 
                if (!tp_conn_request_handles (DBUS_G_PROXY (tp_conn),
140
 
                                              TP_CONN_HANDLE_TYPE_ROOM,
141
 
                                              room_names,
142
 
                                              &room_handles,
143
 
                                              &error)) {
144
 
                        return 0;
145
145
                }
146
146
                */
147
147
                gossip_debug (DEBUG_DOMAIN, "Joining a chatroom: %s",
148
 
                              gossip_chatroom_get_room(room));
149
 
 
150
 
                /*FIXME: room_handles and room_object_path not freed ? */
151
 
 
 
148
                              gossip_chatroom_get_room (room));
 
149
                gossip_chatroom_set_status (room, GOSSIP_CHATROOM_STATUS_JOINING);
 
150
                gossip_chatroom_set_last_error (room, NULL);
 
151
 
 
152
                /* FIXME: One of those tp calls do network stuff,
 
153
                 *        we should make this call async */
 
154
                /* Get a handle for the room */
152
155
                room_names[0] = gossip_chatroom_get_room (room);
153
156
                if (!tp_conn_request_handles (DBUS_G_PROXY (tp_conn),
154
157
                                              TP_CONN_HANDLE_TYPE_ROOM,
155
158
                                              room_names,
156
159
                                              &room_handles,
157
160
                                              &error)) {
 
161
                        gossip_debug (DEBUG_DOMAIN, "Error requesting room handle:%s",
 
162
                                      error->message);
 
163
                        g_clear_error (&error);
158
164
                        return 0;
159
165
                }
160
 
 
161
166
                room_handle = g_array_index (room_handles, guint, 0);
162
 
                gossip_debug (DEBUG_DOMAIN, "Got the room handle: %d", room_handle);
 
167
                g_array_free (room_handles, TRUE);
163
168
 
 
169
                /* Request the object path */
164
170
                if (!tp_conn_request_channel (DBUS_G_PROXY (tp_conn),
165
171
                                              TP_IFACE_CHANNEL_TYPE_TEXT,
166
172
                                              TP_CONN_HANDLE_TYPE_ROOM,
168
174
                                              TRUE,
169
175
                                              &room_object_path,
170
176
                                              &error)) {
 
177
                        gossip_debug (DEBUG_DOMAIN, "Error requesting room channel:%s",
 
178
                                      error->message);
 
179
                        g_clear_error (&error);
171
180
                        return 0;
172
181
                }
173
182
 
174
 
                gossip_debug (DEBUG_DOMAIN, "Got obj path for room: %s",
175
 
                              room_object_path);        
176
 
 
 
183
                /* Create the channel */
177
184
                account = gossip_telepathy_get_account (chatrooms->telepathy);
178
185
                bus_name = gossip_account_get_bus_name (account);
179
 
                tp_room->room_channel = tp_chan_new (dbus_g_bus_get (DBUS_BUS_SESSION, NULL),
180
 
                                                     bus_name,
181
 
                                                     room_object_path,
182
 
                                                     TP_IFACE_CHANNEL_TYPE_TEXT,
183
 
                                                     TP_CONN_HANDLE_TYPE_ROOM,
184
 
                                                     room_handle);      
 
186
                room_channel = tp_chan_new (tp_get_bus (),
 
187
                                            bus_name,
 
188
                                            room_object_path,
 
189
                                            TP_IFACE_CHANNEL_TYPE_TEXT,
 
190
                                            TP_CONN_HANDLE_TYPE_ROOM,
 
191
                                            room_handle);       
 
192
                g_free (room_object_path);
185
193
 
186
 
                g_hash_table_insert (chatrooms->room_id_hash,
 
194
                /* Room joined, configure it ... */
 
195
                tp_room = g_slice_new0 (TelepathyChatroom);
 
196
                tp_room->chatroom = g_object_ref (room);
 
197
                tp_room->telepathy = chatrooms->telepathy;
 
198
                tp_room->room_channel = room_channel;
 
199
                tp_room->group = gossip_telepathy_group_new (tp_room->telepathy,
 
200
                                                             tp_room->room_channel);
 
201
                
 
202
                g_hash_table_insert (chatrooms->rooms,
187
203
                                     GINT_TO_POINTER (room_id),
188
204
                                     tp_room);
189
205
 
190
 
                gossip_chatroom_set_status (tp_room->chatroom,
191
 
                                            GOSSIP_CHATROOM_STATUS_JOINING);
192
 
                gossip_chatroom_set_last_error (tp_room->chatroom, NULL);
193
 
 
194
 
                tp_room->join_callback = callback;
195
 
                tp_room->join_user_data = user_data;
196
 
                tp_room->telepathy = chatrooms->telepathy;
197
 
 
198
 
                gossip_chatroom_set_status (tp_room->chatroom,
199
 
                                            GOSSIP_CHATROOM_STATUS_ACTIVE);
200
 
                gossip_chatroom_set_last_error (tp_room->chatroom,
 
206
                dbus_g_proxy_connect_signal (DBUS_G_PROXY (room_channel),
 
207
                                             "Closed",
 
208
                                             G_CALLBACK (telepathy_chatrooms_closed_cb),
 
209
                                             chatrooms, NULL);
 
210
 
 
211
                gossip_chatroom_set_status (room, GOSSIP_CHATROOM_STATUS_ACTIVE);
 
212
                gossip_chatroom_set_last_error (room,
201
213
                        gossip_chatroom_provider_join_result_as_str (GOSSIP_CHATROOM_JOIN_OK));
202
214
 
203
 
                gossip_debug (DEBUG_DOMAIN, "Calling callback");
204
 
                (callback) (GOSSIP_CHATROOM_PROVIDER (chatrooms->telepathy),
205
 
                            GOSSIP_CHATROOM_JOIN_OK,
206
 
                            room_id, user_data);
 
215
                if (callback) {
 
216
                        (callback) (GOSSIP_CHATROOM_PROVIDER (chatrooms->telepathy),
 
217
                                    GOSSIP_CHATROOM_JOIN_OK,
 
218
                                    room_id, user_data);
 
219
                }
207
220
 
208
221
                g_signal_emit_by_name (chatrooms->telepathy,
209
222
                                       "chatroom-joined",
210
223
                                       room_id);
211
224
 
212
 
                gossip_telepathy_message_setup (chatrooms->telepathy,
213
 
                                                tp_room->room_channel,
214
 
                                                room_id);
 
225
                /* Setup message sending/receiving for the new text channel */
 
226
                gossip_telepathy_message_newchannel (chatrooms->message,
 
227
                                                     room_channel, room_id);
215
228
 
216
229
                /* Setup the chatroom's contact list */
217
 
                tp_room->group = gossip_telepathy_group_new (tp_room->telepathy,
218
 
                                                             tp_room->room_channel);
219
230
                g_signal_connect (tp_room->group, "members-added",
220
231
                                  G_CALLBACK (telepathy_chatrooms_members_added_cb),
221
232
                                  tp_room);
223
234
                                  G_CALLBACK (telepathy_chatrooms_members_removed_cb),
224
235
                                  tp_room);
225
236
                gossip_telepathy_group_setup (tp_room->group);
226
 
        } else {
 
237
        }
 
238
        else if (callback) {
227
239
                (callback) (GOSSIP_CHATROOM_PROVIDER (chatrooms->telepathy),
228
240
                            GOSSIP_CHATROOM_JOIN_ALREADY_OPEN,
229
 
                            room_id,
230
 
                            user_data);
 
241
                            room_id, user_data);
231
242
        }
232
 
        
233
 
        gossip_debug (DEBUG_DOMAIN, "Returning from join");
234
243
 
235
244
        return room_id;
236
245
}
240
249
                                   GossipChatroomId          id)
241
250
{
242
251
/*
243
 
        g_hash_table_remove (chatrooms->room_id_hash,
 
252
        g_hash_table_remove (chatrooms->rooms,
244
253
                             GINT_TO_POINTER (id));
245
254
*/
246
255
}
250
259
                                 GossipChatroomId          id,
251
260
                                 const gchar              *message)
252
261
{
253
 
        TelepathyChatroom *room;
254
 
 
255
 
        room = g_hash_table_lookup (chatrooms->room_id_hash,
256
 
                                    GINT_TO_POINTER (id));
257
 
 
258
 
        g_return_if_fail (room != NULL);
 
262
        g_return_if_fail (chatrooms != NULL);
259
263
 
260
264
        gossip_debug (DEBUG_DOMAIN, "ID[%d] Send message: %s", id, message);
261
 
        gossip_telepathy_message_send (room->room_channel, message);
 
265
        gossip_telepathy_message_send (chatrooms->message, id, message);
262
266
}
263
267
 
264
268
void
268
272
{
269
273
        TelepathyChatroom *room;
270
274
        
271
 
        room = g_hash_table_lookup (chatrooms->room_id_hash,
 
275
        room = g_hash_table_lookup (chatrooms->rooms,
272
276
                                    GINT_TO_POINTER (id));
273
277
        g_return_if_fail (room != NULL);
274
278
 
285
289
{
286
290
        TelepathyChatroom *room;
287
291
 
288
 
        room = g_hash_table_lookup (chatrooms->room_id_hash,
 
292
        room = g_hash_table_lookup (chatrooms->rooms,
289
293
                                    GINT_TO_POINTER (id));
290
294
        g_return_if_fail (room != NULL);
291
295
 
300
304
                                  GossipChatroomId          id)
301
305
{
302
306
        TelepathyChatroom *room;
 
307
        GError            *error = NULL;
303
308
 
304
 
        room = g_hash_table_lookup (chatrooms->room_id_hash,
 
309
        room = g_hash_table_lookup (chatrooms->rooms,
305
310
                                    GINT_TO_POINTER (id));
306
311
        g_return_if_fail (room != NULL);
307
312
 
309
314
                                    GOSSIP_CHATROOM_STATUS_INACTIVE);
310
315
        gossip_chatroom_set_last_error (room->chatroom, NULL);
311
316
 
312
 
        /* Quit room */
313
 
        g_hash_table_remove (chatrooms->room_id_hash,
314
 
                             GINT_TO_POINTER (id));
 
317
        if (!tp_chan_close (DBUS_G_PROXY (room->room_channel), &error)) {
 
318
                gossip_debug (DEBUG_DOMAIN, "Error closing room channel: %s",
 
319
                              error->message);
 
320
                g_clear_error (&error);
 
321
        }
 
322
 
315
323
}
316
324
 
317
325
GossipChatroom *
324
332
        id = gossip_chatroom_get_id (chatroom);
325
333
        gossip_debug (DEBUG_DOMAIN, "Finding room with id=%d", id);
326
334
 
327
 
        room = g_hash_table_lookup (chatrooms->room_id_hash,
 
335
        room = g_hash_table_lookup (chatrooms->rooms,
328
336
                                    GINT_TO_POINTER (id));
329
337
        if (!room) {
330
338
                return NULL;
342
350
        TelepathyChatroom       *room;
343
351
        GossipTelepathyContacts *contacts;
344
352
        guint                    handle;
 
353
        const gchar             *contact_id;
345
354
 
346
355
        g_return_if_fail (chatrooms != NULL);
347
356
        g_return_if_fail (GOSSIP_IS_CONTACT (contact));
348
357
 
349
 
        room = g_hash_table_lookup (chatrooms->room_id_hash,
 
358
        room = g_hash_table_lookup (chatrooms->rooms,
350
359
                                    GINT_TO_POINTER (id));
351
360
        g_return_if_fail (room != NULL);
352
361
  
355
364
                      gossip_contact_get_id (contact));
356
365
 
357
366
        contacts = gossip_telepathy_get_contacts (room->telepathy);
358
 
        handle = gossip_telepathy_contacts_get_handle (contacts, contact);
 
367
        contact_id = gossip_contact_get_id (contact);
 
368
        handle = gossip_telepathy_contacts_get_handle (contacts, contact_id);
359
369
 
360
370
        g_return_if_fail (handle > 0);
361
371
 
443
453
 
444
454
        g_return_val_if_fail (chatrooms != NULL, NULL);
445
455
 
446
 
        g_hash_table_foreach (chatrooms->room_id_hash,
 
456
        g_hash_table_foreach (chatrooms->rooms,
447
457
                              (GHFunc) telepathy_chatrooms_get_rooms_foreach,
448
458
                              &list);
449
459
        return list;
450
460
}
451
461
 
452
462
static void
 
463
telepathy_chatrooms_closed_cb (TpChan                   *tp_chan,
 
464
                               GossipTelepathyChatrooms *chatrooms)
 
465
{
 
466
        TelepathyChatroom *room;
 
467
 
 
468
        room = g_hash_table_find (chatrooms->rooms,
 
469
                                  (GHRFunc) telepathy_chatrooms_find_chan,
 
470
                                  tp_chan);
 
471
        g_return_if_fail (room != NULL);
 
472
 
 
473
        gossip_debug (DEBUG_DOMAIN, "Channel closed: %d", tp_chan->handle);
 
474
 
 
475
        g_hash_table_remove (chatrooms->rooms,
 
476
                             (gchar*) gossip_chatroom_get_id (room->chatroom));
 
477
}
 
478
 
 
479
static gboolean
 
480
telepathy_chatrooms_find_chan (guint              key,
 
481
                               TelepathyChatroom *room,
 
482
                               TpChan            *tp_chan)
 
483
{
 
484
        if (tp_chan->handle == room->room_channel->handle) {
 
485
                return TRUE;
 
486
        }
 
487
 
 
488
        return FALSE;
 
489
}
 
490
 
 
491
static void
453
492
telepathy_chatrooms_chatroom_free (TelepathyChatroom *room)
454
493
{
455
494
        g_object_unref (room->chatroom);
456
495
        g_object_unref (room->room_channel);
457
496
        g_object_unref (room->group);
458
 
}
459
 
 
460
 
static TelepathyChatroom *
461
 
telepathy_chatrooms_chatroom_new (GossipChatroom *room)
462
 
{
463
 
        TelepathyChatroom *tp_room;
464
 
 
465
 
        tp_room = g_new0 (TelepathyChatroom, 1);
466
 
        tp_room->chatroom = g_object_ref (room);
467
 
 
468
 
        return tp_room;
 
497
        g_slice_free (TelepathyChatroom, room);
469
498
}
470
499
 
471
500
static void
476
505
        *list = g_list_append (*list, key);
477
506
}
478
507
 
479
 
static GossipContact *
480
 
telepathy_chatrooms_new_contact (GossipTelepathy   *telepathy,
481
 
                                 TelepathyChatroom *room)
482
 
{
483
 
        GossipChatroomContact *contact;
484
 
        GossipAccount         *account;
485
 
 
486
 
        account = gossip_telepathy_get_account (telepathy);
487
 
        contact = gossip_chatroom_contact_new (account);
488
 
        gossip_chatroom_contact_set_role (contact,
489
 
                                          GOSSIP_CHATROOM_ROLE_PARTICIPANT);
490
 
        gossip_chatroom_contact_set_affiliation (contact,
491
 
                                                 GOSSIP_CHATROOM_AFFILIATION_MEMBER);
492
 
 
493
 
        return GOSSIP_CONTACT (contact);
494
 
}
495
 
 
496
508
static void
497
509
telepathy_chatrooms_members_added_cb (GossipTelepathyGroup *group,
498
510
                                      GArray               *members,
504
516
        gossip_debug (DEBUG_DOMAIN, "adding %d members", members->len);
505
517
                        
506
518
        contacts = gossip_telepathy_get_contacts (room->telepathy);
507
 
        added_list = gossip_telepathy_contacts_add_handles (contacts,
508
 
                                                            members,
509
 
                                                            (GossipTelepathyContactsNewFunc)
510
 
                                                            telepathy_chatrooms_new_contact,
511
 
                                                            room);
512
 
        for (l = added_list; l; l = l->next) {
 
519
        added_list = gossip_telepathy_contacts_get_from_handles (contacts,
 
520
                                                                 members);
 
521
 
 
522
        for (l = added_list; l; l = l->next) {  
 
523
                GossipChatroomContact *contact;
 
524
 
 
525
                contact = l->data;
 
526
                gossip_chatroom_contact_set_role (contact,
 
527
                                                  GOSSIP_CHATROOM_ROLE_PARTICIPANT);
 
528
                gossip_chatroom_contact_set_affiliation (contact,
 
529
                                                         GOSSIP_CHATROOM_AFFILIATION_MEMBER);
 
530
 
513
531
                g_signal_emit_by_name (room->telepathy, "chatroom-contact-joined",
514
532
                                       gossip_chatroom_get_id (room->chatroom),
515
 
                                       GOSSIP_CONTACT (l->data));
 
533
                                       GOSSIP_CONTACT (contact));
516
534
        }
517
535
 
518
536
        g_list_free (added_list);
536
554
 
537
555
                handle = g_array_index (members, guint, i);
538
556
                contact = gossip_telepathy_contacts_get_from_handle (contacts,
539
 
                                                                     handle,
540
 
                                                                     NULL, NULL);
 
557
                                                                     handle);
541
558
 
542
559
                g_signal_emit_by_name (room->telepathy, "chatroom-contact-left",
543
560
                                       gossip_chatroom_get_id (room->chatroom),