├── server ├── libeventd │ ├── .gitignore │ ├── tests │ │ └── unit │ │ │ ├── event-getters.h │ │ │ ├── event-setters.h │ │ │ ├── protocol-parser.h │ │ │ ├── protocol-generator.h │ │ │ ├── meson.build │ │ │ ├── libeventd-event.c │ │ │ ├── libeventd-protocol.c │ │ │ ├── common.h │ │ │ ├── protocol-parser.c │ │ │ └── protocol-generator.c │ ├── src │ │ ├── event-private.h │ │ ├── event-private.c │ │ ├── protocol-evp-private.h │ │ ├── protocol-evp.c │ │ └── protocol-evp-generator.c │ ├── include │ │ ├── libeventd-event-private.h │ │ ├── libeventd-event.h │ │ └── libeventd-protocol.h │ ├── meson.build │ └── vapi │ │ └── libeventd.vapi ├── eventd │ ├── units │ │ ├── user │ │ │ ├── eventd.socket.in │ │ │ ├── eventd-control.socket.in │ │ │ ├── eventd.service.in │ │ │ └── meson.build │ │ └── system │ │ │ ├── eventd.socket.in │ │ │ ├── eventd-control.socket.in │ │ │ ├── eventd.service.in │ │ │ └── meson.build │ ├── tests │ │ ├── unit │ │ │ ├── meson.build │ │ │ ├── eventd.c │ │ │ └── stubs.c │ │ └── integration │ │ │ ├── meson.build │ │ │ ├── relay-connection.c │ │ │ └── ws-connection.c │ ├── src │ │ ├── control.h │ │ ├── evp │ │ │ ├── client.h │ │ │ ├── evp.h │ │ │ └── evp-internal.h │ │ ├── sockets.h │ │ ├── types.h │ │ ├── sd-modules.h │ │ ├── events.h │ │ ├── config_.h │ │ ├── actions.h │ │ ├── relay │ │ │ ├── relay.h │ │ │ └── server.h │ │ ├── plugins.h │ │ ├── eventd.h │ │ └── sd-modules.c │ └── meson.build ├── eventdctl │ ├── meson.build │ └── include │ │ └── eventdctl.h ├── libeventd-helpers │ ├── meson.build │ ├── include │ │ └── libeventd-helpers-reconnect.h │ └── src │ │ └── reconnect.c ├── libeventd-test │ ├── meson.build │ └── include │ │ └── libeventd-test.h ├── libeventd-plugin │ ├── meson.build │ ├── include │ │ ├── eventd-plugin-private.h │ │ └── eventd-plugin.h │ └── src │ │ └── core.c └── modules │ ├── meson.build │ ├── include │ └── eventd-sd-module.h │ └── src │ └── ws-load.c ├── client ├── libeventc │ ├── .gitignore │ ├── tests │ │ └── integration │ │ │ ├── meson.build │ │ │ └── connection.c │ ├── meson.build │ ├── vapi │ │ └── libeventc.vapi │ └── include │ │ └── libeventc.h ├── eventc │ └── meson.build └── libeventc-light │ ├── meson.build │ └── include │ └── libeventc-light.h ├── .mailmap ├── plugins ├── nd │ ├── .gitignore │ └── src │ │ ├── blur.h │ │ ├── backends.h │ │ ├── pixbuf.h │ │ ├── notification.h │ │ ├── draw.h │ │ ├── types.h │ │ ├── nd.h │ │ ├── backend.h │ │ ├── backends.c │ │ └── style.h ├── fdo-notifications │ ├── .gitignore │ ├── events │ │ ├── notification.event │ │ └── notification.action │ ├── services │ │ └── org.eventd.fdo-notifications.service.in │ └── meson.build ├── test-plugin │ ├── config │ │ ├── test.event │ │ ├── test.action │ │ └── eventd.conf │ ├── meson.build │ └── src │ │ └── test-plugin.c ├── exec │ ├── meson.build │ └── man │ │ └── eventd-exec.conf.xml ├── file │ ├── meson.build │ └── man │ │ └── eventd-file.conf.xml ├── webhook │ └── meson.build ├── tts │ ├── meson.build │ ├── man │ │ └── eventd-tts.conf.xml │ └── src │ │ └── tts.c ├── canberra │ ├── meson.build │ └── man │ │ └── eventd-canberra.conf.xml ├── notify │ └── meson.build ├── ws │ ├── meson.build │ ├── src │ │ ├── ws.h │ │ └── ws-client.h │ └── man │ │ └── eventd-ws.conf.xml ├── im │ ├── meson.build │ └── src │ │ ├── ops.h │ │ └── ops.c └── sound │ ├── meson.build │ ├── src │ └── pulseaudio.h │ └── man │ └── eventd-sound.conf.xml ├── .gitmodules ├── README.md ├── .gitignore ├── COPYING.md ├── src └── config.ent.in ├── meson_options.txt └── PROTOCOL /server/libeventd/.gitignore: -------------------------------------------------------------------------------- 1 | /vapi/*.deps 2 | -------------------------------------------------------------------------------- /client/libeventc/.gitignore: -------------------------------------------------------------------------------- 1 | /vapi/libeventc.deps 2 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Morgane Glidic 2 | -------------------------------------------------------------------------------- /plugins/nd/.gitignore: -------------------------------------------------------------------------------- 1 | /src/unstable/ 2 | /src/stable/ 3 | -------------------------------------------------------------------------------- /plugins/fdo-notifications/.gitignore: -------------------------------------------------------------------------------- 1 | /services/org.eventd.dbus.service 2 | -------------------------------------------------------------------------------- /plugins/test-plugin/config/test.event: -------------------------------------------------------------------------------- 1 | [Event test] 2 | Actions = test; 3 | -------------------------------------------------------------------------------- /plugins/test-plugin/config/test.action: -------------------------------------------------------------------------------- 1 | [Action] 2 | Name = test 3 | 4 | [TestPlugin] 5 | -------------------------------------------------------------------------------- /plugins/fdo-notifications/events/notification.event: -------------------------------------------------------------------------------- 1 | [Event notification] 2 | Actions = notification; 3 | -------------------------------------------------------------------------------- /plugins/fdo-notifications/events/notification.action: -------------------------------------------------------------------------------- 1 | [Action] 2 | Name = notification 3 | 4 | [Notification] 5 | 6 | [Sound] 7 | 8 | [Libcanberra] 9 | 10 | [Libnotify] 11 | -------------------------------------------------------------------------------- /plugins/fdo-notifications/services/org.eventd.fdo-notifications.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.freedesktop.Notifications 3 | Exec=@bindir@/eventdctl start 4 | SystemdService=eventd.service 5 | -------------------------------------------------------------------------------- /plugins/test-plugin/config/eventd.conf: -------------------------------------------------------------------------------- 1 | [Server] 2 | WebSocketSecret=lampeDeChevet 3 | 4 | [Relay] 5 | Servers = test 6 | 7 | [Relay test] 8 | URI = file://relay 9 | Forwards = test; 10 | Subscriptions = test; 11 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libgwater"] 2 | path = subprojects/libgwater 3 | url = https://github.com/sardemff7/libgwater 4 | [submodule "libnkutils"] 5 | path = subprojects/libnkutils 6 | url = https://github.com/sardemff7/libnkutils 7 | -------------------------------------------------------------------------------- /server/eventd/units/user/eventd.socket.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=eventd sockets 3 | 4 | [Socket] 5 | SocketMode=0660 6 | FileDescriptorName=evp 7 | ListenStream=%t/eventd/@EVP_UNIX_SOCKET@ 8 | 9 | [Install] 10 | WantedBy=sockets.target 11 | -------------------------------------------------------------------------------- /server/eventd/units/system/eventd.socket.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=eventd sockets 3 | 4 | [Socket] 5 | SocketUser=eventd 6 | SocketGroup=eventd 7 | SocketMode=0660 8 | FileDescriptorName=evp 9 | ListenStream=/run/eventd/@EVP_UNIX_SOCKET@ 10 | 11 | [Install] 12 | WantedBy=sockets.target 13 | -------------------------------------------------------------------------------- /server/eventd/units/user/eventd-control.socket.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=eventd control socket 3 | 4 | [Socket] 5 | Service=eventd.service 6 | SocketMode=0600 7 | FileDescriptorName=eventd-control 8 | ListenStream=%t/@PACKAGE_NAME@/private 9 | 10 | [Install] 11 | WantedBy=sockets.target 12 | -------------------------------------------------------------------------------- /server/eventd/units/system/eventd-control.socket.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=eventd control socket 3 | 4 | [Socket] 5 | Service=eventd.service 6 | SocketUser=eventd 7 | SocketMode=0600 8 | FileDescriptorName=eventd-control 9 | ListenStream=/run/eventd/private 10 | 11 | [Install] 12 | WantedBy=sockets.target 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | eventd 2 | ====== 3 | 4 | eventd, a small daemon to act on remote or local events 5 | 6 | 7 | Website 8 | ------- 9 | 10 | To get further information, please visit eventd’s website at: 11 | https://www.eventd.org/ 12 | 13 | You can also browse man pages online here: 14 | https://www.eventd.org/man/ 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /src/config.h.in 2 | /src/config.h 3 | /src/config.ent 4 | 5 | /eventd 6 | /eventdctl 7 | /eventc 8 | /eventd-notification-daemon 9 | 10 | *.test 11 | 12 | *.1 13 | *.5 14 | *.pc 15 | *.socket 16 | *.service 17 | /*.gir 18 | /*.typelib 19 | 20 | /eventd-*.tar.xz 21 | /eventd-*/ 22 | 23 | /local-rules.mk 24 | /build/ 25 | -------------------------------------------------------------------------------- /client/libeventc/tests/integration/meson.build: -------------------------------------------------------------------------------- 1 | libeventc_connection_test = executable('libeventc-connection.test', config_h, files( 2 | 'connection.c', 3 | ), 4 | dependencies: [ libeventd_test, libeventc, glib ] 5 | ) 6 | test('libeventc integration test', libeventc_connection_test, 7 | suite: [ 'integration', 'libeventc' ], 8 | timeout: 9 9 | ) 10 | -------------------------------------------------------------------------------- /server/eventd/units/user/eventd.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=eventd 3 | Documentation=man:eventd(1) 4 | Documentation=man:eventd.conf(5) 5 | Documentation=https://www.eventd.org/ 6 | 7 | [Service] 8 | Type=notify 9 | Sockets=eventd-control.socket eventd.socket 10 | ExecStart=@bindir@/eventd --systemd 11 | ExecReload=@bindir@/eventdctl reload 12 | 13 | [Install] 14 | Also=eventd-control.socket 15 | Also=eventd.socket 16 | -------------------------------------------------------------------------------- /server/eventd/units/system/eventd.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=eventd 3 | Documentation=man:eventd(1) 4 | Documentation=man:eventd.conf(5) 5 | Documentation=https://www.eventd.org/ 6 | 7 | [Service] 8 | Type=notify 9 | User=eventd 10 | Sockets=eventd-control.socket eventd.socket 11 | ExecStart=@bindir@/eventd --systemd --system 12 | ExecReload=@bindir@/eventdctl --system reload 13 | 14 | [Install] 15 | Also=eventd-control.socket 16 | Also=eventd.socket 17 | -------------------------------------------------------------------------------- /plugins/exec/meson.build: -------------------------------------------------------------------------------- 1 | # exec plugin 2 | 3 | shared_library('exec', config_h, files( 4 | 'src/exec.c', 5 | ), 6 | c_args: [ 7 | '-DG_LOG_DOMAIN="eventd-exec"', 8 | ], 9 | dependencies: [ libeventd_helpers, libeventd_plugin, libeventd, glib ], 10 | name_prefix: '', 11 | install: true, 12 | install_dir: plugins_install_dir, 13 | ) 14 | 15 | man_pages += [ [ files('man/eventd-exec.conf.xml'), 'eventd-exec.conf.5' ] ] 16 | -------------------------------------------------------------------------------- /plugins/file/meson.build: -------------------------------------------------------------------------------- 1 | # file plugin 2 | 3 | shared_library('file', config_h, files( 4 | 'src/file.c', 5 | ), 6 | c_args: [ 7 | '-DG_LOG_DOMAIN="eventd-file"', 8 | ], 9 | dependencies: [ libeventd_helpers, libeventd_plugin, libeventd, gio, glib ], 10 | name_prefix: '', 11 | install: true, 12 | install_dir: plugins_install_dir, 13 | ) 14 | 15 | man_pages += [ [ files('man/eventd-file.conf.xml'), 'eventd-file.conf.5' ] ] 16 | -------------------------------------------------------------------------------- /plugins/test-plugin/meson.build: -------------------------------------------------------------------------------- 1 | # test plugin 2 | 3 | test_plugin_path += [ meson.current_build_dir() ] 4 | test_plugin = shared_module('test-plugin', config_h, files( 5 | 'src/test-plugin.c', 6 | ), 7 | c_args: [ 8 | '-DG_LOG_DOMAIN="eventd-test-plugin"', 9 | ], 10 | objects: libeventd_event_private, 11 | dependencies: [ libeventd_plugin, libeventd, gio, gobject, libnkutils_uuid, libnkutils, glib ], 12 | name_prefix: '', 13 | ) 14 | -------------------------------------------------------------------------------- /client/eventc/meson.build: -------------------------------------------------------------------------------- 1 | # Basic CLI client 2 | 3 | eventc = executable('eventc', config_h, files( 4 | 'src/eventc.c', 5 | ), 6 | objects: libeventd_event_private, 7 | c_args: [ 8 | '-DG_LOG_DOMAIN="eventc"', 9 | ], 10 | dependencies: [ 11 | libeventc, 12 | libeventd, 13 | libnkutils_uuid, 14 | libnkutils, 15 | gio, 16 | gobject, 17 | glib, 18 | ], 19 | install: true 20 | ) 21 | -------------------------------------------------------------------------------- /server/eventd/tests/unit/meson.build: -------------------------------------------------------------------------------- 1 | eventd_private = eventd.extract_objects( 2 | 'src/config.c', 3 | 'src/events.c', 4 | ) 5 | eventd_test = executable('eventd.test', files( 6 | 'stubs.c', 7 | 'events.c', 8 | 'eventd.c', 9 | ), 10 | objects: eventd_private, 11 | dependencies: eventd_test_dep, 12 | ) 13 | test('eventd unit tests', eventd_test, 14 | suite: [ 'unit', 'eventd' ], 15 | args: [ '--tap' ], 16 | protocol: 'tap', 17 | ) 18 | -------------------------------------------------------------------------------- /server/eventd/units/user/meson.build: -------------------------------------------------------------------------------- 1 | systemduserunit_install_dir = get_option('systemduserunitdir') 2 | if systemduserunit_install_dir == '' 3 | systemduserunit_install_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir') 4 | endif 5 | eventd_user_units = [] 6 | foreach u : eventd_units 7 | configure_file( 8 | input: '@0@.in'.format(u), 9 | output: u, 10 | configuration: other_conf, 11 | install_dir: systemduserunit_install_dir, 12 | ) 13 | endforeach 14 | -------------------------------------------------------------------------------- /server/eventd/units/system/meson.build: -------------------------------------------------------------------------------- 1 | systemdsystemunit_install_dir = get_option('systemdsystemunitdir') 2 | if systemdsystemunit_install_dir == '' 3 | systemdsystemunit_install_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir') 4 | endif 5 | 6 | eventd_system_units = [] 7 | foreach u : eventd_units 8 | configure_file( 9 | input: '@0@.in'.format(u), 10 | output: u, 11 | configuration: other_conf, 12 | install_dir: systemdsystemunit_install_dir, 13 | ) 14 | endforeach 15 | -------------------------------------------------------------------------------- /plugins/webhook/meson.build: -------------------------------------------------------------------------------- 1 | # webhook plugin 2 | 3 | libsoup = dependency('libsoup-3.0') 4 | 5 | shared_library('webhook', config_h, files( 6 | 'src/webhook.c', 7 | ), 8 | c_args: [ 9 | '-DG_LOG_DOMAIN="eventd-webhook"', 10 | ], 11 | dependencies: [ libsoup, libeventd_helpers, libeventd_plugin, libeventd, libnkutils, glib ], 12 | name_prefix: '', 13 | install: true, 14 | install_dir: plugins_install_dir, 15 | ) 16 | 17 | man_pages += [ [ files('man/eventd-webhook.conf.xml'), 'eventd-webhook.conf.5' ] ] 18 | -------------------------------------------------------------------------------- /plugins/tts/meson.build: -------------------------------------------------------------------------------- 1 | # tts plugin 2 | 3 | speechd = dependency('speech-dispatcher') 4 | 5 | shared_library('tts', config_h, files( 6 | 'src/tts.c', 7 | ), 8 | c_args: [ 9 | '-DG_LOG_DOMAIN="eventd-tts"', 10 | ], 11 | dependencies: [ speechd, libeventd_helpers, libeventd_plugin, libeventd, glib ], 12 | name_prefix: '', 13 | install: true, 14 | install_dir: plugins_install_dir, 15 | ) 16 | 17 | man_pages += [ [ files('man/eventd-tts.conf.xml'), 'eventd-tts.conf.5' ] ] 18 | docbook_conditions += 'enable_tts' 19 | -------------------------------------------------------------------------------- /plugins/canberra/meson.build: -------------------------------------------------------------------------------- 1 | # libcanberra plugin 2 | 3 | canberra = dependency('libcanberra') 4 | 5 | shared_library('canberra', config_h, files( 6 | 'src/canberra.c', 7 | ), 8 | c_args: [ 9 | '-DG_LOG_DOMAIN="eventd-canberra"', 10 | ], 11 | dependencies: [ canberra, libeventd_helpers, libeventd_plugin, libeventd, glib ], 12 | name_prefix: '', 13 | install: true, 14 | install_dir: plugins_install_dir, 15 | ) 16 | 17 | man_pages += [ [ files('man/eventd-canberra.conf.xml'), 'eventd-canberra.conf.5' ] ] 18 | docbook_conditions += 'enable_canberra' 19 | -------------------------------------------------------------------------------- /plugins/notify/meson.build: -------------------------------------------------------------------------------- 1 | # notify plugin 2 | 3 | gdk_pixbuf = dependency('gdk-pixbuf-2.0') 4 | 5 | shared_library('notify', config_h, files( 6 | 'src/notify.c', 7 | '../nd/src/pixbuf.c', 8 | ), 9 | c_args: [ 10 | '-DG_LOG_DOMAIN="eventd-notify"', 11 | ], 12 | dependencies: [ gdk_pixbuf, libeventd_helpers, libeventd_plugin, libeventd, libnkutils, gio, glib ], 13 | name_prefix: '', 14 | install: true, 15 | install_dir: plugins_install_dir, 16 | ) 17 | 18 | man_pages += [ [ files('man/eventd-notify.conf.xml'), 'eventd-notify.conf.5' ] ] 19 | docbook_conditions += 'enable_notify' 20 | -------------------------------------------------------------------------------- /plugins/ws/meson.build: -------------------------------------------------------------------------------- 1 | # webhook plugin 2 | 3 | libsoup = dependency('libsoup-3.0', required: get_option('websocket')) 4 | 5 | test_plugin_path += [ meson.current_build_dir() ] 6 | shared_library('ws', config_h, files( 7 | 'src/ws.c', 8 | 'src/ws-client.c', 9 | ), 10 | c_args: [ 11 | '-DG_LOG_DOMAIN="eventd-ws"', 12 | ], 13 | dependencies: [ libsoup, libeventd_helpers, libeventd_plugin, libeventd, libnkutils, glib ], 14 | name_prefix: '', 15 | install: true, 16 | install_dir: plugins_install_dir, 17 | ) 18 | 19 | man_pages += [ [ files('man/eventd-ws.conf.xml'), 'eventd-ws.conf.5' ] ] 20 | -------------------------------------------------------------------------------- /server/eventdctl/meson.build: -------------------------------------------------------------------------------- 1 | # Server control utility 2 | 3 | eventdctl_inc = include_directories('include') 4 | eventdctl = executable('eventdctl', config_h, files( 5 | 'include/eventdctl.h', 6 | 'src/eventdctl.c', 7 | ), 8 | c_args: [ 9 | '-DG_LOG_DOMAIN="eventdctl"', 10 | ], 11 | dependencies: [ 12 | libeventd_plugin, 13 | libeventd, 14 | libnkutils, 15 | gio_platform, 16 | gio, 17 | glib, 18 | ], 19 | include_directories: eventdctl_inc, 20 | install: true 21 | ) 22 | 23 | man_pages += [ [ files('man/eventdctl.xml'), 'eventdctl.1' ] ] 24 | -------------------------------------------------------------------------------- /plugins/im/meson.build: -------------------------------------------------------------------------------- 1 | # IM plugin 2 | 3 | libpurple = dependency('purple') 4 | 5 | shared_library('im', config_h, files( 6 | 'src/im.c', 7 | 'src/ops.h', 8 | 'src/ops.c', 9 | ), 10 | c_args: [ 11 | '-DG_LOG_DOMAIN="eventd-im"', 12 | ], 13 | dependencies: [ libpurple, libeventd_helpers, libeventd_plugin, libeventd, gmodule, glib ], 14 | name_prefix: '', 15 | install: true, 16 | install_dir: plugins_install_dir, 17 | ) 18 | 19 | man_pages += [ [ files('man/eventdctl-im.xml'), 'eventdctl-im.1' ] ] 20 | man_pages += [ [ files('man/eventd-im.conf.xml'), 'eventd-im.conf.5' ] ] 21 | docbook_conditions += 'enable_im' 22 | -------------------------------------------------------------------------------- /plugins/sound/meson.build: -------------------------------------------------------------------------------- 1 | # sound plugin 2 | 3 | sndfile = dependency('sndfile') 4 | pulseaudio = [ dependency('libpulse', version: '>= 0.9.15'), dependency('libpulse-mainloop-glib') ] 5 | 6 | shared_library('sound', config_h, files( 7 | 'src/sound.c', 8 | 'src/pulseaudio.h', 9 | 'src/pulseaudio.c', 10 | ), 11 | c_args: [ 12 | '-DG_LOG_DOMAIN="eventd-sound"', 13 | ], 14 | dependencies: [ sndfile, pulseaudio, libeventd_helpers, libeventd_plugin, libeventd, libnkutils, glib ], 15 | name_prefix: '', 16 | install: true, 17 | install_dir: plugins_install_dir, 18 | ) 19 | 20 | man_pages += [ [ files('man/eventd-sound.conf.xml'), 'eventd-sound.conf.5' ] ] 21 | docbook_conditions += 'enable_sound' 22 | -------------------------------------------------------------------------------- /COPYING.md: -------------------------------------------------------------------------------- 1 | Licencing 2 | --------- 3 | 4 | eventd is distributed under the terms of the [GNU General Public License version 3](https://www.gnu.org/licenses/gpl-3.0.html) (or any later version). 5 |
6 | You can find the licence text in the `COPYING.GPL-3.0+` file. 7 | 8 | However, some parts of it are distributed under other licences: 9 | - Under the terms of the [GNU Lesser General Public License version 3](https://www.gnu.org/licenses/lgpl-3.0.html) (or any later version): 10 | - libeventd-event 11 | - libeventc 12 | - libeventc-light 13 | - libeventd-plugin 14 | 15 | You can find the licence text in the `COPYING.LGPL-3.0+` file. 16 | - Under the terms of the [MIT License](https://opensource.org/licenses/MIT): 17 | - eventc 18 | - libnkutils (included submodule) 19 | - libgwater (included submodule) 20 | 21 | You can find the licence text in the header of their source files. 22 | -------------------------------------------------------------------------------- /server/libeventd-helpers/meson.build: -------------------------------------------------------------------------------- 1 | # Internal helper library 2 | 3 | libeventd_helpers_inc = include_directories('include') 4 | libeventd_helpers_dep = [ 5 | libeventd, 6 | gio, 7 | glib, 8 | ] 9 | libeventd_helpers_lib = library('eventd-helpers', config_h, files( 10 | 'src/reconnect.c', 11 | 'src/config.c', 12 | 'include/libeventd-helpers-dirs.h', 13 | ), 14 | c_args: [ 15 | '-DG_LOG_DOMAIN="libeventd-helpers"', 16 | ], 17 | dependencies: [ libnkutils, libeventd_helpers_dep ], 18 | include_directories: libeventd_helpers_inc, 19 | install: true, 20 | ) 21 | 22 | install_headers( 23 | 'include/libeventd-helpers-config.h', 24 | 'include/libeventd-helpers-reconnect.h', 25 | subdir: meson.project_name(), 26 | ) 27 | 28 | libeventd_helpers = declare_dependency(link_with: libeventd_helpers_lib, include_directories: libeventd_helpers_inc, dependencies: libeventd_helpers_dep) 29 | -------------------------------------------------------------------------------- /server/libeventd-test/meson.build: -------------------------------------------------------------------------------- 1 | # Testing helper library 2 | 3 | libeventd_test_inc = include_directories('include') 4 | libeventd_test_dep = [ 5 | libeventc, 6 | libeventd, 7 | gobject, 8 | glib, 9 | ] 10 | libeventd_test_lib = library('eventd-test', config_h, files( 11 | 'src/libeventc-test.c', 12 | 'src/libtest.c', 13 | ), 14 | c_args: [ 15 | '-DG_LOG_DOMAIN="libeventd-test"', 16 | '-fvisibility=default', 17 | '-DSRC_DIR="@0@"'.format(meson.project_source_root()), 18 | '-DEVENTDCTL_PATH="@0@"'.format(eventdctl.full_path()), 19 | '-DEVENTD_PATH="@0@"'.format(eventd.full_path()), 20 | '-DTEST_PLUGIN_PATH="@0@"'.format(':'.join(test_plugin_path)), 21 | '-DMODULES_BUILD_DIR="@0@"'.format(modules_build_dir), 22 | ], 23 | dependencies: libeventd_test_dep, 24 | include_directories: libeventd_test_inc, 25 | ) 26 | 27 | libeventd_test = declare_dependency(link_with: libeventd_test_lib, include_directories: libeventd_test_inc, dependencies: libeventd_test_dep) 28 | -------------------------------------------------------------------------------- /plugins/nd/src/blur.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_DRAW_BLUR_H__ 24 | #define __EVENTD_ND_DRAW_BLUR_H__ 25 | 26 | void eventd_nd_draw_blur_surface(cairo_t *cr, guint64 blur); 27 | 28 | #endif /* __EVENTD_ND_DRAW_BLUR_H__ */ 29 | -------------------------------------------------------------------------------- /server/eventd/tests/integration/meson.build: -------------------------------------------------------------------------------- 1 | evp_connection_test = executable('evp-connection.test', config_h, files( 2 | 'evp-connection.c', 3 | ), 4 | dependencies: [ libeventd_test, libeventc, libeventd, gio, gobject, glib ] 5 | ) 6 | test('eventd EvP integration test', evp_connection_test, 7 | suite: [ 'integration', 'eventd' ], 8 | timeout: 6 9 | ) 10 | 11 | relay_connection_test = executable('relay-connection.test', config_h, files( 12 | 'relay-connection.c', 13 | ), 14 | dependencies: [ libeventd_test, libeventc, libeventd, gio, gobject, glib ] 15 | ) 16 | test('eventd relay integration test', relay_connection_test, 17 | suite: [ 'integration', 'eventd', 'relay' ], 18 | timeout: 12 19 | ) 20 | 21 | ws_connection_test = executable('ws-connection.test', config_h, files( 22 | 'ws-connection.c', 23 | ), 24 | dependencies: [ libeventd_test, libeventc, libeventd, gio, gobject, glib ] 25 | ) 26 | test('eventd ws integration test', ws_connection_test, 27 | suite: [ 'integration', 'eventd', 'ws' ], 28 | timeout: 9, 29 | should_fail: not libsoup.found() 30 | ) 31 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/event-getters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_TESTS_UNIT_EVENTD_EVENT_GETTERS_H__ 24 | #define __EVENTD_TESTS_UNIT_EVENTD_EVENT_GETTERS_H__ 25 | 26 | void eventd_tests_unit_eventd_event_suite_getters(void); 27 | 28 | #endif /* __EVENTD_TESTS_UNIT_EVENTD_EVENT_GETTERS_H__ */ 29 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/event-setters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_TESTS_UNIT_EVENTD_EVENT_SETTERS_H__ 24 | #define __EVENTD_TESTS_UNIT_EVENTD_EVENT_SETTERS_H__ 25 | 26 | void eventd_tests_unit_eventd_event_suite_setters(void); 27 | 28 | #endif /* __EVENTD_TESTS_UNIT_EVENTD_EVENT_SETTERS_H__ */ 29 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/protocol-parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_TESTS_UNIT_EVENTD_PROTOCOL_PARSER_H__ 24 | #define __EVENTD_TESTS_UNIT_EVENTD_PROTOCOL_PARSER_H__ 25 | 26 | void eventd_tests_unit_eventd_protocol_suite_parser(void); 27 | 28 | #endif /* __EVENTD_TESTS_UNIT_EVENTD_PROTOCOL_PARSER_H__ */ 29 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/protocol-generator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_TESTS_UNIT_EVENTD_PROTOCOL_GENERATOR_H__ 24 | #define __EVENTD_TESTS_UNIT_EVENTD_PROTOCOL_GENERATOR_H__ 25 | 26 | void eventd_tests_unit_eventd_protocol_suite_generator(void); 27 | 28 | #endif /* __EVENTD_TESTS_UNIT_EVENTD_PROTOCOL_GENERATOR_H__ */ 29 | -------------------------------------------------------------------------------- /plugins/nd/src/backends.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_BACKENDS_H__ 24 | #define __EVENTD_ND_BACKENDS_H__ 25 | 26 | gboolean eventd_nd_backends_load(EventdNdBackend *backends, EventdNdInterface *context, NkBindings *bindings); 27 | void eventd_nd_backends_unload(EventdNdBackend *backends); 28 | 29 | #endif /* __EVENTD_ND_BACKENDS_H__ */ 30 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/meson.build: -------------------------------------------------------------------------------- 1 | libeventd_event_private = libeventd_lib.extract_objects('src/event-private.c') 2 | libeventd_event_test = executable('libeventd-event.test', files( 3 | 'common.h', 4 | 'event-getters.c', 5 | 'event-getters.h', 6 | 'event-setters.c', 7 | 'event-setters.h', 8 | 'libeventd-event.c', 9 | ), 10 | objects: libeventd_event_private, 11 | dependencies: [ libnkutils_uuid, libeventd ], 12 | ) 13 | test('libeventd-event unit tests', libeventd_event_test, 14 | suite: [ 'unit', 'libeventd' ], 15 | args: [ '--tap' ], 16 | protocol: 'tap', 17 | ) 18 | 19 | libeventd_protocol_test = executable('libeventd-protocol.test', files( 20 | 'common.h', 21 | 'protocol-parser.c', 22 | 'protocol-parser.h', 23 | 'protocol-generator.c', 24 | 'protocol-generator.h', 25 | 'libeventd-protocol.c', 26 | ), 27 | objects: libeventd_event_private, 28 | dependencies: [ libnkutils_uuid, libeventd ], 29 | ) 30 | test('libeventd-protocol unit tests', libeventd_protocol_test, 31 | suite: [ 'unit', 'libeventd' ], 32 | args: [ '--tap' ], 33 | protocol: 'tap', 34 | ) 35 | -------------------------------------------------------------------------------- /plugins/im/src/ops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_IM_OPS_H__ 24 | #define __EVENTD_IM_OPS_H__ 25 | 26 | guint eventd_im_glib_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, gpointer user_data); 27 | void eventd_im_debug_print(PurpleDebugLevel level, const char *category, const char *arg_s); 28 | 29 | #endif /* __EVENTD_IM_OPS_H__ */ 30 | -------------------------------------------------------------------------------- /server/libeventd/src/event-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-protocol - Main eventd library - Protocol manipulation 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTD_EVENT_EVENT_PRIVATE_H__ 22 | #define __EVENTD_EVENT_EVENT_PRIVATE_H__ 23 | 24 | struct _EventdEvent { 25 | guint64 refcount; 26 | NkUuid uuid; 27 | gchar *category; 28 | gchar *name; 29 | gint64 timeout; 30 | GHashTable *data; 31 | }; 32 | 33 | #endif /* __EVENTD_EVENT_EVENT_PRIVATE_H__ */ 34 | -------------------------------------------------------------------------------- /src/config.ent.in: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | %git_version; 32 | -------------------------------------------------------------------------------- /plugins/ws/src/ws.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_WS_H__ 24 | #define __EVENTD_WS_H__ 25 | 26 | struct _EventdPluginContext { 27 | EventdPluginCoreContext *core; 28 | gchar *secret; 29 | gchar **binds; 30 | SoupServer *server; 31 | GTlsCertificate *certificate; 32 | GList *clients; 33 | GList *subscribe_all; 34 | GHashTable *subscribe_categories; 35 | }; 36 | 37 | #endif /* __EVENTD_WS_H__ */ 38 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/libeventd-event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "common.h" 24 | #include "event-setters.h" 25 | #include "event-getters.h" 26 | 27 | int 28 | main(int argc, char *argv[]) 29 | { 30 | g_test_init(&argc, &argv, NULL); 31 | 32 | g_test_set_nonfatal_assertions(); 33 | 34 | eventd_tests_unit_eventd_event_suite_setters(); 35 | eventd_tests_unit_eventd_event_suite_getters(); 36 | 37 | return g_test_run(); 38 | } 39 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/libeventd-protocol.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A LINEICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "common.h" 24 | #include "protocol-parser.h" 25 | #include "protocol-generator.h" 26 | 27 | int 28 | main(int argc, char *argv[]) 29 | { 30 | g_test_init(&argc, &argv, NULL); 31 | 32 | g_test_set_nonfatal_assertions(); 33 | 34 | eventd_tests_unit_eventd_protocol_suite_parser(); 35 | eventd_tests_unit_eventd_protocol_suite_generator(); 36 | 37 | return g_test_run(); 38 | } 39 | -------------------------------------------------------------------------------- /server/eventd/src/control.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_CONTROL_H__ 24 | #define __EVENTD_CONTROL_H__ 25 | 26 | EventdControl *eventd_control_new(EventdCoreContext *core, const gchar *control_socket); 27 | void eventd_control_free(EventdControl *control); 28 | 29 | typedef struct _EventdControlDelayedStop EventdControlDelayedStop; 30 | void eventd_control_stop(EventdControl *control, EventdControlDelayedStop *delayed_stop); 31 | 32 | #endif /* __EVENTD_CONTROL_H__ */ 33 | -------------------------------------------------------------------------------- /server/eventd/tests/unit/eventd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | 27 | void eventd_tests_add_events_suite(void); 28 | 29 | int 30 | main(int argc, char *argv[]) 31 | { 32 | setlocale(LC_ALL, "C"); 33 | 34 | g_setenv("LANG", "C", TRUE); 35 | g_setenv("TZ", "UTC", TRUE); 36 | 37 | g_test_init(&argc, &argv, NULL); 38 | 39 | g_test_set_nonfatal_assertions(); 40 | 41 | eventd_tests_add_events_suite(); 42 | 43 | return g_test_run(); 44 | } 45 | -------------------------------------------------------------------------------- /server/eventd/src/evp/client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_EVP_CLIENT_H__ 24 | #define __EVENTD_EVP_CLIENT_H__ 25 | 26 | typedef struct _EventdEvpClient EventdEvpClient; 27 | 28 | gboolean eventd_evp_client_connection_handler(GSocketService *service, GSocketConnection *connection, GObject *obj, gpointer user_data); 29 | void eventd_evp_client_disconnect(gpointer data); 30 | void eventd_evp_client_event_dispatch(EventdEvpClient *client, EventdEvent *event); 31 | 32 | #endif /* __EVENTD_EVP_CLIENT_H__ */ 33 | -------------------------------------------------------------------------------- /server/libeventd/include/libeventd-event-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-event - Main eventd library - Event manipulation 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTD_EVENT_PRIVATE_H__ 22 | #define __EVENTD_EVENT_PRIVATE_H__ 23 | 24 | #include "nkutils-uuid.h" 25 | 26 | EventdEvent *eventd_event_new_for_uuid(NkUuid uuid, const gchar *category, const gchar *name); 27 | EventdEvent *eventd_event_new_for_uuid_string(const gchar *uuid_string, const gchar *category, const gchar *name); 28 | 29 | void eventd_event_set_all_data(EventdEvent *event, GHashTable *data); 30 | 31 | #endif /* __EVENTD_EVENT_PRIVATE_H__ */ 32 | -------------------------------------------------------------------------------- /plugins/ws/src/ws-client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_WS_CLIENT_H__ 24 | #define __EVENTD_WS_CLIENT_H__ 25 | 26 | typedef struct _EventdWsClient EventdWsClient; 27 | 28 | void evend_ws_websocket_client_handler(SoupServer *server, SoupServerMessage *server_msg, const char *path, SoupWebsocketConnection *connection, gpointer user_data); 29 | void evend_ws_websocket_client_disconnect(gpointer data); 30 | void evend_ws_websocket_client_event_dispatch(EventdWsClient *client, EventdEvent *event); 31 | 32 | #endif /* __EVENTD_WS_CLIENT_H__ */ 33 | -------------------------------------------------------------------------------- /server/eventd/src/sockets.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_SOCKETS_H__ 24 | #define __EVENTD_SOCKETS_H__ 25 | 26 | EventdSockets *eventd_sockets_new(const gchar *runtime_dir, gboolean take_over_socket, gboolean systemd_mode); 27 | void eventd_sockets_free(EventdSockets *sockets); 28 | 29 | GList *eventd_sockets_get_binds(EventdSockets *sockets, const gchar *namespace, const gchar * const *binds); 30 | GList *eventd_sockets_get_sockets(EventdSockets *sockets, const gchar *namespace, GSocketAddress **binds); 31 | 32 | #endif /* __EVENTD_SOCKETS_H__ */ 33 | -------------------------------------------------------------------------------- /client/libeventc/tests/integration/connection.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include 24 | #include "libeventd-test.h" 25 | 26 | int 27 | main(int argc, char *argv[]) 28 | { 29 | int r = 99; 30 | eventd_tests_env_setup(argv, "libeventc-connection"); 31 | EventdTestsEnv *env = eventd_tests_env_new(NULL, NULL, FALSE); 32 | if ( ! eventd_tests_env_start_eventd(env) ) 33 | goto end; 34 | 35 | r = eventd_tests_run_libeventc(NULL); 36 | 37 | if ( ! eventd_tests_env_stop_eventd(env) ) 38 | r = 99; 39 | 40 | end: 41 | return eventd_tests_env_free(env, r); 42 | } 43 | -------------------------------------------------------------------------------- /server/eventd/src/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_TYPES_H__ 24 | #define __EVENTD_TYPES_H__ 25 | 26 | #include "libeventd-event.h" 27 | #include "eventd-plugin.h" 28 | #include "eventdctl.h" 29 | 30 | typedef struct _EventdCoreContext EventdCoreContext; 31 | 32 | typedef struct _EventdControl EventdControl; 33 | typedef struct _EventdControlDelayedStop EventdControlDelayedStop; 34 | typedef struct _EventdConfig EventdConfig; 35 | typedef struct _EventdEvents EventdEvents; 36 | typedef struct _EventdActions EventdActions; 37 | typedef struct _EventdSockets EventdSockets; 38 | 39 | #endif /* __EVENTD_TYPES_H__ */ 40 | -------------------------------------------------------------------------------- /server/eventd/src/sd-modules.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_SD_MODULES_H__ 24 | #define __EVENTD_SD_MODULES_H__ 25 | 26 | #include "eventd-sd-module.h" 27 | 28 | void eventd_sd_modules_load(const EventdSdModuleControlInterface *control, GList *sockets); 29 | void eventd_sd_modules_unload(void); 30 | 31 | void eventd_sd_modules_set_publish_name(const gchar *name); 32 | void eventd_sd_modules_monitor_server(const gchar *name, EventdRelayServer *server); 33 | 34 | void eventd_sd_modules_start(void); 35 | void eventd_sd_modules_stop(void); 36 | 37 | gboolean eventd_sd_modules_can_discover(void); 38 | 39 | #endif /* __EVENTD_SD_MODULES_H__ */ 40 | -------------------------------------------------------------------------------- /server/eventd/src/events.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_EVENTS_H__ 24 | #define __EVENTD_EVENTS_H__ 25 | 26 | EventdEvents *eventd_events_new(void); 27 | void eventd_events_reset(EventdEvents *self); 28 | void eventd_events_free(EventdEvents *self); 29 | 30 | void eventd_events_parse(EventdEvents *self, GKeyFile *config_file); 31 | void eventd_events_link_actions(EventdEvents *self, EventdActions *actions); 32 | 33 | gboolean eventd_events_process_event(EventdEvents *self, EventdEvent *event, GQuark *flags, const GList **actions); 34 | 35 | gchar *eventd_events_dump_event(EventdEvents *self, const gchar *event_id); 36 | 37 | #endif /* __EVENTD_EVENTS_H__ */ 38 | -------------------------------------------------------------------------------- /plugins/fdo-notifications/meson.build: -------------------------------------------------------------------------------- 1 | # Freedesktop.org notifications event collection plugin 2 | 3 | fdo_notificacions = shared_library('fdo-notifications', config_h, files( 4 | 'src/fdo-notifications.c', 5 | ), 6 | c_args: [ 7 | '-DG_LOG_DOMAIN="eventd-fdo-notifications"', 8 | ], 9 | dependencies: [ libeventd_plugin, libeventd, libnkutils, gio, glib ], 10 | name_prefix: '', 11 | install: true, 12 | install_dir: plugins_install_dir, 13 | ) 14 | 15 | if get_option('debug') 16 | executable('eventd-fdo-notifications', config_h, files( 17 | 'src/debug-daemon.c', 18 | ), 19 | objects: fdo_notificacions.extract_objects( 20 | 'src/fdo-notifications.c' 21 | ), 22 | dependencies: [ libeventd_plugin, libeventc, libeventd, libnkutils, glib ], 23 | 24 | ) 25 | endif 26 | 27 | dbussessionservice_install_dir = get_option('dbussessionservicedir') 28 | if dbussessionservice_install_dir == '' 29 | dbus = dependency('dbus-1') 30 | dbussessionservice_install_dir = dbus.get_variable(pkgconfig: 'session_bus_services_dir') 31 | endif 32 | 33 | configure_file( 34 | input: 'services/org.eventd.fdo-notifications.service.in', 35 | output: 'org.eventd.fdo-notifications.service', 36 | configuration: other_conf, 37 | install_dir: dbussessionservice_install_dir, 38 | ) 39 | 40 | install_data([ 41 | 'events/notification.event', 42 | 'events/notification.action', 43 | ], 44 | install_dir: events_install_dir, 45 | ) 46 | -------------------------------------------------------------------------------- /server/libeventd-test/include/libeventd-test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_LIBEVENTD_TEST_H__ 24 | #define __EVENTD_LIBEVENTD_TEST_H__ 25 | 26 | #include 27 | 28 | typedef struct _EventdTestsEnv EventdTestsEnv; 29 | 30 | void eventd_tests_env_setup(gchar **argv, const gchar *test); 31 | EventdTestsEnv *eventd_tests_env_new(const gchar *evp_socket, const gchar *plugins, gboolean enable_relay); 32 | int eventd_tests_env_free(EventdTestsEnv *env, int r); 33 | gboolean eventd_tests_env_start_eventd(EventdTestsEnv *env); 34 | gboolean eventd_tests_env_stop_eventd(EventdTestsEnv *env); 35 | 36 | int eventd_tests_run_libeventc(const gchar *host); 37 | 38 | #endif /* __EVENTD_LIBEVENTD_TEST_H__ */ 39 | -------------------------------------------------------------------------------- /server/eventd/src/evp/evp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_EVP_EVP_H__ 24 | #define __EVENTD_EVP_EVP_H__ 25 | 26 | typedef struct _EventdEvpContext EventdEvpContext; 27 | 28 | EventdEvpContext *eventd_evp_init(EventdCoreContext *core, const gchar * const *binds, GList **user_sockets); 29 | void eventd_evp_uninit(EventdEvpContext *evp); 30 | 31 | void eventd_evp_start(EventdEvpContext *evp); 32 | void eventd_evp_stop(EventdEvpContext *evp); 33 | 34 | void eventd_evp_global_parse(EventdEvpContext *evp, GKeyFile *config_file); 35 | void eventd_evp_config_reset(EventdEvpContext *evp); 36 | 37 | void eventd_evp_event_dispatch(EventdEvpContext *evp, EventdEvent *event); 38 | 39 | #endif /* __EVENTD_EVP_EVP_H__ */ 40 | -------------------------------------------------------------------------------- /plugins/nd/src/pixbuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_PIXBUF_H__ 24 | #define __EVENTD_ND_PIXBUF_H__ 25 | 26 | #if ( ( GDK_PIXBUF_MAJOR < 2 ) || ( ( GDK_PIXBUF_MAJOR == 2 ) && ( GDK_PIXBUF_MINOR < 31 ) ) ) 27 | static inline const guchar *gdk_pixbuf_read_pixels(GdkPixbuf *pixbuf) { return gdk_pixbuf_get_pixels(pixbuf); } 28 | #endif /* gdk-pixbux < 2.32 */ 29 | 30 | GdkPixbuf *eventd_nd_pixbuf_from_uri(gchar *uri, gint width, gint height, gint scale); 31 | GdkPixbuf *eventd_nd_pixbuf_from_data(GVariant *data, gint width, gint height, gint scale); 32 | GdkPixbuf *eventd_nd_pixbuf_from_theme(NkXdgThemeContext *context, const gchar *theme, gchar *uri, gint size, gint scale); 33 | 34 | #endif /* __EVENTD_ND_PIXBUF_H__ */ 35 | -------------------------------------------------------------------------------- /server/eventd/src/config_.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_CONFIG_H__ 24 | #define __EVENTD_CONFIG_H__ 25 | 26 | EventdConfig *eventd_config_new(const gchar *arg_dir, gboolean system_mode); 27 | void eventd_config_parse(EventdConfig *config, gboolean system_mode); 28 | void eventd_config_free(EventdConfig *config); 29 | 30 | gboolean eventd_config_process_event(EventdConfig *self, EventdEvent *event, GQuark *flags, const GList **actions); 31 | 32 | GQuark *eventd_config_parse_flags_list(gchar **flags, gsize length); 33 | 34 | gchar *eventd_config_dump_event(EventdConfig *self, const gchar *event_id); 35 | gchar *eventd_config_dump_action(EventdConfig *self, const gchar *action_id); 36 | 37 | #endif /* __EVENTD_CONFIG_H__ */ 38 | -------------------------------------------------------------------------------- /server/eventd/src/evp/evp-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_EVP_EVP_INTERAL_H__ 24 | #define __EVENTD_EVP_EVP_INTERAL_H__ 25 | 26 | #include "../types.h" 27 | #include "evp.h" 28 | #include "eventd-ws-module.h" 29 | 30 | struct _EventdEvpContext { 31 | EventdCoreContext *core; 32 | GTlsCertificate *certificate; 33 | GList *client_certificates; 34 | gchar *cert_file; 35 | gchar *key_file; 36 | gchar *client_certs_file; 37 | GFileMonitor *cert_monitor; 38 | GFileMonitor *key_monitor; 39 | GFileMonitor *client_certs_monitor; 40 | GSocketService *service; 41 | GList *clients; 42 | GList *subscribe_all; 43 | GHashTable *subscribe_categories; 44 | }; 45 | 46 | #endif /* __EVENTD_EVP_EVP_INTERAL_H__ */ 47 | -------------------------------------------------------------------------------- /client/libeventc-light/meson.build: -------------------------------------------------------------------------------- 1 | # Client library - light (local-only non-GIO) version 2 | 3 | libeventc_light_dep = [] 4 | if is_unix 5 | headers = [ 6 | 'sys/un.h', 7 | 'netinet/in.h', 8 | ] 9 | else 10 | headers = [ 11 | 'winsock2.h', 12 | 'windows.h', 13 | ] 14 | libeventc_light_dep += c_compiler.find_library('ws2_32') 15 | endif 16 | 17 | foreach h : headers 18 | if not c_compiler.has_header(h) 19 | error('Header @0@ was not found, but is required'.format(h)) 20 | endif 21 | endforeach 22 | 23 | libeventc_light_inc = include_directories('include') 24 | libeventc_light_dep += [ 25 | libeventd, 26 | libnkutils, 27 | glib, 28 | ] 29 | libeventc_light_lib = library('eventc-light', config_h, files( 30 | 'src/libeventc-light.c', 31 | ), 32 | c_args: [ 33 | '-DG_LOG_DOMAIN="libeventc-light"', 34 | ], 35 | dependencies: libeventc_light_dep, 36 | version: '0.0.0', 37 | include_directories: libeventc_light_inc, 38 | install: true 39 | ) 40 | 41 | install_headers( 42 | files('include/libeventc-light.h'), 43 | subdir: meson.project_name(), 44 | ) 45 | 46 | libeventc_light = declare_dependency(link_with: libeventc_light_lib, include_directories: libeventc_light_inc, dependencies: libeventc_light_dep) 47 | 48 | pkgconfig.generate(libeventc_light_lib, 49 | filebase: 'libeventc-light', 50 | name: 'libeventc-light', 51 | version: meson.project_version(), 52 | description: 'Library to communicate with eventd, light (local-only non-GIO) version', 53 | subdirs: 'eventd', 54 | ) 55 | -------------------------------------------------------------------------------- /plugins/sound/src/pulseaudio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_PLUGINS_SOUND_PULSEAUDIO_H__ 24 | #define __EVENTD_PLUGINS_SOUND_PULSEAUDIO_H__ 25 | 26 | typedef struct _EventdSoundPulseaudioContext EventdSoundPulseaudioContext; 27 | 28 | EventdSoundPulseaudioContext *eventd_sound_pulseaudio_init(void); 29 | void eventd_sound_pulseaudio_uninit(EventdSoundPulseaudioContext *context); 30 | 31 | void eventd_sound_pulseaudio_start(EventdSoundPulseaudioContext *context); 32 | void eventd_sound_pulseaudio_stop(EventdSoundPulseaudioContext *context); 33 | 34 | void eventd_sound_pulseaudio_play_data(EventdSoundPulseaudioContext *context, void *data, gsize length, gint format, guint32 rate, guint8 channels); 35 | 36 | #endif /* __EVENTD_PLUGINS_SOUND_PULSEAUDIO_H__ */ 37 | -------------------------------------------------------------------------------- /server/eventd/src/actions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ACTIONS_H__ 24 | #define __EVENTD_ACTIONS_H__ 25 | 26 | 27 | EventdActions *eventd_actions_new(void); 28 | void eventd_actions_free(EventdActions *actions); 29 | 30 | void eventd_actions_parse(EventdActions *actions, GKeyFile *file, const gchar *default_id); 31 | void eventd_actions_link_actions(EventdActions *actions); 32 | void eventd_actions_reset(); 33 | 34 | void eventd_actions_replace_actions(EventdActions *self, GList **list); 35 | 36 | void eventd_actions_dump_actions(GString *dump, GList *actions); 37 | gchar *eventd_actions_dump_action(EventdActions *self, const gchar *action_id); 38 | 39 | void eventd_actions_trigger(EventdCoreContext *core, const GList *actions, EventdEvent *event); 40 | 41 | #endif /* __EVENTD_ACTIONS_H__ */ 42 | -------------------------------------------------------------------------------- /server/libeventd-helpers/include/libeventd-helpers-reconnect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd - Internal helper 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __LIBEVENTD_RECONNECT_H__ 24 | #define __LIBEVENTD_RECONNECT_H__ 25 | 26 | typedef struct _LibeventdReconnectHandler LibeventdReconnectHandler; 27 | 28 | typedef void (*LibeventdReconnectTryCallback)(LibeventdReconnectHandler *handler, gpointer user_data); 29 | 30 | LibeventdReconnectHandler *evhelpers_reconnect_new(gint64 timeout, gint64 max_tries, LibeventdReconnectTryCallback callback, gpointer user_data); 31 | void evhelpers_reconnect_free(LibeventdReconnectHandler *handler); 32 | 33 | gboolean evhelpers_reconnect_too_much(LibeventdReconnectHandler *self); 34 | gboolean evhelpers_reconnect_try(LibeventdReconnectHandler *handler); 35 | void evhelpers_reconnect_reset(LibeventdReconnectHandler *handler); 36 | 37 | #endif /* __LIBEVENTD_RECONNECT_H__ */ 38 | -------------------------------------------------------------------------------- /server/eventd/tests/unit/stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | 27 | #include "types.h" 28 | #include "actions.h" 29 | #include "plugins.h" 30 | 31 | void eventd_plugins_config_reset_all(void) {} 32 | void eventd_plugins_global_parse_all(GKeyFile *config_file) {} 33 | 34 | void eventd_actions_reset(void) {} 35 | void eventd_actions_parse(EventdActions *actions, GKeyFile *file, const gchar *default_id) {} 36 | void eventd_actions_link_actions(EventdActions *actions) {} 37 | void eventd_actions_replace_actions(EventdActions *actions, GList **list) {} 38 | void eventd_actions_dump_actions(GString *dump, GList *actions) {} 39 | gchar *eventd_actions_dump_action(EventdActions *self, const gchar *action_id) { return NULL; } 40 | EventdActions *eventd_actions_new(void) { return NULL; } 41 | void eventd_actions_free(EventdActions *action) {} 42 | -------------------------------------------------------------------------------- /server/eventd/tests/integration/relay-connection.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | 27 | #include "libeventc.h" 28 | #include "libeventd-test.h" 29 | 30 | int 31 | main(int argc, char *argv[]) 32 | { 33 | int r = 99; 34 | eventd_tests_env_setup(argv, "relay-connection"); 35 | EventdTestsEnv *env = eventd_tests_env_new("tcp-file:relay", NULL, FALSE); 36 | EventdTestsEnv *relay = eventd_tests_env_new(NULL, "", TRUE); 37 | if ( ! eventd_tests_env_start_eventd(env) ) 38 | goto end; 39 | if ( ! eventd_tests_env_start_eventd(relay) ) 40 | goto end; 41 | 42 | r = eventd_tests_run_libeventc(NULL); 43 | 44 | if ( ! eventd_tests_env_stop_eventd(relay) ) 45 | r = 99; 46 | if ( ! eventd_tests_env_stop_eventd(env) ) 47 | r = 99; 48 | 49 | end: 50 | return eventd_tests_env_free(env, r); 51 | } 52 | -------------------------------------------------------------------------------- /server/eventd/src/relay/relay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_RELAY_RELAY_H__ 24 | #define __EVENTD_RELAY_RELAY_H__ 25 | 26 | typedef struct _EventdRelayContext EventdRelayContext; 27 | 28 | EventdRelayContext *eventd_relay_init(EventdCoreContext *core); 29 | void eventd_relay_uninit(EventdRelayContext *evp); 30 | 31 | void eventd_relay_start(EventdRelayContext *evp); 32 | void eventd_relay_stop(EventdRelayContext *evp); 33 | 34 | EventdPluginCommandStatus eventd_relay_control_command(EventdRelayContext *context, guint64 argc, const gchar * const *argv, gchar **status); 35 | 36 | void eventd_relay_global_parse(EventdRelayContext *evp, GKeyFile *config_file); 37 | void eventd_relay_config_reset(EventdRelayContext *evp); 38 | 39 | void eventd_relay_set_certificate(EventdRelayContext *relay, GTlsCertificate *certificate); 40 | 41 | void eventd_relay_event_dispatch(EventdRelayContext *evp, EventdEvent *event); 42 | 43 | #endif /* __EVENTD_RELAY_RELAY_H__ */ 44 | -------------------------------------------------------------------------------- /client/libeventc/meson.build: -------------------------------------------------------------------------------- 1 | # Client library 2 | 3 | libeventc_inc = include_directories('include') 4 | libeventc_dep = [ 5 | libeventd, 6 | gio_platform, 7 | gio, 8 | gmodule, 9 | gobject, 10 | glib, 11 | ] 12 | libeventc_sources = files( 13 | 'src/libeventc.c', 14 | ) 15 | libeventc_lib = library('eventc', 16 | config_h, libeventc_sources, 17 | c_args: [ 18 | '-DG_LOG_DOMAIN="libeventc"', 19 | ], 20 | dependencies: [ ws_module, libnkutils, libeventc_dep ], 21 | version: '0.0.0', 22 | include_directories: libeventc_inc, 23 | install: true 24 | ) 25 | 26 | libeventc_headers = files( 27 | 'include/libeventc.h', 28 | ) 29 | install_headers(libeventc_headers, 30 | subdir: meson.project_name(), 31 | ) 32 | 33 | libeventc = declare_dependency(link_with: libeventc_lib, include_directories: libeventc_inc, dependencies: libeventc_dep) 34 | 35 | pkgconfig.generate(libeventc_lib, 36 | filebase: 'libeventc', 37 | name: 'libeventc', 38 | version: meson.project_version(), 39 | description: 'Library to communicate with eventd', 40 | subdirs: 'eventd', 41 | ) 42 | 43 | if get_option('gobject-introspection') 44 | libeventc_gir = gnome.generate_gir(libeventc_lib, 45 | dependencies: libeventc, 46 | namespace: 'Eventc', 47 | nsversion: '0', 48 | sources: libeventc_sources + libeventc_headers, 49 | includes: [ libeventd_gir[0], 'Gio-2.0', 'GObject-2.0', 'GLib-2.0' ], 50 | extra_args: [ 51 | '--c-include=libeventc.h', 52 | ], 53 | install: true, 54 | ) 55 | if get_option('vapi') 56 | gnome.generate_vapi('libeventc', 57 | sources: [ libeventc_gir[0] ], 58 | packages: [ 'gio-2.0', 'gobject-2.0', 'glib-2.0' ], 59 | install: true, 60 | ) 61 | endif 62 | endif 63 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_TESTS_UNIT_EVENTD_EVENT_COMMON_H__ 24 | #define __EVENTD_TESTS_UNIT_EVENTD_EVENT_COMMON_H__ 25 | 26 | #include 27 | #include 28 | #include 29 | #include "libeventd-event.h" 30 | #include "libeventd-event-private.h" 31 | #include "libeventd-protocol.h" 32 | 33 | #define EVENTD_EVENT_TEST_UUID "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb" 34 | #define EVENTD_EVENT_TEST_NAME "test-name" 35 | #define EVENTD_EVENT_TEST_CATEGORY "test-category" 36 | #define EVENTD_EVENT_TEST_DATA_NAME "test-name" 37 | #define EVENTD_EVENT_TEST_DATA_CONTENT "test-content" 38 | #define EVENTD_EVENT_TEST_DATA_ESCAPING_NAME "test-name-newline" 39 | #define EVENTD_EVENT_TEST_DATA_ESCAPING_CONTENT "test-content\ntest-newline-content\\test-backslash-context" 40 | #define EVENTD_EVENT_TEST_DATA_ESCAPING_CONTENT_ESCAPED "test-content\\ntest-newline-content\\\\test-backslash-context" 41 | 42 | #endif /* __EVENTD_TESTS_UNIT_EVENTD_EVENT_COMMON_H__ */ 43 | -------------------------------------------------------------------------------- /plugins/nd/src/notification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_NOTIFICATION_H__ 24 | #define __EVENTD_ND_NOTIFICATION_H__ 25 | 26 | #include "types.h" 27 | 28 | void eventd_nd_notification_refresh_list(EventdPluginContext *context, gboolean update); 29 | EventdPluginCommandStatus eventd_nd_notification_dismiss_target(EventdPluginContext *context, EventdNdDismissTarget target, EventdNdQueue *queue); 30 | 31 | EventdNdNotification *eventd_nd_notification_new(EventdPluginContext *context, EventdEvent *event, EventdNdStyle *style); 32 | void eventd_nd_notification_free(gpointer data); 33 | 34 | void eventd_nd_notification_shape(EventdNdNotification *notification, cairo_t *cr); 35 | void eventd_nd_notification_draw(EventdNdNotification *notification, cairo_surface_t *surface); 36 | void eventd_nd_notification_update(EventdNdNotification *notification, EventdEvent *event); 37 | void eventd_nd_notification_dismiss(EventdNdNotification *notification); 38 | void eventd_nd_notification_dismiss_queue(EventdNdNotification *notification); 39 | 40 | #endif /* __EVENTD_ND_NOTIFICATION_H__ */ 41 | -------------------------------------------------------------------------------- /server/libeventd-plugin/meson.build: -------------------------------------------------------------------------------- 1 | # Plugin and core interfaces manipulation library 2 | 3 | libeventd_plugin_inc = include_directories('include') 4 | libeventd_plugin_dep = [ 5 | libeventd, 6 | gobject, 7 | glib, 8 | ] 9 | libeventd_plugin_sources = files( 10 | 'src/core.c', 11 | 'src/plugin.c', 12 | ) 13 | libeventd_plugin_lib = library('eventd-plugin', config_h, files( 14 | 'include/eventd-plugin-private.h', 15 | ), libeventd_plugin_sources, 16 | c_args: [ 17 | '-DG_LOG_DOMAIN="libeventd-plugin"', 18 | ], 19 | dependencies: libeventd_plugin_dep, 20 | version: '0.0.0', 21 | include_directories: libeventd_plugin_inc, 22 | install: true, 23 | ) 24 | 25 | libeventd_plugin_headers = files( 26 | 'include/eventd-plugin.h', 27 | ) 28 | install_headers(libeventd_plugin_headers, 29 | subdir: meson.project_name(), 30 | ) 31 | 32 | libeventd_plugin = declare_dependency(link_with: libeventd_plugin_lib, include_directories: libeventd_plugin_inc, dependencies: libeventd_plugin_dep) 33 | 34 | pkgconfig.generate(libeventd_plugin_lib, 35 | filebase: 'libeventd-plugin', 36 | name: 'libeventd-plugin', 37 | version: meson.project_version(), 38 | description: 'Library to implement an eventd plugin', 39 | subdirs: 'eventd', 40 | variables: [ 41 | 'pluginsdir=@0@'.format(join_paths('${prefix}', plugins_install_dir)), 42 | ], 43 | ) 44 | 45 | if get_option('gobject-introspection') 46 | libeventd_plugin_gir = gnome.generate_gir(libeventd_plugin_lib, 47 | dependencies: libeventd_plugin, 48 | namespace: 'EventdPlugin', 49 | nsversion: '0', 50 | sources: libeventd_plugin_sources + libeventd_plugin_headers, 51 | includes: [ libeventd_gir[0], 'Gio-2.0', 'GObject-2.0' ], 52 | extra_args: [ 53 | '--c-include=eventd-plugin.h', 54 | ], 55 | install: true, 56 | ) 57 | endif 58 | -------------------------------------------------------------------------------- /plugins/nd/src/draw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_DRAW_H__ 24 | #define __EVENTD_ND_DRAW_H__ 25 | 26 | #include 27 | 28 | PangoLayout *eventd_nd_draw_text_process(EventdNdStyle *style, EventdEvent *event, gint max_width, guint more_size, gint *text_width); 29 | void eventd_nd_draw_image_and_icon_process(NkXdgThemeContext *theme_context, EventdNdStyle *style, EventdEvent *event, gint max_width, gint scale, cairo_surface_t **image, cairo_surface_t **icon, gint *text_x, gint *width, gint *height); 30 | 31 | void eventd_nd_draw_bubble_shape(cairo_t *cr, EventdNdStyle *style, gint width, gint height); 32 | void eventd_nd_draw_bubble_draw(cairo_t *cr, EventdNdStyle *style, gint width, gint height, EventdNdShaping shaping, gdouble value); 33 | void eventd_nd_draw_text_draw(cairo_t *cr, EventdNdStyle *style, PangoLayout *text, gint offset_x, gint offset_y); 34 | void eventd_nd_draw_image_and_icon_draw(cairo_t *cr, cairo_surface_t *image, cairo_surface_t *icon, EventdNdStyle *style, gint width, gint height, gdouble value); 35 | 36 | #endif /* __EVENTD_ND_DRAW_H__ */ 37 | -------------------------------------------------------------------------------- /plugins/nd/src/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_TYPES_H__ 24 | #define __EVENTD_ND_TYPES_H__ 25 | 26 | #include 27 | #include "eventd-plugin.h" 28 | 29 | typedef struct _EventdPluginContext EventdNdContext; 30 | typedef struct _EventdPluginAction EventdNdStyle; 31 | typedef struct _EventdNdNotification EventdNdNotification; 32 | typedef struct _EventdNdQueue EventdNdQueue; 33 | 34 | typedef enum { 35 | EVENTD_ND_SHAPING_NONE = 0, 36 | EVENTD_ND_SHAPING_COMPOSITING, 37 | EVENTD_ND_SHAPING_SHAPE, 38 | } EventdNdShaping; 39 | 40 | typedef enum { 41 | EVENTD_ND_ANCHOR_TOP_LEFT, 42 | EVENTD_ND_ANCHOR_TOP, 43 | EVENTD_ND_ANCHOR_TOP_RIGHT, 44 | EVENTD_ND_ANCHOR_BOTTOM_LEFT, 45 | EVENTD_ND_ANCHOR_BOTTOM, 46 | EVENTD_ND_ANCHOR_BOTTOM_RIGHT, 47 | _EVENTD_ND_ANCHOR_SIZE 48 | } EventdNdAnchor; 49 | 50 | typedef enum { 51 | EVENTD_ND_DISMISS_NONE, 52 | EVENTD_ND_DISMISS_ALL, 53 | EVENTD_ND_DISMISS_OLDEST, 54 | EVENTD_ND_DISMISS_NEWEST, 55 | } EventdNdDismissTarget; 56 | 57 | 58 | #endif /* __EVENTD_ND_TYPES_H__ */ 59 | -------------------------------------------------------------------------------- /server/eventd/src/plugins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_PLUGINS_H__ 24 | #define __EVENTD_PLUGINS_H__ 25 | 26 | void eventd_plugins_load(EventdPluginCoreContext *core, const gchar * const *evp_binds, gboolean enable_relay, gboolean enable_sd_modules, gboolean system_mode); 27 | void eventd_plugins_unload(void); 28 | 29 | void eventd_plugins_start_all(void); 30 | void eventd_plugins_stop_all(void); 31 | 32 | EventdctlReturnCode eventd_plugins_control_command(const gchar *id, guint64 argc, const gchar * const *argv, gchar **status); 33 | 34 | void eventd_plugins_config_init_all(void); 35 | void eventd_plugins_config_reset_all(void); 36 | void eventd_plugins_relay_set_certificate(GTlsCertificate *certificate); 37 | 38 | void eventd_plugins_global_parse_all(GKeyFile *config_file); 39 | GList *eventd_plugins_event_parse_all(GKeyFile *config_file); 40 | 41 | void eventd_plugins_event_dispatch_all(EventdEvent *event); 42 | void eventd_plugins_event_action_all(const GList *actions, EventdEvent *event); 43 | 44 | void eventd_plugins_action_free(gpointer data); 45 | #endif /* __EVENTD_PLUGINS_H__ */ 46 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('websocket', type: 'feature', description: 'WebSocket support') 2 | option('dns-sd', type: 'feature', description: 'DNS-SD support') 3 | option('ssdp', type: 'feature', description: 'SSDP support') 4 | option('ipv6', type: 'boolean', value: true, description: 'IPv6 support') 5 | option('systemd', type: 'boolean', value: false, description: 'systemd activation support') 6 | option('notification-daemon', type: 'boolean', value: true, description: 'notification-daemon plugin') 7 | option('nd-wayland', type: 'boolean', value: false, description: 'Wayland graphical backend') 8 | option('nd-xcb', type: 'boolean', value: true, description: 'XCB graphical backend') 9 | option('nd-fbdev', type: 'boolean', value: false, description: 'fbdev backend') 10 | option('im', type: 'boolean', value: true, description: 'IM support through libpurple') 11 | option('sound', type: 'boolean', value: true, description: 'Sound support through libsndfile') 12 | option('tts', type: 'boolean', value: false, description: 'Text-to-speech support through Speech Dispatcher') 13 | option('webhook', type: 'boolean', value: false, description: 'WebHook sender through libsoup') 14 | option('libnotify', type: 'boolean', value: true, description: 'libnotify support (client side)') 15 | option('libcanberra', type: 'boolean', value: false, description: 'libcanberra support') 16 | option('gobject-introspection', type: 'boolean', value: false, description: 'GObject Introspection support') 17 | option('vapi', type: 'boolean', value: false, description: 'VAPI generation (requires GObject Introspection)') 18 | option('debug-output', type: 'boolean', value: true, description: 'debug output') 19 | 20 | option('systemduserunitdir', type: 'string', description: 'Directory for systemd user unit files') 21 | option('systemdsystemunitdir', type: 'string', description: 'Directory for systemd system unit files') 22 | option('dbussessionservicedir', type: 'string', description: 'Directory for D-Bus session service files') 23 | -------------------------------------------------------------------------------- /server/eventd/tests/integration/ws-connection.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | #include 27 | 28 | #include "libeventc.h" 29 | #include "libeventd-test.h" 30 | 31 | int 32 | main(int argc, char *argv[]) 33 | { 34 | int r = 99; 35 | eventd_tests_env_setup(argv, "ws-connection"); 36 | EventdTestsEnv *env = eventd_tests_env_new(NULL, "test-plugin,ws", FALSE); 37 | if ( ! eventd_tests_env_start_eventd(env) ) 38 | goto end; 39 | 40 | gchar *file; 41 | gchar *port; 42 | gsize length; 43 | file = g_build_filename(g_get_user_runtime_dir(), PACKAGE_NAME, "evp-ws", NULL); 44 | if ( g_file_test(file, G_FILE_TEST_IS_REGULAR) && g_file_get_contents(file, &port, &length, NULL) && ( length < 6 ) ) 45 | { 46 | gchar uri[37]; 47 | g_snprintf(uri, sizeof(uri), "ws://:lampeDeChevet@localhost:%s/", port); 48 | r = eventd_tests_run_libeventc(uri); 49 | } 50 | g_free(file); 51 | 52 | if ( ! eventd_tests_env_stop_eventd(env) ) 53 | r = 99; 54 | 55 | end: 56 | return eventd_tests_env_free(env, r); 57 | } 58 | -------------------------------------------------------------------------------- /plugins/nd/src/nd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_ND_H__ 24 | #define __EVENTD_ND_ND_H__ 25 | 26 | #include "types.h" 27 | #include 28 | 29 | struct _EventdNdQueue { 30 | EventdNdAnchor anchor; 31 | guint64 limit; 32 | gint margin_x; 33 | gint margin_y; 34 | gint spacing; 35 | gboolean reverse; 36 | gboolean more_indicator; 37 | EventdEvent *more_event; 38 | EventdNdNotification *more_notification; 39 | GQueue *wait_queue; 40 | GQueue *queue; 41 | }; 42 | 43 | struct _EventdPluginContext { 44 | EventdPluginCoreContext *core; 45 | EventdNdInterface interface; 46 | NkBindings *bindings; 47 | EventdNdBackend backends[_EVENTD_ND_BACKENDS_SIZE]; 48 | EventdNdBackend *backend; 49 | GHashTable *queues; 50 | EventdNdStyle *style; 51 | EventdNdBackends last_backend; 52 | NkXdgThemeContext *theme_context; 53 | gchar *last_target; 54 | struct { 55 | gint x; 56 | gint y; 57 | gint w; 58 | gint h; 59 | gint s; 60 | } geometry; 61 | GHashTable *notifications; 62 | gboolean no_refresh; 63 | EventdNdShaping shaping; 64 | GSList *actions; 65 | }; 66 | 67 | #endif /* __EVENTD_ND_ND_H__ */ 68 | -------------------------------------------------------------------------------- /client/libeventc/vapi/libeventc.vapi: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventc - Library to communicate with eventd 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | namespace Eventc 24 | { 25 | [CCode (cheader_filename = "libeventc.h")] 26 | public static unowned string get_version(); 27 | 28 | [CCode (cheader_filename = "libeventc.h")] 29 | public errordomain Error { 30 | HOSTNAME, 31 | CONNECTION, 32 | ALREADY_CONNECTED, 33 | NOT_CONNECTED, 34 | RECEIVE, 35 | EVENT, 36 | END, 37 | BYE 38 | } 39 | 40 | [CCode (cheader_filename = "libeventc.h")] 41 | public class Connection : GLib.Object 42 | { 43 | public Connection(string host) throws Eventc.Error; 44 | public Connection.for_connectable(GLib.SocketConnectable connectable); 45 | 46 | public bool get_subscribe(); 47 | 48 | public bool set_host(string host) throws Eventc.Error; 49 | public void set_connectable(GLib.SocketConnectable address); 50 | public void set_accept_unknown_ca(bool accept_unknown_ca); 51 | public void set_subscribe(bool subscribe); 52 | public void add_subscription(owned string category); 53 | 54 | public bool is_connected() throws Eventc.Error; 55 | public new async void connect() throws Eventc.Error; 56 | public new void connect_sync() throws Eventc.Error; 57 | public bool event(Eventd.Event event) throws Eventc.Error; 58 | public bool close() throws Eventc.Error; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /server/libeventd/src/event-private.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-event - Main eventd library - Event manipulation 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | #include "libeventd-event.h" 29 | #include "libeventd-event-private.h" 30 | 31 | #include "event-private.h" 32 | 33 | 34 | EventdEvent * 35 | eventd_event_new_for_uuid(NkUuid uuid, const gchar *category, const gchar *name) 36 | { 37 | EventdEvent *self; 38 | 39 | self = g_new0(EventdEvent, 1); 40 | self->refcount = 1; 41 | 42 | self->uuid = uuid; 43 | self->category = g_strdup(category); 44 | self->name = g_strdup(name); 45 | 46 | return self; 47 | } 48 | 49 | EventdEvent * 50 | eventd_event_new_for_uuid_string(const gchar *uuid_string, const gchar *category, const gchar *name) 51 | { 52 | g_return_val_if_fail(uuid_string != NULL, NULL); 53 | g_return_val_if_fail(category != NULL, NULL); 54 | g_return_val_if_fail(name != NULL, NULL); 55 | 56 | NkUuid uuid; 57 | if ( ! nk_uuid_parse(&uuid, uuid_string) ) 58 | return NULL; 59 | 60 | return eventd_event_new_for_uuid(uuid, category, name); 61 | } 62 | 63 | void 64 | eventd_event_set_all_data(EventdEvent *self, GHashTable *data) 65 | { 66 | g_return_if_fail(self != NULL); 67 | 68 | if ( self->data != NULL ) 69 | g_hash_table_unref(self->data); 70 | self->data = data; 71 | } 72 | -------------------------------------------------------------------------------- /server/eventd/src/relay/server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_PLUGINS_RELAY_SERVER_H__ 24 | #define __EVENTD_PLUGINS_RELAY_SERVER_H__ 25 | 26 | #include "../types.h" 27 | #include "eventd-sd-module.h" 28 | 29 | EventdRelayServer *eventd_relay_server_new(EventdCoreContext *core, guint ping_interval, const gchar *server_identity, gboolean accept_unknown_ca, gchar **forwards, gchar **subscriptions, gboolean event_on_connection); 30 | EventdRelayServer *eventd_relay_server_new_for_uri(EventdCoreContext *core, guint ping_interval, const gchar *server_identity, gboolean accept_unknown_ca, gchar **forwards, gchar **subscriptions, gboolean event_on_connection, const gchar *uri); 31 | void eventd_relay_server_free(gpointer data); 32 | 33 | void eventd_relay_server_set_address(EventdRelayServer *server, GSocketConnectable *address); 34 | gboolean eventd_relay_server_has_address(EventdRelayServer *server); 35 | 36 | gboolean eventd_relay_server_is_connected(EventdRelayServer *server); 37 | 38 | void eventd_relay_server_start(EventdRelayServer *server, gboolean force); 39 | void eventd_relay_server_stop(EventdRelayServer *server); 40 | 41 | void eventd_relay_server_set_certificate(EventdRelayServer *server, GTlsCertificate *certificate); 42 | 43 | void eventd_relay_server_event(EventdRelayServer *server, EventdEvent *event); 44 | 45 | #endif /* __EVENTD_PLUGINS_RELAY_SERVER_H__ */ 46 | -------------------------------------------------------------------------------- /server/libeventd-plugin/include/eventd-plugin-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-plugin - Library to implement an eventd plugin 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTD_EVENTD_PLUGIN_PRIVATE_H__ 22 | #define __EVENTD_EVENTD_PLUGIN_PRIVATE_H__ 23 | 24 | #include "eventd-plugin.h" 25 | 26 | typedef GList *(*EventdPluginCoreGetBindsFunc)(EventdPluginCoreContext *context, const gchar *namespace, const gchar * const *binds); 27 | typedef GList *(*EventdPluginCoreGetSocketsFunc)(EventdPluginCoreContext *context, const gchar *namespace, GSocketAddress **binds); 28 | 29 | typedef gboolean (*EventdPluginCorePushEventFunc)(EventdPluginCoreContext *context, EventdEvent *event); 30 | 31 | typedef struct { 32 | EventdPluginCoreGetBindsFunc get_binds; 33 | EventdPluginCoreGetSocketsFunc get_sockets; 34 | 35 | EventdPluginCorePushEventFunc push_event; 36 | } EventdCoreInterface; 37 | 38 | struct EventdPluginInterface { 39 | EventdPluginInitFunc init; 40 | EventdPluginSimpleFunc uninit; 41 | 42 | EventdPluginSimpleFunc start; 43 | EventdPluginSimpleFunc stop; 44 | 45 | EventdPluginControlCommandFunc control_command; 46 | 47 | EventdPluginGlobalParseFunc global_parse; 48 | EventdPluginActionParseFunc action_parse; 49 | EventdPluginSimpleFunc config_reset; 50 | 51 | EventdPluginEventDispatchFunc event_dispatch; 52 | EventdPluginEventActionFunc event_action; 53 | }; 54 | 55 | #endif /* __EVENTD_EVENTD_PLUGIN_PRIVATE_H__ */ 56 | -------------------------------------------------------------------------------- /server/libeventd/meson.build: -------------------------------------------------------------------------------- 1 | # Main eventd library 2 | 3 | libeventd_inc = include_directories('include') 4 | libeventd_dep = [ 5 | gobject, 6 | glib, 7 | ] 8 | libeventd_sources = files( 9 | 'src/event-private.c', 10 | 'src/event.c', 11 | 'src/protocol-evp.c', 12 | 'src/protocol-evp-parser.c', 13 | 'src/protocol-evp-generator.c', 14 | ) 15 | libeventd_lib = library('eventd', config_h, files( 16 | 'include/libeventd-event-private.h', 17 | 'include/libeventd-event.h', 18 | 'include/libeventd-protocol.h', 19 | 'src/event-private.h', 20 | 'src/protocol-evp-private.h', 21 | ), libeventd_sources, 22 | c_args: [ 23 | '-DG_LOG_DOMAIN="libeventd"', 24 | ], 25 | dependencies: [ libnkutils_uuid, libeventd_dep ], 26 | version: '0.0.0', 27 | include_directories: libeventd_inc, 28 | install: true, 29 | ) 30 | 31 | libeventd_headers = files( 32 | 'include/libeventd-event.h', 33 | 'include/libeventd-protocol.h', 34 | ) 35 | install_headers(libeventd_headers, 36 | subdir: meson.project_name(), 37 | ) 38 | 39 | libeventd = declare_dependency(link_with: libeventd_lib, include_directories: libeventd_inc, dependencies: libeventd_dep) 40 | 41 | pkgconfig.generate(libeventd_lib, 42 | filebase: 'libeventd', 43 | name: 'libeventd', 44 | version: meson.project_version(), 45 | description: 'Main eventd library', 46 | subdirs: 'eventd', 47 | ) 48 | 49 | subdir('tests/unit') 50 | 51 | if get_option('gobject-introspection') 52 | libeventd_gir = gnome.generate_gir(libeventd_lib, 53 | dependencies: libeventd, 54 | namespace: 'Eventd', 55 | nsversion: '0', 56 | sources: libeventd_sources + libeventd_headers, 57 | includes: [ 'GObject-2.0', 'GLib-2.0' ], 58 | extra_args: [ 59 | '--c-include=libeventd-event.h', 60 | '--c-include=libeventd-protocol.h', 61 | ], 62 | install: true, 63 | ) 64 | if get_option('vapi') 65 | gnome.generate_vapi('libeventd', 66 | sources: [ libeventd_gir[0] ], 67 | packages: [ 'gobject-2.0', 'glib-2.0' ], 68 | install: true, 69 | ) 70 | endif 71 | endif 72 | -------------------------------------------------------------------------------- /server/libeventd/include/libeventd-event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-event - Main eventd library - Event manipulation 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTD_EVENT_H__ 22 | #define __EVENTD_EVENT_H__ 23 | 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | /* 30 | * EventdEvent 31 | */ 32 | typedef struct _EventdEvent EventdEvent; 33 | 34 | GType eventd_event_get_type(void) G_GNUC_CONST; 35 | 36 | #define EVENTD_TYPE_EVENT (eventd_event_get_type()) 37 | 38 | /* 39 | * Functions 40 | */ 41 | EventdEvent *eventd_event_new(const gchar *category, const gchar *name); 42 | EventdEvent *eventd_event_ref(EventdEvent *event); 43 | void eventd_event_unref(EventdEvent *event); 44 | 45 | void eventd_event_add_data(EventdEvent *event, gchar *name, GVariant *content); 46 | void eventd_event_add_data_string(EventdEvent *event, gchar *name, gchar *content); 47 | 48 | const gchar *eventd_event_get_uuid(EventdEvent *event); 49 | const gchar *eventd_event_get_category(const EventdEvent *event); 50 | const gchar *eventd_event_get_name(const EventdEvent *event); 51 | gboolean eventd_event_has_data(const EventdEvent *event, const gchar *name); 52 | GVariant *eventd_event_get_data(const EventdEvent *event, const gchar *name); 53 | const gchar *eventd_event_get_data_string(const EventdEvent *event, const gchar *name); 54 | GHashTable *eventd_event_get_all_data(const EventdEvent *event); 55 | 56 | G_END_DECLS 57 | 58 | #endif /* __EVENTD_EVENT_H__ */ 59 | -------------------------------------------------------------------------------- /server/eventd/src/eventd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_CORE_H__ 24 | #define __EVENTD_CORE_H__ 25 | 26 | #include "types.h" 27 | 28 | typedef enum { 29 | EVENTD_RETURN_CODE_OK = 0, 30 | EVENTD_RETURN_CODE_FILESYSTEM_ENCODING_ERROR = 1, 31 | EVENTD_RETURN_CODE_ARGV_ERROR = 3, 32 | EVENTD_RETURN_CODE_NO_RUNTIME_DIR_ERROR = 4, 33 | EVENTD_RETURN_CODE_CONTROL_INTERFACE_ERROR = 10, 34 | } EventdReturnCode; 35 | 36 | GList *eventd_core_get_binds(EventdCoreContext *context, const gchar *namespace, const gchar * const *binds); 37 | GList *eventd_core_get_sockets(EventdCoreContext *context, const gchar *namespace, GSocketAddress **binds); 38 | 39 | const gchar *eventd_core_get_uuid(EventdCoreContext *context); 40 | 41 | gboolean eventd_core_push_event(EventdCoreContext *context, EventdEvent *event); 42 | 43 | void eventd_core_flags_add(EventdCoreContext *context, GQuark flag); 44 | void eventd_core_flags_remove(EventdCoreContext *context, GQuark flag); 45 | gboolean eventd_core_flags_test(EventdCoreContext *context, GQuark flag); 46 | void eventd_core_flags_reset(EventdCoreContext *context); 47 | gchar *eventd_core_flags_list(EventdCoreContext *context); 48 | 49 | void eventd_core_config_reload(EventdCoreContext *context); 50 | 51 | void eventd_core_stop(EventdCoreContext *context, EventdControlDelayedStop *delayed_stop); 52 | 53 | gchar *eventd_core_dump_event(EventdCoreContext *context, const gchar *event_id); 54 | gchar *eventd_core_dump_action(EventdCoreContext *context, const gchar *action_id); 55 | 56 | #endif /* __EVENTD_CORE_H__ */ 57 | -------------------------------------------------------------------------------- /server/modules/meson.build: -------------------------------------------------------------------------------- 1 | modules_build_dir = meson.current_build_dir() 2 | 3 | libsoup = dependency('libsoup-3.0', required: get_option('websocket')) 4 | if libsoup.found() 5 | docbook_conditions += 'enable_websocket' 6 | ws = shared_library('ws', config_h, files( 7 | 'include/eventd-ws-module.h', 8 | 'src/ws.c', 9 | ), 10 | c_args: [ 11 | '-DG_LOG_DOMAIN="eventd-ws"', 12 | ], 13 | include_directories: include_directories('include'), 14 | dependencies: [ 15 | libsoup, 16 | libeventc, 17 | libeventd, 18 | gio, 19 | gobject, 20 | glib, 21 | ], 22 | name_prefix: '', 23 | install: true, 24 | install_dir: modules_install_dir, 25 | ) 26 | endif 27 | 28 | avahi = dependency('avahi-client', required: get_option('dns-sd')) 29 | avahi_glib = dependency('avahi-glib', required: get_option('dns-sd')) 30 | if avahi.found() and avahi_glib.found() 31 | docbook_conditions += 'enable_dns_sd' 32 | dns_sd = shared_library('dns-sd', config_h, files( 33 | 'include/eventd-sd-module.h', 34 | 'src/dns-sd.c', 35 | ), 36 | c_args: [ 37 | '-DG_LOG_DOMAIN="eventd-dns-sd"', 38 | ], 39 | include_directories: include_directories('include'), 40 | dependencies: [ 41 | avahi_glib, 42 | avahi, 43 | libeventd, 44 | gio, 45 | gobject, 46 | glib, 47 | ], 48 | name_prefix: '', 49 | install: true, 50 | install_dir: modules_install_dir, 51 | ) 52 | endif 53 | 54 | gssdp = dependency('gssdp-1.6', required: get_option('ssdp')) 55 | if gssdp.found() 56 | docbook_conditions += 'enable_ssdp' 57 | ssdp = shared_library('ssdp', config_h, files( 58 | 'include/eventd-sd-module.h', 59 | 'src/ssdp.c', 60 | ), 61 | c_args: [ 62 | '-DG_LOG_DOMAIN="eventd-ssdp"', 63 | ], 64 | include_directories: include_directories('include'), 65 | dependencies: [ 66 | gssdp, 67 | libeventd, 68 | libnkutils_uuid, 69 | gio, 70 | gobject, 71 | glib, 72 | ], 73 | name_prefix: '', 74 | install: true, 75 | install_dir: modules_install_dir, 76 | ) 77 | endif 78 | -------------------------------------------------------------------------------- /server/modules/include/eventd-sd-module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_SD_MODULE_H__ 24 | #define __EVENTD_SD_MODULE_H__ 25 | 26 | #include "libeventd-event.h" 27 | 28 | typedef struct _EventdRelayServer EventdRelayServer; 29 | 30 | typedef enum { 31 | EVENTD_SD_MODULE_NONE = 0, 32 | EVENTD_SD_MODULE_DNS_SD, 33 | EVENTD_SD_MODULE_SSDP, 34 | _EVENTD_SD_MODULES_SIZE 35 | } EventdSdModules; 36 | 37 | typedef struct { 38 | gboolean (*server_has_address)(EventdRelayServer *server); 39 | void (*server_set_address)(EventdRelayServer *server, GSocketConnectable *address); 40 | void (*server_start)(EventdRelayServer *server, gboolean force); 41 | void (*server_stop)(EventdRelayServer *server); 42 | } EventdSdModuleControlInterface; 43 | 44 | typedef struct _EventdSdModuleContext EventdSdModuleContext; 45 | 46 | typedef struct { 47 | EventdSdModuleContext *(*init)(const EventdSdModuleControlInterface *control, GList *sockets); 48 | void (*uninit)(EventdSdModuleContext *context); 49 | 50 | void (*set_publish_name)(EventdSdModuleContext *context, const gchar *publish_name); 51 | void (*monitor_server)(EventdSdModuleContext *context, const gchar *discover_name, EventdRelayServer *server); 52 | 53 | void (*start)(EventdSdModuleContext *context); 54 | void (*stop)(EventdSdModuleContext *context); 55 | 56 | gpointer module; 57 | EventdSdModuleContext *context; 58 | } EventdSdModule; 59 | 60 | typedef void (*EventdSdModuleGetInfoFunc)(EventdSdModule *backend); 61 | void eventd_sd_module_get_info(EventdSdModule *backend); 62 | 63 | #endif /* __EVENTD_SD_MODULE_H__ */ 64 | -------------------------------------------------------------------------------- /server/eventdctl/include/eventdctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventdctl - Control utility for eventd 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTCTL_H__ 24 | #define __EVENTCTL_H__ 25 | 26 | #include "eventd-plugin.h" 27 | 28 | typedef enum { 29 | EVENTDCTL_RETURN_CODE_OK = 0, 30 | EVENTDCTL_RETURN_CODE_ARGV_ERROR = 1, 31 | EVENTDCTL_RETURN_CODE_CONNECTION_ERROR = 10, 32 | EVENTDCTL_RETURN_CODE_INVOCATION_ERROR = 11, 33 | EVENTDCTL_RETURN_CODE_COMMAND_ERROR = 20, 34 | EVENTDCTL_RETURN_CODE_PLUGIN_ERROR = 21, 35 | EVENTDCTL_RETURN_CODE_PLUGIN_COMMAND_ERROR = EVENTD_PLUGIN_COMMAND_STATUS_COMMAND_ERROR, 36 | EVENTDCTL_RETURN_CODE_PLUGIN_EXEC_ERROR = EVENTD_PLUGIN_COMMAND_STATUS_EXEC_ERROR, 37 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_1 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_1, 38 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_2 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_2, 39 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_3 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_3, 40 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_4 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_4, 41 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_5 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_5, 42 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_6 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_6, 43 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_7 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_7, 44 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_8 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_8, 45 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_9 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_9, 46 | EVENTDCTL_RETURN_CODE_PLUGIN_CUSTOM_10 = EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_10, 47 | } EventdctlReturnCode; 48 | 49 | #endif /* __EVENTCTL_H__ */ 50 | -------------------------------------------------------------------------------- /server/libeventd/src/protocol-evp-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-protocol - Main eventd library - Protocol manipulation 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTD_PROTOCOL_EVP_PRIVATE_H__ 22 | #define __EVENTD_PROTOCOL_EVP_PRIVATE_H__ 23 | 24 | typedef enum { 25 | EVENTD_PROTOCOL_EVP_STATE_BASE = 0, 26 | EVENTD_PROTOCOL_EVP_STATE_PASSIVE, 27 | EVENTD_PROTOCOL_EVP_STATE_SUBSCRIBE, 28 | EVENTD_PROTOCOL_EVP_STATE_BYE, 29 | EVENTD_PROTOCOL_EVP_STATE_DOT_SUBSCRIBE, 30 | EVENTD_PROTOCOL_EVP_STATE_DOT_EVENT, 31 | EVENTD_PROTOCOL_EVP_STATE_IGNORING, 32 | _EVENTD_PROTOCOL_EVP_STATE_SIZE 33 | } EventdProtocolState; 34 | 35 | struct _EventdProtocol { 36 | guint64 refcount; 37 | 38 | const EventdProtocolCallbacks *callbacks; 39 | gpointer user_data; 40 | GDestroyNotify notify; 41 | 42 | EventdProtocolState state; 43 | EventdProtocolState base_state; 44 | union { 45 | struct { 46 | guint64 level; 47 | } catchall; 48 | EventdEvent *event; 49 | GHashTable *subscriptions; 50 | }; 51 | struct { 52 | GHashTable *hash; 53 | EventdProtocolState return_state; 54 | gchar *name; 55 | GString *value; 56 | } data; 57 | }; 58 | 59 | gboolean eventd_protocol_evp_parse(EventdProtocol *protocol, const gchar *buffer, GError **error); 60 | void eventd_protocol_evp_parse_free(EventdProtocol *self); 61 | 62 | gchar *eventd_protocol_evp_generate_event(EventdProtocol *protocol, EventdEvent *event); 63 | gchar *eventd_protocol_evp_generate_subscribe(EventdProtocol *protocol, GHashTable *categories); 64 | gchar *eventd_protocol_evp_generate_bye(EventdProtocol *protocol, const gchar *message); 65 | 66 | 67 | #endif /* __EVENTD_PROTOCOL_EVP_PRIVATE_H__ */ 68 | -------------------------------------------------------------------------------- /server/libeventd-plugin/src/core.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-plugin - Library to implement an eventd plugin 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | 25 | #include "eventd-plugin.h" 26 | #include "eventd-plugin-private.h" 27 | 28 | /** 29 | * eventd_plugin_core_get_binds: 30 | * @context: an #EventdPluginCoreContext 31 | * @binds: (array zero-terminated=1) (element-type utf8) (nullable): list of strings 32 | * 33 | * Returns: (element-type GSocket) (transfer full): list of sockets for the binds 34 | */ 35 | EVENTD_EXPORT 36 | GList * 37 | eventd_plugin_core_get_binds(EventdPluginCoreContext *context, const gchar *namespace, const gchar * const *binds) 38 | { 39 | return ((EventdCoreInterface *) context)->get_binds(context, namespace, binds); 40 | } 41 | 42 | /** 43 | * eventd_plugin_core_get_sockets: 44 | * @context: an #EventdPluginCoreContext 45 | * @binds: (array zero-terminated=1) (element-type utf8) (nullable): list of strings 46 | * 47 | * Returns: (element-type GSocket) (transfer full): list of sockets for the binds 48 | */ 49 | EVENTD_EXPORT 50 | GList * 51 | eventd_plugin_core_get_sockets(EventdPluginCoreContext *context, const gchar *namespace, GSocketAddress **binds) 52 | { 53 | return ((EventdCoreInterface *) context)->get_sockets(context, namespace, binds); 54 | } 55 | 56 | /** 57 | * eventd_plugin_core_push_event: 58 | * @context: an #EventdPluginCoreContext 59 | * @event: an #EventdEvent 60 | * 61 | * Pushes an event into the queue. 62 | * 63 | * Returns: %TRUE if the event was pushed successfully. 64 | */ 65 | EVENTD_EXPORT 66 | gboolean 67 | eventd_plugin_core_push_event(EventdPluginCoreContext *context, EventdEvent *event) 68 | { 69 | return ((EventdCoreInterface *) context)->push_event(context, event); 70 | } 71 | -------------------------------------------------------------------------------- /server/eventd/meson.build: -------------------------------------------------------------------------------- 1 | # Server 2 | 3 | eventd_c_args = [ 4 | '-DG_LOG_DOMAIN="eventd"', 5 | ] 6 | eventd_deps = [ 7 | ws_module, 8 | libeventc, 9 | libeventd_plugin, 10 | libeventd_helpers, 11 | libeventd, 12 | libnkutils, 13 | libnkutils_uuid, 14 | gio, 15 | gmodule, 16 | gobject, 17 | glib 18 | ] 19 | if get_option('systemd') 20 | eventd_deps += dependency('libsystemd', version: '>= 209') 21 | eventd_c_args += '-DENABLE_SYSTEMD' 22 | docbook_conditions += 'enable_systemd' 23 | endif 24 | 25 | eventd = executable('eventd', config_h, files( 26 | 'src/types.h', 27 | 'src/config_.h', 28 | 'src/config.c', 29 | 'src/events.h', 30 | 'src/events.c', 31 | 'src/actions.h', 32 | 'src/actions.c', 33 | 'src/plugins.h', 34 | 'src/plugins.c', 35 | 'src/sd-modules.h', 36 | 'src/sd-modules.c', 37 | 'src/control.h', 38 | 'src/control.c', 39 | 'src/sockets.h', 40 | 'src/sockets.c', 41 | 'src/eventd.h', 42 | 'src/eventd.c', 43 | 'src/evp/evp.h', 44 | 'src/evp/evp-internal.h', 45 | 'src/evp/evp.c', 46 | 'src/evp/client.h', 47 | 'src/evp/client.c', 48 | 'src/relay/relay.h', 49 | 'src/relay/relay.c', 50 | 'src/relay/server.h', 51 | 'src/relay/server.c', 52 | ), 53 | c_args: eventd_c_args, 54 | dependencies: eventd_deps, 55 | include_directories: eventdctl_inc, 56 | install: true, 57 | ) 58 | 59 | eventd_test_dep = declare_dependency( 60 | dependencies: eventd_deps, 61 | include_directories: [ include_directories('src'), eventdctl_inc ], 62 | ) 63 | 64 | 65 | man_pages += [ [ files('man/eventd.xml'), 'eventd.1' ] ] 66 | man_pages += [ [ files('man/eventd.conf.xml'), 'eventd.conf.5' ] ] 67 | 68 | pkgconfig.generate( 69 | filebase: 'eventd', 70 | name: 'eventd', 71 | version: meson.project_version(), 72 | description: 'eventd daemon', 73 | url: 'https://www.eventd.org/', 74 | variables: [ 75 | 'datadir=@0@'.format(join_paths('${prefix}', get_option('datadir'))), 76 | 'eventdir=${datadir}/eventd', 77 | 'ssdp_ns_uuid=@0@'.format(evp_ssdp_ns_uuid), 78 | 'ssdp_urn=@0@'.format(evp_ssdp_urn), 79 | ], 80 | install_dir: join_paths(get_option('datadir'), 'pkgconfig') 81 | ) 82 | 83 | subdir('tests/unit') 84 | 85 | if get_option('systemd') 86 | systemd = dependency('systemd') 87 | eventd_units = [ 88 | 'eventd-control.socket', 89 | 'eventd.socket', 90 | 'eventd.service', 91 | ] 92 | 93 | subdir('units/user') 94 | subdir('units/system') 95 | endif 96 | -------------------------------------------------------------------------------- /server/libeventd/vapi/libeventd.vapi: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-event - Library to manipulate eventd events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | namespace Eventd 22 | { 23 | [CCode (cheader_filename = "libeventd-event.h")] 24 | public class Event : GLib.Object 25 | { 26 | [CCode (has_construct_function = false)] 27 | public Event(string category, string name); 28 | 29 | public void add_data(owned string name, owned GLib.Variant content); 30 | public void add_data_string(owned string name, owned string content); 31 | 32 | public unowned string get_category(); 33 | public unowned string get_name(); 34 | public bool has_data(string name); 35 | public unowned GLib.Variant? get_data(string name); 36 | public unowned string? get_data_string(string name); 37 | public GLib.HashTable? get_all_data(); 38 | } 39 | 40 | [CCode (cheader_filename = "libeventd-protocol.h")] 41 | public errordomain ProtocolParseError 42 | { 43 | UNEXPECTED_TOKEN, 44 | MALFORMED, 45 | GARBAGE, 46 | WRONG_UUID, 47 | KNOWN_ID, 48 | UNKNOWN_ID, 49 | UNKNOWN; 50 | } 51 | 52 | [CCode (cheader_filename = "libeventd-protocol.h")] 53 | public interface Protocol : GLib.Object 54 | { 55 | public abstract bool parse(string buffer) throws ProtocolParseError; 56 | 57 | public abstract string generate_event(Eventd.Event event); 58 | public abstract string generate_subscribe(GLib.HashTable? categories); 59 | public abstract string generate_bye(string? message); 60 | 61 | public signal void event(Eventd.Event event); 62 | public signal void subscribe(GLib.HashTable? categories); 63 | public signal void bye(string? message); 64 | } 65 | 66 | [CCode (cheader_filename = "libeventd-protocol.h")] 67 | public class ProtocolEvp : GLib.Object, Eventd.Protocol 68 | { 69 | [CCode (has_construct_function = false, type = "EventdProtocol*")] 70 | public ProtocolEvp(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /PROTOCOL: -------------------------------------------------------------------------------- 1 | This file describes the EVENT protocol (EvP), 2 | a generic events dispatching protocol 3 | 4 | 5 | This protocol can be server on a UNIX stream socket or a TCP connection. 6 | When using TCP, the connection *must* use TLS. 7 | 8 | 9 | Messages are UTF-8 text which ends at the "\n" character. 10 | Messages starting with a dot (".") are multiple-lines messages and ends with a 11 | single dot on its own line (".\n"). They are referred as "dot messages". 12 | Any error in the pairing should close the connection. Implementations should 13 | send a "BYE Wrong dot message" message in this case. 14 | 15 | An implementation must discard unknown messages for compatibility. 16 | Only dot messages require special handling regarding that: an implementation 17 | must match any dot message with its corresponding ending line (".\n") and 18 | ignore it. Nesting is possible and must be handled. 19 | 20 | If the first received message is a valid HTTP request (so "GET / HTTP/1.1\r"), 21 | the implementation should either handle it as EvP over WebSocket or send 22 | an 501 status (so "HTTP/1.1 501 Not Implemented\r\n\r\n") and close the 23 | connection. 24 | 25 | 26 | 27 | Event related messages 28 | ---------------------- 29 | 30 | .EVENT 31 | Inform the server that an event happened 32 | The id is a UUID. 33 | The name must contain only the characters 34 | "A-Za-z0-9-." (without the quotes). 35 | The category can use the same characters as the name. 36 | Special categories may exist, beginning by a dot ('.'). 37 | These special events are generated by action endpoints, 38 | for example to indicate user action. 39 | These special events *must* be forwarded to all connected clients. 40 | The message may contain data using the corresponding messages. 41 | 42 | DATA 43 | These messages are nested in .EVENT messages. 44 | The data name has the same constraints as event category and name. 45 | The data content is a GVariant text. 46 | See https://developer.gnome.org/glib/stable/gvariant-text.html 47 | for more information. 48 | 49 | Connection related messages 50 | --------------------------- 51 | 52 | SUBSCRIBE [] 53 | .SUBSCRIBE 54 | Ask the server to send us events. 55 | The first form ask for either all events or a single category. 56 | The second form ask for any number of categories (but at least two). 57 | Must be sent only once. 58 | 59 | PING 60 | Both server and client can send this message as a probe at any time 61 | to keep the connection alive. No answer is required. 62 | 63 | BYE [] 64 | Close the connection. 65 | The connection is closed immediately and must not be used any more. 66 | The reason is an human readable reason possibly shown to the user. 67 | The reason is optional, thus implementations must check for the exact 68 | "BYE" message as well as the "BYE " prefix. 69 | -------------------------------------------------------------------------------- /server/modules/src/ws-load.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | #include "libeventd-helpers-dirs.h" 32 | 33 | #include "eventd-ws-module.h" 34 | 35 | static EventdWsModule * 36 | _eventd_ws_module_load_dir(gchar *modules_dir_name) 37 | { 38 | eventd_debug("Scanning modules dir: %s", modules_dir_name); 39 | 40 | gchar *file; 41 | file = g_build_filename(modules_dir_name, "ws." G_MODULE_SUFFIX, NULL); 42 | g_free(modules_dir_name); 43 | 44 | if ( ( ! g_file_test(file, G_FILE_TEST_EXISTS) ) || g_file_test(file, G_FILE_TEST_IS_DIR) ) 45 | { 46 | g_free(file); 47 | return NULL; 48 | } 49 | 50 | GModule *module; 51 | module = g_module_open(file, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL); 52 | g_free(file); 53 | if ( module == NULL ) 54 | { 55 | g_warning("Couldn't load WebSocket module: %s", g_module_error()); 56 | return NULL; 57 | } 58 | 59 | EventdWsModuleGetInfoFunc get_info; 60 | if ( ! g_module_symbol(module, "eventd_ws_module_get_info", (void **)&get_info) ) 61 | return NULL; 62 | 63 | eventd_debug("Loading WebSocket module"); 64 | 65 | EventdWsModule *ws_module; 66 | ws_module = g_new(EventdWsModule, 1); 67 | get_info(ws_module); 68 | ws_module->module = module; 69 | return ws_module; 70 | } 71 | 72 | EventdWsModule * 73 | eventd_ws_init(void) 74 | { 75 | if ( ! g_module_supported() ) 76 | return NULL; 77 | 78 | EventdWsModule *ws = NULL; 79 | gchar **dirs, **dir; 80 | dirs = evhelpers_dirs_get_lib("MODULES", "modules" G_DIR_SEPARATOR_S MODULES_VERSION); 81 | for ( dir = dirs ; ( ws == NULL ) && ( *dir != NULL ) ; ++dir ) 82 | ws = _eventd_ws_module_load_dir(*dir); 83 | g_free(dirs); 84 | return ws; 85 | } 86 | 87 | void 88 | eventd_ws_uninit(EventdWsModule *module) 89 | { 90 | if ( module == NULL ) 91 | return; 92 | 93 | g_module_close(module->module); 94 | g_free(module); 95 | } 96 | 97 | -------------------------------------------------------------------------------- /plugins/sound/man/eventd-sound.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | %config; 5 | ]> 6 | 7 | 27 | 28 | 30 | 31 | 32 | 33 | eventd-sound.conf 34 | 5 35 | 36 | 37 | 38 | eventd-sound.conf 39 | Sound plugin configuration 40 | 41 | 42 | 43 | 44 | Configuration for the sound plugin. 45 | 46 | 47 | 48 | 49 | Description 50 | 51 | 52 | The sound plugin plays sound files read with libsndfile through PulseAudio. 53 | 54 | 55 | 56 | 57 | Action sections 58 | 59 | 60 | Section <varname>[Sound]</varname> 61 | 62 | 63 | 64 | Disable= 65 | 66 | A boolean 67 | If true, no sound will be play. 68 | 69 | 70 | 71 | 72 | Sound= (defaults to "sound") 73 | 74 | A file URI 75 | The sound data or file to read on event. 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /plugins/test-plugin/src/test-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | #include 27 | 28 | #include "eventd-plugin.h" 29 | #include "libeventd-event.h" 30 | #include "libeventd-event-private.h" 31 | 32 | static struct _EventdPluginContext { 33 | EventdPluginCoreContext *core; 34 | } _eventd_test_context; 35 | 36 | static EventdPluginContext * 37 | _eventd_test_init(EventdPluginCoreContext *core) 38 | { 39 | _eventd_test_context.core = core; 40 | return &_eventd_test_context; 41 | } 42 | 43 | static void 44 | _eventd_test_uninit(EventdPluginContext *context) 45 | { 46 | } 47 | 48 | static EventdPluginAction * 49 | _eventd_test_action_parse(EventdPluginContext *context, GKeyFile *key_file) 50 | { 51 | if ( ! g_key_file_has_group(key_file, "TestPlugin") ) 52 | return NULL; 53 | 54 | return (EventdPluginAction *) -1; 55 | } 56 | 57 | static void 58 | _eventd_test_event_action(EventdPluginContext *context, EventdPluginAction *action, EventdEvent *event) 59 | { 60 | GError *error = NULL; 61 | 62 | const gchar *filename; 63 | const gchar *contents; 64 | 65 | filename = eventd_event_get_data_string(event, "file"); 66 | contents = eventd_event_get_data_string(event, "test"); 67 | 68 | if ( ( filename == NULL ) || ( contents == NULL ) ) 69 | return; 70 | 71 | if ( ! g_file_set_contents(filename, contents, -1, &error) ) 72 | g_warning("Couldn’t write to file: %s", error->message); 73 | g_clear_error(&error); 74 | 75 | event = eventd_event_new_for_uuid_string("cedb8a77-b7fb-4e32-b3e4-3a772664f1f4", "test", "answer"); 76 | eventd_plugin_core_push_event(context->core, event); 77 | eventd_event_unref(event); 78 | } 79 | 80 | EVENTD_EXPORT const gchar *eventd_plugin_id = "test-plugin"; 81 | EVENTD_EXPORT 82 | void 83 | eventd_plugin_get_interface(EventdPluginInterface *interface) 84 | { 85 | eventd_plugin_interface_add_init_callback(interface, _eventd_test_init); 86 | eventd_plugin_interface_add_uninit_callback(interface, _eventd_test_uninit); 87 | 88 | eventd_plugin_interface_add_action_parse_callback(interface, _eventd_test_action_parse); 89 | eventd_plugin_interface_add_event_action_callback(interface, _eventd_test_event_action); 90 | } 91 | -------------------------------------------------------------------------------- /server/libeventd/include/libeventd-protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-event - Library to manipulate eventd events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTD_PROTOCOL_H__ 22 | #define __EVENTD_PROTOCOL_H__ 23 | 24 | #include "libeventd-event.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | /* 29 | * EventdProtocol 30 | */ 31 | 32 | typedef struct _EventdProtocol EventdProtocol; 33 | typedef struct _EventdProtocolCallbacks EventdProtocolCallbacks; 34 | 35 | GType eventd_protocol_get_type(void); 36 | 37 | #define EVENTD_TYPE_PROTOCOL (eventd_protocol_get_type()) 38 | 39 | struct _EventdProtocolCallbacks 40 | { 41 | void (*event)(EventdProtocol *protocol, EventdEvent *event, gpointer user_data); 42 | void (*subscribe)(EventdProtocol *protocol, GHashTable *categories, gpointer user_data); 43 | void (*ping)(EventdProtocol *protocol, gpointer user_data); 44 | void (*bye)(EventdProtocol *protocol, const gchar *message, gpointer user_data); 45 | }; 46 | 47 | /* 48 | * EventdProtocolParseError 49 | */ 50 | typedef enum { 51 | EVENTD_PROTOCOL_PARSE_ERROR_UNEXPECTED_TOKEN, 52 | EVENTD_PROTOCOL_PARSE_ERROR_MALFORMED, 53 | EVENTD_PROTOCOL_PARSE_ERROR_GARBAGE, 54 | EVENTD_PROTOCOL_PARSE_ERROR_WRONG_UUID, 55 | EVENTD_PROTOCOL_PARSE_ERROR_KNOWN_ID, 56 | EVENTD_PROTOCOL_PARSE_ERROR_UNKNOWN_ID, 57 | EVENTD_PROTOCOL_PARSE_ERROR_UNKNOWN 58 | } EventdProtocolParseError; 59 | 60 | GQuark eventd_protocol_parse_error_quark(void); 61 | #define EVENTD_PROTOCOL_PARSE_ERROR (eventd_protocol_parse_error_quark()) 62 | 63 | /* 64 | * Functions 65 | */ 66 | 67 | EventdProtocol *eventd_protocol_new(const EventdProtocolCallbacks *callbacks, gpointer user_data, GDestroyNotify notify); 68 | EventdProtocol *eventd_protocol_ref(EventdProtocol *protocol); 69 | void eventd_protocol_unref(EventdProtocol *protocol); 70 | 71 | gboolean eventd_protocol_parse(EventdProtocol *protocol, gchar *buffer, gsize length, GError **error); 72 | 73 | gchar *eventd_protocol_generate_event(EventdProtocol *protocol, EventdEvent *event); 74 | gchar *eventd_protocol_generate_subscribe(EventdProtocol *protocol, GHashTable *categories); 75 | gchar *eventd_protocol_generate_ping(EventdProtocol *protocol); 76 | gchar *eventd_protocol_generate_bye(EventdProtocol *protocol, const gchar *message); 77 | 78 | 79 | G_END_DECLS 80 | 81 | #endif /* __EVENTD_PROTOCOL_H__ */ 82 | -------------------------------------------------------------------------------- /plugins/canberra/man/eventd-canberra.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | %config; 5 | ]> 6 | 7 | 27 | 28 | 30 | 31 | 32 | 33 | eventd-canberra.conf 34 | 5 35 | 36 | 37 | 38 | eventd-canberra.conf 39 | libcanberra plugin configuration 40 | 41 | 42 | 43 | 44 | Configuration for the libcanberra plugin. 45 | 46 | 47 | 48 | 49 | Description 50 | 51 | 52 | The canberra plugin plays theme-based sounds through the system mechanism. 53 | 54 | 55 | 56 | 57 | Action sections 58 | 59 | 60 | Section <varname>[Libcanberra]</varname> 61 | 62 | 63 | 64 | Disable= 65 | 66 | A boolean 67 | If true, no sound will be played. 68 | 69 | 70 | 71 | 72 | Sound= (defaults to "sound") 73 | 74 | A file URI 75 | The sound file to play. 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /server/libeventd-helpers/src/reconnect.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd - Internal helper 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | 27 | #include "libeventd-helpers-reconnect.h" 28 | 29 | struct _LibeventdReconnectHandler { 30 | gint64 timeout; 31 | gint64 max_tries; 32 | LibeventdReconnectTryCallback callback; 33 | gpointer user_data; 34 | guint64 try; 35 | guint timeout_tag; 36 | }; 37 | 38 | EVENTD_EXPORT 39 | LibeventdReconnectHandler * 40 | evhelpers_reconnect_new(gint64 timeout, gint64 max_tries, LibeventdReconnectTryCallback callback, gpointer user_data) 41 | { 42 | g_return_val_if_fail(callback != NULL, NULL); 43 | 44 | LibeventdReconnectHandler *self; 45 | 46 | self = g_slice_new0(LibeventdReconnectHandler); 47 | 48 | self->timeout = timeout; 49 | self->max_tries = max_tries; 50 | self->callback = callback; 51 | self->user_data = user_data; 52 | 53 | return self; 54 | } 55 | 56 | EVENTD_EXPORT 57 | void 58 | evhelpers_reconnect_free(LibeventdReconnectHandler *self) 59 | { 60 | if ( self->timeout_tag > 0 ) 61 | g_source_remove(self->timeout_tag); 62 | g_slice_free(LibeventdReconnectHandler, self); 63 | } 64 | 65 | static gboolean 66 | _evhelpers_reconnect_timeout(gpointer user_data) 67 | { 68 | LibeventdReconnectHandler *self = user_data; 69 | 70 | self->callback(self, self->user_data); 71 | 72 | self->timeout_tag = 0; 73 | return G_SOURCE_REMOVE; 74 | } 75 | 76 | EVENTD_EXPORT 77 | gboolean 78 | evhelpers_reconnect_too_much(LibeventdReconnectHandler *self) 79 | { 80 | return ( ( self->max_tries > 0 ) && ( self->try >= (guint64) self->max_tries ) ); 81 | } 82 | 83 | EVENTD_EXPORT 84 | gboolean 85 | evhelpers_reconnect_try(LibeventdReconnectHandler *self) 86 | { 87 | if ( evhelpers_reconnect_too_much(self) ) 88 | return FALSE; 89 | if ( self->timeout_tag > 0 ) 90 | return TRUE; 91 | 92 | guint seconds = self->timeout << self->try; 93 | 94 | self->timeout_tag = g_timeout_add_seconds(MIN(seconds, 3600), _evhelpers_reconnect_timeout, self); 95 | ++self->try; 96 | return TRUE; 97 | } 98 | 99 | EVENTD_EXPORT 100 | void 101 | evhelpers_reconnect_reset(LibeventdReconnectHandler *self) 102 | { 103 | self->try = 0; 104 | if ( self->timeout_tag > 0 ) 105 | g_source_remove(self->timeout_tag); 106 | self->timeout_tag = 0; 107 | } 108 | -------------------------------------------------------------------------------- /plugins/tts/man/eventd-tts.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | %config; 5 | ]> 6 | 7 | 27 | 28 | 30 | 31 | 32 | 33 | eventd-tts.conf 34 | 5 35 | 36 | 37 | 38 | eventd-tts.conf 39 | Text-to-speech plugin configuration 40 | 41 | 42 | 43 | 44 | Configuration for the text-to-speech plugin. 45 | 46 | 47 | 48 | 49 | Description 50 | 51 | 52 | The tts plugin provides Text-to-Speech support through Speech Dispatcher. 53 | 54 | 55 | 56 | 57 | Action sections 58 | 59 | 60 | Section <varname>[TTS]</varname> 61 | 62 | 63 | 64 | Disable= 65 | 66 | A boolean 67 | If true, no text will be read. 68 | 69 | 70 | 71 | 72 | Message= (defaults to "<voice name="${message-lang}">${message}</voice>") 73 | 74 | A localised format string 75 | The text which will be read using. You can use SSMLSpeech Synthesis Markup Language. 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /client/libeventc-light/include/libeventc-light.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventc-light - Library to communicate with eventd, light (local-only non-GIO) version 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTC_LIGHT_CONNECTION_H__ 22 | #define __EVENTC_LIGHT_CONNECTION_H__ 23 | 24 | #include 25 | #include "libeventd-event.h" 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef struct _EventcLightConnection EventcLightConnection; 30 | 31 | #ifdef G_OS_UNIX 32 | typedef gint EventcLightSocket; 33 | #else /* ! G_OS_UNIX */ 34 | #include 35 | #include 36 | typedef SOCKET EventcLightSocket; 37 | #endif /* ! G_OS_UNIX */ 38 | 39 | typedef void (*EventcLightConnectionReceivedEventCallback)(EventcLightConnection *connection, EventdEvent *event, gpointer user_data); 40 | typedef void (*EventcLightConnectionDisconnectedCallback)(EventcLightConnection *connection, gpointer user_data); 41 | 42 | const gchar *eventc_light_get_version(void); 43 | 44 | 45 | EventcLightConnection *eventc_light_connection_new(const gchar *name); 46 | EventcLightConnection *eventc_light_connection_ref(EventcLightConnection *connection); 47 | void eventc_light_connection_unref(EventcLightConnection *connection); 48 | 49 | void eventc_light_connection_set_received_event_callback(EventcLightConnection *connection, EventcLightConnectionReceivedEventCallback callback, gpointer data, GDestroyNotify notify); 50 | void eventc_light_connection_set_disconnected_callback(EventcLightConnection *connection, EventcLightConnectionDisconnectedCallback callback, gpointer data, GDestroyNotify notify); 51 | EventcLightSocket eventc_light_connection_get_socket(EventcLightConnection *connection); 52 | gint eventc_light_connection_read(EventcLightConnection *connection); 53 | 54 | gint eventc_light_connection_connect(EventcLightConnection *connection); 55 | gint eventc_light_connection_send_event(EventcLightConnection *connection, EventdEvent *event); 56 | gint eventc_light_connection_close(EventcLightConnection *connection); 57 | 58 | gboolean eventc_light_connection_is_connected(EventcLightConnection *connection, gint *error); 59 | 60 | void eventc_light_connection_set_name(EventcLightConnection *connection, const gchar *name); 61 | void eventc_light_connection_set_subscribe(EventcLightConnection *connection, gboolean subscribe); 62 | void eventc_light_connection_add_subscription(EventcLightConnection *connection, gchar *category); 63 | 64 | gboolean eventc_light_connection_get_subscribe(EventcLightConnection *connection); 65 | 66 | G_END_DECLS 67 | 68 | #endif /* __EVENTC_LIGHT_CONNECTION_H__ */ 69 | -------------------------------------------------------------------------------- /server/libeventd/src/protocol-evp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-protocol - Main eventd library - Protocol manipulation 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #include "libeventd-event.h" 29 | #include "libeventd-protocol.h" 30 | #include "libeventd-event-private.h" 31 | 32 | #include "protocol-evp-private.h" 33 | 34 | EVENTD_EXPORT GType eventd_protocol_get_type(void); 35 | G_DEFINE_BOXED_TYPE(EventdProtocol, eventd_protocol, eventd_protocol_ref, eventd_protocol_unref) 36 | 37 | static void 38 | _eventd_protocol_evp_free(EventdProtocol *protocol) 39 | { 40 | EventdProtocol *self = (EventdProtocol *) protocol; 41 | 42 | eventd_protocol_evp_parse_free(self); 43 | 44 | g_free(self); 45 | } 46 | 47 | /** 48 | * eventd_protocol_ref: 49 | * @protocol: an #EventdProtocol 50 | * 51 | * Increments the reference counter of @protocol. 52 | * 53 | * Returns: (transfer full): the #EventdProtocol 54 | */ 55 | EVENTD_EXPORT 56 | EventdProtocol * 57 | eventd_protocol_ref(EventdProtocol *self) 58 | { 59 | g_return_val_if_fail(self != NULL, NULL); 60 | 61 | ++self->refcount; 62 | 63 | return self; 64 | } 65 | 66 | /** 67 | * eventd_protocol_unref: 68 | * @protocol: an #EventdProtocol 69 | * 70 | * Decrements the reference counter of @protocol. 71 | * If it reaches 0, free @protocol. 72 | */ 73 | EVENTD_EXPORT 74 | void 75 | eventd_protocol_unref(EventdProtocol *self) 76 | { 77 | g_return_if_fail(self != NULL); 78 | 79 | if ( --self->refcount > 0 ) 80 | return; 81 | 82 | if ( self->notify != NULL ) 83 | self->notify(self->user_data); 84 | 85 | _eventd_protocol_evp_free(self); 86 | } 87 | 88 | /** 89 | * eventd_protocol_new: 90 | * 91 | * Returns: (transfer full): An #EventdProtocol 92 | */ 93 | EVENTD_EXPORT 94 | EventdProtocol * 95 | eventd_protocol_new(const EventdProtocolCallbacks *callbacks, gpointer user_data, GDestroyNotify notify) 96 | { 97 | EventdProtocol *self; 98 | 99 | self = g_new0(EventdProtocol, 1); 100 | self->refcount = 1; 101 | 102 | self->callbacks = callbacks; 103 | self->user_data = user_data; 104 | self->notify = notify; 105 | 106 | return self; 107 | } 108 | 109 | 110 | /* 111 | * EventdProtocolParseError 112 | */ 113 | 114 | EVENTD_EXPORT 115 | GQuark 116 | eventd_protocol_parse_error_quark(void) 117 | { 118 | return g_quark_from_static_string("eventd_protocol_parse_error-quark"); 119 | } 120 | -------------------------------------------------------------------------------- /plugins/ws/man/eventd-ws.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | %config; 5 | ]> 6 | 7 | 27 | 28 | 30 | 31 | 32 | 33 | eventd-ws.conf 34 | 5 35 | 36 | 37 | 38 | eventd-ws.conf 39 | WebSocket plugin configuration 40 | 41 | 42 | 43 | 44 | Configuration for the WebSocket plugin. 45 | 46 | 47 | 48 | 49 | Description 50 | 51 | 52 | The ws plugin implements the EVENT protocol over WebSocket. 53 | 54 | 55 | 56 | 57 | Global sections 58 | 59 | 60 | Section <varname>[Server]</varname> 61 | 62 | The ws plugin is using the same TLS certificate/key files as eventd. 63 | See eventd.conf5. 64 | 65 | 66 | 67 | ListenWS= 68 | 69 | A list of bindings 70 | Uses the same values as the option of eventd. See eventd1. 71 | 72 | 73 | 74 | WebSocketSecret= 75 | 76 | A string 77 | This secret is checked in client WebSocket handshake. 78 | Use wss://:secret@host/ URI (password with no user) to send a secret on client side. 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /plugins/exec/man/eventd-exec.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | %config; 5 | ]> 6 | 7 | 27 | 28 | 30 | 31 | 32 | 33 | eventd-exec.conf 34 | 5 35 | 36 | 37 | 38 | eventd-exec.conf 39 | exec plugin configuration 40 | 41 | 42 | 43 | 44 | Configuration for the exec plugin. 45 | 46 | 47 | 48 | 49 | Description 50 | 51 | 52 | The exec plugin allows to run arbitrary commands. 53 | 54 | 55 | 56 | 57 | Action sections 58 | 59 | 60 | Section <varname>[Exec]</varname> 61 | 62 | 63 | 64 | Disable= 65 | 66 | A boolean 67 | If true, no command will be run. 68 | 69 | 70 | 71 | 72 | Command= 73 | 74 | A format string 75 | The command to exec when an event occurs. It is run asynchronously. 76 | 77 | 78 | 79 | 80 | StdInTemplate= 81 | 82 | A file name, containing a format string 83 | The file name is not a file URI, no data references may be used here. 84 | The whole file content is taken as a format string. 85 | If present, the resolved format string will be written to the command standard input. 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /plugins/nd/src/backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_BACKEND_H__ 24 | #define __EVENTD_ND_BACKEND_H__ 25 | 26 | #include "libeventd-event.h" 27 | #include "eventd-plugin.h" 28 | 29 | #include "types.h" 30 | 31 | typedef enum { 32 | EVENTD_ND_BACKEND_NONE = 0, 33 | EVENTD_ND_BACKEND_WAYLAND, 34 | EVENTD_ND_BACKEND_XCB, 35 | EVENTD_ND_BACKEND_FBDEV, 36 | EVENTD_ND_BACKEND_WIN, 37 | _EVENTD_ND_BACKENDS_SIZE 38 | } EventdNdBackends; 39 | 40 | extern const gchar *eventd_nd_backends_names[_EVENTD_ND_BACKENDS_SIZE]; 41 | 42 | typedef struct { 43 | EventdNdContext *context; 44 | 45 | void (*shaping_update)(EventdNdContext *context, EventdNdShaping shaping); 46 | void (*geometry_update)(EventdNdContext *context, gint w, gint h, gint scale); 47 | gboolean (*backend_stop)(EventdNdContext *context); 48 | 49 | void (*notification_shape)(EventdNdNotification *notification, cairo_t *cr); 50 | void (*notification_draw)(EventdNdNotification *notification, cairo_surface_t *surface); 51 | } EventdNdInterface; 52 | 53 | 54 | typedef struct _EventdNdBackendContext EventdNdBackendContext; 55 | typedef struct _EventdNdSurface EventdNdSurface; 56 | 57 | typedef struct { 58 | EventdNdBackendContext *(*init)(EventdNdInterface *context, NkBindings *bindings); 59 | void (*uninit)(EventdNdBackendContext *context); 60 | 61 | EventdPluginCommandStatus (*status)(EventdNdBackendContext *context, GString *status); 62 | 63 | void (*global_parse)(EventdNdBackendContext *context, GKeyFile *config_file); 64 | void (*config_reset)(EventdNdBackendContext *context); 65 | 66 | gboolean (*start)(EventdNdBackendContext *context, const gchar *target); 67 | void (*stop)(EventdNdBackendContext *context); 68 | 69 | EventdNdSurface *(*surface_new)(EventdNdBackendContext *context, EventdNdNotification *notification, gint width, gint height); 70 | void (*surface_update)(EventdNdSurface *surface, gint width, gint height); 71 | void (*surface_free)(EventdNdSurface *surface); 72 | 73 | gpointer (*move_begin)(EventdNdBackendContext *context, gsize count); 74 | void (*move_surface)(EventdNdSurface *surface, gint x, gint y, gpointer data); 75 | void (*move_end)(EventdNdBackendContext *context, gpointer data); 76 | 77 | const gchar *name; 78 | gpointer module; 79 | EventdNdBackendContext *context; 80 | } EventdNdBackend; 81 | 82 | typedef void (*EventdNdBackendGetInfoFunc)(EventdNdBackend *backend); 83 | 84 | 85 | static inline gint 86 | _eventd_nd_compute_scale_from_dpi(gdouble dpi) 87 | { 88 | return (gint) ( dpi / 96. + 0.25 ); 89 | } 90 | 91 | static inline gint 92 | _eventd_nd_compute_scale_from_size(gint w, gint h, gint mm_w, gint mm_h) 93 | { 94 | gdouble dpi_x = ( (gdouble) w * 25.4 ) / (gdouble) mm_w; 95 | gdouble dpi_y = ( (gdouble) h * 25.4 ) / (gdouble) mm_h; 96 | gdouble dpi = MIN(dpi_x, dpi_y); 97 | 98 | return _eventd_nd_compute_scale_from_dpi(dpi); 99 | } 100 | 101 | #endif /* __EVENTD_ND_BACKEND_H__ */ 102 | -------------------------------------------------------------------------------- /plugins/im/src/ops.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | 27 | #include 28 | 29 | #include "ops.h" 30 | 31 | #define PURPLE_GLIB_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) 32 | #define PURPLE_GLIB_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) 33 | 34 | typedef struct { 35 | PurpleInputFunction function; 36 | guint result; 37 | gpointer user_data; 38 | } EventdImGLibIOData; 39 | 40 | static void 41 | _eventd_im_glib_io_free(gpointer data) 42 | { 43 | g_slice_free(EventdImGLibIOData, data); 44 | } 45 | 46 | static gboolean 47 | _eventd_im_glib_io_invoke(GIOChannel *source, GIOCondition cond, gpointer user_data) 48 | { 49 | EventdImGLibIOData *data = user_data; 50 | PurpleInputCondition condition = 0; 51 | 52 | if ( cond & PURPLE_GLIB_READ_COND ) 53 | condition |= PURPLE_INPUT_READ; 54 | if ( cond & PURPLE_GLIB_WRITE_COND ) 55 | condition |= PURPLE_INPUT_WRITE; 56 | 57 | data->function(data->user_data, g_io_channel_unix_get_fd(source), condition); 58 | 59 | return TRUE; 60 | } 61 | 62 | guint 63 | eventd_im_glib_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, gpointer user_data) 64 | { 65 | EventdImGLibIOData *data; 66 | GIOChannel *channel; 67 | GIOCondition cond = 0; 68 | 69 | data = g_slice_new(EventdImGLibIOData); 70 | 71 | data->function = function; 72 | data->user_data = user_data; 73 | 74 | if ( condition & PURPLE_INPUT_READ ) 75 | cond |= PURPLE_GLIB_READ_COND; 76 | if ( condition & PURPLE_INPUT_WRITE ) 77 | cond |= PURPLE_GLIB_WRITE_COND; 78 | 79 | channel = g_io_channel_unix_new(fd); 80 | data->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, _eventd_im_glib_io_invoke, data, _eventd_im_glib_io_free); 81 | g_io_channel_unref(channel); 82 | 83 | return data->result; 84 | } 85 | 86 | void 87 | eventd_im_debug_print(PurpleDebugLevel level, const char *category, const char *message) 88 | { 89 | GLogLevelFlags glib_level = G_LOG_LEVEL_DEBUG; 90 | switch ( level ) 91 | { 92 | case PURPLE_DEBUG_ALL: 93 | g_return_if_reached(); 94 | case PURPLE_DEBUG_MISC: 95 | glib_level = G_LOG_LEVEL_DEBUG; 96 | break; 97 | case PURPLE_DEBUG_INFO: 98 | glib_level = G_LOG_LEVEL_INFO; 99 | break; 100 | case PURPLE_DEBUG_WARNING: 101 | glib_level = G_LOG_LEVEL_WARNING; 102 | break; 103 | case PURPLE_DEBUG_ERROR: 104 | glib_level = G_LOG_LEVEL_CRITICAL; 105 | break; 106 | case PURPLE_DEBUG_FATAL: 107 | glib_level = G_LOG_LEVEL_ERROR; 108 | break; 109 | } 110 | 111 | gsize l = strlen("purple-") + strlen(category) + 1; 112 | gchar *full_category = g_newa(char, l); 113 | g_snprintf(full_category, l, "purple-%s", category); 114 | 115 | gsize ml = strlen(message); 116 | while ( g_ascii_isspace(message[ml-1]) ) 117 | --ml; 118 | 119 | g_log_structured(full_category, glib_level, "MESSAGE", "%.*s", (int) ml, message); 120 | } 121 | -------------------------------------------------------------------------------- /plugins/nd/src/backends.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include "libeventd-helpers-dirs.h" 32 | 33 | #include "backend.h" 34 | #include "backends.h" 35 | 36 | static gboolean 37 | _eventd_nd_backends_load_dir(EventdNdBackend *backends, EventdNdInterface *context, NkBindings *bindings, gchar *backends_dir_name) 38 | { 39 | gboolean ret = FALSE; 40 | 41 | eventd_debug("Scanning notification backends dir: %s", backends_dir_name); 42 | 43 | EventdNdBackends i; 44 | for ( i = EVENTD_ND_BACKEND_NONE + 1 ; i < _EVENTD_ND_BACKENDS_SIZE ; ++i ) 45 | { 46 | if ( backends[i].context != NULL ) 47 | continue; 48 | 49 | gchar name[12]; /* wayland.dll + \0 */ 50 | gchar *file; 51 | g_snprintf(name, sizeof(name), "%s." G_MODULE_SUFFIX, eventd_nd_backends_names[i]); 52 | file = g_build_filename(backends_dir_name, name, NULL); 53 | 54 | if ( ( ! g_file_test(file, G_FILE_TEST_EXISTS) ) || g_file_test(file, G_FILE_TEST_IS_DIR) ) 55 | goto next; 56 | 57 | GModule *module; 58 | module = g_module_open(file, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL); 59 | if ( module == NULL ) 60 | { 61 | g_warning("Couldn't load module '%s': %s", eventd_nd_backends_names[i], g_module_error()); 62 | goto next; 63 | } 64 | 65 | EventdNdBackendGetInfoFunc get_info; 66 | if ( ! g_module_symbol(module, "eventd_nd_backend_get_info", (void **)&get_info) ) 67 | goto next; 68 | 69 | eventd_debug("Loading backend '%s'", file); 70 | 71 | EventdNdBackend backend = { .module = NULL, .context = NULL }; 72 | get_info(&backend); 73 | backend.name = eventd_nd_backends_names[i]; 74 | backend.module = module; 75 | backend.context = backend.init(context, bindings); 76 | 77 | if ( backend.context != NULL ) 78 | { 79 | backends[i] = backend; 80 | ret = TRUE; 81 | } 82 | else 83 | g_module_close(module); 84 | 85 | next: 86 | g_free(file); 87 | } 88 | g_free(backends_dir_name); 89 | 90 | return ret; 91 | } 92 | 93 | gboolean 94 | eventd_nd_backends_load(EventdNdBackend *backends, EventdNdInterface *context, NkBindings *bindings) 95 | { 96 | gboolean ret = FALSE; 97 | 98 | gchar **dirs, **dir; 99 | dirs = evhelpers_dirs_get_lib("NOTIFICATION_BACKENDS", "modules" G_DIR_SEPARATOR_S MODULES_VERSION G_DIR_SEPARATOR_S "nd"); 100 | for ( dir = dirs ; *dir != NULL ; ++dir ) 101 | ret = _eventd_nd_backends_load_dir(backends, context, bindings, *dir) || ret; 102 | g_free(dirs); 103 | 104 | return ret; 105 | } 106 | 107 | void 108 | eventd_nd_backends_unload(EventdNdBackend *backends) 109 | { 110 | EventdNdBackends i; 111 | for ( i = EVENTD_ND_BACKEND_NONE + 1 ; i < _EVENTD_ND_BACKENDS_SIZE ; ++i ) 112 | { 113 | if ( backends[i].context == NULL ) 114 | continue; 115 | 116 | backends[i].uninit(backends[i].context); 117 | g_module_close(backends[i].module); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/protocol-parser.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A LINEICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "common.h" 24 | 25 | static gchar *BUILDER_EVENT_LINES[] = { 26 | ".EVENT " EVENTD_EVENT_TEST_UUID " " EVENTD_EVENT_TEST_NAME " " EVENTD_EVENT_TEST_NAME, 27 | "DATA " EVENTD_EVENT_TEST_DATA_NAME " '" EVENTD_EVENT_TEST_DATA_CONTENT "'", 28 | "DATA " EVENTD_EVENT_TEST_DATA_ESCAPING_NAME " '." EVENTD_EVENT_TEST_DATA_ESCAPING_CONTENT_ESCAPED "'", 29 | "." 30 | }; 31 | 32 | typedef struct { 33 | EventdProtocol *protocol; 34 | EventdEvent *event; 35 | } EvpData; 36 | 37 | static void 38 | _test_evp_event_callback(EventdProtocol *parser, EventdEvent *event, gpointer user_data) 39 | { 40 | EvpData *data = user_data; 41 | 42 | data->event = eventd_event_ref(event); 43 | } 44 | 45 | static const EventdProtocolCallbacks _callbacks = { 46 | .event = _test_evp_event_callback 47 | }; 48 | 49 | static void 50 | _init_data_evp(gpointer fixture, gconstpointer user_data) 51 | { 52 | EvpData *data = fixture; 53 | 54 | data->protocol = eventd_protocol_new(&_callbacks, data, NULL); 55 | } 56 | 57 | static void 58 | _clean_data_evp(gpointer fixture, gconstpointer user_data) 59 | { 60 | EvpData *data = fixture; 61 | 62 | eventd_event_unref(data->event); 63 | 64 | eventd_protocol_unref(data->protocol); 65 | } 66 | 67 | static void 68 | _test_evp_parse_parts_good(gpointer fixture, gconstpointer user_data) 69 | { 70 | EvpData *data = fixture; 71 | gboolean r; 72 | GError *error = NULL; 73 | gsize i, last = G_N_ELEMENTS(BUILDER_EVENT_LINES) - 1; 74 | 75 | for ( i = 0 ; i < last ; ++i ) 76 | { 77 | r = eventd_protocol_parse(data->protocol, BUILDER_EVENT_LINES[i], strlen(BUILDER_EVENT_LINES[i]), &error); 78 | g_assert_true(r); 79 | g_assert_no_error(error); 80 | g_assert_null(data->event); 81 | } 82 | 83 | r = eventd_protocol_parse(data->protocol, BUILDER_EVENT_LINES[G_N_ELEMENTS(BUILDER_EVENT_LINES) - 1], strlen(BUILDER_EVENT_LINES[G_N_ELEMENTS(BUILDER_EVENT_LINES) - 1]), &error); 84 | g_assert_true(r); 85 | g_assert_no_error(error); 86 | g_assert_nonnull(data->event); 87 | } 88 | 89 | static void 90 | _test_evp_parse_parts_bad(gpointer fixture, gconstpointer user_data) 91 | { 92 | EvpData *data = fixture; 93 | gboolean r; 94 | GError *error = NULL; 95 | gsize i, last = G_N_ELEMENTS(BUILDER_EVENT_LINES) - 1; 96 | 97 | for ( i = 0 ; i < last ; ++i ) 98 | { 99 | r = eventd_protocol_parse(data->protocol, BUILDER_EVENT_LINES[i], strlen(BUILDER_EVENT_LINES[i]), &error); 100 | g_assert_true(r); 101 | g_assert_no_error(error); 102 | g_assert_null(data->event); 103 | } 104 | 105 | r = eventd_protocol_parse(data->protocol, BUILDER_EVENT_LINES[0], strlen(BUILDER_EVENT_LINES[0]), &error); 106 | g_assert_false(r); 107 | g_assert_error(error, EVENTD_PROTOCOL_PARSE_ERROR, EVENTD_PROTOCOL_PARSE_ERROR_UNEXPECTED_TOKEN); 108 | g_assert_null(data->event); 109 | } 110 | 111 | void 112 | eventd_tests_unit_eventd_protocol_suite_parser(void) 113 | { 114 | GTestSuite *suite; 115 | 116 | suite = g_test_create_suite("LibeventdEvp parser test suite"); 117 | 118 | g_test_suite_add(suite, g_test_create_case("evp_parse(parts_good)", sizeof(EvpData), NULL, _init_data_evp, _test_evp_parse_parts_good, _clean_data_evp)); 119 | g_test_suite_add(suite, g_test_create_case("evp_parse(parts_bad)", sizeof(EvpData), NULL, _init_data_evp, _test_evp_parse_parts_bad, _clean_data_evp)); 120 | 121 | g_test_suite_add_suite(g_test_get_root(), suite); 122 | } 123 | -------------------------------------------------------------------------------- /client/libeventc/include/libeventc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventc - Library to communicate with eventd 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTC_CONNECTION_H__ 22 | #define __EVENTC_CONNECTION_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "libeventd-event.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct _EventcConnection EventcConnection; 32 | typedef struct _EventcConnectionClass EventcConnectionClass; 33 | typedef struct _EventcConnectionPrivate EventcConnectionPrivate; 34 | 35 | typedef enum { 36 | EVENTC_ERROR_URI, 37 | EVENTC_ERROR_CONNECTION, 38 | EVENTC_ERROR_ALREADY_CONNECTED, 39 | EVENTC_ERROR_NOT_CONNECTED, 40 | EVENTC_ERROR_RECEIVE, 41 | EVENTC_ERROR_EVENT, 42 | EVENTC_ERROR_END, 43 | EVENTC_ERROR_BYE 44 | } EventcError; 45 | 46 | 47 | GType eventc_connection_get_type(void) G_GNUC_CONST; 48 | GQuark eventc_error_quark(void); 49 | 50 | #define EVENTC_TYPE_CONNECTION (eventc_connection_get_type()) 51 | #define EVENTC_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), EVENTC_TYPE_CONNECTION, EventcConnection)) 52 | #define EVENTC_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), EVENTC_TYPE_CONNECTION)) 53 | #define EVENTC_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EVENTC_TYPE_CONNECTION, EventcConnectionClass)) 54 | #define EVENTC_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EVENTC_TYPE_CONNECTION)) 55 | #define EVENTC_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EVENTC_TYPE_CONNECTION, EventcConnectionClass)) 56 | 57 | #define EVENTC_ERROR (eventc_error_quark()) 58 | 59 | 60 | struct _EventcConnection { 61 | GObject parent_instance; 62 | 63 | /*< private >*/ 64 | EventcConnectionPrivate *priv; 65 | }; 66 | 67 | struct _EventcConnectionClass { 68 | GObjectClass parent_class; 69 | 70 | /* Signals */ 71 | void (*received_event)(EventcConnection *connection, EventdEvent *event); 72 | void (*disconnected)(EventcConnection *connection); 73 | }; 74 | 75 | 76 | const gchar *eventc_get_version(void); 77 | 78 | 79 | EventcConnection *eventc_connection_new(const gchar *uri, GError **error); 80 | EventcConnection *eventc_connection_new_for_connectable(GSocketConnectable *address); 81 | 82 | void eventc_connection_connect(EventcConnection *connection, GAsyncReadyCallback callback, gpointer user_data); 83 | gboolean eventc_connection_connect_finish(EventcConnection *connection, GAsyncResult *result, GError **error); 84 | gboolean eventc_connection_connect_sync(EventcConnection *connection, GError **error); 85 | gboolean eventc_connection_send_event(EventcConnection *connection, EventdEvent *event, GError **error); 86 | gboolean eventc_connection_close(EventcConnection *connection, GError **error); 87 | 88 | 89 | gboolean eventc_connection_set_uri(EventcConnection *connection, const gchar *uri, GError **error); 90 | void eventc_connection_set_connectable(EventcConnection *connection, GSocketConnectable *address); 91 | void eventc_connection_set_ping_interval(EventcConnection *connection, guint ping_interval); 92 | void eventc_connection_set_server_identity(EventcConnection *connection, GSocketConnectable *server_identity); 93 | void eventc_connection_set_accept_unknown_ca(EventcConnection *connection, gboolean accept_unknown_ca); 94 | void eventc_connection_set_certificate(EventcConnection *connection, GTlsCertificate *certificate); 95 | void eventc_connection_set_subscribe(EventcConnection *connection, gboolean subscribe); 96 | void eventc_connection_add_subscription(EventcConnection *connection, gchar *category); 97 | 98 | gboolean eventc_connection_is_connected(EventcConnection *connection, GError **error); 99 | gboolean eventc_connection_get_subscribe(EventcConnection *connection); 100 | 101 | G_END_DECLS 102 | 103 | #endif /* __EVENTC_CONNECTION_H__ */ 104 | -------------------------------------------------------------------------------- /server/libeventd/tests/unit/protocol-generator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A LINEICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "common.h" 24 | #include "protocol-generator.h" 25 | 26 | typedef struct { 27 | EventdProtocol *protocol; 28 | EventdEvent *event; 29 | } GeneratorData; 30 | 31 | static const EventdProtocolCallbacks _callbacks; 32 | 33 | static void 34 | _init_data(gpointer fixture, gconstpointer user_data) 35 | { 36 | GeneratorData *data = fixture; 37 | 38 | data->protocol = eventd_protocol_new(&_callbacks, NULL, NULL); 39 | data->event = eventd_event_new_for_uuid_string(EVENTD_EVENT_TEST_UUID, EVENTD_EVENT_TEST_NAME, EVENTD_EVENT_TEST_NAME); 40 | } 41 | 42 | static void 43 | _init_data_with_data(gpointer fixture, gconstpointer user_data) 44 | { 45 | GeneratorData *data = fixture; 46 | _init_data(fixture, user_data); 47 | 48 | eventd_event_add_data_string(data->event, g_strdup(EVENTD_EVENT_TEST_DATA_ESCAPING_NAME), g_strdup(EVENTD_EVENT_TEST_DATA_ESCAPING_CONTENT)); 49 | } 50 | 51 | static void 52 | _clean_data(gpointer fixture, gconstpointer user_data) 53 | { 54 | GeneratorData *data = fixture; 55 | 56 | eventd_event_unref(data->event); 57 | eventd_protocol_unref(data->protocol); 58 | } 59 | 60 | static void 61 | _test_evp_generate_event(gpointer fixture, gconstpointer user_data) 62 | { 63 | GeneratorData *data = fixture; 64 | GHashTable *data_hash; 65 | const gchar *expected; 66 | gchar *message; 67 | 68 | 69 | data_hash = eventd_event_get_all_data(data->event); 70 | if ( data_hash != NULL ) 71 | { 72 | g_hash_table_unref(data_hash); 73 | expected = 74 | ".EVENT " EVENTD_EVENT_TEST_UUID " " EVENTD_EVENT_TEST_NAME " " EVENTD_EVENT_TEST_NAME "\n" 75 | "DATA " EVENTD_EVENT_TEST_DATA_ESCAPING_NAME " '" EVENTD_EVENT_TEST_DATA_ESCAPING_CONTENT_ESCAPED "'\n" 76 | ".\n"; 77 | } 78 | else 79 | expected = "EVENT " EVENTD_EVENT_TEST_UUID " " EVENTD_EVENT_TEST_NAME " " EVENTD_EVENT_TEST_NAME "\n"; 80 | 81 | message = eventd_protocol_generate_event(data->protocol, data->event); 82 | g_assert_cmpstr(message, ==, expected); 83 | 84 | g_free(message); 85 | } 86 | 87 | static void 88 | _test_evp_generate_bye(gpointer fixture, gconstpointer user_data) 89 | { 90 | GeneratorData *data = fixture; 91 | gboolean with_message = GPOINTER_TO_INT(user_data); 92 | const gchar *expected; 93 | const gchar *bye_message = NULL; 94 | gchar *message; 95 | 96 | if ( with_message ) 97 | { 98 | bye_message = "test"; 99 | expected = "BYE test\n"; 100 | } 101 | else 102 | expected = "BYE\n"; 103 | 104 | message = eventd_protocol_generate_bye(data->protocol, bye_message); 105 | g_assert_cmpstr(message, ==, expected); 106 | 107 | g_free(message); 108 | } 109 | 110 | void 111 | eventd_tests_unit_eventd_protocol_suite_generator(void) 112 | { 113 | GTestSuite *suite; 114 | 115 | suite = g_test_create_suite("LibeventdEvp generator test suite"); 116 | 117 | g_test_suite_add(suite, g_test_create_case("evp_generate_event()", sizeof(GeneratorData), NULL, _init_data, _test_evp_generate_event, _clean_data)); 118 | g_test_suite_add(suite, g_test_create_case("evp_generate_event(data)", sizeof(GeneratorData), NULL, _init_data_with_data, _test_evp_generate_event, _clean_data)); 119 | g_test_suite_add(suite, g_test_create_case("evp_generate_bye()", sizeof(GeneratorData), NULL, _init_data, _test_evp_generate_bye, _clean_data)); 120 | g_test_suite_add(suite, g_test_create_case("evp_generate_bye(message)", sizeof(GeneratorData), GINT_TO_POINTER(TRUE), _init_data, _test_evp_generate_bye, _clean_data)); 121 | 122 | g_test_suite_add_suite(g_test_get_root(), suite); 123 | } 124 | -------------------------------------------------------------------------------- /plugins/file/man/eventd-file.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | %config; 5 | ]> 6 | 7 | 27 | 28 | 30 | 31 | 32 | 33 | eventd-file.conf 34 | 5 35 | 36 | 37 | 38 | eventd-file.conf 39 | file plugin configuration 40 | 41 | 42 | 43 | 44 | Configuration for the file plugin. 45 | 46 | 47 | 48 | 49 | Description 50 | 51 | 52 | The file plugin allows to write arbitrary string to arbitrary files. 53 | 54 | 55 | 56 | 57 | Action sections 58 | 59 | 60 | Section <varname>[FileWrite]</varname> 61 | 62 | 63 | 64 | Disable= 65 | 66 | A boolean 67 | If true, nothing will be written. 68 | 69 | 70 | 71 | 72 | File= 73 | 74 | A format string of a GIO file URI 75 | The file to write to. 76 | This can be any URI supported by GIO on your platform. 77 | Writing operations are done asynchronously. 78 | 79 | 80 | 81 | 82 | Template= 83 | 84 | A file name, containing a format string 85 | The file name is not a file URI, no data references may be used here. 86 | The whole file content is taken as a format string. 87 | If Template= is given, String= is ignored. 88 | 89 | 90 | 91 | 92 | String= 93 | 94 | A format string 95 | The string to write. The string is used as-is, so you have to write "\n" at the end of the string if you want to write lines. 96 | 97 | 98 | 99 | 100 | Truncate= (defaults to false) 101 | 102 | A boolean 103 | If true, the file will be truncated before writing to it. 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /plugins/tts/src/tts.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #include "eventd-plugin.h" 33 | #include "libeventd-event.h" 34 | #include "libeventd-helpers-config.h" 35 | 36 | struct _EventdPluginContext { 37 | SPDConnection *spd; 38 | GSList *actions; 39 | }; 40 | 41 | struct _EventdPluginAction { 42 | FormatString *message; 43 | }; 44 | 45 | 46 | static void 47 | _eventd_tts_action_free(gpointer data) 48 | { 49 | EventdPluginAction *action = data; 50 | 51 | evhelpers_format_string_unref(action->message); 52 | 53 | g_slice_free(EventdPluginAction, action); 54 | } 55 | 56 | /* 57 | * Initialization interface 58 | */ 59 | 60 | static EventdPluginContext * 61 | _eventd_tts_init(EventdPluginCoreContext *core) 62 | { 63 | SPDConnection *spd; 64 | EventdPluginContext *context; 65 | 66 | spd = spd_open(PACKAGE_NAME, NULL, NULL, SPD_MODE_THREADED); 67 | 68 | if ( spd == NULL ) 69 | { 70 | g_warning("Couldn't initialize Speech Dispatcher connection"); 71 | return NULL; 72 | } 73 | 74 | context = g_new0(EventdPluginContext, 1); 75 | context->spd = spd; 76 | 77 | return context; 78 | } 79 | 80 | static void 81 | _eventd_tts_uninit(EventdPluginContext *context) 82 | { 83 | spd_close(context->spd); 84 | 85 | g_free(context); 86 | } 87 | 88 | 89 | /* 90 | * Start/Stop interface 91 | */ 92 | 93 | static void 94 | _eventd_tts_stop(EventdPluginContext *context) 95 | { 96 | spd_cancel(context->spd); 97 | } 98 | 99 | 100 | /* 101 | * Configuration interface 102 | */ 103 | 104 | static EventdPluginAction * 105 | _eventd_tts_action_parse(EventdPluginContext *context, GKeyFile *config_file) 106 | { 107 | gboolean disable = FALSE; 108 | FormatString *message = NULL; 109 | 110 | if ( ! g_key_file_has_group(config_file, "TTS") ) 111 | return NULL; 112 | 113 | if ( evhelpers_config_key_file_get_boolean(config_file, "TTS", "Disable", &disable) < 0 ) 114 | return NULL; 115 | 116 | if ( disable ) 117 | return NULL; 118 | 119 | if ( evhelpers_config_key_file_get_locale_format_string_with_default(config_file, "TTS", "Message", NULL, "${message}", &message) < 0 ) 120 | return NULL; 121 | 122 | EventdPluginAction *action; 123 | action = g_slice_new(EventdPluginAction); 124 | action->message = message; 125 | 126 | context->actions = g_slist_prepend(context->actions, action); 127 | 128 | return action; 129 | } 130 | 131 | static void 132 | _eventd_tts_config_reset(EventdPluginContext *context) 133 | { 134 | g_slist_free_full(context->actions, _eventd_tts_action_free); 135 | context->actions = NULL; 136 | } 137 | 138 | 139 | /* 140 | * Event action interface 141 | */ 142 | 143 | static void 144 | _eventd_tts_event_action(EventdPluginContext *context, EventdPluginAction *action, EventdEvent *event) 145 | { 146 | gchar *msg; 147 | gint id; 148 | 149 | msg = evhelpers_format_string_get_string(action->message, event, NULL, NULL); 150 | 151 | id = spd_say(context->spd, SPD_NOTIFICATION, msg); 152 | 153 | if ( id == -1 ) 154 | g_warning("Couldn't synthetise text"); 155 | 156 | g_free(msg); 157 | } 158 | 159 | 160 | /* 161 | * Plugin interface 162 | */ 163 | 164 | EVENTD_EXPORT const gchar *eventd_plugin_id = "tts"; 165 | EVENTD_EXPORT 166 | void 167 | eventd_plugin_get_interface(EventdPluginInterface *interface) 168 | { 169 | eventd_plugin_interface_add_init_callback(interface, _eventd_tts_init); 170 | eventd_plugin_interface_add_uninit_callback(interface, _eventd_tts_uninit); 171 | 172 | eventd_plugin_interface_add_stop_callback(interface, _eventd_tts_stop); 173 | 174 | eventd_plugin_interface_add_action_parse_callback(interface, _eventd_tts_action_parse); 175 | eventd_plugin_interface_add_config_reset_callback(interface, _eventd_tts_config_reset); 176 | 177 | eventd_plugin_interface_add_event_action_callback(interface, _eventd_tts_event_action); 178 | } 179 | -------------------------------------------------------------------------------- /server/libeventd-plugin/include/eventd-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-plugin - Library to implement an eventd plugin 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #ifndef __EVENTD_EVENTD_PLUGIN_H__ 22 | #define __EVENTD_EVENTD_PLUGIN_H__ 23 | 24 | #include "libeventd-event.h" 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef struct _EventdCoreContext EventdPluginCoreContext; 30 | 31 | typedef struct _EventdPluginContext EventdPluginContext; 32 | typedef struct EventdPluginInterface EventdPluginInterface; 33 | typedef struct _EventdPluginAction EventdPluginAction; 34 | 35 | typedef enum { 36 | EVENTD_PLUGIN_COMMAND_STATUS_OK = 0, 37 | EVENTD_PLUGIN_COMMAND_STATUS_COMMAND_ERROR = 30, 38 | EVENTD_PLUGIN_COMMAND_STATUS_EXEC_ERROR = 31, 39 | /* 40 | * Code from 50 to 59 are reserved for the plugins 41 | * to report a specific status 42 | */ 43 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_1 = 50, 44 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_2 = 51, 45 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_3 = 52, 46 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_4 = 53, 47 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_5 = 54, 48 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_6 = 55, 49 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_7 = 56, 50 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_8 = 57, 51 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_9 = 58, 52 | EVENTD_PLUGIN_COMMAND_STATUS_CUSTOM_10 = 59, 53 | } EventdPluginCommandStatus; 54 | 55 | GType eventd_plugin_command_status_get_type(void) G_GNUC_CONST; 56 | #define EVENTD_PLUGIN_TYPE_COMMAND_STATUS (eventd_plugin_command_status_get_type()) 57 | 58 | /* 59 | * eventd plugin interface 60 | */ 61 | 62 | typedef EventdPluginContext *(*EventdPluginInitFunc)(EventdPluginCoreContext *core); 63 | typedef void (*EventdPluginSimpleFunc)(EventdPluginContext *context); 64 | typedef EventdPluginCommandStatus (*EventdPluginControlCommandFunc)(EventdPluginContext *context, guint64 argc, const gchar * const *argv, gchar **status); 65 | typedef void (*EventdPluginGlobalParseFunc)(EventdPluginContext *context, GKeyFile *key_file); 66 | typedef EventdPluginAction *(*EventdPluginActionParseFunc)(EventdPluginContext *context, GKeyFile *key_file); 67 | typedef void (*EventdPluginEventDispatchFunc)(EventdPluginContext *context, EventdEvent *event); 68 | typedef void (*EventdPluginEventActionFunc)(EventdPluginContext *context, EventdPluginAction *action, EventdEvent *event); 69 | 70 | typedef void (*EventdPluginGetInterfaceFunc)(EventdPluginInterface *iface); 71 | void eventd_plugin_get_interface(EventdPluginInterface *iface); 72 | 73 | void eventd_plugin_interface_add_init_callback(EventdPluginInterface *iface, EventdPluginInitFunc callback); 74 | void eventd_plugin_interface_add_uninit_callback(EventdPluginInterface *iface, EventdPluginSimpleFunc callback); 75 | 76 | void eventd_plugin_interface_add_start_callback(EventdPluginInterface *iface, EventdPluginSimpleFunc callback); 77 | void eventd_plugin_interface_add_stop_callback(EventdPluginInterface *iface, EventdPluginSimpleFunc callback); 78 | 79 | void eventd_plugin_interface_add_control_command_callback(EventdPluginInterface *iface, EventdPluginControlCommandFunc callback); 80 | 81 | void eventd_plugin_interface_add_global_parse_callback(EventdPluginInterface *iface, EventdPluginGlobalParseFunc callback); 82 | void eventd_plugin_interface_add_action_parse_callback(EventdPluginInterface *iface, EventdPluginActionParseFunc callback); 83 | void eventd_plugin_interface_add_config_reset_callback(EventdPluginInterface *iface, EventdPluginSimpleFunc callback); 84 | 85 | void eventd_plugin_interface_add_event_dispatch_callback(EventdPluginInterface *iface, EventdPluginEventDispatchFunc callback); 86 | void eventd_plugin_interface_add_event_action_callback(EventdPluginInterface *iface, EventdPluginEventActionFunc callback); 87 | 88 | 89 | /* 90 | * eventd core interface 91 | */ 92 | 93 | GList *eventd_plugin_core_get_binds(EventdPluginCoreContext *context, const gchar *namespace, const gchar * const *binds); 94 | GList *eventd_plugin_core_get_sockets(EventdPluginCoreContext *context, const gchar *namespace, GSocketAddress **binds); 95 | 96 | gboolean eventd_plugin_core_push_event(EventdPluginCoreContext *context, EventdEvent *event); 97 | 98 | G_END_DECLS 99 | 100 | #endif /* __EVENTD_EVENTD_PLUGIN_H__ */ 101 | -------------------------------------------------------------------------------- /server/eventd/src/sd-modules.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #include "config.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | #include "libeventd-helpers-dirs.h" 32 | 33 | #include "eventd-sd-module.h" 34 | #include "sd-modules.h" 35 | 36 | static const gchar *_eventd_sd_modules_names[_EVENTD_SD_MODULES_SIZE] = { 37 | [EVENTD_SD_MODULE_DNS_SD] = "dns-sd." G_MODULE_SUFFIX, 38 | [EVENTD_SD_MODULE_SSDP] = "ssdp." G_MODULE_SUFFIX, 39 | }; 40 | 41 | static EventdSdModule modules[_EVENTD_SD_MODULES_SIZE]; 42 | 43 | static void 44 | _eventd_sd_modules_load_dir(const EventdSdModuleControlInterface *control, GList *sockets, gchar *modules_dir_name) 45 | { 46 | eventd_debug("Scanning service discovery modules dir: %s", modules_dir_name); 47 | 48 | EventdSdModules i; 49 | for ( i = EVENTD_SD_MODULE_NONE + 1 ; i < _EVENTD_SD_MODULES_SIZE ; ++i ) 50 | { 51 | if ( modules[i].context != NULL ) 52 | continue; 53 | 54 | gchar *file; 55 | file = g_build_filename(modules_dir_name, _eventd_sd_modules_names[i], NULL); 56 | 57 | if ( ( ! g_file_test(file, G_FILE_TEST_EXISTS) ) || g_file_test(file, G_FILE_TEST_IS_DIR) ) 58 | goto next; 59 | 60 | GModule *module; 61 | module = g_module_open(file, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL); 62 | if ( module == NULL ) 63 | { 64 | g_warning("Couldn't load module '%s': %s", _eventd_sd_modules_names[i], g_module_error()); 65 | goto next; 66 | } 67 | 68 | EventdSdModuleGetInfoFunc get_info; 69 | if ( ! g_module_symbol(module, "eventd_sd_module_get_info", (void **)&get_info) ) 70 | goto next; 71 | 72 | eventd_debug("Loading service discovery module '%s'", file); 73 | 74 | EventdSdModule sd_module = { .module = NULL, .context = NULL }; 75 | get_info(&sd_module); 76 | sd_module.module = module; 77 | sd_module.context = sd_module.init(control, sockets); 78 | 79 | if ( sd_module.context != NULL ) 80 | modules[i] = sd_module; 81 | else 82 | g_module_close(module); 83 | 84 | next: 85 | g_free(file); 86 | } 87 | g_free(modules_dir_name); 88 | } 89 | 90 | void 91 | eventd_sd_modules_load(const EventdSdModuleControlInterface *control, GList *sockets) 92 | { 93 | gchar **dirs, **dir; 94 | dirs = evhelpers_dirs_get_lib("MODULES", "modules" G_DIR_SEPARATOR_S MODULES_VERSION); 95 | for ( dir = dirs ; *dir != NULL ; ++dir ) 96 | _eventd_sd_modules_load_dir(control, sockets, *dir); 97 | g_free(dirs); 98 | } 99 | 100 | #define _eventd_sd_modules_foreach(code) G_STMT_START { \ 101 | EventdSdModules i; \ 102 | for ( i = EVENTD_SD_MODULE_NONE + 1 ; i < _EVENTD_SD_MODULES_SIZE ; ++i ) \ 103 | { \ 104 | if ( modules[i].context == NULL ) \ 105 | continue; \ 106 | \ 107 | code; \ 108 | } \ 109 | } G_STMT_END 110 | 111 | void 112 | eventd_sd_modules_unload(void) 113 | { 114 | EventdSdModules i; 115 | for ( i = EVENTD_SD_MODULE_NONE + 1 ; i < _EVENTD_SD_MODULES_SIZE ; ++i ) 116 | { 117 | if ( modules[i].context == NULL ) 118 | continue; 119 | 120 | modules[i].uninit(modules[i].context); 121 | g_module_close(modules[i].module); 122 | } 123 | } 124 | 125 | #define EV_COMMA , 126 | #define _eventd_sd_modules_foreach_call(name, args) _eventd_sd_modules_foreach(modules[i].name(modules[i].context args)) 127 | 128 | void 129 | eventd_sd_modules_set_publish_name(const gchar *name) 130 | { 131 | _eventd_sd_modules_foreach_call(set_publish_name, EV_COMMA name); 132 | } 133 | 134 | void 135 | eventd_sd_modules_monitor_server(const gchar *name, EventdRelayServer *server) 136 | { 137 | _eventd_sd_modules_foreach_call(monitor_server, EV_COMMA name EV_COMMA server); 138 | } 139 | 140 | void 141 | eventd_sd_modules_start(void) 142 | { 143 | _eventd_sd_modules_foreach_call(start,); 144 | } 145 | 146 | void 147 | eventd_sd_modules_stop(void) 148 | { 149 | _eventd_sd_modules_foreach_call(stop,); 150 | } 151 | 152 | gboolean 153 | eventd_sd_modules_can_discover(void) 154 | { 155 | gboolean ret = FALSE; 156 | _eventd_sd_modules_foreach(ret = TRUE); 157 | return ret; 158 | } 159 | -------------------------------------------------------------------------------- /plugins/nd/src/style.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eventd - Small daemon to act on remote or local events 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This file is part of eventd. 7 | * 8 | * eventd is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * eventd is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with eventd. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __EVENTD_ND_STYLE_H__ 24 | #define __EVENTD_ND_STYLE_H__ 25 | 26 | #include "types.h" 27 | 28 | typedef enum { 29 | EVENTD_ND_VANCHOR_TOP, 30 | EVENTD_ND_VANCHOR_BOTTOM, 31 | EVENTD_ND_VANCHOR_CENTER, 32 | } EventdNdAnchorVertical; 33 | 34 | typedef enum { 35 | EVENTD_ND_HANCHOR_LEFT, 36 | EVENTD_ND_HANCHOR_RIGHT, 37 | EVENTD_ND_HANCHOR_CENTER, 38 | } EventdNdAnchorHorizontal; 39 | 40 | typedef enum { 41 | EVENTD_ND_STYLE_ICON_PLACEMENT_BACKGROUND, 42 | EVENTD_ND_STYLE_ICON_PLACEMENT_OVERLAY, 43 | EVENTD_ND_STYLE_ICON_PLACEMENT_FOREGROUND 44 | } EventdNdStyleIconPlacement; 45 | 46 | typedef enum { 47 | EVENTD_ND_STYLE_PROGRESS_PLACEMENT_BAR_BOTTOM, 48 | EVENTD_ND_STYLE_PROGRESS_PLACEMENT_IMAGE_BOTTOM_TOP, 49 | EVENTD_ND_STYLE_PROGRESS_PLACEMENT_IMAGE_TOP_BOTTOM, 50 | EVENTD_ND_STYLE_PROGRESS_PLACEMENT_IMAGE_LEFT_RIGHT, 51 | EVENTD_ND_STYLE_PROGRESS_PLACEMENT_IMAGE_RIGHT_LEFT, 52 | EVENTD_ND_STYLE_PROGRESS_PLACEMENT_IMAGE_CIRCULAR, 53 | } EventdNdStyleProgressPlacement; 54 | 55 | EventdNdStyle *eventd_nd_style_new(EventdNdStyle *parent); 56 | void eventd_nd_style_free(gpointer style); 57 | 58 | void eventd_nd_style_update(EventdNdStyle *style, GKeyFile *config_file); 59 | 60 | FormatString *eventd_nd_style_get_template_text(EventdNdStyle *style); 61 | Filename *eventd_nd_style_get_template_image(EventdNdStyle *style); 62 | Filename *eventd_nd_style_get_template_icon(EventdNdStyle *style); 63 | const gchar *eventd_nd_style_get_template_progress(EventdNdStyle *style); 64 | 65 | const gchar *eventd_nd_style_get_bubble_queue(EventdNdStyle *style); 66 | gint eventd_nd_style_get_bubble_timeout(EventdNdStyle *style); 67 | 68 | gint eventd_nd_style_get_bubble_min_width(EventdNdStyle *style); 69 | gint eventd_nd_style_get_bubble_max_width(EventdNdStyle *style); 70 | 71 | gint eventd_nd_style_get_bubble_padding(EventdNdStyle *style); 72 | gint eventd_nd_style_get_bubble_radius(EventdNdStyle *style); 73 | Colour eventd_nd_style_get_bubble_colour(EventdNdStyle *style); 74 | gint eventd_nd_style_get_bubble_border(EventdNdStyle *style); 75 | Colour eventd_nd_style_get_bubble_border_colour(EventdNdStyle *style); 76 | guint64 eventd_nd_style_get_bubble_border_blur(EventdNdStyle *style); 77 | gint64 eventd_nd_style_get_bubble_border_blur_offset_x(EventdNdStyle *style); 78 | gint64 eventd_nd_style_get_bubble_border_blur_offset_y(EventdNdStyle *style); 79 | 80 | const PangoFontDescription *eventd_nd_style_get_text_font(EventdNdStyle *style); 81 | PangoAlignment eventd_nd_style_get_text_align(EventdNdStyle *style); 82 | EventdNdAnchorVertical eventd_nd_style_get_text_valign(EventdNdStyle *style); 83 | PangoEllipsizeMode eventd_nd_style_get_text_ellipsize(EventdNdStyle *style); 84 | guint8 eventd_nd_style_get_text_max_lines(EventdNdStyle *style); 85 | gint eventd_nd_style_get_text_max_width(EventdNdStyle *style); 86 | Colour eventd_nd_style_get_text_colour(EventdNdStyle *style); 87 | 88 | EventdNdAnchorVertical eventd_nd_style_get_image_anchor(EventdNdStyle *style); 89 | gint eventd_nd_style_get_image_width(EventdNdStyle *style); 90 | gint eventd_nd_style_get_image_height(EventdNdStyle *style); 91 | void eventd_nd_style_get_image_size(EventdNdStyle *style, gint max_draw_width, gint *width, gint *height); 92 | gboolean eventd_nd_style_get_image_fixed_size(EventdNdStyle *style); 93 | gint eventd_nd_style_get_image_margin(EventdNdStyle *style); 94 | const gchar *eventd_nd_style_get_image_theme(EventdNdStyle *style); 95 | 96 | EventdNdStyleIconPlacement eventd_nd_style_get_icon_placement(EventdNdStyle *style); 97 | EventdNdAnchorVertical eventd_nd_style_get_icon_anchor(EventdNdStyle *style); 98 | gint eventd_nd_style_get_icon_width(EventdNdStyle *style); 99 | gint eventd_nd_style_get_icon_height(EventdNdStyle *style); 100 | void eventd_nd_style_get_icon_size(EventdNdStyle *style, gint max_draw_width, gint *width, gint *height); 101 | gboolean eventd_nd_style_get_icon_fixed_size(EventdNdStyle *style); 102 | gint eventd_nd_style_get_icon_margin(EventdNdStyle *style); 103 | gdouble eventd_nd_style_get_icon_fade_width(EventdNdStyle *style); 104 | const gchar *eventd_nd_style_get_icon_theme(EventdNdStyle *style); 105 | 106 | EventdNdStyleProgressPlacement eventd_nd_style_get_progress_placement(EventdNdStyle *style); 107 | gboolean eventd_nd_style_get_progress_reversed(EventdNdStyle *style); 108 | gint eventd_nd_style_get_progress_bar_width(EventdNdStyle *style); 109 | Colour eventd_nd_style_get_progress_colour(EventdNdStyle *self); 110 | 111 | #endif /* __EVENTD_ND_STYLE_H__ */ 112 | -------------------------------------------------------------------------------- /server/libeventd/src/protocol-evp-generator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libeventd-protocol - Main eventd library - Protocol manipulation 3 | * 4 | * Copyright © 2011-2024 Morgane "Sardem FF7" Glidic 5 | * 6 | * This library is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with eventd. If not, see . 18 | * 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #include "libeventd-event.h" 29 | #include "libeventd-event-private.h" 30 | #include "libeventd-protocol.h" 31 | 32 | #include "protocol-evp-private.h" 33 | 34 | #define DATA_SAMPLE ".DATA test-data\nSome data to put inside\nAnd here is a new line\nThat should be enough\n.\n" 35 | 36 | static void 37 | _eventd_protocol_generate_data(GString *str, GHashTable *data) 38 | { 39 | if ( data == NULL ) 40 | return; 41 | 42 | GHashTableIter iter; 43 | gchar *name; 44 | GVariant *value; 45 | g_hash_table_iter_init(&iter, data); 46 | while ( g_hash_table_iter_next(&iter, (gpointer *) &name, (gpointer *) &value) ) 47 | { 48 | g_string_append_printf(str, "DATA %s ", name); 49 | g_variant_print_string(value, str, ! g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)); 50 | g_string_append_c(str, '\n'); 51 | } 52 | 53 | g_hash_table_unref(data); 54 | } 55 | 56 | /** 57 | * eventd_protocol_generate_event: 58 | * @protocol: an #EventdProtocol 59 | * @event: the #EventdEVent to generate a message for 60 | * 61 | * Generates an EVENT message. 62 | * 63 | * Returns: (transfer full): the message 64 | */ 65 | EVENTD_EXPORT 66 | gchar * 67 | eventd_protocol_generate_event(EventdProtocol *protocol, EventdEvent *event) 68 | { 69 | GHashTable *data; 70 | data = eventd_event_get_all_data(event); 71 | 72 | if ( data == NULL ) 73 | return g_strdup_printf("EVENT %s %s %s\n", eventd_event_get_uuid(event), eventd_event_get_category(event), eventd_event_get_name(event)); 74 | 75 | gsize size; 76 | size = strlen(".EVENT 1b4e28ba-2fa1-11d2-883f-0016d3cca427 test-category test-name\n.\n") + ( g_hash_table_size(data) * strlen(DATA_SAMPLE) ); 77 | 78 | GString *str; 79 | str = g_string_sized_new(size); 80 | 81 | g_string_append_printf(str, ".EVENT %s %s %s\n", eventd_event_get_uuid(event), eventd_event_get_category(event), eventd_event_get_name(event)); 82 | 83 | _eventd_protocol_generate_data(str, data); 84 | 85 | g_string_append(str, ".\n"); 86 | 87 | return g_string_free(str, FALSE); 88 | } 89 | 90 | /** 91 | * eventd_protocol_generate_subscribe: 92 | * @protocol: an #EventdProtocol 93 | * @categories: (element-type utf8 utf8) (nullable): the categories of events you want to subscribe to as a set (key == value) 94 | * 95 | * Generates a SUBSCRIBE message. 96 | * 97 | * Returns: (transfer full): the message 98 | */ 99 | EVENTD_EXPORT 100 | gchar * 101 | eventd_protocol_generate_subscribe(EventdProtocol *protocol, GHashTable *categories) 102 | { 103 | if ( categories == NULL ) 104 | return g_strdup("SUBSCRIBE\n"); 105 | 106 | guint length; 107 | GHashTableIter iter; 108 | gchar *category; 109 | length = g_hash_table_size(categories); 110 | g_hash_table_iter_init(&iter, categories); 111 | if ( ! g_hash_table_iter_next(&iter, (gpointer *) &category, NULL) ) 112 | return g_strdup("SUBSCRIBE\n"); 113 | 114 | if ( length == 1 ) 115 | return g_strdup_printf("SUBSCRIBE %s\n", category); 116 | 117 | gsize size; 118 | GString *str; 119 | size = strlen(".SUBSCRIBE\n.\n") + ( strlen(category) + 1) * length; 120 | str = g_string_sized_new(size); 121 | 122 | g_string_append(str, ".SUBSCRIBE\n"); 123 | do 124 | g_string_append_c(g_string_append(str, category), '\n'); 125 | while ( g_hash_table_iter_next(&iter, (gpointer *) &category, NULL) ); 126 | g_string_append(str, ".\n"); 127 | 128 | return g_string_free(str, FALSE); 129 | } 130 | 131 | /** 132 | * eventd_protocol_generate_ping: 133 | * @protocol: an #EventdProtocol 134 | * 135 | * Generates a PING message. 136 | * 137 | * Returns: (transfer full): the message 138 | */ 139 | EVENTD_EXPORT 140 | gchar * 141 | eventd_protocol_generate_ping(EventdProtocol *protocol) 142 | { 143 | return g_strdup("PING\n"); 144 | } 145 | 146 | /** 147 | * eventd_protocol_generate_bye: 148 | * @protocol: an #EventdProtocol 149 | * @message: (nullable): an optional message to send 150 | * 151 | * Generates a BYE message. 152 | * 153 | * Returns: (transfer full): the message 154 | */ 155 | EVENTD_EXPORT 156 | gchar * 157 | eventd_protocol_generate_bye(EventdProtocol *protocol, const gchar *message) 158 | { 159 | if ( message == NULL ) 160 | return g_strdup("BYE\n"); 161 | 162 | return g_strdup_printf("BYE %s\n", message); 163 | } 164 | --------------------------------------------------------------------------------