]> git.0d.be Git - empathy.git/blob - libempathy/empathy-chatroom-manager.c
Merge commit 'upstream/master' into mc5
[empathy.git] / libempathy / empathy-chatroom-manager.c
1 /*
2  * Copyright (C) 2004-2007 Imendio AB
3  * Copyright (C) 2007-2009 Collabora Ltd.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA  02110-1301  USA
19  *
20  * Authors: Xavier Claessens <xclaesse@gmail.com>
21  *          Martyn Russell <martyn@imendio.com>
22  */
23
24 #include "config.h"
25
26 #include <string.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
29
30 #include <libxml/parser.h>
31 #include <libxml/tree.h>
32
33 #include <telepathy-glib/interfaces.h>
34
35 #include "empathy-tp-chat.h"
36 #include "empathy-chatroom-manager.h"
37 #include "empathy-account-manager.h"
38 #include "empathy-utils.h"
39
40 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
41 #include "empathy-debug.h"
42
43 #define CHATROOMS_XML_FILENAME "chatrooms.xml"
44 #define CHATROOMS_DTD_FILENAME "empathy-chatroom-manager.dtd"
45 #define SAVE_TIMER 4
46
47 static EmpathyChatroomManager *chatroom_manager_singleton = NULL;
48
49 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatroomManager)
50 typedef struct
51 {
52   GList *chatrooms;
53   gchar *file;
54   EmpathyAccountManager *account_manager;
55   /* source id of the autosave timer */
56   gint save_timer_id;
57 } EmpathyChatroomManagerPriv;
58
59 enum {
60   CHATROOM_ADDED,
61   CHATROOM_REMOVED,
62   LAST_SIGNAL
63 };
64
65 static guint signals[LAST_SIGNAL];
66
67 /* properties */
68 enum
69 {
70   PROP_FILE = 1,
71   LAST_PROPERTY
72 };
73
74 G_DEFINE_TYPE (EmpathyChatroomManager, empathy_chatroom_manager, G_TYPE_OBJECT);
75
76 /*
77  * API to save/load and parse the chatrooms file.
78  */
79
80 static gboolean
81 chatroom_manager_file_save (EmpathyChatroomManager *manager)
82 {
83         EmpathyChatroomManagerPriv *priv;
84         xmlDocPtr                  doc;
85         xmlNodePtr                 root;
86         GList                     *l;
87
88         priv = GET_PRIV (manager);
89
90         doc = xmlNewDoc ("1.0");
91         root = xmlNewNode (NULL, "chatrooms");
92         xmlDocSetRootElement (doc, root);
93
94         for (l = priv->chatrooms; l; l = l->next) {
95                 EmpathyChatroom *chatroom;
96                 xmlNodePtr       node;
97                 const gchar     *account_id;
98
99                 chatroom = l->data;
100
101                 if (!empathy_chatroom_is_favorite (chatroom)) {
102                         continue;
103                 }
104
105                 account_id = empathy_account_get_unique_name (
106                   empathy_chatroom_get_account (chatroom));
107
108                 node = xmlNewChild (root, NULL, "chatroom", NULL);
109                 xmlNewTextChild (node, NULL, "name", empathy_chatroom_get_name (chatroom));
110                 xmlNewTextChild (node, NULL, "room", empathy_chatroom_get_room (chatroom));
111                 xmlNewTextChild (node, NULL, "account", account_id);
112                 xmlNewTextChild (node, NULL, "auto_connect",
113                         empathy_chatroom_get_auto_connect (chatroom) ? "yes" : "no");
114         }
115
116         /* Make sure the XML is indented properly */
117         xmlIndentTreeOutput = 1;
118
119         DEBUG ("Saving file:'%s'", priv->file);
120         xmlSaveFormatFileEnc (priv->file, doc, "utf-8", 1);
121         xmlFreeDoc (doc);
122
123         xmlCleanupParser ();
124         xmlMemoryDump ();
125
126         return TRUE;
127 }
128
129 static gboolean
130 save_timeout (EmpathyChatroomManager *self)
131 {
132   EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
133
134   priv->save_timer_id = 0;
135   chatroom_manager_file_save (self);
136
137   return FALSE;
138 }
139
140 static void
141 reset_save_timeout (EmpathyChatroomManager *self)
142 {
143   EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
144
145   if (priv->save_timer_id > 0)
146     {
147       g_source_remove (priv->save_timer_id);
148     }
149
150   priv->save_timer_id = g_timeout_add_seconds (SAVE_TIMER,
151       (GSourceFunc) save_timeout, self);
152 }
153
154 static void
155 chatroom_changed_cb (EmpathyChatroom *chatroom,
156                      GParamSpec *spec,
157                      EmpathyChatroomManager *self)
158 {
159   reset_save_timeout (self);
160 }
161
162 static void
163 add_chatroom (EmpathyChatroomManager *self,
164               EmpathyChatroom *chatroom)
165 {
166   EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
167
168   priv->chatrooms = g_list_prepend (priv->chatrooms, g_object_ref (chatroom));
169
170   g_signal_connect (chatroom, "notify",
171       G_CALLBACK (chatroom_changed_cb), self);
172 }
173
174 static void
175 chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
176                                  xmlNodePtr             node)
177 {
178         EmpathyChatroomManagerPriv *priv;
179         EmpathyChatroom            *chatroom;
180         EmpathyAccount             *account;
181         xmlNodePtr                 child;
182         gchar                     *str;
183         gchar                     *name;
184         gchar                     *room;
185         gchar                     *account_id;
186         gboolean                   auto_connect;
187
188         priv = GET_PRIV (manager);
189
190         /* default values. */
191         name = NULL;
192         room = NULL;
193         auto_connect = TRUE;
194         account_id = NULL;
195
196         for (child = node->children; child; child = child->next) {
197                 gchar *tag;
198
199                 if (xmlNodeIsText (child)) {
200                         continue;
201                 }
202
203                 tag = (gchar *) child->name;
204                 str = (gchar *) xmlNodeGetContent (child);
205
206                 if (strcmp (tag, "name") == 0) {
207                         name = g_strdup (str);
208                 }
209                 else if (strcmp (tag, "room") == 0) {
210                         room = g_strdup (str);
211                 }
212                 else if (strcmp (tag, "auto_connect") == 0) {
213                         if (strcmp (str, "yes") == 0) {
214                                 auto_connect = TRUE;
215                         } else {
216                                 auto_connect = FALSE;
217                         }
218                 }
219                 else if (strcmp (tag, "account") == 0) {
220                         account_id = g_strdup (str);
221                 }
222
223                 xmlFree (str);
224         }
225
226         account = empathy_account_manager_lookup (priv->account_manager, account_id);
227         if (!account) {
228                 g_free (name);
229                 g_free (room);
230                 g_free (account_id);
231                 return;
232         }
233
234         chatroom = empathy_chatroom_new_full (account, room, name, auto_connect);
235         empathy_chatroom_set_favorite (chatroom, TRUE);
236         add_chatroom (manager, chatroom);
237         g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
238
239         g_object_unref (account);
240         g_free (name);
241         g_free (room);
242         g_free (account_id);
243 }
244
245 static gboolean
246 chatroom_manager_file_parse (EmpathyChatroomManager *manager,
247                              const gchar           *filename)
248 {
249         EmpathyChatroomManagerPriv *priv;
250         xmlParserCtxtPtr           ctxt;
251         xmlDocPtr                  doc;
252         xmlNodePtr                 chatrooms;
253         xmlNodePtr                 node;
254
255         priv = GET_PRIV (manager);
256
257         DEBUG ("Attempting to parse file:'%s'...", filename);
258
259         ctxt = xmlNewParserCtxt ();
260
261         /* Parse and validate the file. */
262         doc = xmlCtxtReadFile (ctxt, filename, NULL, 0);
263         if (!doc) {
264                 g_warning ("Failed to parse file:'%s'", filename);
265                 xmlFreeParserCtxt (ctxt);
266                 return FALSE;
267         }
268
269         if (!empathy_xml_validate (doc, CHATROOMS_DTD_FILENAME)) {
270                 g_warning ("Failed to validate file:'%s'", filename);
271                 xmlFreeDoc (doc);
272                 xmlFreeParserCtxt (ctxt);
273                 return FALSE;
274         }
275
276         /* The root node, chatrooms. */
277         chatrooms = xmlDocGetRootElement (doc);
278
279         for (node = chatrooms->children; node; node = node->next) {
280                 if (strcmp ((gchar *) node->name, "chatroom") == 0) {
281                         chatroom_manager_parse_chatroom (manager, node);
282                 }
283         }
284
285         DEBUG ("Parsed %d chatrooms", g_list_length (priv->chatrooms));
286
287         xmlFreeDoc (doc);
288         xmlFreeParserCtxt (ctxt);
289
290         return TRUE;
291 }
292
293 static gboolean
294 chatroom_manager_get_all (EmpathyChatroomManager *manager)
295 {
296         EmpathyChatroomManagerPriv *priv;
297
298         priv = GET_PRIV (manager);
299
300         /* read file in */
301         if (g_file_test (priv->file, G_FILE_TEST_EXISTS) &&
302             !chatroom_manager_file_parse (manager, priv->file)) {
303                 return FALSE;
304         }
305
306         return TRUE;
307 }
308
309 static void
310 empathy_chatroom_manager_get_property (GObject *object,
311                                        guint property_id,
312                                        GValue *value,
313                                        GParamSpec *pspec)
314 {
315   EmpathyChatroomManager *self = EMPATHY_CHATROOM_MANAGER (object);
316   EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
317
318   switch (property_id)
319     {
320       case PROP_FILE:
321         g_value_set_string (value, priv->file);
322         break;
323       default:
324         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
325         break;
326     }
327 }
328
329 static void
330 empathy_chatroom_manager_set_property (GObject *object,
331                                        guint property_id,
332                                        const GValue *value,
333                                        GParamSpec *pspec)
334 {
335   EmpathyChatroomManager *self = EMPATHY_CHATROOM_MANAGER (object);
336   EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
337
338   switch (property_id)
339     {
340       case PROP_FILE:
341         g_free (priv->file);
342         priv->file = g_value_dup_string (value);
343         break;
344       default:
345         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
346         break;
347     }
348 }
349
350 static void
351 chatroom_manager_finalize (GObject *object)
352 {
353   EmpathyChatroomManager *self = EMPATHY_CHATROOM_MANAGER (object);
354   EmpathyChatroomManagerPriv *priv;
355   GList *l;
356
357   priv = GET_PRIV (object);
358
359   g_object_unref (priv->account_manager);
360
361   if (priv->save_timer_id > 0)
362     {
363       /* have to save before destroy the object */
364       g_source_remove (priv->save_timer_id);
365       priv->save_timer_id = 0;
366       chatroom_manager_file_save (self);
367     }
368
369   for (l = priv->chatrooms; l != NULL; l = g_list_next (l))
370     {
371       EmpathyChatroom *chatroom = l->data;
372
373       g_signal_handlers_disconnect_by_func (chatroom, chatroom_changed_cb,
374           self);
375
376       g_object_unref (chatroom);
377     }
378
379   g_list_free (priv->chatrooms);
380   g_free (priv->file);
381
382   (G_OBJECT_CLASS (empathy_chatroom_manager_parent_class)->finalize) (object);
383 }
384
385 static GObject *
386 empathy_chatroom_manager_constructor (GType type,
387                                       guint n_props,
388                                       GObjectConstructParam *props)
389 {
390   GObject *obj;
391   EmpathyChatroomManager *self;
392   EmpathyChatroomManagerPriv *priv;
393
394   if (chatroom_manager_singleton != NULL)
395     return g_object_ref (chatroom_manager_singleton);
396
397   /* Parent constructor chain */
398   obj = G_OBJECT_CLASS (empathy_chatroom_manager_parent_class)->
399         constructor (type, n_props, props);
400
401   self = EMPATHY_CHATROOM_MANAGER (obj);
402   priv = GET_PRIV (self);
403
404   chatroom_manager_singleton = self;
405   g_object_add_weak_pointer (obj, (gpointer) &chatroom_manager_singleton);
406
407   priv->account_manager = empathy_account_manager_dup_singleton ();
408
409   if (priv->file == NULL)
410     {
411       /* Set the default file path */
412       gchar *dir;
413
414       dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
415       if (!g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
416         g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
417
418       priv->file = g_build_filename (dir, CHATROOMS_XML_FILENAME, NULL);
419       g_free (dir);
420     }
421
422   chatroom_manager_get_all (self);
423   return obj;
424 }
425
426 static void
427 empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass)
428 {
429   GObjectClass *object_class = G_OBJECT_CLASS (klass);
430   GParamSpec *param_spec;
431
432   object_class->constructor = empathy_chatroom_manager_constructor;
433   object_class->get_property = empathy_chatroom_manager_get_property;
434   object_class->set_property = empathy_chatroom_manager_set_property;
435         object_class->finalize = chatroom_manager_finalize;
436
437   param_spec = g_param_spec_string (
438       "file",
439       "path of the favorite file",
440       "The path of the XML file containing user's favorites",
441       NULL,
442       G_PARAM_CONSTRUCT_ONLY |
443       G_PARAM_READWRITE |
444       G_PARAM_STATIC_NAME |
445       G_PARAM_STATIC_NICK |
446       G_PARAM_STATIC_BLURB);
447   g_object_class_install_property (object_class, PROP_FILE, param_spec);
448
449   signals[CHATROOM_ADDED] = g_signal_new ("chatroom-added",
450       G_TYPE_FROM_CLASS (klass),
451       G_SIGNAL_RUN_LAST,
452       0, NULL, NULL,
453       g_cclosure_marshal_VOID__OBJECT,
454       G_TYPE_NONE,
455       1, EMPATHY_TYPE_CHATROOM);
456
457   signals[CHATROOM_REMOVED] = g_signal_new ("chatroom-removed",
458       G_TYPE_FROM_CLASS (klass),
459       G_SIGNAL_RUN_LAST,
460       0, NULL, NULL,
461       g_cclosure_marshal_VOID__OBJECT,
462       G_TYPE_NONE,
463       1, EMPATHY_TYPE_CHATROOM);
464
465   g_type_class_add_private (object_class, sizeof (EmpathyChatroomManagerPriv));
466 }
467
468 static void
469 empathy_chatroom_manager_init (EmpathyChatroomManager *manager)
470 {
471   EmpathyChatroomManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
472       EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerPriv);
473
474   manager->priv = priv;
475 }
476
477 EmpathyChatroomManager *
478 empathy_chatroom_manager_dup_singleton (const gchar *file)
479 {
480   return EMPATHY_CHATROOM_MANAGER (g_object_new (EMPATHY_TYPE_CHATROOM_MANAGER,
481       "file", file, NULL));
482 }
483
484 gboolean
485 empathy_chatroom_manager_add (EmpathyChatroomManager *manager,
486                              EmpathyChatroom        *chatroom)
487 {
488   EmpathyChatroomManagerPriv *priv;
489
490   g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), FALSE);
491   g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), FALSE);
492
493   priv = GET_PRIV (manager);
494
495   /* don't add more than once */
496   if (!empathy_chatroom_manager_find (manager,
497       empathy_chatroom_get_account (chatroom),
498       empathy_chatroom_get_room (chatroom)))
499     {
500       add_chatroom (manager, chatroom);
501
502       if (empathy_chatroom_is_favorite (chatroom))
503         reset_save_timeout (manager);
504
505       g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
506       return TRUE;
507     }
508
509   return FALSE;
510 }
511
512 static void
513 chatroom_manager_remove_link (EmpathyChatroomManager *manager,
514                               GList *l)
515 {
516   EmpathyChatroomManagerPriv *priv;
517   EmpathyChatroom *chatroom;
518
519   priv = GET_PRIV (manager);
520
521   chatroom = l->data;
522
523   if (empathy_chatroom_is_favorite (chatroom))
524     reset_save_timeout (manager);
525
526   priv->chatrooms = g_list_delete_link (priv->chatrooms, l);
527
528   g_signal_emit (manager, signals[CHATROOM_REMOVED], 0, chatroom);
529   g_signal_handlers_disconnect_by_func (chatroom, chatroom_changed_cb, manager);
530
531   g_object_unref (chatroom);
532 }
533
534 void
535 empathy_chatroom_manager_remove (EmpathyChatroomManager *manager,
536                                  EmpathyChatroom        *chatroom)
537 {
538   EmpathyChatroomManagerPriv *priv;
539   GList *l;
540
541   g_return_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager));
542   g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom));
543
544   priv = GET_PRIV (manager);
545
546   for (l = priv->chatrooms; l; l = l->next)
547     {
548       EmpathyChatroom *this_chatroom;
549
550       this_chatroom = l->data;
551
552       if (this_chatroom == chatroom ||
553           empathy_chatroom_equal (chatroom, this_chatroom))
554         {
555           chatroom_manager_remove_link (manager, l);
556           break;
557         }
558     }
559 }
560
561 EmpathyChatroom *
562 empathy_chatroom_manager_find (EmpathyChatroomManager *manager,
563                                EmpathyAccount *account,
564                                const gchar *room)
565 {
566         EmpathyChatroomManagerPriv *priv;
567         GList                     *l;
568
569         g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), NULL);
570         g_return_val_if_fail (room != NULL, NULL);
571
572         priv = GET_PRIV (manager);
573
574         for (l = priv->chatrooms; l; l = l->next) {
575                 EmpathyChatroom *chatroom;
576                 EmpathyAccount *this_account;
577                 const gchar    *this_room;
578
579                 chatroom = l->data;
580                 this_account = empathy_chatroom_get_account (chatroom);
581                 this_room = empathy_chatroom_get_room (chatroom);
582
583                 if (this_account && this_room &&
584                     empathy_account_equal (account, this_account) &&
585                     strcmp (this_room, room) == 0) {
586                         return chatroom;
587                 }
588         }
589
590         return NULL;
591 }
592
593 GList *
594 empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager,
595                                        EmpathyAccount *account)
596 {
597         EmpathyChatroomManagerPriv *priv;
598         GList                     *chatrooms, *l;
599
600         g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), NULL);
601
602         priv = GET_PRIV (manager);
603
604         if (!account) {
605                 return g_list_copy (priv->chatrooms);
606         }
607
608         chatrooms = NULL;
609         for (l = priv->chatrooms; l; l = l->next) {
610                 EmpathyChatroom *chatroom;
611
612                 chatroom = l->data;
613
614                 if (empathy_account_equal (account,
615                                           empathy_chatroom_get_account (chatroom))) {
616                         chatrooms = g_list_append (chatrooms, chatroom);
617                 }
618         }
619
620         return chatrooms;
621 }
622
623 guint
624 empathy_chatroom_manager_get_count (EmpathyChatroomManager *manager,
625                                    EmpathyAccount *account)
626 {
627         EmpathyChatroomManagerPriv *priv;
628         GList                     *l;
629         guint                      count = 0;
630
631         g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), 0);
632
633         priv = GET_PRIV (manager);
634
635         if (!account) {
636                 return g_list_length (priv->chatrooms);
637         }
638
639         for (l = priv->chatrooms; l; l = l->next) {
640                 EmpathyChatroom *chatroom;
641
642                 chatroom = l->data;
643
644                 if (empathy_account_equal (account,
645                                            empathy_chatroom_get_account (chatroom))) {
646                         count++;
647                 }
648         }
649
650         return count;
651 }
652
653 static void
654 chatroom_manager_chat_destroyed_cb (EmpathyTpChat *chat,
655   gpointer manager)
656 {
657   EmpathyChatroomManagerPriv *priv = GET_PRIV (manager);
658   GList *l;
659
660   for (l = priv->chatrooms; l; l = l->next)
661     {
662       EmpathyChatroom *chatroom = l->data;
663
664       if (empathy_chatroom_get_tp_chat (chatroom) != chat)
665         continue;
666
667       empathy_chatroom_set_tp_chat (chatroom, NULL);
668
669       if (!empathy_chatroom_is_favorite (chatroom))
670         {
671           /* Remove the chatroom from the list, unless it's in the list of
672            * favourites..
673            * FIXME this policy should probably not be in libempathy */
674           chatroom_manager_remove_link (manager, l);
675         }
676
677       break;
678     }
679 }
680
681 static void
682 chatroom_manager_observe_channel_cb (EmpathyDispatcher *dispatcher,
683   EmpathyDispatchOperation *operation, gpointer manager)
684 {
685   EmpathyChatroomManagerPriv *priv = GET_PRIV (manager);
686   EmpathyChatroom *chatroom;
687   TpChannel *channel;
688   EmpathyTpChat *chat;
689   const gchar *roomname;
690   GQuark channel_type;
691   TpHandleType handle_type;
692   EmpathyAccount *account;
693   TpConnection *connection;
694
695   channel_type = empathy_dispatch_operation_get_channel_type_id (operation);
696
697   /* Observe Text channels to rooms only */
698   if (channel_type != TP_IFACE_QUARK_CHANNEL_TYPE_TEXT)
699     return;
700
701   channel = empathy_dispatch_operation_get_channel (operation);
702   tp_channel_get_handle (channel, &handle_type);
703
704   if (handle_type != TP_HANDLE_TYPE_ROOM)
705     return;
706
707   chat = EMPATHY_TP_CHAT (
708     empathy_dispatch_operation_get_channel_wrapper (operation));
709   connection = empathy_tp_chat_get_connection (chat);
710   account = empathy_account_manager_get_account (priv->account_manager,
711       connection);
712
713   roomname = empathy_tp_chat_get_id (chat);
714
715   chatroom = empathy_chatroom_manager_find (manager, account, roomname);
716
717   if (chatroom == NULL)
718     {
719       chatroom = empathy_chatroom_new_full (account, roomname, roomname,
720         FALSE);
721       empathy_chatroom_set_tp_chat (chatroom, chat);
722       empathy_chatroom_manager_add (manager, chatroom);
723       g_object_unref (chatroom);
724     }
725   else
726     {
727         empathy_chatroom_set_tp_chat (chatroom, chat);
728     }
729
730   /* A TpChat is always destroyed as it only gets unreffed after the channel
731    * has been invalidated in the dispatcher..  */
732   g_signal_connect (chat, "destroy",
733     G_CALLBACK (chatroom_manager_chat_destroyed_cb),
734     manager);
735 }
736
737 void
738 empathy_chatroom_manager_observe (EmpathyChatroomManager *manager,
739   EmpathyDispatcher *dispatcher)
740 {
741   g_signal_connect (dispatcher, "observe",
742     G_CALLBACK (chatroom_manager_observe_channel_cb), manager);
743 }