예제 #1
0
	torrent_alert::torrent_alert(aux::stack_allocator& alloc
		, torrent_handle const& h)
		: handle(h)
		, m_alloc(alloc)
	{
		std::string name_str;
		if (h.native_handle())
		{
			m_name_idx = alloc.copy_string(h.native_handle()->name());
		}
		else if (h.is_valid())
		{
			char msg[41];
			to_hex(h.native_handle()->info_hash().data(), 20, msg);
			m_name_idx = alloc.copy_string(msg);
		}
		else
		{
			m_name_idx = alloc.copy_string("");
		}

#ifndef TORRENT_NO_DEPRECATE
		name = torrent_name();
#endif
	}
예제 #2
0
	torrent_alert::torrent_alert(aux::stack_allocator& alloc
		, torrent_handle const& h)
		: handle(h)
		, m_alloc(alloc)
	{
		boost::shared_ptr<torrent> t = h.native_handle();
		if (t)
		{
			std::string name_str = t->name();
			if (!name_str.empty()) {
				m_name_idx = alloc.copy_string(name_str);
			}
			else
			{
				char msg[41];
				to_hex(t->info_hash().data(), 20, msg);
				m_name_idx = alloc.copy_string(msg);
			}
		}
		else
		{
			m_name_idx = alloc.copy_string("");
		}

#ifndef TORRENT_NO_DEPRECATE
		name = torrent_name();
#endif
	}
예제 #3
0
	portmap_log_alert::portmap_log_alert(aux::stack_allocator& alloc, int t, const char* m)
		: map_type(t)
#ifndef TORRENT_NO_DEPRECATE
		, msg(m)
#endif
		, m_alloc(alloc)
		, m_log_idx(alloc.copy_string(m))
	{}
예제 #4
0
	storage_moved_alert::storage_moved_alert(aux::stack_allocator& alloc
		, torrent_handle const& h, std::string const& p)
		: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
		, path(p)
#endif
		, m_path_idx(alloc.copy_string(p))
	{}
예제 #5
0
	tracker_alert::tracker_alert(aux::stack_allocator& alloc
		, torrent_handle const& h
		, std::string const& u)
		: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
		, url(u)
#endif
		, m_url_idx(alloc.copy_string(u))
	{}
예제 #6
0
	url_seed_alert::url_seed_alert(aux::stack_allocator& alloc, torrent_handle const& h
		, std::string const& u, std::string const& m)
		: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
		, url(u)
		, msg(m)
#endif
		, m_url_idx(alloc.copy_string(u))
		, m_msg_idx(alloc.copy_string(m))
	{}
예제 #7
0
	torrent_error_alert::torrent_error_alert(
		aux::stack_allocator& alloc
		, torrent_handle const& h
		, error_code const& e, std::string const& f)
		: torrent_alert(alloc, h)
		, error(e)
#ifndef TORRENT_NO_DEPRECATE
		, error_file(f)
#endif
		, m_file_idx(alloc.copy_string(f))
	{}
예제 #8
0
	file_renamed_alert::file_renamed_alert(aux::stack_allocator& alloc
		, torrent_handle const& h
		, std::string const& n
		, int idx)
		: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
		, name(n)
#endif
		, index(idx)
		, m_name_idx(alloc.copy_string(n))
	{}
예제 #9
0
	url_seed_alert::url_seed_alert(aux::stack_allocator& alloc, torrent_handle const& h
		, std::string const& u, error_code const& e)
		: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
		, url(u)
		, msg(convert_from_native(e.message()))
#endif
		, error(e)
		, m_url_idx(alloc.copy_string(u))
		, m_msg_idx(-1)
	{}
예제 #10
0
	trackerid_alert::trackerid_alert(
		aux::stack_allocator& alloc
		, torrent_handle const& h
		, std::string const& u
		, const std::string& id)
		: tracker_alert(alloc, h, u)
#ifndef TORRENT_NO_DEPRECATE
		, trackerid(id)
#endif
		, m_tracker_idx(alloc.copy_string(id))
	{}
예제 #11
0
	tracker_warning_alert::tracker_warning_alert(aux::stack_allocator& alloc
		, torrent_handle const& h
		, std::string const& u
		, std::string const& m)
		: tracker_alert(alloc, h, u)
#ifndef TORRENT_NO_DEPRECATE
		, msg(m)
#endif
		, m_msg_idx(alloc.copy_string(m))
	{
		TORRENT_ASSERT(!u.empty());
	}
예제 #12
0
	peer_log_alert::peer_log_alert(aux::stack_allocator& alloc
		, torrent_handle const& h
		, tcp::endpoint const& i
		, peer_id const& pi
		, direction_t dir
		, char const* event
		, char const* log)
		: peer_alert(alloc, h, i, pi)
		, event_type(event)
		, direction(dir)
		, m_str_idx(alloc.copy_string(log))
	{}
예제 #13
0
	storage_moved_failed_alert::storage_moved_failed_alert(
		aux::stack_allocator& alloc
		, torrent_handle const& h
		, error_code const& e
		, std::string const& f
		, char const* op)
		: torrent_alert(alloc, h)
		, error(e)
#ifndef TORRENT_NO_DEPRECATE
		, file(f)
#endif
		, operation(op)
		, m_file_idx(alloc.copy_string(f))
	{}
예제 #14
0
	listen_failed_alert::listen_failed_alert(
		aux::stack_allocator& alloc
		, std::string const& iface
		, tcp::endpoint const& ep
		, int op
		, error_code const& ec
		, socket_type_t t)
		: error(ec)
		, operation(op)
		, sock_type(t)
		, endpoint(ep)
		, m_alloc(alloc)
		, m_interface_idx(alloc.copy_string(iface))
	{}
예제 #15
0
	listen_failed_alert::listen_failed_alert(
		aux::stack_allocator& alloc
		, std::string iface
		, int op
		, error_code const& ec
		, socket_type_t t)
		:
#if !defined(TORRENT_NO_DEPRECATE) && !defined(TORRENT_WINRT)
			interface(iface),
#endif
		error(ec)
		, operation(op)
		, sock_type(t)
		, m_alloc(alloc)
		, m_interface_idx(alloc.copy_string(iface))
	{}
예제 #16
0
	file_error_alert::file_error_alert(aux::stack_allocator& alloc
		, error_code const& ec
		, std::string const& f
		, char const* op
		, torrent_handle const& h)
		: torrent_alert(alloc, h)
#ifndef TORRENT_NO_DEPRECATE
		, file(f)
#endif
		, error(ec)
		, operation(op)
		, m_file_idx(alloc.copy_string(f))
	{
#ifndef TORRENT_NO_DEPRECATE
		msg = convert_from_native(error.message());
#endif
	}
예제 #17
0
	fastresume_rejected_alert::fastresume_rejected_alert(
		aux::stack_allocator& alloc
		, torrent_handle const& h
		, error_code const& ec
		, std::string const& file
		, char const* op)
		: torrent_alert(alloc, h)
		, error(ec)
#ifndef TORRENT_NO_DEPRECATE
		, file(file)
#endif
		, operation(op)
		, m_path_idx(alloc.copy_string(file))
	{
#ifndef TORRENT_NO_DEPRECATE
		msg = convert_from_native(error.message());
#endif
	}
예제 #18
0
	tracker_error_alert::tracker_error_alert(aux::stack_allocator& alloc
		, torrent_handle const& h
		, int times
		, int status
		, std::string const& u
		, error_code const& e
		, std::string const& m)
		: tracker_alert(alloc, h, u)
		, times_in_row(times)
		, status_code(status)
		, error(e)
#ifndef TORRENT_NO_DEPRECATE
		, msg(m)
#endif
		, m_msg_idx(alloc.copy_string(m))
	{
		TORRENT_ASSERT(!u.empty());
	}
예제 #19
0
	dht_log_alert::dht_log_alert(aux::stack_allocator& alloc
		, dht_log_alert::dht_module_t m, const char* msg)
		: module(m)
		, m_alloc(alloc)
		, m_msg_idx(alloc.copy_string(msg))
	{}
예제 #20
0
	torrent_log_alert::torrent_log_alert(aux::stack_allocator& alloc, torrent_handle h
		, char const* log)
		: torrent_alert(alloc, h)
		, m_str_idx(alloc.copy_string(log))
	{}
예제 #21
0
	log_alert::log_alert(aux::stack_allocator& alloc, char const* log)
		: m_alloc(alloc)
		, m_str_idx(alloc.copy_string(log))
	{}