群消息不能接收剪切的图片

来源:互联网 发布:凹凸视频大软件 编辑:程序博客网 时间:2024/04/30 03:18

原因:消息发送后,接收者没有从FTP服务器中下载此图片,导致窗口中不能显示剪切的图片。

 

处理方法:在PASSIVE_GROUP_TALK消息和GroupChatRoom::CheckOfflineMessage()函数调用GroupChatRoom::setOutputLine()函数下载剪切的图片,代码如下:

Message_GroupSharedFile mgtio;    mgtio.ToGroupId = mes.ToGroupId;    bool flag = false;    if( mes.MessageContent.astr.contains(".png.lp") )    {        flag = true;    }    mgtio.Group_File_Name = mes.MessageContent.astr.right(mes.MessageContent.astr.size() -                                                          mes.MessageContent.astr.lastIndexOf("/") -1 );    mgtio.Group_File_Name = mgtio.Group_File_Name.left(mgtio.Group_File_Name.lastIndexOf("."));    QString tmpImg = tr("%1/%2/Tmp/%3").arg(GlobalData::seaarespath).arg(mes.FromUserId).arg(mgtio.Group_File_Name);    FileDownloader *fd = new FileDownloader(mgtio, tmpImg, NULL);    connect(fd, SIGNAL(downloadDataUpdate(Message_GroupSharedFile,qint64, qint64)),            this, SLOT(downloadFromSeverUpdate(Message_GroupSharedFile,qint64,qint64)));    fd->download(GlobalData::myself->Id, GlobalData::myself->Password, DOWNLOADGROUPTEMPIMAGE);    QString spanString;    QString dateTime = mes.SendTime;    if( flag )    {        spanString = QString("<span style=\" font-family: '%1';font-weight:%2; font-style:%3;"                             " text-decoration: %4;color:%5; font-size: %6pt;\">%7</span>")                .arg(mes.MessageContent.fontFamily)                .arg(mes.MessageContent.isBold ? "600" : "400")                .arg(mes.MessageContent.isItalic ? "italic" : "normal")                .arg(mes.MessageContent.isUnderline ? "underline":"none")                .arg(tr("#") + r + g + b)                .arg(mes.MessageContent.fontSize)                .arg("<img src = " + tmpImg + ">");    }    else    {        spanString = QString("<span style=\" font-family: '%1';font-weight:%2; font-style:%3;"                             " text-decoration: %4;color:%5; font-size: %6pt;\">%7</span>")                .arg(mes.MessageContent.fontFamily)                .arg(mes.MessageContent.isBold ? "600" : "400")                .arg(mes.MessageContent.isItalic ? "italic" : "normal")                .arg(mes.MessageContent.isUnderline ? "underline":"none")                .arg(tr("#") + r + g + b)                .arg(mes.MessageContent.fontSize)                .arg(mes.MessageContent.astr);    }


0 0
原创粉丝点击