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

原因:消息发送后,接收者没有从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);
    }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值