[][src]Struct weechat::weechat::Weechat

pub struct Weechat { /* fields omitted */ }

Main Weechat struct that encapsulates common weechat API functions. It has a similar API as the weechat script API.

Methods

impl Weechat[src]

Search a buffer by plugin and/or name.

  • plugin_name - name of a plugin, the following special value is allowed: "==", the buffer name used is the buffers full name.
  • buffer_name - name of a buffer, if this is an empty string, the current buffer is returned (buffer displayed by current window); if the name starts with (?i), the search is case insensitive. Returns a Buffer if one is found, otherwise None.

pub fn buffer_new<A: Default, B: Default>(
    &self,
    name: &str,
    input_cb: Option<fn(_: &mut A, _: Buffer, _: &str)>,
    input_data: Option<A>,
    close_cb: Option<fn(_: &B, _: Buffer)>,
    close_cb_data: Option<B>
) -> Buffer
[src]

Create a new Weechat buffer

  • name - Name of the new buffer
  • input_cb - Callback that will be called when something is entered into the input bar of the buffer
  • input_data - Data that will be taken over by weechat and passed to the input callback, this data will be freed when the buffer closes
  • close_cb - Callback that will be called when the buffer is closed.
  • close_cb_data - Reference to some data that will be passed to the close callback.

impl Weechat[src]

Configuration file part of the weechat API.

pub fn config_new<T: Default>(
    &self,
    name: &str,
    reload_callback: Option<fn(_: &mut T)>,
    reload_data: Option<T>
) -> Config<T>
[src]

Create a new Weechat configuration file, returns a Config object. The configuration file is freed when the Config object is dropped.

  • name - Name of the new configuration file
  • reload_callback - Callback that will be called when the configuration file is reloaded.
  • reload_data - Data that will be taken over by weechat and passed to the reload callback, this data will be freed when the Config object returned by this method is dropped.

impl Weechat[src]

pub fn hook_command<T>(
    &self,
    command_info: CommandDescription,
    callback: fn(data: &T, buffer: Buffer, args: ArgsWeechat),
    callback_data: Option<T>
) -> CommandHook<T> where
    T: Default
[src]

Create a new weechat command. Returns the hook of the command. The command is unhooked if the hook is dropped.

pub fn hook_fd<T, F>(
    &self,
    fd_object: F,
    mode: FdHookMode,
    callback: fn(data: &T, fd_object: &mut F),
    callback_data: Option<T>
) -> FdHook<T, F> where
    T: Default,
    F: AsRawFd
[src]

Hook an object that can be turned into a raw file descriptor. Returns the hook object.

  • fd_object - An object for wich the file descriptor will be watched and the callback called when read or write operations can happen on it.
  • mode - Configure the hook to watch for writes, reads or both on the file descriptor.
  • callback - A function that will be called if a watched event on the file descriptor happends.
  • callback_data - Data that will be passed to the callback every time the callback runs. This data will be freed when the hook is unhooked.

impl Weechat[src]

pub fn from_ptr(ptr: *mut t_weechat_plugin) -> Weechat[src]

Create a Weechat object from a C t_weechat_plugin pointer.

  • ptr - Pointer of the weechat plugin.

pub fn log(&self, msg: &str)[src]

Write a message in WeeChat log file (weechat.log).

pub fn print(&self, msg: &str)[src]

Display a message on the core weechat buffer.

pub fn color(&self, color_name: &str) -> &str[src]

Return a string color code for display.

  • color_name - name the color

pub fn info_get(&self, info_name: &str, arguments: &str) -> &str[src]

Get some info from Weechat or a plugin.

  • info_name - name the info
  • arguments - arguments for the info

impl Weechat[src]

pub fn infolist_get(&self, name: &str, arguments: &str) -> Option<Infolist>[src]

Get an infolist.

  • name - The name of the infolist.
  • arguments - Optional arguments for the infolist. See the weechat C API documentation for valid values. Returns an Infolist object that behaves like a cursor that can be moved back and forth to access individual Infolist items.

Auto Trait Implementations

impl !Send for Weechat

impl !Sync for Weechat

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]