static void _test_evp_generate_event(gpointer fixture, gconstpointer user_data) { GeneratorData *data = fixture; GHashTable *data_hash; const gchar *expected; gchar *message; data_hash = eventd_event_get_all_data(data->event); if ( data_hash != NULL ) { g_hash_table_unref(data_hash); expected = ".EVENT " EVENTD_EVENT_TEST_UUID " " EVENTD_EVENT_TEST_NAME " " EVENTD_EVENT_TEST_NAME "\n" "DATA " EVENTD_EVENT_TEST_DATA_ESCAPING_NAME " '" EVENTD_EVENT_TEST_DATA_ESCAPING_CONTENT_ESCAPED "'\n" ".\n"; } else expected = "EVENT " EVENTD_EVENT_TEST_UUID " " EVENTD_EVENT_TEST_NAME " " EVENTD_EVENT_TEST_NAME "\n"; message = eventd_protocol_generate_event(data->protocol, data->event); g_assert_cmpstr(message, ==, expected); g_free(message); }
/** * eventc_light_connection_event: * @connection: an #EventcLightConnection * @event: an #EventdEvent to send to the server * * Sends an event across the connection. * * Returns: 0 if the event was sent successfully, a negative %errno value otherwise */ EVENTD_EXPORT gint eventc_light_connection_event(EventcLightConnection *self, EventdEvent *event) { g_return_val_if_fail(self != NULL, -EFAULT); g_return_val_if_fail(event != NULL, -EFAULT); gint error = 0; if ( ! _eventc_light_connection_expect_connected(self, &error) ) return error; return _eventc_light_connection_send_message(self, eventd_protocol_generate_event(self->protocol, event)); }