summary refs log tree commit diff stats
path: root/src/version
diff options
context:
space:
mode:
Diffstat (limited to 'src/version')
0 files changed, 0 insertions, 0 deletions
ef='#n70'>70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
/*
 * 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 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
//! 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 std::marker::PhantomData;
use std::marker::PhantomPinned;

use libc;

use ltptr::*;

// apparently this is the new right way to do these
#[repr(C)]
pub struct HexchatList {
    _data: libc::c_void,
    // remove Send/Sync/etc
    _marker: PhantomData<(*mut u8, PhantomPinned)>
}
#[repr(C)]
pub struct HexchatHook {
    _data: libc::c_void,
    // remove Send/Sync/etc
    _marker: PhantomData<(*mut u8, PhantomPinned)>
}
#[repr(C)]
pub struct HexchatContext {
    _data: libc::c_void,
    // remove Send/Sync/etc
    _marker: PhantomData<(*mut u8, PhantomPinned)>
}

// not in hexchat-plugin.h
#[repr(C)]
pub struct PluginGuiHandle {
    _data: libc::c_void,
    // remove Send/Sync/etc
    _marker: PhantomData<(*mut u8, PhantomPinned)>
}

#[repr(C)]
pub struct HexchatEventAttrs {
    pub server_time_utc: libc::time_t,
}

#[repr(C)]
pub struct Ph<'ph> {
    pub(crate) hexchat_hook_command: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            name: *const libc::c_char,
            pri: libc::c_int,
            /* CALLBACK */
            callback: unsafe extern "C" fn(word: *const *const libc::c_char, word_eol: *const *const libc::c_char, user_data: *mut libc::c_void) -> libc::c_int,
            help_text: *const libc::c_char,
            userdata: *mut libc::c_void) -> *const HexchatHook,
    pub(crate) hexchat_hook_server: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            name: *const libc::c_char,
            pri: libc::c_int,
            /* CALLBACK */
            callback: unsafe extern "C" fn(word: *const *const libc::c_char, word_eol: *const *const libc::c_char, user_data: *mut libc::c_void) -> libc::c_int,
            userdata: *mut libc::c_void) -> *const HexchatHook,
    pub(crate) hexchat_hook_print: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            name: *const libc::c_char,
            pri: libc::c_int,
            /* CALLBACK */
            callback: unsafe extern "C" fn(word: *const *const libc::c_char, user_data: *mut libc::c_void) -> libc::c_int,
            userdata: *mut libc::c_void) -> *const HexchatHook,
    pub(crate) hexchat_hook_timer: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            timeout: libc::c_int,
            /* CALLBACK */
            callback: unsafe extern "C" fn(user_data: *mut libc::c_void) -> libc::c_int,
            userdata: *mut libc::c_void) -> *const HexchatHook,
    pub(crate) hexchat_hook_fd: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            fd: libc::c_int,
            flags: libc::c_int,
            /* CALLBACK */
            callback: unsafe extern "C" fn(fd: libc::c_int, flags: libc::c_int, user_data: *mut libc::c_void) -> libc::c_int,
            userdata: *mut libc::c_void) -> *const HexchatHook,
    pub(crate) hexchat_unhook: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            hook: *const HexchatHook) -> *const libc::c_void,
    pub(crate) hexchat_print: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            text: *const libc::c_char),
    // this is VERY NAUGHTY.
    // NOTE this is an *owned* pointer, so {Const,Mut}LtPtr don't apply here.
    // TODO see if hexchat's gonna provide a proper userdata field at some point.
    // TODO test this on platforms hexchat doesn't build on, like AVR.
    pub(crate) userdata: *mut crate::PhUserdata<'ph>,
    /*pub(crate) hexchat_printf_do_not_use: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            format: *const libc::c_char, ...),*/
    pub(crate) hexchat_command: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            command: *const libc::c_char),
    pub(crate) hexchat_commandf_do_not_use: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            format: *const libc::c_char, ...),
    pub(crate) hexchat_nickcmp: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            s1: *const libc::c_char,
            s2: *const libc::c_char) -> libc::c_int,
    pub(crate) hexchat_set_context: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            ctx: *const HexchatContext) -> libc::c_int,
    pub(crate) hexchat_find_context: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            servname: *const libc::c_char,
            channel: *const libc::c_char) -> *const HexchatContext,
    pub(crate) hexchat_get_context: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>) -> *const HexchatContext,
    pub(crate) hexchat_get_info: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            id: *const libc::c_char) -> *const libc::c_char,
    pub(crate) hexchat_get_prefs: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            name: *const libc::c_char,
            string: *mut *const libc::c_char,
            integer: *mut libc::c_int) -> libc::c_int,
    pub(crate) hexchat_list_get: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            name: *const libc::c_char) -> *mut HexchatList,
    pub(crate) hexchat_list_free: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            xlist: *const HexchatList),
    pub(crate) hexchat_list_fields: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            name: *const libc::c_char) -> *const *const libc::c_char,
    pub(crate) hexchat_list_next: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            xlist: *const HexchatList) -> libc::c_int,
    pub(crate) hexchat_list_str: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            xlist: *const HexchatList,
            name: *const libc::c_char) -> *const libc::c_char,
    pub(crate) hexchat_list_int: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            xlist: *const HexchatList,
            name: *const libc::c_char) -> libc::c_int,
    pub(crate) hexchat_plugingui_add: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            filename: *const libc::c_char,
            name: *const libc::c_char,
            desc: *const libc::c_char,
            version: *const libc::c_char,
            reserved: *mut char) -> *const PluginGuiHandle,
    pub(crate) hexchat_plugingui_remove: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            handle: *const PluginGuiHandle),
    pub(crate) hexchat_emit_print: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            event_name: *const libc::c_char, ...) -> libc::c_int,
    pub(crate) hexchat_read_fd: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            src: *const libc::c_void,
            buf: *mut char,
            len: *mut libc::c_int) -> libc::c_int,
    pub(crate) hexchat_list_time: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            xlist: *const HexchatList,
            name: *const libc::c_char) -> libc::time_t,
    pub(crate) hexchat_gettext: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            msgid: *const libc::c_char) -> *const libc::c_char,
    pub(crate) hexchat_send_modes: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            targets: *mut *const libc::c_char,
            ntargets: libc::c_int,
            modes_per_line: libc::c_int,
            sign: libc::c_char,
            mode: libc::c_char),
    pub(crate) hexchat_strip: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            string: *const libc::c_char,
            len: libc::c_int,
            flags: libc::c_int) -> *const libc::c_char,
    pub(crate) hexchat_free: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            ptr: *const libc::c_void),
    pub(crate) hexchat_pluginpref_set_str: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            var: *const libc::c_char,
            value: *const libc::c_char) -> libc::c_int,
    pub(crate) hexchat_pluginpref_get_str: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            var: *const libc::c_char,
            dest: *mut char) -> libc::c_int,
    pub(crate) hexchat_pluginpref_set_int: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            var: *const libc::c_char,
            value: libc::c_int) -> libc::c_int,
    pub(crate) hexchat_pluginpref_get_int: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            var: *const libc::c_char) -> libc::c_int,
    pub(crate) hexchat_pluginpref_delete: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            var: *const libc::c_char) -> libc::c_int,
    pub(crate) hexchat_pluginpref_list: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            dest: *mut char) -> libc::c_int,
    pub(crate) hexchat_hook_server_attrs: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            name: *const libc::c_char,
            pri: libc::c_int,
            /* CALLBACK */
            callback: unsafe extern "C" fn(word: *const *const libc::c_char, word_eol: *const *const libc::c_char, attrs: *const HexchatEventAttrs, user_data: *mut libc::c_void) -> libc::c_int,
            userdata: *mut libc::c_void) -> *const HexchatHook,
    pub(crate) hexchat_hook_print_attrs: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            name: *const libc::c_char,
            pri: libc::c_int,
            /* CALLBACK */
            callback: unsafe extern "C" fn(word: *const *const libc::c_char, attrs: *const HexchatEventAttrs, user_data: *mut libc::c_void) -> libc::c_int,
            userdata: *mut libc::c_void) -> *const HexchatHook,
    pub(crate) hexchat_emit_print_attrs: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>, attrs: *const HexchatEventAttrs,
            event_name: *const libc::c_char, ...) -> libc::c_int,
    pub(crate) hexchat_event_attrs_create: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>) -> *mut HexchatEventAttrs,
    pub(crate) hexchat_event_attrs_free: unsafe extern "C" fn(ph: MutLtPtr<'ph, Ph<'ph>>,
            attrs: *mut HexchatEventAttrs),
}