Target

Constructors

this
this(Channel chan)
this
this(User user_)
this
this(string str, string modePrefixes, string channelPrefixes)
Undocumented in source.

Members

Functions

isChannel
bool isChannel()
isNickname
bool isNickname()
isUser
bool isUser()
opEquals
bool opEquals(string target)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(User target)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Channel target)
Undocumented in source. Be warned that the author may not have intended to support it.
targetText
auto targetText()
toString
void toString(T sink)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

channel
Nullable!Channel channel;
prefixes
Nullable!string prefixes;

Mode prefixes present in target. May be present on both channels and users.

user
Nullable!User user;

Examples

import virc.common : Channel, User;
{
	Target target;
	target.channel = Channel("#hello");
	assert(target == Channel("#hello"));
	assert(target != User("test"));
	assert(target == "#hello");
	assert(target.isChannel && !target.isUser);
}
{
	Target target;
	target.user = User("test");
	assert(target != Channel("#hello"));
	assert(target == User("test"));
	assert(target == "test");
	assert(!target.isChannel && target.isUser);
}
{
	Target target;
	assert(target != Channel("#hello"));
	assert(target != User("test"));
	assert(target != "test");
	assert(target != "#hello");
}
assert(Target("Hello", "+@%", "#&")  == User("Hello"));
assert(Target(Channel("#test")) == Channel("#test"));
assert(Target(User("Test")) == User("Test"));
{
	auto target = Target("+Hello", "+@%", "#&");
	assert(target == User("Hello"));
	assert(target.prefixes == "+");
}
assert(Target("#Hello", "+@%", "#&")  == Channel("#Hello"));
{
	auto target = Target("+#Hello", "+@%", "#&");
	assert(target == Channel("#Hello"));
	assert(target.prefixes == "+");
}
{
	auto target = Target("+@#Hello", "+@%", "#&");
	assert(target == Channel("#Hello"));
	assert(target.prefixes == "+@");
}
{
	auto target = Target("", "", "");
	assert(target.channel.isNull);
	assert(target.user.isNull);
}

Meta