const char* target = params[0].c_str();
std::string text = params[1].c_str();
- if ((*target == '@') || (*target == '%') || (*target == '+'))
+ if (Instance->Modes->FindPrefix(*target))
{
status = *target;
target++;
}
Channel* channel = Instance->FindChan(target);
-
- if (target)
+
+ if (channel)
{
if (messagetype == "PRIVMSG")
{
if (s)
{
FOREACH_MOD_I(Instance, I_OnText, OnText(NULL, channel, TYPE_CHANNEL, text, status, except_list));
- channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name, text.c_str());
+ channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name.c_str(), text.c_str());
}
}
else
{
User* user = Instance->FindNick(target);
-
+
if (user)
{
if (messagetype == "PRIVMSG")
if (s)
{
FOREACH_MOD_I(Instance, I_OnText, OnText(NULL, user, TYPE_USER, text, status, except_list));
- user->Write(":%s %s %s :%s", s->GetName().c_str(), messagetype.c_str(), user->nick, text.c_str());
+ user->Write(":%s %s %s :%s", s->GetName().c_str(), messagetype.c_str(), user->nick.c_str(), text.c_str());
}
}