示例#1
0
static void highlight_init() {
    /* Let everyone know we're here. */
    scr_log_print(LPRINT_NORMAL, "highlight: plugin enabled.");

    /* Register our message handler so we can start processing incoming messages. */
    globals.hook = hk_add_handler(highlight_process_message, HOOK_PRE_MESSAGE_IN, G_PRIORITY_DEFAULT, NULL);

    /* Add our commands for highlighting. */
    cmd_add("highlight", "", 0, 0, highlight_command, NULL);
}
示例#2
0
static void mucignore_init()
{
    const gchar* ignore = settings_opt_get("mucignore");
    if (ignore) {
        mucignore = g_regex_new(ignore,
            G_REGEX_OPTIMIZE|G_REGEX_ANCHORED, G_REGEX_MATCH_ANCHORED, NULL);
        mucignore_msg_in_hid = hk_add_handler(mucignore_handle_message,
            HOOK_PRE_MESSAGE_IN, G_PRIORITY_HIGH, NULL);
    } else {
        mucignore = NULL;
    }
}
示例#3
0
/* Initialization */
static void urlregex_init(void)
{
  if (settings_opt_get("url_regex")) {
#ifdef HAVE_GLIB_REGEX
    url_regex = g_regex_new(settings_opt_get("url_regex"),
                            G_REGEX_OPTIMIZE, 0, NULL);
    /* Add handler
     * We are only interested in incoming message events
     */
    urlregex_hid = hk_add_handler(urlregex_hh, HOOK_POST_MESSAGE_IN,
                                  G_PRIORITY_DEFAULT_IDLE, NULL);
#else
    scr_log_print(LPRINT_LOGNORM, "ERROR: Your glib version is too old, "
                  "cannot use url_regex.");
#endif // HAVE_GLIB_REGEX
  }
}