]> git.0d.be Git - empathy.git/blob - src/empathy-event-manager.c
W.I.P. for notifications on chat window.
[empathy.git] / src / empathy-event-manager.c
1 /*
2  * Copyright (C) 2007-2008 Collabora Ltd.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  * 
18  * Authors: Xavier Claessens <xclaesse@gmail.com>
19  *          Sjoerd Simons <sjoerd.simons@collabora.co.uk>
20  */
21
22 #include <config.h>
23
24 #include <string.h>
25 #include <glib/gi18n.h>
26
27 #include <telepathy-glib/util.h>
28
29 #include <libempathy/empathy-dispatcher.h>
30 #include <libempathy/empathy-contact-factory.h>
31 #include <libempathy/empathy-contact-manager.h>
32 #include <libempathy/empathy-tp-chat.h>
33 #include <libempathy/empathy-tp-call.h>
34 #include <libempathy/empathy-utils.h>
35
36 #include <extensions/extensions.h>
37
38 #include <libempathy-gtk/empathy-images.h>
39 #include <libempathy-gtk/empathy-contact-dialogs.h>
40
41 #include "empathy-event-manager.h"
42 #include "empathy-tube-dispatch.h"
43
44 #define DEBUG_FLAG EMPATHY_DEBUG_DISPATCHER
45 #include <libempathy/empathy-debug.h>
46
47 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyEventManager)
48
49 typedef struct {
50   EmpathyEventManager *manager;
51   EmpathyDispatchOperation *operation;
52   gulong approved_handler;
53   gulong claimed_handler;
54   gulong invalidated_handler;
55   /* Remove contact if applicable */
56   EmpathyContact *contact;
57   /* Tube dispatcher if applicable */
58   EmpathyTubeDispatch *tube_dispatch;
59   /* option signal handler */
60   gulong handler;
61 } EventManagerApproval;
62
63 typedef struct {
64   EmpathyDispatcher *dispatcher;
65   EmpathyContactManager *contact_manager;
66   GSList *events;
67   /* Ongoing approvals */
68   GSList *approvals;
69 } EmpathyEventManagerPriv;
70
71 typedef struct _EventPriv EventPriv;
72 typedef void (*EventFunc) (EventPriv *event);
73
74 struct _EventPriv {
75   EmpathyEvent public;
76   EmpathyEventManager *manager;
77   EventManagerApproval *approval;
78   EventFunc func;
79   gboolean inhibit;
80   gpointer user_data;
81 };
82
83 enum {
84   EVENT_ADDED,
85   EVENT_REMOVED,
86   EVENT_UPDATED,
87   LAST_SIGNAL
88 };
89
90 static guint signals[LAST_SIGNAL];
91
92 G_DEFINE_TYPE (EmpathyEventManager, empathy_event_manager, G_TYPE_OBJECT);
93
94 static EmpathyEventManager * manager_singleton = NULL;
95
96 static EventManagerApproval *
97 event_manager_approval_new (EmpathyEventManager *manager,
98   EmpathyDispatchOperation *operation)
99 {
100   EventManagerApproval *result = g_slice_new0 (EventManagerApproval);
101   result->operation = g_object_ref (operation);
102   result->manager = manager;
103
104   return result;
105 }
106
107 static void
108 event_manager_approval_free (EventManagerApproval *approval)
109 {
110   g_signal_handler_disconnect (approval->operation,
111     approval->approved_handler);
112   g_signal_handler_disconnect (approval->operation,
113     approval->claimed_handler);
114   g_signal_handler_disconnect (approval->operation,
115     approval->invalidated_handler);
116   g_object_unref (approval->operation);
117
118   if (approval->contact != NULL)
119     g_object_unref (approval->contact);
120
121   if (approval->tube_dispatch != NULL)
122     g_object_unref (approval->tube_dispatch);
123
124   g_slice_free (EventManagerApproval, approval);
125 }
126
127 static void event_remove (EventPriv *event);
128
129 static void
130 event_free (EventPriv *event)
131 {
132   g_free (event->public.icon_name);
133   g_free (event->public.header);
134   g_free (event->public.message);
135
136   if (event->public.contact)
137     {
138       g_object_unref (event->public.contact);
139     }
140
141   g_slice_free (EventPriv, event);
142 }
143
144 static void
145 event_remove (EventPriv *event)
146 {
147   EmpathyEventManagerPriv *priv = GET_PRIV (event->manager);
148
149   DEBUG ("Removing event %p", event);
150   priv->events = g_slist_remove (priv->events, event);
151   g_signal_emit (event->manager, signals[EVENT_REMOVED], 0, event);
152   event_free (event);
153 }
154
155 static void
156 event_manager_add (EmpathyEventManager *manager, EmpathyContact *contact,
157   const gchar *icon_name, const gchar *header, const gchar *message,
158   EventManagerApproval *approval, EventFunc func, gpointer user_data)
159 {
160   EmpathyEventManagerPriv *priv = GET_PRIV (manager);
161   EventPriv               *event;
162
163   event = g_slice_new0 (EventPriv);
164   event->public.contact = contact ? g_object_ref (contact) : NULL;
165   event->public.icon_name = g_strdup (icon_name);
166   event->public.header = g_strdup (header);
167   event->public.message = g_strdup (message);
168   event->inhibit = FALSE;
169   event->func = func;
170   event->user_data = user_data;
171   event->manager = manager;
172   event->approval = approval;
173
174   DEBUG ("Adding event %p", event);
175   priv->events = g_slist_prepend (priv->events, event);
176   g_signal_emit (event->manager, signals[EVENT_ADDED], 0, event);
177 }
178
179 static void
180 event_channel_process_func (EventPriv *event)
181 {
182   empathy_dispatch_operation_approve (event->approval->operation);
183 }
184
185 static EventPriv *
186 event_lookup_by_approval (EmpathyEventManager *manager,
187   EventManagerApproval *approval)
188 {
189   EmpathyEventManagerPriv *priv = GET_PRIV (manager);
190   GSList *l;
191   EventPriv *retval = NULL;
192
193   for (l = priv->events; l; l = l->next)
194     {
195       EventPriv *event = l->data;
196
197       if (event->approval == approval)
198         {
199           retval = event;
200         }
201     }
202
203   return retval;
204 }
205
206 static void
207 event_update (EmpathyEventManager *manager, EventPriv *event,
208   const char *icon_name, const char *header, const char *msg)
209 {
210   g_free (event->public.icon_name);
211   g_free (event->public.header);
212   g_free (event->public.message);
213
214   event->public.icon_name = g_strdup (icon_name);
215   event->public.header = g_strdup (header);
216   event->public.message = g_strdup (msg);
217
218   g_signal_emit (manager, signals[EVENT_UPDATED], 0, event);
219 }
220
221 static void
222 event_manager_chat_message_received_cb (EmpathyTpChat *tp_chat,
223   EmpathyMessage *message, EventManagerApproval *approval)
224 {
225   EmpathyContact  *sender;
226   gchar           *header;
227   const gchar     *msg;
228   TpChannel       *channel;
229   EventPriv       *event;
230
231   /* try to update the event if it's referring to a chat which is already in the
232    * queue. */
233   event = event_lookup_by_approval (approval->manager, approval);
234
235   if (event != NULL && event->inhibit)
236     {
237       g_signal_handlers_disconnect_by_func (tp_chat,
238         event_manager_chat_message_received_cb, approval);
239       return;
240     }
241
242   sender = empathy_message_get_sender (message);
243   header = g_strdup_printf (_("New message from %s"),
244                             empathy_contact_get_name (sender));
245   msg = empathy_message_get_body (message);
246
247   channel = empathy_tp_chat_get_channel (tp_chat);
248
249   if (event != NULL)
250     event_update (approval->manager, event, EMPATHY_IMAGE_NEW_MESSAGE, header, msg);
251   else
252     event_manager_add (approval->manager, sender, EMPATHY_IMAGE_NEW_MESSAGE, header,
253       msg, approval, event_channel_process_func, NULL);
254
255   g_free (header);
256 }
257
258 static void
259 event_manager_approval_done (EventManagerApproval *approval)
260 {
261   EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager);
262   GSList                  *l;
263
264   priv->approvals = g_slist_remove (priv->approvals, approval);
265
266   for (l = priv->events; l; l = l->next)
267     {
268       EventPriv *event = l->data;
269
270       if (event->approval == approval)
271         {
272           event_remove (event);
273           break;
274         }
275     }
276
277   event_manager_approval_free (approval);
278 }
279
280 static void
281 event_manager_operation_approved_cb (EmpathyDispatchOperation *operation,
282   EventManagerApproval *approval)
283 {
284   event_manager_approval_done (approval);
285 }
286
287 static void
288 event_manager_operation_claimed_cb (EmpathyDispatchOperation *operation,
289   EventManagerApproval *approval)
290 {
291   event_manager_approval_done (approval);
292 }
293
294 static void
295 event_manager_operation_invalidated_cb (EmpathyDispatchOperation *operation,
296   guint domain, gint code, gchar *message,
297   EventManagerApproval *approval)
298 {
299   event_manager_approval_done (approval);
300 }
301
302 static void
303 event_manager_media_channel_got_name_cb (EmpathyContact *contact,
304   const GError *error, gpointer user_data, GObject *object)
305 {
306   EventManagerApproval *approval = user_data;
307   gchar *header;
308
309   if (error != NULL)
310     {
311       /* FIXME just returning assuming the operation will be invalidated as
312        * well */
313       return;
314     }
315
316   header = g_strdup_printf (_("Incoming call from %s"),
317     empathy_contact_get_name (contact));
318
319   event_manager_add (approval->manager,
320     approval->contact, EMPATHY_IMAGE_VOIP, header, NULL,
321     approval, event_channel_process_func, NULL);
322
323   g_free (header);
324 }
325
326 static void
327 event_manager_media_channel_got_contact (EventManagerApproval *approval)
328 {
329   empathy_contact_call_when_ready (approval->contact,
330      EMPATHY_CONTACT_READY_NAME, event_manager_media_channel_got_name_cb,
331         approval, NULL, G_OBJECT (approval->manager));
332 }
333
334 static void
335 event_manager_media_channel_contact_changed_cb (EmpathyTpCall *call,
336   GParamSpec *param, EventManagerApproval *approval)
337 {
338   EmpathyContact *contact;
339
340   g_object_get (G_OBJECT (call), "contact", &contact, NULL);
341
342   if (contact == NULL)
343     return;
344
345   approval->contact = contact;
346   event_manager_media_channel_got_contact (approval);
347 }
348
349 static void
350 event_manager_tube_approved_cb (EventPriv *event)
351 {
352   empathy_tube_dispatch_handle (event->approval->tube_dispatch);
353 }
354
355 static void
356 event_manager_add_tube_approval (EventManagerApproval *approval,
357   EmpathyTubeDispatchAbility ability)
358 {
359   const gchar *icon_name;
360   gchar       *header;
361   const gchar *msg;
362
363   header = g_strdup_printf (_("%s is offering you an invitation"),
364     empathy_contact_get_name (approval->contact));
365
366   if (ability == EMPATHY_TUBE_DISPATCHABILITY_POSSIBLE)
367     {
368       icon_name = GTK_STOCK_EXECUTE;
369       msg = _("An external application will be started to handle it.");
370     }
371   else
372     {
373       icon_name = GTK_STOCK_DIALOG_ERROR;
374       msg = _("You don't have the needed external "
375               "application to handle it.");
376     }
377
378   event_manager_add (approval->manager, approval->contact, icon_name, header,
379     msg, approval, event_manager_tube_approved_cb, approval);
380
381   g_free (header);
382 }
383
384 static void
385 event_manager_tube_dispatch_ability_cb (GObject *object,
386    GParamSpec *spec, gpointer user_data)
387 {
388   EventManagerApproval *approval = (EventManagerApproval *)user_data;
389   EmpathyTubeDispatchAbility dispatchability;
390
391   dispatchability =
392     empathy_tube_dispatch_is_dispatchable (approval->tube_dispatch);
393
394   if (dispatchability != EMPATHY_TUBE_DISPATCHABILITY_UNKNOWN)
395     {
396       event_manager_add_tube_approval (approval, dispatchability);
397       g_signal_handler_disconnect (object, approval->handler);
398       approval->handler = 0;
399     }
400 }
401
402 static void
403 event_manager_tube_got_contact_name_cb (EmpathyContact *contact,
404   const GError *error, gpointer user_data, GObject *object)
405 {
406   EventManagerApproval *approval = (EventManagerApproval *)user_data;
407   EmpathyTubeDispatchAbility dispatchability;
408
409   if (error != NULL)
410     {
411       /* FIXME?, we assume that the operation gets invalidated as well (if it
412        * didn't already */
413        return;
414     }
415
416   dispatchability = empathy_tube_dispatch_is_dispatchable
417     (approval->tube_dispatch);
418
419
420   switch (dispatchability)
421     {
422       case EMPATHY_TUBE_DISPATCHABILITY_UNKNOWN:
423         approval->handler = g_signal_connect (approval->tube_dispatch,
424           "notify::dispatchability",
425           G_CALLBACK (event_manager_tube_dispatch_ability_cb), approval);
426         break;
427       case EMPATHY_TUBE_DISPATCHABILITY_POSSIBLE:
428         /* fallthrough */
429       case EMPATHY_TUBE_DISPATCHABILITY_IMPOSSIBLE:
430         event_manager_add_tube_approval (approval, dispatchability);
431         break;
432     }
433 }
434
435 static void
436 event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
437   EmpathyDispatchOperation  *operation, EmpathyEventManager *manager)
438 {
439   const gchar *channel_type;
440   EventManagerApproval *approval;
441   EmpathyEventManagerPriv *priv = GET_PRIV (manager);
442
443   channel_type = empathy_dispatch_operation_get_channel_type (operation);
444
445   approval = event_manager_approval_new (manager, operation);
446   priv->approvals = g_slist_prepend (priv->approvals, approval);
447
448   approval->approved_handler = g_signal_connect (operation, "approved",
449     G_CALLBACK (event_manager_operation_approved_cb), approval);
450
451   approval->claimed_handler = g_signal_connect (operation, "claimed",
452      G_CALLBACK (event_manager_operation_claimed_cb), approval);
453
454   approval->invalidated_handler = g_signal_connect (operation, "invalidated",
455      G_CALLBACK (event_manager_operation_invalidated_cb), approval);
456
457   if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT))
458     {
459       EmpathyTpChat *tp_chat =
460         EMPATHY_TP_CHAT (
461           empathy_dispatch_operation_get_channel_wrapper (operation));
462
463       g_signal_connect (tp_chat, "message-received",
464         G_CALLBACK (event_manager_chat_message_received_cb), approval);
465
466     }
467   else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA))
468     {
469       EmpathyContact *contact;
470       EmpathyTpCall *call = EMPATHY_TP_CALL (
471           empathy_dispatch_operation_get_channel_wrapper (operation));
472
473       g_object_get (G_OBJECT (call), "contact", &contact, NULL);
474
475       if (contact == NULL)
476         {
477           g_signal_connect (call, "notify::contact",
478             G_CALLBACK (event_manager_media_channel_contact_changed_cb),
479             approval);
480         }
481       else
482         {
483           approval->contact = contact;
484           event_manager_media_channel_got_contact (approval);
485         }
486
487     }
488   else if (!tp_strdiff (channel_type, EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER))
489     {
490       EmpathyContact        *contact;
491       gchar                 *header;
492       TpHandle               handle;
493       McAccount             *account;
494       EmpathyContactFactory *factory;
495       TpChannel *channel = empathy_dispatch_operation_get_channel (operation);
496
497       factory = empathy_contact_factory_dup_singleton ();
498       handle = tp_channel_get_handle (channel, NULL);
499       account = empathy_channel_get_account (channel);
500
501       contact = empathy_contact_factory_get_from_handle (factory, account,
502         handle);
503
504       empathy_contact_run_until_ready (contact,
505         EMPATHY_CONTACT_READY_NAME, NULL);
506
507       header = g_strdup_printf (_("Incoming file transfer from %s"),
508         empathy_contact_get_name (contact));
509
510       event_manager_add (manager, contact, EMPATHY_IMAGE_DOCUMENT_SEND,
511         header, NULL, approval, event_channel_process_func, NULL);
512
513       g_object_unref (factory);
514       g_object_unref (account);
515       g_free (header);
516     }
517   else if (!tp_strdiff (channel_type, EMP_IFACE_CHANNEL_TYPE_STREAM_TUBE) ||
518       !tp_strdiff (channel_type, EMP_IFACE_CHANNEL_TYPE_DBUS_TUBE))
519     {
520       EmpathyContact        *contact;
521       TpHandle               handle;
522       TpHandleType           handle_type;
523       McAccount             *account;
524       EmpathyContactFactory *factory;
525       EmpathyTubeDispatch *tube_dispatch;
526       TpChannel *channel;
527
528       channel = empathy_dispatch_operation_get_channel (operation);
529
530       handle = tp_channel_get_handle (channel, &handle_type);
531
532       /* Only understand p2p tubes */
533       if (handle_type != TP_HANDLE_TYPE_CONTACT)
534         return;
535
536       factory = empathy_contact_factory_dup_singleton ();
537       account = empathy_channel_get_account (channel);
538
539       contact = empathy_contact_factory_get_from_handle (factory, account,
540         handle);
541
542       tube_dispatch = empathy_tube_dispatch_new (operation);
543
544       approval->contact = contact;
545       approval->tube_dispatch = tube_dispatch;
546
547       empathy_contact_call_when_ready (contact,
548         EMPATHY_CONTACT_READY_NAME, event_manager_tube_got_contact_name_cb,
549         approval, NULL, G_OBJECT (manager));
550
551       g_object_unref (factory);
552       g_object_unref (account);
553     }
554   else
555     {
556       DEBUG ("Unknown channel type, ignoring..");
557     }
558 }
559
560 static void
561 event_pending_subscribe_func (EventPriv *event)
562 {
563   empathy_subscription_dialog_show (event->public.contact, NULL);
564   event_remove (event);
565 }
566
567 static void
568 event_manager_pendings_changed_cb (EmpathyContactList  *list,
569   EmpathyContact *contact, EmpathyContact *actor,
570   guint reason, gchar *message, gboolean is_pending,
571   EmpathyEventManager *manager)
572 {
573   EmpathyEventManagerPriv *priv = GET_PRIV (manager);
574   gchar                   *header, *event_msg;
575
576   if (!is_pending)
577     {
578       GSList *l;
579
580       for (l = priv->events; l; l = l->next)
581         {
582           EventPriv *event = l->data;
583
584       if (event->public.contact == contact &&
585           event->func == event_pending_subscribe_func)
586         {
587           event_remove (event);
588           break;
589         }
590       }
591
592       return;
593     }
594
595   empathy_contact_run_until_ready (contact, EMPATHY_CONTACT_READY_NAME, NULL);
596
597   header = g_strdup_printf (_("Subscription requested by %s"),
598     empathy_contact_get_name (contact));
599
600   if (!EMP_STR_EMPTY (message))
601     event_msg = g_strdup_printf (_("\nMessage: %s"), message);
602   else
603     event_msg = NULL;
604
605   event_manager_add (manager, contact, GTK_STOCK_DIALOG_QUESTION, header,
606     event_msg, NULL, event_pending_subscribe_func, NULL);
607
608   g_free (event_msg);
609   g_free (header);
610 }
611
612 static GObject *
613 event_manager_constructor (GType type,
614                            guint n_props,
615                            GObjectConstructParam *props)
616 {
617         GObject *retval;
618
619         if (manager_singleton) {
620                 retval = g_object_ref (manager_singleton);
621         } else {
622                 retval = G_OBJECT_CLASS (empathy_event_manager_parent_class)->constructor
623                         (type, n_props, props);
624
625                 manager_singleton = EMPATHY_EVENT_MANAGER (retval);
626                 g_object_add_weak_pointer (retval, (gpointer *) &manager_singleton);
627         }
628
629         return retval;
630 }
631
632 static void
633 event_manager_finalize (GObject *object)
634 {
635   EmpathyEventManagerPriv *priv = GET_PRIV (object);
636
637   g_slist_foreach (priv->events, (GFunc) event_free, NULL);
638   g_slist_free (priv->events);
639   g_slist_foreach (priv->approvals, (GFunc) event_manager_approval_free, NULL);
640   g_slist_free (priv->approvals);
641   g_object_unref (priv->contact_manager);
642   g_object_unref (priv->dispatcher);
643 }
644
645 static void
646 empathy_event_manager_class_init (EmpathyEventManagerClass *klass)
647 {
648   GObjectClass *object_class = G_OBJECT_CLASS (klass);
649
650   object_class->finalize = event_manager_finalize;
651   object_class->constructor = event_manager_constructor;
652
653   signals[EVENT_ADDED] =
654     g_signal_new ("event-added",
655       G_TYPE_FROM_CLASS (klass),
656       G_SIGNAL_RUN_LAST,
657       0,
658       NULL, NULL,
659       g_cclosure_marshal_VOID__POINTER,
660       G_TYPE_NONE,
661       1, G_TYPE_POINTER);
662
663   signals[EVENT_REMOVED] =
664   g_signal_new ("event-removed",
665       G_TYPE_FROM_CLASS (klass),
666       G_SIGNAL_RUN_LAST,
667       0,
668       NULL, NULL,
669       g_cclosure_marshal_VOID__POINTER,
670       G_TYPE_NONE, 1, G_TYPE_POINTER);
671
672   signals[EVENT_UPDATED] =
673   g_signal_new ("event-updated",
674       G_TYPE_FROM_CLASS (klass),
675       G_SIGNAL_RUN_LAST,
676       0,
677       NULL, NULL,
678       g_cclosure_marshal_VOID__POINTER,
679       G_TYPE_NONE, 1, G_TYPE_POINTER);
680
681
682   g_type_class_add_private (object_class, sizeof (EmpathyEventManagerPriv));
683 }
684
685 static void
686 empathy_event_manager_init (EmpathyEventManager *manager)
687 {
688   EmpathyEventManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
689     EMPATHY_TYPE_EVENT_MANAGER, EmpathyEventManagerPriv);
690
691   manager->priv = priv;
692
693   priv->dispatcher = empathy_dispatcher_dup_singleton ();
694   priv->contact_manager = empathy_contact_manager_dup_singleton ();
695   g_signal_connect (priv->dispatcher, "approve",
696     G_CALLBACK (event_manager_approve_channel_cb), manager);
697   g_signal_connect (priv->contact_manager, "pendings-changed",
698     G_CALLBACK (event_manager_pendings_changed_cb), manager);
699 }
700
701 EmpathyEventManager *
702 empathy_event_manager_dup_singleton (void)
703 {
704   return g_object_new (EMPATHY_TYPE_EVENT_MANAGER, NULL);
705 }
706
707 GSList *
708 empathy_event_manager_get_events (EmpathyEventManager *manager)
709 {
710   EmpathyEventManagerPriv *priv = GET_PRIV (manager);
711
712   g_return_val_if_fail (EMPATHY_IS_EVENT_MANAGER (manager), NULL);
713
714   return priv->events;
715 }
716
717 EmpathyEvent *
718 empathy_event_manager_get_top_event (EmpathyEventManager *manager)
719 {
720   EmpathyEventManagerPriv *priv = GET_PRIV (manager);
721
722   g_return_val_if_fail (EMPATHY_IS_EVENT_MANAGER (manager), NULL);
723
724   return priv->events ? priv->events->data : NULL;
725 }
726
727 void
728 empathy_event_activate (EmpathyEvent *event_public)
729 {
730   EventPriv *event = (EventPriv*) event_public;
731
732   g_return_if_fail (event_public != NULL);
733
734   if (event->func)
735     event->func (event);
736   else
737     event_remove (event);
738 }
739
740 void
741 empathy_event_inhibit_updates (EmpathyEvent *event_public)
742 {
743   EventPriv *event = (EventPriv *) event_public;
744
745   g_return_if_fail (event_public != NULL);
746
747   event->inhibit = TRUE;
748 }
749