static void _clean_data(gpointer fixture, gconstpointer user_data) { SettersData *data = fixture; eventd_event_unref(data->event); }
static void _clean_data(gpointer fixture, gconstpointer user_data) { GeneratorData *data = fixture; eventd_event_unref(data->event); eventd_protocol_unref(data->protocol); }
/* EVENT */ static void _eventd_protocol_evp_parse_event(EventdProtocol *self, const gchar * const *argv, GError **error) { EventdEvent *event; event = _eventd_protocol_evp_parser_get_event(self, argv, error); if ( event == NULL ) return; eventd_protocol_call_event((EventdProtocol *) self, event); eventd_event_unref(event); }
static gboolean _eventd_nd_event_timedout(gpointer user_data) { EventdNdNotification *self = user_data; EventdEvent *event; self->timeout = 0; event = eventd_event_new(".notification", "timeout"); eventd_event_add_data_string(event, g_strdup("source-event"), g_strdup(eventd_event_get_uuid(self->event))); eventd_plugin_core_push_event(self->context->core, event); eventd_event_unref(event); return G_SOURCE_REMOVE; }
static void _eventd_nd_notification_clean(EventdNdNotification *self) { eventd_event_unref(self->event); if ( self->icon != NULL ) cairo_surface_destroy(self->icon); self->icon = NULL; if ( self->image != NULL ) cairo_surface_destroy(self->image); self->image = NULL; if ( self->text.text != NULL ) g_object_unref(self->text.text); self->text.text = NULL; }
void eventd_nd_notification_dismiss(EventdNdNotification *self) { if ( self->event == NULL ) { eventd_nd_notification_dismiss_target(self->context, EVENTD_ND_DISMISS_ALL, self->queue); return; } EventdEvent *event; event = eventd_event_new(".notification", "dismiss"); eventd_event_add_data_string(event, g_strdup("source-event"), g_strdup(eventd_event_get_uuid(self->event))); eventd_plugin_core_push_event(self->context->core, event); eventd_event_unref(event); }
static void _eventd_protocol_evp_parse_dot_event_end(EventdProtocol *self, GError **error) { if ( self->data.hash != NULL ) { eventd_event_set_all_data(self->event, self->data.hash); self->data.hash = NULL; } eventd_protocol_call_event((EventdProtocol *) self, self->event); eventd_event_unref(self->event); self->event = NULL; self->state = self->base_state; }
void eventd_nd_notification_refresh_list(EventdPluginContext *context, gboolean update) { GHashTableIter iter; if ( update ) { EventdNdNotification *notification; g_hash_table_iter_init(&iter, context->notifications); while ( g_hash_table_iter_next(&iter, NULL, (gpointer *) ¬ification) ) { /* We may be the last user of event, so make sure we keep it alive */ _eventd_nd_notification_update(notification, eventd_event_ref(notification->event)); eventd_event_unref(notification->event); } } EventdNdQueue *queue; g_hash_table_iter_init(&iter, context->queues); while ( g_hash_table_iter_next(&iter, NULL, (gpointer *) &queue) ) _eventd_nd_notification_refresh_list(context, queue); }
void eventd_protocol_evp_parse_free(EventdProtocol *self) { switch ( self->state ) { case EVENTD_PROTOCOL_EVP_STATE_DOT_EVENT: if ( self->data.hash != NULL ) g_hash_table_unref(self->data.hash); self->data.hash = NULL; eventd_event_unref(self->event); self->event = NULL; break; case EVENTD_PROTOCOL_EVP_STATE_DOT_SUBSCRIBE: g_hash_table_unref(self->subscriptions); self->subscriptions = NULL; break; default: break; } self->state = _EVENTD_PROTOCOL_EVP_STATE_SIZE; }
static gint _wec_print_callback(gconstpointer user_data, gpointer data, struct t_gui_buffer *buffer, time_t date, gint tags_count, const gchar **tags, gint displayed, gint highlight, const gchar *prefix, const gchar *message) { if ( ( ! displayed ) || ( buffer == NULL ) ) return WEECHAT_RC_OK; const gchar *plugin = weechat_buffer_get_string(buffer, "plugin"); if ( g_strcmp0(plugin, "irc") != 0 ) return WEECHAT_RC_OK; if ( _wec_config_boolean(restrictions, ignore_current_buffer) && ( buffer == weechat_current_buffer() ) ) return WEECHAT_RC_OK; gint error = 0; if ( ! eventc_light_connection_is_connected(_wec_context.client, &error) ) return WEECHAT_RC_OK; const gchar *category = NULL; const gchar *name = NULL; const gchar *channel = NULL; const gchar *buffer_type = weechat_buffer_get_string(buffer, "localvar_type"); if ( g_strcmp0(buffer_type, "channel") == 0 ) { category = "chat"; channel = weechat_buffer_get_string(buffer, "localvar_channel"); } else if ( g_strcmp0(buffer_type, "private") == 0 ) category = "im"; const gchar *nick = NULL; gchar *msg = NULL; gint i; for ( i = 0 ; i < tags_count ; ++i ) { const gchar *tag = tags[i]; if ( g_str_has_prefix(tag, "log") || g_str_has_prefix(tag, "no_") ) continue; if ( ( g_strcmp0(tag, "away_info") == 0 ) || ( g_strcmp0(tag, "notify_none") == 0 ) ) goto cleanup; if ( g_str_has_prefix(tag, "irc_") ) { tag += strlen("irc_"); if ( g_strcmp0(tag, "privmsg") == 0 ) { if ( highlight && _wec_config_boolean(events, highlight) ) { name = "highlight"; continue; } if ( ( channel != NULL ) && ( ! _wec_config_boolean(events, chat) ) ) break; if ( ! _wec_config_boolean(events, im) ) break; name = "received"; } else if ( g_strcmp0(tag, "notice") == 0 ) { category = "im"; if ( highlight && _wec_config_boolean(events, highlight) ) { name = "highlight"; continue; } if ( ! _wec_config_boolean(events, notice) ) break; name = "received"; } else if ( g_str_has_prefix(tag, "notify_") ) { if ( ! _wec_config_boolean(events, notify) ) break; tag += strlen("notify_"); category = "presence"; if ( g_strcmp0(tag, "join") == 0 ) name = "signed-on"; else if ( g_strcmp0(tag, "quit") == 0 ) name = "signed-off"; else if ( g_strcmp0(tag, "back") == 0 ) name = "back"; else if ( g_strcmp0(tag, "away") == 0 ) { name = "away"; msg = _wec_split_message(message); } else if ( g_strcmp0(tag, "still_away") == 0 ) { name = "message"; msg = _wec_split_message(message); } } else if ( g_strcmp0(tag, "join") == 0 ) { if ( ! _wec_config_boolean(events, join) ) break; category = "presence"; name = "join"; } else if ( g_strcmp0(tag, "leave") == 0 ) { if ( ! _wec_config_boolean(events, leave) ) break; category = "presence"; name = "leave"; } else if ( g_strcmp0(tag, "quit") == 0 ) { if ( ! _wec_config_boolean(events, quit) ) break; category = "presence"; name = "signed-off"; } } else if ( g_str_has_prefix(tag, "nick_") ) nick = tag + strlen("nick_"); } if ( ( category == NULL ) || ( name == NULL ) ) goto cleanup; if ( g_hash_table_contains(_wec_context.blacklist, nick) ) goto cleanup; EventdEvent *event; event = eventd_event_new(category, name); if ( nick != NULL ) eventd_event_add_data_string(event, g_strdup("buddy-name"), g_strdup(nick)); if ( channel != NULL ) eventd_event_add_data_string(event, g_strdup("channel"), g_strdup(channel)); eventd_event_add_data_string(event, g_strdup("message"), ( msg != NULL ) ? msg : g_strdup(message)); msg = NULL; eventc_light_connection_event(_wec_context.client, event); eventd_event_unref(event); cleanup: g_free(msg); return WEECHAT_RC_OK; }