Exemplo n.º 1
0
void GroupControler::_getGroupInfo(service::ErrorInfo &info, service::Group group)
{
    qDebug() << Q_FUNC_INFO<<"22222222222"<<info.code();
    if(info.code()==0){
        Group gp;
        if(group.info.avatar!=""){
            gp.avatar="/data/data/com.vrv.linkDood/public/head/"+QString::fromStdString(group.info.avatar);
        }
        qDebug() << Q_FUNC_INFO<<gp.avatar<<"ssssssssssssssssssssssss";
        gp.createrid=QString::number(group.creater_id);
        QDateTime DateTime;
        DateTime.setMSecsSinceEpoch(group.create_time);
        gp.create_time=DateTime.toString("MM月dd日") +QString::fromLocal8Bit(" ")+DateTime.toString("HH:mm");
        gp.extend=QString::fromStdString(group.extend);
        gp.id=QString::number(group.info.id);
        gp.level=QString::number(group.info.level);
        gp.name=QString::fromStdString(group.info.name);
        gp.pinyin=QString::fromStdString(group.info.pinyin);
        gp.server=QString::fromStdString(group.info.server);
        if(group.info.thumb_avatar!=""){
            gp.thumbAvatar="/data/data/com.vrv.linkDood/public/head/"+QString::fromStdString(group.info.thumb_avatar);
        }
        qDebug() << Q_FUNC_INFO<<"22222222222"<<gp.thumbAvatar<<gp.name;
        gp.timeZone=QString::number(group.info.time_zone);
        gp.brief=QString::fromStdString(group.brief);
        gp.bulletin=QString::fromStdString(group.bulletin);
        if(gp.brief=="#"){
            gp.brief="";
        }
        qDebug() << Q_FUNC_INFO<<"33333333333"<<gp.brief<<gp.bulletin;
        qDebug() << Q_FUNC_INFO<<"member_num:"<<group.member_nums;
        emit getGroupInfoResult("获取群信息成功",gp);
    }
}
Exemplo n.º 2
0
void GroupControler::_getMemberInfo(service::ErrorInfo& info, service::User& member)
{
    qDebug() << Q_FUNC_INFO<<info.code();
    if(info.code()==0){
        //        service::Member mem=dynamic_cast<service::Member&>(member);
        Member m;
        m.name=QString::fromStdString(member.name);
        //        m.avatar=QString::fromStdString(mem.avatar);
        //        if(mem.gender==0){
        //            m.gender="保密";
        //        }
        //        if(mem.gender==1){
        //            m.gender="男";
        //        }
        //        if(mem.gender==2){
        //            m.gender="女";
        //        }
        //        m.groupid=QString::number(mem.groupid);
        //        m.id=QString::number(mem.id);
        //        m.member_type=QString::number(mem.member_type);
        //        m.name=QString::fromStdString(mem.name);
        //        m.remark=QString::fromStdString(mem.remark);
        //        m.team=QString::number(mem.team);
        //        m.thumbAvatar=QString::fromStdString(mem.thumb_avatar);
        emit getMemberInfoResult("获取成员信息成功",m);
    }
    else{
        Member m;
        emit getMemberInfoResult("获取成员信息失败",m);
    }
}
Exemplo n.º 3
0
void AuthControler::_getVerifyImg(service::ErrorInfo info, std::string img)
{
    qDebug() << Q_FUNC_INFO<<info.code()<<img.c_str();
    if(img!=""){
        img="file://"+img;
    }
    emit getVerifyImgResult(QString::number(info.code()),QString::fromStdString(img));
}
Exemplo n.º 4
0
void GroupControler::_removeMember(service::ErrorInfo &info)
{
    qDebug() << Q_FUNC_INFO<<"1111111111:"<<info.code();
    if(info.code()==0){
        emit removeMemberResult("移除群成员成功");
    }
    else{
        emit removeMemberResult("移除群成员失败");
    }
}
Exemplo n.º 5
0
void GroupControler::_removeGroup(service::ErrorInfo &info)
{
    qDebug() << Q_FUNC_INFO<<"ssssssssssssssss"<<info.code();
    if(info.code()==0){
        emit removeGroupResult("成功");
    }
    else{
        emit removeGroupResult("操作失败");
    }
}
Exemplo n.º 6
0
void GroupControler::_inviteMember(service::ErrorInfo &info)
{
    qDebug() << Q_FUNC_INFO<<info.code();
    if(info.code()==0){
        emit inviteMemberResult("邀请成员成功");
    }
    else{
        emit inviteMemberResult("邀请成员失败");
    }
}
Exemplo n.º 7
0
void GroupControler::_setMemberInfo(service::ErrorInfo &info)
{
    qDebug() << Q_FUNC_INFO<<info.code();
    if(info.code()==0){
        emit setMemberInfoResult("设置成员信息成功");
    }
    else{
        emit setMemberInfoResult("设置成员信息失败");
    }
}
Exemplo n.º 8
0
void AuthControler::onLogoutChanged(service::ErrorInfo& info)
{
    qDebug() << Q_FUNC_INFO << "loginout_code:" << info.code();

    if(info.code() == 0 ||info.code() == 1304||info.code()<0)
    {
        emit loginoutRelust(true);
    }else
    {
        emit loginoutRelust(false);
    }
}
Exemplo n.º 9
0
void AuthControler::_changepassword(service::ErrorInfo &info)
{
    qDebug() << Q_FUNC_INFO<<info.code();
    if(info.code()==0){
        emit changePasswordResult("修改成功");
    }
    else if(info.code()==543){
        emit changePasswordResult("旧密码不正确");
    }
    else{
        emit changePasswordResult("修改失败");
    }
}
Exemplo n.º 10
0
void EnterpriseControler::_getSonOrgs(service::ErrorInfo info, std::vector<service::Org> orgs, std::vector<service::OrgUser> orgusers)
{
    qDebug() << Q_FUNC_INFO<<info.code()<<orgs.size();
    OrgList orgList;
    OrgUserList orgUserList;
    for(auto org:orgs){
        orgList.insert(orgList.size(),orgToQorg(org));
    }
    for(auto orgUser:orgusers){
        orgUserList.insert(orgUserList.size(),orguserToQorguser(orgUser));
    }
    emit getSonOrgsResult(info.code(),orgList,orgUserList);
}
Exemplo n.º 11
0
void GroupControler::_getMemberList(service::ErrorInfo &info, std::vector<std::shared_ptr<service::User> > members,QString groupId)
{
    qDebug() << Q_FUNC_INFO <<"size:"<<members.size()<<"groupId:"<<groupId;
    MemberList memberList;
    if(info.code()==0){
        if(members.size() >0){
            memberList=MemberToQMemberList(members);
            emit getGroupMemberListReslut(info.code(),groupId,memberList);
        }
        emit getMemberListResult("获取成员列表成功",memberList);

    }
}
Exemplo n.º 12
0
void GroupControler::_transferGroup(service::ErrorInfo &info)
{
    qDebug()<<Q_FUNC_INFO<<info.code();
    if(info.code()==0){
        emit transferGroupResult("转让群成功");
    }
    else if(info.code()==303){
        emit transferGroupResult("该用户拥有的群数量已经超过限制");
    }
    else{
        emit transferGroupResult("转让群失败");
    }
}
Exemplo n.º 13
0
void GroupControler::_createGroup(service::ErrorInfo &info, long long &res)
{
    qDebug() << Q_FUNC_INFO<<"2222222......"<<info.code();
    if(info.code()==0){
        emit createGroupResult(QString::number(res));
    }
    else if(info.code()==303){
        emit createGroupResult("创建群失败(群数量超过限制)");
    }
    else{
        emit createGroupResult("创建群失败");
    }

}
Exemplo n.º 14
0
void ChatControler::_getMesage(service::ErrorInfo &info, int64 targetId, std::vector<service::MsgPtr>msgPtr)
{
    qDebug() << Q_FUNC_INFO << msgPtr.size();
    MsgList msgList;
    //std::shared_ptr<service::Msg> msg;

    for(auto msg:msgPtr){
        if(msg->msgtype == 2||msg->msgtype == 8){
            std::shared_ptr<service::MsgText> msgText = std::dynamic_pointer_cast<service::MsgText>(msg);
            Msg item;
            item.activeType = QString::number(msgText->active_type);
            item.body = QString::fromStdString(utils::MsgUtils::getText(msgText->body));
            item.fromid = QString::number(msgText->fromid);
            item.localid = QString::number(msgText->localid);
            item.msgid = QString::number(msgText->msgid);
            item.msgProperties = QString::fromStdString(msgText->msg_properties);
            item.msgtype = QString::number(msgText->msgtype);
            item.relatedMsgid = QString::number(msgText->related_msgid);
            item.targetid = QString::number(msgText->targetid);
            item.time = QString::number(msgText->time);
            item.toid = QString::number(msgText->toid);
            msgList.insert(msgList.size(),item);
        }
   }
    if(!info.code()){
        emit getMessagesBack(true,targetId,msgList);
    }else{
        emit getMessagesBack(true,targetId,msgList);
    }
}
Exemplo n.º 15
0
void EnterpriseControler::_getOrgUserInfo(service::ErrorInfo &info, service::OrgUser &orguser)
{
    qDebug() << Q_FUNC_INFO;
    OrgUser Qorguser;
    Qorguser= orguserToQorguser(orguser);
    emit getOrgUserInfoResult(info.code(),Qorguser);
}
Exemplo n.º 16
0
void GroupControler::_getGroupSet(service::ErrorInfo &info, int8 verify_type, int8 is_allow)
{
    if(info.code()==0){
        QString verify;
        QString allow;
        if(verify_type==3){
            verify="允许任何人加群";
        }
        else if(verify_type==1){
            verify="不允许加群";
        }
        else{
            verify="需要验证";
        }
        if(is_allow==1){
            allow="允许邀请";
        }
        else{
            allow="不允许邀请";
        }
        emit getGroupSetResult("获取群设置成功",verify,allow);
    }
    else{
        emit getGroupSetResult("获取群设置失败","","");
    }
}
Exemplo n.º 17
0
void GroupControler::_setGroupSet(service::ErrorInfo &info)
{
    if(info.code()==0){
        emit setGroupSetResult("设置成功");
    }
    else{
        emit setGroupSetResult("设置失败");
    }
}
Exemplo n.º 18
0
void GroupControler::_setGroupInfo(service::ErrorInfo &info)
{
    if(info.code()==0){
        emit setGroupInfoResult("设置群信息成功");
    }
    else{
        emit setGroupInfoResult("设置群信息失败");
    }
}
Exemplo n.º 19
0
void AuthControler::_loginResult(service::ErrorInfo &info, long long userId)
{
    qDebug() << Q_FUNC_INFO << info.code() << userId;
    if(info.code() == 0 )
    {
        QString fileName = LinkDoodService::instance()->dataPath()+ "config.ini";
        QSettings settings(fileName, QSettings::IniFormat);
        settings.setValue("myId",QString::number(userId));
        emit loginSucceeded(QString::number(userId));

        emit loginResultObserver(0,QString::number(userId));
    }
    else
    {
        qDebug() << Q_FUNC_INFO << "loginFailed = " << info.code();
        emit loginFailed(info.code());
    }
}
Exemplo n.º 20
0
void ChatControler::_sendMesage(service::ErrorInfo &info, int64 sendTime, int64 msgId)
{
    qDebug() << Q_FUNC_INFO;
    if(!info.code()){
        emit sendMessageBack(true,sendTime,msgId);
    }else{
        emit sendMessageBack(false,sendTime,msgId);
    }
}
Exemplo n.º 21
0
void GroupControler::_deleteGroupFile(service::ErrorInfo &info)
{
    qDebug() << Q_FUNC_INFO;
    if(info.code()==0){
        emit deleteGroupFileResult("删除成功");
    }
    else{
        emit deleteGroupFileResult("删除失败");
    }
}
Exemplo n.º 22
0
void GroupControler::_addGroup(service::ErrorInfo &info)
{
    qDebug() << Q_FUNC_INFO<<"2222222"<<info.code();
    switch (info.code()) {
    case 0:
        emit addGroupResult("请求已发出,等待对方处理");
        break;
    case 333:
        emit addGroupResult("您已在该群中");
        break;
    case 323:
        emit addGroupResult("该群不允许任何人添加");
        break;
    case 307:
        emit addGroupResult("该群已不存在");
        break;
    case 310:
        emit addGroupResult("该群成员已满");
        break;
    default:
        emit addGroupResult("操作失败");
        break;
    }
}
Exemplo n.º 23
0
void ChatControler::_getFileList(service::ErrorInfo &info, std::vector<FileInfo> files)
{
    FileInfoList msgList;
    MsgFileInfo fileInfo;
    for(auto msg:files)
    {
        fileInfo.fileid = QString::number(msg.fileid);
        fileInfo.userid = QString::number(msg.userid);
        fileInfo.targetid = QString::number(msg.targetid);
        fileInfo.size = msg.size;
        fileInfo.time = msg.time;
        fileInfo.path = QString::fromStdString(msg.path);
        fileInfo.name = QString::fromStdString(msg.name);
        fileInfo.url = QString::fromStdString(msg.url);
        fileInfo.encrypt_key = QString::fromStdString(msg.encrypt_key);
        msgList.push_back(fileInfo);
    }
    emit getFileListBack(info.code(), msgList);
}
Exemplo n.º 24
0
void LinkDoodService::onChatGetFileList(service::ErrorInfo &info, std::vector<FileInfo> files)
{
    qDebug() << Q_FUNC_INFO;
    FileInfoList msgList;
    MsgFileInfo fileInfo;
    for(auto msg:files)
    {
        fileInfo.fileid = QString::number(msg.fileid);
        fileInfo.userid = QString::number(msg.userid);
        fileInfo.targetid = QString::number(msg.targetid);
        fileInfo.size = msg.size;
        fileInfo.time = msg.time;
        fileInfo.path = QString::fromStdString(msg.path);
        fileInfo.name = QString::fromStdString(msg.name);
        fileInfo.url = QString::fromStdString(msg.url);
        fileInfo.encrypt_key = QString::fromStdString(msg.encrypt_key);
        msgList.push_back(fileInfo);
    }

    emit getFileListResult(info.code(), msgList);
}
Exemplo n.º 25
0
void GroupControler::_getGroupFileList(service::ErrorInfo &info, std::vector<FileInfo> fileInfos)
{
    FileInfoList fileInfoList;
    if(info.code()==0){
        for(auto i: fileInfos){
            MsgFileInfo msgFileInfo;
            msgFileInfo.encrypt_key=QString::fromStdString(i.encrypt_key);
            msgFileInfo.fileid=QString::number(i.fileid);
            msgFileInfo.name=QString::fromStdString(i.name);
            msgFileInfo.path=QString::fromStdString(i.path);
            msgFileInfo.size=QString::number(i.size);
            msgFileInfo.targetid=QString::number(i.targetid);
            msgFileInfo.url=QString::fromStdString(i.url);
            msgFileInfo.userid=QString::number(i.userid);
            QDateTime DateTime;
            DateTime.setMSecsSinceEpoch(i.time);
            msgFileInfo.time=DateTime.toString("MM月dd日");
            fileInfoList.push_back(msgFileInfo);
        }
    }
    emit getGroupFileListResult(fileInfoList);
}
Exemplo n.º 26
0
void LinkDoodService::onSrvGetContactInfoResult(service::ErrorInfo &info, service::User &user)
{
     qDebug() << Q_FUNC_INFO << info.code() << user.name.c_str();
     emit srvGetContactInfo(user);
}
Exemplo n.º 27
0
void LinkDoodService::onChatDownloadImage(service::ErrorInfo &info, QString localpath, int64 tagetid)
{
    qDebug() << Q_FUNC_INFO;
    emit downloadImageResult(info.code(), localpath, QString::number(tagetid));
}
Exemplo n.º 28
0
void SysMsgControler::_response(service::ErrorInfo &info)
{
    qDebug()<<Q_FUNC_INFO<<"code:"<<info.code();
    //    emit responseResult(info.code());
}
Exemplo n.º 29
0
void SysMsgControler::_getSysMessages(service::ErrorInfo info, std::vector<SysMsg> sysmsgs)
{
    qDebug()<<Q_FUNC_INFO;
    IMSysMsgList msgList;

    for(int i = 0; i < sysmsgs.size(); i++)
    {
        IMSysMsg sysMsg;
        sysMsg.respons.clear();
        sysMsg.isShowButton = false;
        sysMsg.msgid = QString::number(sysmsgs[i].msgid);
        sysMsg.targetid = QString::number(sysmsgs[i].targetid);
        sysMsg.time = QString::number(sysmsgs[i].time)/*Common::dealTime(sysmsgs[i].time, 1)*/;
        sysMsg.respons.clear();
        sysMsg.name =QString::fromStdString(sysmsgs[i].name);
        sysMsg.avatar = QString::fromStdString(sysmsgs[i].avatar);
        sysMsg.msgType = QString::number(sysmsgs[i].msgtype);
        sysMsg.info = QString::fromStdString(sysmsgs[i].info);
        sysMsg.operUser = QString::fromStdString(sysmsgs[i].operUser);
        sysMsg.isread = QString::number(sysmsgs[i].isread);

        if(sysmsgs[i].msgtype == 1)
        {
            sysMsg.msgtypeText = "好友申请";
            if(sysmsgs[i].isread == 0) //未读
                sysMsg.isShowButton = true;
            else
            {
                if(sysmsgs[i].opertype == 1)
                    sysMsg.respons = "已同意";
                else if(sysmsgs[i].opertype == 2)
                    sysMsg.respons = "已拒绝";
                else{
                    sysMsg.respons = "已处理";
                }
            }
        }
        else if(sysmsgs[i].msgtype == 2)
        {
            sysMsg.msgtypeText = "好友验证信息";
            if(sysmsgs[i].subtype ==0 && sysmsgs[i].opertype==2){
                sysMsg.info = sysMsg.operUser + "拒绝了您的好友申请";
            }
        }
        else if(sysmsgs[i].msgtype == 3)
        {
            sysMsg.msgtypeText = "群请求";
            if(sysmsgs[i].isread == 0)
                sysMsg.isShowButton = true;
            else
            {
                if(sysmsgs[i].opertype == 3)
                    sysMsg.respons = "已拒绝";
                else if(sysmsgs[i].opertype == 2)
                    sysMsg.respons = "已同意";
            }
        }
        else
        {
            sysMsg.msgtypeText = "群验证信息";
            if(sysmsgs[i].opertype == 2)
            {
                sysMsg.info = sysMsg.operUser + "同意您加入" + sysMsg.name;
            }
            else if(sysmsgs[i].opertype == 3)
            {
                sysMsg.info = sysMsg.operUser + "拒绝您加入" + sysMsg.name;
            }
            else if(sysmsgs[i].opertype == 5)
            {
                if(sysMsg.name == "#" || sysMsg.name =="")
                {
                    continue;
                }
                sysMsg.info = sysMsg.operUser + "解散了群" + sysMsg.name;
                qDebug()<<Q_FUNC_INFO << "  sysMsg.info:" << sysMsg.info;
            }
            else if(sysmsgs[i].opertype == 6)
            {
                if(sysMsg.name.size() == 0)
                {
                    sysMsg.name = sysMsg.targetid;
                }
                sysMsg.info = "您被" + sysMsg.operUser + "移出了群" + sysMsg.name;
            }
            else if(sysmsgs[i].opertype == 7)
            {
                if(sysMsg.name.size() == 0)
                    sysMsg.name = sysMsg.targetid;
                sysMsg.info = sysMsg.operUser + "主动退出了群" +sysMsg.name;
            }
        }
        if(!sysMsg.isShowButton){
            setSysMessagRead(sysMsg.msgType.toInt(),sysMsg.msgid);
        }
        qDebug() << "  msgid:" << sysMsg.msgid << "   targetid:" << sysMsg.targetid << "  time:" << sysMsg.time << "   msgtypeText:" << sysMsg.msgtypeText << "   respons:" << sysMsg.respons << "   name:" << sysMsg.name << "   avatar:" << sysMsg.avatar << "  operUser:"******"   info:" << sysMsg.info;
        msgList.push_back(sysMsg);
    }
    emit getSysMessagesReult(info.code(), msgList);
}
Exemplo n.º 30
0
void AuthControler::onLoginResultObserver(service::ErrorInfo& info, int64 userid)
{
    qDebug() << Q_FUNC_INFO << "chengcy0000000000000" << info << userid;
    emit loginResultObserver(info.code(),QString::number(userid));
}