示例#1
0
void wr_client_init(void) {
	wr_server_string_encoding = wi_string_encoding_init_with_charset(
		wi_string_encoding_alloc(),
		WI_STR("UTF-8"),
		WI_STRING_ENCODING_IGNORE | WI_STRING_ENCODING_TRANSLITERATE);
	
	wr_client_set_charset(WI_STR("UTF-8"));
	
	wr_nick = wi_retain(wi_user_name());
	wr_icon = wi_data_init_with_base64(wi_data_alloc(), wi_string_with_cstring(wr_default_icon));
}
示例#2
0
void wr_init_client(void) {
	int			options;
	
	wr_socket_context = wi_socket_context_init(wi_socket_context_alloc());
	
	if(!wi_socket_context_set_ssl_type(wr_socket_context, WI_SOCKET_SSL_CLIENT))
		wi_log_err(WI_STR("Could not set SSL context: %m"));
	
	options = WI_STRING_ENCODING_IGNORE | WI_STRING_ENCODING_TRANSLITERATE;
	
	wr_client_string_encoding = wi_string_encoding_init_with_charset(wi_string_encoding_alloc(),
																	 WI_STR("ISO-8859-1"),
																	 options);
	
	wr_server_string_encoding = wi_string_encoding_init_with_charset(wi_string_encoding_alloc(),
																	 WI_STR("UTF-8"),
																	 options);
	
	wr_icon = wi_string_init_with_cstring(wi_string_alloc(), wr_default_icon);
}
示例#3
0
void wr_client_init(void) {
	wr_socket_tls = wi_socket_tls_init_with_type(wi_socket_tls_alloc(), WI_SOCKET_TLS_CLIENT);
	
	if(!wr_socket_tls)
		wi_log_error(WI_STR("Could not create TLS context: %m"));
	
	if(!wi_socket_tls_set_ciphers(wr_socket_tls, WI_STR("ALL:NULL:!MD5:@STRENGTH")))
		wi_log_error(WI_STR("Could not set TLS ciphers: %m"));
	
	wr_server_string_encoding = wi_string_encoding_init_with_charset(
		wi_string_encoding_alloc(),
		WI_STR("UTF-8"),
		WI_STRING_ENCODING_IGNORE | WI_STRING_ENCODING_TRANSLITERATE);
	
	wr_set_charset(WI_STR("UTF-8"));
	
	wr_nick = wi_retain(wi_user_name());
	wr_icon = wi_string_init_with_cstring(wi_string_alloc(), wr_default_icon);
}
示例#4
0
wi_boolean_t wr_client_set_charset(wi_string_t *charset) {
	wi_string_encoding_t	*encoding;
	wi_integer_t			options;
	
	if(wr_client_string_encoding && wi_is_equal(charset, wi_string_encoding_charset(wr_client_string_encoding)))
		return true;
	
	options = WI_STRING_ENCODING_IGNORE | WI_STRING_ENCODING_TRANSLITERATE;
	encoding = wi_string_encoding_init_with_charset(wi_string_encoding_alloc(),
													charset,
													options);
	
	if(!encoding)
		return false;

	wi_release(wr_client_string_encoding);
	wr_client_string_encoding = encoding;
	
	wr_printf_prefix(WI_STR("Using character set %@"), charset);
	
	return true;
}
示例#5
0
void wr_client_init(void) {
    wr_server_string_encoding = wi_string_encoding_init_with_charset(
                                    wi_string_encoding_alloc(),
                                    WI_STR("UTF-8"),
                                    WI_STRING_ENCODING_IGNORE | WI_STRING_ENCODING_TRANSLITERATE);

    //wr_client_set_charset(WI_STR("UTF-8"));

    wr_nick 	= wi_retain(wi_config_string_for_name(wd_config, WI_STR("nick")));
    wr_status 	= wi_retain(wi_config_string_for_name(wd_config, WI_STR("status")));

    // if(wi_fs_path_exists(wr_icon_path, false)) {
    // 	wi_log_info(WI_STR("wr_icon_path: %@"), wr_icon_path);
    // 	wr_icon	= wi_data_init_with_contents_of_file(wi_data_alloc(), wr_icon_path);
    // }

    if(!wr_nick)
        wr_nick = wi_retain(wi_user_name());

    // if(!wr_icon)
    // 	wr_icon = wi_data_init_with_base64(wi_data_alloc(), wi_string_with_cstring(wr_default_icon));

    wr_client_reload_icon();
}
wi_string_encoding_t * wi_string_encoding_with_charset(wi_string_t *charset, wi_string_encoding_options_t options) {
    return wi_autorelease(wi_string_encoding_init_with_charset(wi_string_encoding_alloc(), charset, options));
}