1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use crate::{c, to_cstring, Context};
use std::ffi::c_void;
use std::path::Path;
use std::ptr;
impl Context {
pub fn add_fake_plugin(
&self,
path: impl AsRef<Path>,
name: &str,
description: &str,
version: &str,
) -> FakePlugin {
let path = to_cstring(&path.as_ref().to_string_lossy());
let name = to_cstring(name);
let description = to_cstring(description);
let version = to_cstring(version);
let handle = unsafe {
c!(
hexchat_plugingui_add,
self.handle,
path.as_ptr(),
name.as_ptr(),
description.as_ptr(),
version.as_ptr(),
ptr::null(),
)
};
FakePlugin { handle }
}
#[allow(clippy::needless_pass_by_value)]
pub fn remove_fake_plugin(&self, plugin: FakePlugin) {
unsafe { c!(hexchat_plugingui_remove, self.handle, plugin.handle) }
}
}
pub struct FakePlugin {
handle: *mut c_void,
}