/*
* Hexchat Plugin API Bindings for Rust - Internals
* Copyright (C) 2018 Soni L.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
//! Implementation details, mostly.
//!
//! This also includes the hexchat_plugin struct, from hexchat-plugin.h. Note that we use the
//! struct even on non-Windows platforms because it's a lot easier that way. Should be safe, tho.
use libc;
// apparently this is the right way to do these
#[repr(i8)]
pub enum HexchatList {
__One,
__Two,
}
#[repr(i8)]
pub enum HexchatHook {
__One,
__Two,
}
#[repr(i8)]
pub enum HexchatContext {
__One,
__Two,
}
// not in hexchat-plugin.h
#[repr(i8)]
pub enum PluginGuiHandle {
__One,
__Two,
}
#[repr(C)]
pub struct HexchatEventAttrs {
server_time_utc: libc::time_t,
}
pub type HexchatPlugin = Ph;
#[repr(C)]
pub struct Ph {
pub hexchat_hook_command: Option libc::c_int>,
help_text: *const libc::c_char,
userdata: *mut libc::c_void) -> *const HexchatHook>,
pub hexchat_hook_server: Option libc::c_int>,
userdata: *mut libc::c_void) -> *const HexchatHook>,
pub hexchat_hook_print: Option libc::c_int>,
userdata: *mut libc::c_void) -> *const HexchatHook>,
pub hexchat_hook_timer: Option libc::c_int>,
userdata: *mut libc::c_void) -> *const HexchatHook>,
pub hexchat_hook_fd: Option libc::c_int>,
userdata: *mut libc::c_void) -> *const HexchatHook>,
pub hexchat_unhook: Option *const libc::c_void>,
pub hexchat_print: Option,
pub hexchat_printf: Option,
pub hexchat_command: Option,
pub hexchat_commandf: Option,
pub hexchat_nickcmp: Option libc::c_int>,
pub hexchat_set_context: Option libc::c_int>,
pub hexchat_find_context: Option *const HexchatContext>,
pub hexchat_get_context: Option *const HexchatContext>,
pub hexchat_get_info: Option *const libc::c_char>,
pub hexchat_get_prefs: Option libc::c_int>,
pub hexchat_list_get: Option *const HexchatList>,
pub hexchat_list_free: Option,
pub hexchat_list_fields: Option *const *const libc::c_char>,
pub hexchat_list_next: Option libc::c_int>,
pub hexchat_list_str: Option *const libc::c_char>,
pub hexchat_list_int: Option libc::c_int>,
pub hexchat_plugingui_add: Option *const PluginGuiHandle>,
pub hexchat_plugingui_remove: Option,
pub hexchat_emit_print: Option libc::c_int>,
// this is VERY NAUGHTY.
// TODO see if hexchat's gonna provide a proper userdata field at some point.
// it appears this function isn't used anywhere by hexchat so we reuse its pointer.
// on linux, it's a dummy anyway.
// another option would've been to use one of the printf functions.
// TODO test this on platforms hexchat doesn't build on, like AVR.
pub userdata: *mut libc::c_void,
/*pub hexchat_read_fd: Option libc::c_int>,*/
pub hexchat_list_time: Option libc::time_t>,
pub hexchat_gettext: Option *const libc::c_char>,
pub hexchat_send_modes: Option,
pub hexchat_strip: Option *const libc::c_char>,
pub hexchat_free: Option,
pub hexchat_pluginpref_set_str: Option libc::c_int>,
pub hexchat_pluginpref_get_str: Option libc::c_int>,
pub hexchat_pluginpref_set_int: Option libc::c_int>,
pub hexchat_pluginpref_get_int: Option libc::c_int>,
pub hexchat_pluginpref_delete: Option libc::c_int>,
pub hexchat_pluginpref_list: Option libc::c_int>,
pub hexchat_hook_server_attrs: Option libc::c_int>,
userdata: *mut libc::c_void) -> *const HexchatHook>,
pub hexchat_hook_print_attrs: Option libc::c_int>,
userdata: *mut libc::c_void) -> *const HexchatHook>,
pub hexchat_emit_print_attrs: Option libc::c_int>,
pub hexchat_event_attrs_create: Option *mut HexchatEventAttrs>,
pub hexchat_event_attrs_free: Option,
}