Beispiel #1
0
void ClientAgent::ActionMessage(const char* msgz, const char* nick)
{
	BMessage actionSend(M_SERVER_SEND);

	AddSend(&actionSend, "PRIVMSG ");
	AddSend(&actionSend, fId);
	AddSend(&actionSend, " :\1ACTION ");
	AddSend(&actionSend, msgz);
	AddSend(&actionSend, "\1");
	AddSend(&actionSend, endl);

	BString theAction("\1ACTION ");
	theAction += msgz;
	theAction += "\1";

	ChannelMessage(theAction.String(), nick);
}
void IOServiceLibEvent::send(const ChannelId& id,
		mxcore::SharedPtr<mxcore::ByteBuffer> message, int timeout)
{
	ChannelContext* ctx = findChannel(id);

	MX_ASSERT(NULL != ctx);
	MX_ASSERT(ctx->isConnector());
	MX_ASSERT(message->remaining() > 0);

	ConnectorChannelContext* connectorCtx = (ConnectorChannelContext*) ctx;

	bool haveMessage = connectorCtx->haveMessageToWrite();

	connectorCtx->putWriteMessage(ChannelMessage(message, timeout, false));

	if (!haveMessage)
	{
		connectorCtx->registWrite();
		connectorCtx->registWriteTimer(timeout);
	}
}