The complete source code of IdealIRC
http://www.idealirc.org/
37 lines
1.2 KiB
37 lines
1.2 KiB
/*
|
|
* IdealIRC - Internet Relay Chat client
|
|
* Copyright (C) 2021 Tom-Andre Barstad.
|
|
* This software is licensed under the Software Attribution License.
|
|
* See LICENSE for more information.
|
|
*/
|
|
|
|
#include "ICommand/ICommandPriv.h"
|
|
#include "ICommand/Commands.h"
|
|
#include "IRCClient/IRCChannel.h"
|
|
|
|
using namespace Command::Internal;
|
|
|
|
void ICommandPriv::cmd_me(const std::string& target, const std::string& message)
|
|
{
|
|
connection.ctcpRequest(target, ACTION, message);
|
|
|
|
std::string mynick = connection.getNickname();
|
|
IWin* cw = status.getActiveWindow();
|
|
|
|
if (cw->getType() == IWin::Type::Channel) {
|
|
auto channel = connection.getChannel( cw->getButtonText().toStdString() );
|
|
auto& member = channel->getMember(mynick)->get();
|
|
const std::string& mymodes = member.modes();
|
|
|
|
if (!mymodes.empty()) {
|
|
std::string pf = connection.toMemberPrefix(mymodes);
|
|
if (!pf.empty())
|
|
mynick.insert(mynick.begin(), pf[0]);
|
|
}
|
|
}
|
|
|
|
if (!target.empty() && !message.empty())
|
|
cw->print(PrintType::Action, QStringLiteral("%1 %2")
|
|
.arg(mynick.c_str())
|
|
.arg(message.c_str()));
|
|
}
|
|
|