コード例 #1
0
ファイル: libxmpp.c プロジェクト: bf4/pidgin-mac
static void
init_plugin(PurplePlugin *plugin)
{
#ifdef HAVE_CYRUS_SASL
#ifdef _WIN32
	UINT old_error_mode;
	gchar *sasldir;
#endif
	int ret;
#endif
	PurpleAccountUserSplit *split;
	PurpleAccountOption *option;
	
	/* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */
	split = purple_account_user_split_new(_("Domain"), NULL, '@');
	purple_account_user_split_set_reverse(split, FALSE);
	prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
	
	split = purple_account_user_split_new(_("Resource"), NULL, '/');
	purple_account_user_split_set_reverse(split, FALSE);
	prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
	
	option = purple_account_option_bool_new(_("Require SSL/TLS"), "require_tls", FALSE);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
											   option);
	
	option = purple_account_option_bool_new(_("Force old (port 5223) SSL"), "old_ssl", FALSE);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
											   option);
	
	option = purple_account_option_bool_new(
						_("Allow plaintext auth over unencrypted streams"),
						"auth_plain_in_clear", FALSE);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
						   option);
	
	option = purple_account_option_int_new(_("Connect port"), "port", 5222);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
						   option);

	option = purple_account_option_string_new(_("Connect server"),
						  "connect_server", NULL);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
						  option);

	option = purple_account_option_string_new(_("File transfer proxies"),
						  "ft_proxies",
						/* TODO: Is this an acceptable default? */
						  "proxy.jabber.org");
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
						  option);

	/* this should probably be part of global smiley theme settings later on,
	  shared with MSN */
	option = purple_account_option_bool_new(_("Show Custom Smileys"),
		"custom_smileys", TRUE);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
		option);

	jabber_init_plugin(plugin);

	purple_prefs_remove("/plugins/prpl/jabber");

	/* XXX - If any other plugin wants SASL this won't be good ... */
#ifdef HAVE_CYRUS_SASL
#ifdef _WIN32
	sasldir = g_build_filename(wpurple_install_dir(), "sasl2", NULL);
	sasl_set_path(SASL_PATH_TYPE_PLUGIN, sasldir);
	g_free(sasldir);
	/* Suppress error popups for failing to load sasl plugins */
	old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
	if ((ret = sasl_client_init(NULL)) != SASL_OK) {
		purple_debug_error("xmpp", "Error (%d) initializing SASL.\n", ret);
	}
#ifdef _WIN32
	/* Restore the original error mode */
	SetErrorMode(old_error_mode);
#endif
#endif
	jabber_register_commands();
	
	jabber_iq_init();
	jabber_pep_init();
	
	jabber_tune_init();
	jabber_caps_init();
	
	jabber_data_init();
	
	jabber_add_feature("avatarmeta", AVATARNAMESPACEMETA, jabber_pep_namespace_only_when_pep_enabled_cb);
	jabber_add_feature("avatardata", AVATARNAMESPACEDATA, jabber_pep_namespace_only_when_pep_enabled_cb);
	jabber_add_feature("buzz", "http://www.xmpp.org/extensions/xep-0224.html#ns",
					   jabber_buzz_isenabled);
	jabber_add_feature("bob", XEP_0231_NAMESPACE,
					   jabber_custom_smileys_isenabled);

	jabber_pep_register_handler("avatar", AVATARNAMESPACEMETA, jabber_buddy_avatar_update_metadata);
}
コード例 #2
0
ファイル: libxmpp.c プロジェクト: psunkari/spicebird
static void
init_plugin(PurplePlugin *plugin)
{
#ifdef HAVE_CYRUS_SASL
#ifdef _WIN32
    UINT old_error_mode;
    gchar *sasldir;
#endif
    int ret;
#endif
    PurpleAccountUserSplit *split;
    PurpleAccountOption *option;

    /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */
    split = purple_account_user_split_new(_("Domain"), NULL, '@');
    purple_account_user_split_set_reverse(split, FALSE);
    prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);

    split = purple_account_user_split_new(_("Resource"), NULL, '/');
    purple_account_user_split_set_reverse(split, FALSE);
    prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);

    option = purple_account_option_bool_new(_("Require SSL/TLS"), "require_tls", JABBER_DEFAULT_REQUIRE_TLS);
    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
                                 option);

    option = purple_account_option_bool_new(_("Force old (port 5223) SSL"), "old_ssl", FALSE);
    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
                                 option);

    option = purple_account_option_bool_new(
                 _("Allow plaintext auth over unencrypted streams"),
                 "auth_plain_in_clear", FALSE);
    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
                                 option);

    option = purple_account_option_int_new(_("Connect port"), "port", 5222);
    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
                                 option);

    option = purple_account_option_string_new(_("Connect server"),
             "connect_server", NULL);
    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
                                 option);

    option = purple_account_option_string_new(_("File transfer proxies"),
             "ft_proxies",
             /* TODO: Is this an acceptable default?
              * Also, keep this in sync as they add more servers */
             "proxy.eu.jabber.org");
    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
                                 option);

    option = purple_account_option_string_new(_("BOSH URL"),
             "bosh_url", NULL);
    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
                                 option);

    /* this should probably be part of global smiley theme settings later on,
      shared with MSN */
    option = purple_account_option_bool_new(_("Show Custom Smileys"),
                                            "custom_smileys", TRUE);
    prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
                                 option);

    my_protocol = plugin;
    jabber_init_plugin(plugin);

    purple_prefs_remove("/plugins/prpl/jabber");

    /* XXX - If any other plugin wants SASL this won't be good ... */
#ifdef HAVE_CYRUS_SASL
#ifdef _WIN32
    sasldir = g_build_filename(wpurple_install_dir(), "sasl2", NULL);
    sasl_set_path(SASL_PATH_TYPE_PLUGIN, sasldir);
    g_free(sasldir);
    /* Suppress error popups for failing to load sasl plugins */
    old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
    if ((ret = sasl_client_init(NULL)) != SASL_OK) {
        purple_debug_error("xmpp", "Error (%d) initializing SASL.\n", ret);
    }
#ifdef _WIN32
    /* Restore the original error mode */
    SetErrorMode(old_error_mode);
#endif
#endif
    jabber_register_commands();

    /* reverse order of unload_plugin */
    jabber_iq_init();
    jabber_caps_init();
    /* PEP things should be init via jabber_pep_init, not here */
    jabber_pep_init();
    jabber_data_init();
    jabber_bosh_init();

    /* BEGIN SPICEBIRD CHANGES */
#if 0
#warning implement adding and retrieving own features via IPC API
#endif
    /* END SPICEBIRD CHANGES */

    jabber_ibb_init();
    jabber_si_init();

    purple_signal_connect(purple_get_core(), "uri-handler", plugin,
                          PURPLE_CALLBACK(xmpp_uri_handler), NULL);
}