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(") )"); }
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(); }
void JMessageSessionManager::sendMessage(qutim_sdk_0_3::ChatUnit *unit, const qutim_sdk_0_3::Message &message) { JID jid = unit->id(); Jreen::MessageSession *s = session(jid, Jreen::Message::Chat, true); Jreen::Message msg(Jreen::Message::Chat, jid, message.text(), message.property("subject").toString()); msg.setID(QString::number(message.id())); // if (JPGPSupport::instance()->send(s, unit, msg)) // emit messageEcnrypted(message.id()); // else s->sendMessage(msg); //We will close the session at Jreen together with a session in qutim s->setParent(ChatLayer::get(const_cast<ChatUnit*>(message.chatUnit()),true)); }
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(); }
void ChatController::onMessageAppended(const qutim_sdk_0_3::Message &msg) { Message copy = msg; QString html = UrlParser::parseUrls(copy.html(), UrlParser::Html); copy.setProperty("messageId", msg.id()); if (msg.property("topic", false)) { copy.setHtml(html); m_topic = copy; // if (!m_isLoading) // updateTopic(); return; } if (msg.property("firstFocus", false)) clearFocusClass(); // We don't want emoticons in topic html = Emoticons::theme().parseEmoticons(html); copy.setHtml(html); bool similiar = isContentSimiliar(m_last, msg); QString script = m_style.scriptForAppendingContent(copy, similiar, false, false); m_last = msg; evaluateJavaScript(script); }