10 unstable releases (3 breaking)

0.4.0 Aug 5, 2024
0.3.2 Jul 4, 2024
0.2.0 May 30, 2024
0.1.4 May 30, 2024

#19 in #optional

Download history 316/week @ 2024-05-30 4/week @ 2024-06-06 1/week @ 2024-06-13 289/week @ 2024-07-04 6/week @ 2024-07-11 2/week @ 2024-07-25 106/week @ 2024-08-01 22/week @ 2024-08-08 5/week @ 2024-08-15

134 downloads per month
Used in mailing-list

GPL-3.0 license

14KB

mlpa

mlpa is an API library for writing plugins for mailing-list

Examples

A plugin that says hello:

use std::ffi::CStr;
use std::os::raw::c_char;
use mlpa::Plugin;

#[no_mangle]
pub extern "C" fn get_plugin() -> Plugin {
    use mlpa::Optional::Some;
    Plugin {
        message_handler: Some(message_handler),
    }
}

extern "C" fn message_handler(message: *const c_char) {
    let message = unsafe { CStr::from_ptr(message) };
    let message = String::from_utf8_lossy(message.to_bytes()).to_string();

    println!("Hello from plugin!");
    println!("Message: {message}");
}

to build and use in mailing-list:

  1. Add to Cargo.toml
[lib]
crate-type = ["dylib"]
  1. Build your plugin
  2. Add to daemon.toml
plugins = [
    "[your plugin]"
]

No runtime deps