コード例 #1
0
ファイル: message.cpp プロジェクト: nico-izo/qutim
QDebug operator<<(QDebug dbg, const qutim_sdk_0_3::Message &msg)
{
	dbg.nospace() << QLatin1String("Ureen::Message(")
				  << QLatin1String("id: ") << msg.id()
				  << QLatin1String("chatUnit: ") << msg.chatUnit()
				  << QLatin1String("isIncoming: ") << msg.isIncoming()
				  << QLatin1String("text: ") << msg.text()
				  << QLatin1String("time: ") << msg.time()
				  << QLatin1String("properties: (");
	foreach (QByteArray name, msg.dynamicPropertyNames())
		dbg.nospace() << name << ": " << msg.property(name);
	return dbg.nospace() << QLatin1String(") )");
}
コード例 #2
0
QString WebKitMessageViewStyle::templateForContent(const qutim_sdk_0_3::Message &message, bool contentIsSimilar)
{
	Q_D(WebKitMessageViewStyle);
	QString result;
	
	// Get the correct result for what we're inserting
	
	if (message.property("topic", false)) {
		result = d->topicHTML;
	// FIXME: Implement file transfer support
//	} else if (content.pro == IContent::FileTranfser) {
//		result = d->fileTransferHTML;
	} else if (!message.property("service", false)) {
		bool isAction = message.html().startsWith(QLatin1String("/me "), Qt::CaseInsensitive);
		if (isAction && hasAction()) {
			if (!message.isIncoming())
				result = d->actionOutHTML;
			else
				result = d->actionInHTML;
		} else if (message.property("history", false)) {
			if (!message.isIncoming())
				result = contentIsSimilar ? d->nextContextOutHTML : d->contextOutHTML;
			else
				result = contentIsSimilar ? d->nextContextInHTML : d->contextInHTML;
		} else {
			if (!message.isIncoming())
				result = contentIsSimilar ? d->nextContentOutHTML : d->contentOutHTML;
			else
				result = contentIsSimilar ? d->nextContentInHTML : d->contentInHTML;
		} 
	} else {
		result = d->statusHTML;
	} 
	
	if (!result.isEmpty())
		fillKeywords(result, message, contentIsSimilar);
	
	return result;
}
コード例 #3
0
ファイル: chatchannel.cpp プロジェクト: xujb/qutim
qint64 ChatChannel::doAppendMessage(qutim_sdk_0_3::Message &message)
{
	if (message.isIncoming())
		emit messageReceived(&message);
	else
		emit messageSent(&message);
	
	if (message.property("spam", false) || message.property("hide", false))
		return message.id();
	
	bool service = message.property("service", false);
	
	if ((!isActive() && !service) && message.isIncoming()) {
		m_unread.append(message);
		emit unreadChanged(m_unread);
		emit unreadCountChanged(m_unread.count());
	}
	
	if (!message.property("silent", false) && !isActive())
		Notification::send(message);
	
	emit messageAppended(message);
	return message.id();
}
コード例 #4
0
ファイル: networkmanager.cpp プロジェクト: eclipsy/qutim
void NetworkManager::sendMessage(const qutim_sdk_0_3::Message &message)
{
	MessageAction *action = new MessageAction();
	ChatUnit *contact = const_cast<ChatUnit*>(message.chatUnit()->getHistoryUnit());
	action->account = AccountId(contact->account());
	action->contact = contact->id();
	action->time = message.time();
	action->text = message.text();
	action->incoming = message.isIncoming();
	if (message.property("otrEncrypted", false))
		action->encryption << QLatin1String("otr");
	if (message.property("pgpEncrypted", false)
	        || (encryptedMessageIdInited
	            && encryptedMessageId == message.id())) {
		action->encryption << QLatin1String("pgp");
	}
    if (message.property("autoreply", false))
        action->encryption << QLatin1String("autoreply");
	m_actions << action;
	trySend();
}