Ejemplo n.º 1
0
MessagePart * Attachment::attachmentWithMessageMIME(struct mailmime * mime)
{
    MessagePart * attachment;
    AbstractPart * mainPart;
    
    attachment = new MessagePart();
    attachment->header()->importIMFFields(mime->mm_data.mm_message.mm_fields);
    mainPart = attachmentsWithMIMEWithMain(mime->mm_data.mm_message.mm_msg_mime, false);
    attachment->setMainPart(mainPart);
    
    return (MessagePart *) attachment->autorelease();
}
Ejemplo n.º 2
0
void QueryResult::fillMessagePartFromModel(MessagePart &messagePart)
{
    MessagePart newPart;

    if (!eventId) {
        eventId = Event::urlToId(result->value(MessagePartColumnMessage).toString());
    }
    newPart.setUri(result->value(MessagePartColumnMessagePart).toString());
    newPart.setContentId(result->value(MessagePartColumnContentId).toString());
    newPart.setPlainTextContent(result->value(MessagePartColumnText).toString());
    newPart.setContentType(result->value(MessagePartColumnMimeType).toString());
    newPart.setCharacterSet(result->value(MessagePartColumnCharacterSet).toString());
    newPart.setContentSize(result->value(MessagePartColumnContentSize).toInt());
    newPart.setContentLocation(result->value(MessagePartColumnFileName).toString());

    messagePart = newPart;
}
Ejemplo n.º 3
0
void MRAOfflineMessage::parseTextPart(MessagePart &mainPart, MessagePart &textPart) {
    if (m_protoVersion < MAKE_VERSION(1,16)) {
        return;
    }
    m_text = textPart.text().trimmed();

    if (textPart.header("Content-Transfer-Encoding") == "base64") {

        QByteArray data;
        data = QByteArray::fromBase64( m_text.toAscii() );
        QTextCodec *codec = QTextCodec::codecForName( textPart.charset().toAscii() );

        m_text = codec->toUnicode(data);
    }

    if ( !mainPart.subject().isEmpty() || mainPart.hasHeader("Sender") ) {
        m_text = mainPart.subject() + '(' + mainPart.header("Sender") + "):\n" + m_text;
    }

}
Ejemplo n.º 4
0
/**
 * Sends a message to the connected peer.
 *
 * @param message The message.
 */
void JsonRpcClient::SendMessage(const MessagePart& message)
{
	Value value = message.GetDictionary();
	NetString::WriteStringToIOQueue(this, value.Serialize());
}
Ejemplo n.º 5
0
/**
 * Adds an item to the message using an automatically generated property name.
 *
 * @param value The value.
 */
void MessagePart::Add(const MessagePart& value)
{
	GetDictionary()->Add(value.GetDictionary());
}
Ejemplo n.º 6
0
/**
 * Sets a property's value.
 *
 * @param key The name of the property.
 * @param value The value.
 */
void MessagePart::Set(String key, const MessagePart& value)
{
	GetDictionary()->Set(key, value.GetDictionary());
}
Ejemplo n.º 7
0
/**
 * Copy-constructor for the MessagePart class.
 *
 * @param message The message that should be copied.
 */
MessagePart::MessagePart(const MessagePart& message)
{
	m_Dictionary = message.GetDictionary();
}