示例#1
0
void fe_common_irc_init(void)
{
	settings_add_bool("lookandfeel", "show_away_once", TRUE);

	theme_register(fecommon_irc_formats);

	fe_irc_channels_init();
	fe_irc_queries_init();
	fe_irc_messages_init();
	fe_irc_commands_init();
	fe_ircnet_init();
	fe_irc_server_init();
	fe_ctcp_init();
	fe_events_init();
	fe_events_numeric_init();
	fe_modes_init();
	fe_netsplit_init();
	fe_netjoin_init();
        fe_whois_init();
	fe_sasl_init();
        irc_completion_init();

	settings_check();
	module_register("core", "fe-irc");

	fe_irc_modules_init();
}
示例#2
0
void fe_common_irc_init(void)
{
	static struct poptOption options[] = {
		{ "connect", 'c', POPT_ARG_STRING, &autocon_server, 0, N_("Automatically connect to server/ircnet"), N_("SERVER") },
		{ "password", 'w', POPT_ARG_STRING, &autocon_password, 0, N_("Autoconnect password"), N_("SERVER") },
		{ "port", 'p', POPT_ARG_INT, &autocon_port, 0, N_("Autoconnect port"), N_("PORT") },
		{ "noconnect", '!', POPT_ARG_NONE, &no_autoconnect, 0, N_("Disable autoconnecting"), NULL },
		{ "nick", 'n', POPT_ARG_STRING, &cmdline_nick, 0, N_("Specify nick to use"), NULL },
		{ "hostname", 'h', POPT_ARG_STRING, &cmdline_hostname, 0, N_("Specify host name to use"), NULL },
		{ NULL, '\0', 0, NULL }
	};

	autocon_server = NULL;
	autocon_password = NULL;
	autocon_port = 6667;
	no_autoconnect = FALSE;
	cmdline_nick = NULL;
	cmdline_hostname = NULL;
	args_register(options);

	settings_add_str("lookandfeel", "beep_on_msg", "");
	settings_add_bool("lookandfeel", "beep_when_away", TRUE);
	settings_add_bool("lookandfeel", "show_away_once", TRUE);
	settings_add_bool("lookandfeel", "show_quit_once", FALSE);

	theme_register(fecommon_irc_formats);

	fe_channels_init();
	fe_irc_commands_init();
	fe_ircnet_init();
	fe_irc_server_init();
	fe_ctcp_init();
	fe_events_init();
	fe_events_numeric_init();
	fe_ignore_init();
	fe_netsplit_init();
	fe_query_init();
	irc_completion_init();
	irc_hilight_text_init();
	irc_window_activity_init();

	fe_irc_modules_init();
}
示例#3
0
int
dogechat_plugin_init (struct t_dogechat_plugin *plugin, int argc, char *argv[])
{
    int i, auto_connect, upgrading;

    dogechat_plugin = plugin;

    if (!irc_config_init ())
        return DOGECHAT_RC_ERROR;

    irc_config_read ();

    irc_command_init ();

    irc_info_init ();

    irc_redirect_init ();

    irc_notify_init ();

    /* hook some signals */
    irc_debug_init ();
    dogechat_hook_signal ("quit", &irc_signal_quit_cb, NULL);
    dogechat_hook_signal ("upgrade", &irc_signal_upgrade_cb, NULL);
    dogechat_hook_signal ("xfer_send_ready", &irc_server_xfer_send_ready_cb, NULL);
    dogechat_hook_signal ("xfer_resume_ready", &irc_server_xfer_resume_ready_cb, NULL);
    dogechat_hook_signal ("xfer_send_accept_resume", &irc_server_xfer_send_accept_resume_cb, NULL);
    dogechat_hook_signal ("irc_input_send", &irc_input_send_cb, NULL);

    /* hook hsignals for redirection */
    dogechat_hook_hsignal ("irc_redirect_pattern", &irc_redirect_pattern_hsignal_cb, NULL);
    dogechat_hook_hsignal ("irc_redirect_command", &irc_redirect_command_hsignal_cb, NULL);

    /* modifiers */
    dogechat_hook_modifier ("irc_color_decode", &irc_color_modifier_cb, NULL);
    dogechat_hook_modifier ("irc_color_encode", &irc_color_modifier_cb, NULL);
    dogechat_hook_modifier ("irc_color_decode_ansi", &irc_color_modifier_cb, NULL);

    /* hook completions */
    irc_completion_init ();

    irc_bar_item_init ();

    /* look at arguments */
    auto_connect = 1;
    upgrading = 0;
    for (i = 0; i < argc; i++)
    {
        if ((dogechat_strcasecmp (argv[i], "-a") == 0)
            || (dogechat_strcasecmp (argv[i], "--no-connect") == 0))
        {
            auto_connect = 0;
        }
        else if ((dogechat_strncasecmp (argv[i], IRC_PLUGIN_NAME, 3) == 0))
        {
            if (!irc_server_alloc_with_url (argv[i]))
            {
                dogechat_printf (
                    NULL,
                    _("%s%s: unable to add temporary server \"%s\" (check "
                      "if there is already a server with this name)"),
                    dogechat_prefix ("error"), IRC_PLUGIN_NAME, argv[i]);
            }
        }
        else if (dogechat_strcasecmp (argv[i], "--upgrade") == 0)
        {
            upgrading = 1;
        }
    }

    if (upgrading)
    {
        if (!irc_upgrade_load ())
        {
            dogechat_printf (
                NULL,
                _("%s%s: WARNING: some network connections may still be "
                  "opened and not visible, you should restart DogeChat now "
                  "(with /quit)."),
                dogechat_prefix ("error"), IRC_PLUGIN_NAME);
        }
    }
    else
    {
        irc_server_auto_connect (auto_connect);
    }

    irc_hook_timer = dogechat_hook_timer (1 * 1000, 0, 0,
                                         &irc_server_timer_cb, NULL);

    return DOGECHAT_RC_OK;
}