Beispiel #1
0
void Logic::ParsingFile(int NumberMessage,QString filterStart,QString filterFinish,QString& Output)
{
    int i = NumberMessage;
    QFile textFile("Message"+QString::number(i,10)+".txt");
    textFile.open(QIODevice::ReadOnly | QIODevice::Text);
    bool exit = false;
    bool base64 = false;
    while(!exit)
    {
        bool flag = true;
        QString textLine = textFile.readLine();
        if(textLine.startsWith("Content-Transfer-Encoding: base64"))
            base64 = true;
        if(textLine.startsWith(filterStart))
        {
            while(!exit)
            {
                Output += textLine;
                textLine = textFile.readLine();
                if(textFile.atEnd())exit = true;
            }
        }
        Output.replace(0,4,"\n");
    }
    if(base64)
    {
        QByteArray xcode("");;
        xcode.append(Output);
        QByteArray precode(QByteArray::fromBase64(xcode));
        Output = precode.data();
    }
    textFile.close();
}
Beispiel #2
0
QString Smtp::decodeBase64( QString xml )
{
    QByteArray xcode("");;
    xcode.append(xml);
    QByteArray precode(QByteArray::fromBase64(xcode));
    QString notetxt = precode.data();
    return notetxt;
}