Пример #1
0
	void Plugin::hookTooltipBeforeVariants (IHookProxy_ptr proxy, QObject *entryObj)
	{
		if (!IsGoodEntry (entryObj))
			return;

		const auto entry = qobject_cast<ICLEntry*> (entryObj);
		const auto& id = entry->GetEntryID ();

		const auto& maybeStats = Storage_->GetEntryStats (id);
		if (!maybeStats)
			return;

		const auto& stats = *maybeStats;

		QString addition;

		const auto curState = entry->GetStatus ().State_;

		if (curState != SOnline)
		{
			const auto& avail = stats.Available_;
			if (avail.isValid ())
				addition += tr ("Was available: %1")
					.arg (avail.toString ());
		}

		if (curState == SOffline ||
				curState == SError ||
				curState == SInvalid)
		{
			const auto& online = stats.Online_;
			if (online.isValid ())
			{
				if (!addition.isEmpty ())
					addition += "<br/>";
				addition += tr ("Was online: %1")
					.arg (online.toString ());
			}
		}

		const auto& lastChange = stats.StatusChange_;
		if (lastChange.isValid ())
		{
			if (!addition.isEmpty ())
				addition += "<br/>";
			addition += tr ("Last status change: %1")
					.arg (lastChange.toString ());
		}

		if (addition.isEmpty ())
			return;

		const auto& tip = proxy->GetValue ("tooltip").toString ();
		proxy->SetValue ("tooltip", tip + "<br/><br/>" + addition + "<br/>");
	}
Пример #2
0
void Plugin::hookFormatBodyEnd (IHookProxy_ptr proxy,
                                QObject *chatTab, QString body, QObject *msgObj)
{
    IMessage *msg = qobject_cast<IMessage*> (msgObj);
    if (msg->GetDirection () != IMessage::DIn ||
            msg->GetMessageType () != IMessage::MTChatMessage)
        return;

    ICLEntry *other = qobject_cast<ICLEntry*> (msg->OtherPart ());
    if (!other->GetEntryID ().contains ("*****@*****.**"))
        return;

    proxy->SetValue ("body", FormatBody (body));
}
Пример #3
0
	void Plugin::hookFormatBodyEnd (IHookProxy_ptr proxy,
			QObject *message)
	{
		if (ConvScriptPath_.isEmpty ())
			return;

		if (!XmlSettingsManager::Instance ()
				.property ("OnDisplayRendering").toBool ())
			return;

		const QString& body = proxy->GetValue ("body").toString ();

		if (!body.contains ("$$"))
			return;

		const QString newBody = HandleBody (body);
		if (body != newBody)
			proxy->SetValue ("body", newBody);
	}
Пример #4
0
	void Plugin::hookTooltipBeforeVariants (IHookProxy_ptr proxy, QObject *entryObj)
	{
		if (!IsGoodEntry (entryObj))
			return;

		ICLEntry *entry = qobject_cast<ICLEntry*> (entryObj);
		const QString& id = entry->GetEntryID ();

		QString addition;

		const State curState = entry->GetStatus ().State_;

		if (curState != SOnline)
		{
			const QDateTime& avail = LastAvailable_.value (id);
			if (avail.isValid ())
				addition += tr ("Was available: %1")
					.arg (avail.toString ());
		}

		if (curState == SOffline ||
				curState == SError ||
				curState == SInvalid)
		{
			const QDateTime& online = LastOnline_.value (id);
			if (LastOnline_.contains (id))
			{
				if (!addition.isEmpty ())
					addition += "<br/>";
				addition += tr ("Was online: %1")
					.arg (online.toString ());
			}
		}

		if (addition.isEmpty ())
			return;

		const QString& tip = proxy->GetValue ("tooltip").toString ();
		proxy->SetValue ("tooltip", tip + "<br/><br/>" + addition + "<br/>");
	}
Пример #5
0
	void Plugin::hookFormatBodyEnd (IHookProxy_ptr proxy,
			QObject*, QString body, QObject *msgObj)
	{
		IMessage *msg = qobject_cast<IMessage*> (msgObj);
		if (msg->GetDirection () != IMessage::DIn ||
				msg->GetMessageType () != IMessage::MTChatMessage)
			return;

		ICLEntry *other = qobject_cast<ICLEntry*> (msg->OtherPart ());
		if (!other)
		{
			qWarning () << Q_FUNC_INFO
					<< "NULL other part for message"
					<< msgObj
					<< msg->GetBody ();
			return;
		}

		if (!other->GetEntryID ().contains ("*****@*****.**"))
			return;

		proxy->SetValue ("body", FormatBody (body));
	}
Пример #6
0
	void Plugin::hookFormatBodyEnd (IHookProxy_ptr proxy,
			QObject *msgObj)
	{
		if (ShouldHandle (msgObj, IMessage::Direction::In, IMessage::Type::ChatMessage))
			proxy->SetValue ("body", FormatBody (proxy->GetValue ("body").toString ()));
	}