TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

以下内容为反编译后的 TroopTopicMgr.java 源代码,内容仅作参考


package com.tencent.mobileqq.troop.utils;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.TextUtils;
import com.tencent.biz.ProtoServlet;
import com.tencent.biz.ProtoUtils;
import com.tencent.common.app.AppInterface;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.mobileqq.WebSsoBody;
import com.tencent.mobileqq.activity.BaseChatPie;
import com.tencent.mobileqq.activity.ChatActivityFacade;
import com.tencent.mobileqq.activity.aio.SessionInfo;
import com.tencent.mobileqq.activity.aio.rebuild.TroopChatPie;
import com.tencent.mobileqq.activity.selectmember.SelectMemberActivity;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.LogTag;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.app.SVIPHandler;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.app.automator.StepFactory;
import com.tencent.mobileqq.app.message.QQMessageFacade;
import com.tencent.mobileqq.app.utils.MessagePkgUtils;
import com.tencent.mobileqq.data.ChatMessage;
import com.tencent.mobileqq.data.MessageForLongMsg;
import com.tencent.mobileqq.data.MessageForPic;
import com.tencent.mobileqq.data.MessageForReplyText;
import com.tencent.mobileqq.data.MessageForStructing;
import com.tencent.mobileqq.data.MessageForText;
import com.tencent.mobileqq.data.MessageForTroopTopic;
import com.tencent.mobileqq.data.MessageRecord;
import com.tencent.mobileqq.filemanager.util.FileManagerUtil;
import com.tencent.mobileqq.msf.core.NetConnInfoCenter;
import com.tencent.mobileqq.persistence.EntityManager;
import com.tencent.mobileqq.pic.PicBusiManager;
import com.tencent.mobileqq.pic.PicReq;
import com.tencent.mobileqq.service.message.MessageCache;
import com.tencent.mobileqq.service.message.MessageConstants;
import com.tencent.mobileqq.service.message.MessageProtoCodec;
import com.tencent.mobileqq.service.message.MessageRecordFactory;
import com.tencent.mobileqq.service.message.MessageUtils;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.structmsg.AbsStructMsgElement;
import com.tencent.mobileqq.structmsg.StructMsgFactory;
import com.tencent.mobileqq.structmsg.StructMsgForGeneralShare;
import com.tencent.mobileqq.structmsg.view.StructMsgItemCover;
import com.tencent.mobileqq.structmsg.view.StructMsgItemLayout2;
import com.tencent.mobileqq.structmsg.view.StructMsgItemSummary;
import com.tencent.mobileqq.structmsg.view.StructMsgItemTitle;
import com.tencent.mobileqq.text.QQText;
import com.tencent.mobileqq.transfile.AbsDownloader;
import com.tencent.mobileqq.transfile.URLDrawableHelper;
import com.tencent.mobileqq.troop.activity.AbsPublishActivity;
import com.tencent.mobileqq.troop.activity.TroopBarPublishActivity;
import com.tencent.mobileqq.troop.activity.TroopBarPublishUtils;
import com.tencent.mobileqq.troop.activity.TroopBarReplyActivity;
import com.tencent.mobileqq.troop.data.AudioInfo;
import com.tencent.mobileqq.troop.data.TroopBarMyBar;
import com.tencent.mobileqq.troop.data.TroopTopicDetailInfo;
import com.tencent.mobileqq.troop.data.TroopTopicDetailInfoManager;
import com.tencent.mobileqq.troop.text.AtTroopMemberSpan;
import com.tencent.mobileqq.utils.Base64Util;
import com.tencent.mobileqq.utils.DeviceInfoUtil;
import com.tencent.mobileqq.utils.HexUtil;
import com.tencent.mobileqq.vip.DownloadTask;
import com.tencent.mobileqq.vip.DownloaderFactory;
import com.tencent.mqp.app.sec.MQPSensitiveMsgUtil;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import java.io.File;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import mqq.app.AccountNotMatchException;
import mqq.app.NewIntent;
import mqq.manager.Manager;
import mqq.manager.TicketManager;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import tencent.im.msg.im_msg_body;
public class TroopTopicMgr implements Manager {
    public static final int f94141a = 500;
    public static final String f32666a = ".troop.troop_topic.TroopTopicMgr";
    public static final int f94142b = 5;
    public static final String f32667b = "CgiPublishableTime";
    public static final int f94143c = 100;
    public static String f32668c = "http://buluo.qq.com/cgi-bin/sbar/post/publishable";
    public static final int d = 1;
    public static final String f32669d = "MQUpdateSvc_com_qq_buluo.web.sbar_post_extinfo";
    public static final int e = 2;
    public static final String f32670e = "MQUpdateSvc_com_qq_buluo.web.sbar_comment";
    public static final int f = 3;
    public static final String f32671f = "MQUpdateSvc_com_qq_buluo.web.sbar_like";
    private QQAppInterface f32673a;
    private EntityManager f32674a;
    public TroopTopicDetailInfoManager f32675a;
    protected PlusProgressRunable f32676a;
    public boolean f32679a;
    public long[] f32680a;
    public String[] f32681a;
    public long[] f32683b;
    public int g;
    private HashMap f32677a = new HashMap(5);
    public ConcurrentHashMap f32678a = new ConcurrentHashMap();
    protected ConcurrentHashMap f32682b = new ConcurrentHashMap();
    protected ConcurrentHashMap f32684c = new ConcurrentHashMap();
    protected Handler f32672a = new Handler(Looper.getMainLooper());

    public interface DoLikeCallback {
        void a(int i, JSONObject jSONObject);
    }

    public interface WriteCommentCallback {
        void a(int i, JSONObject jSONObject);
    }

    public void m8842a(MessageForTroopTopic messageForTroopTopic) {
        Vector vector;
        if (messageForTroopTopic != null) {
            if (this.f32684c.containsKey(messageForTroopTopic.frienduin)) {
                vector = (Vector) this.f32684c.get(messageForTroopTopic.frienduin);
            } else {
                vector = new Vector();
                this.f32684c.put(messageForTroopTopic.frienduin, vector);
            }
            if (!vector.contains(messageForTroopTopic)) {
                vector.add(messageForTroopTopic);
            }
        }
    }

    public void a(String str) {
        if (!TextUtils.isEmpty(str) && this.f32684c.containsKey(str)) {
            Iterator it = ((Vector) this.f32684c.get(str)).iterator();
            while (it.hasNext()) {
                ((MessageForTroopTopic) it.next()).isExpand = false;
            }
            this.f32684c.remove(str);
        }
    }

    public TroopTopicMgr(QQAppInterface qQAppInterface) {
        this.f32675a = null;
        this.f32673a = qQAppInterface;
        this.f32674a = qQAppInterface.getEntityManagerFactory().createEntityManager();
        this.f32675a = new TroopTopicDetailInfoManager(this.f32674a);
        b(this.f32673a.getApp().getSharedPreferences(this.f32673a.getCurrentAccountUin() + "_TroopTopic", 0).getString("ShareCommentWhiteList", "{}"));
    }

    public void a(BaseChatPie baseChatPie, String str, int i) {
    }

    public void a(BaseChatPie baseChatPie, String str, ChatMessage chatMessage, String str2, int i) {
        String str3;
        if (baseChatPie != null && (baseChatPie instanceof TroopChatPie) && baseChatPie.f8371a != null) {
            TroopChatPie troopChatPie = (TroopChatPie) baseChatPie;
            JSONObject jSONObject = (JSONObject) this.f32677a.get(str);
            if (jSONObject != null) {
                if ((System.currentTimeMillis() / 1000) - jSONObject.optLong(f32667b, 0L) < 5) {
                    a(troopChatPie, a(jSONObject, chatMessage, str2, i).toString());
                    return;
                }
            }
            this.f32676a = new PlusProgressRunable(troopChatPie);
            this.f32672a.postDelayed(this.f32676a, 500L);
            String m4704d = this.f32673a.m4704d();
            TicketManager ticketManager = (TicketManager) this.f32673a.getManager(2);
            if (ticketManager == null) {
                str3 = null;
            } else {
                str3 = ticketManager.getSkey(m4704d);
            }
            HashMap hashMap = new HashMap();
            Bundle bundle = new Bundle();
            bundle.putString("group_type", "2");
            bundle.putString(SelectMemberActivity.f16481ab, str);
            bundle.putString("version", DeviceInfoUtil.m9140c());
            bundle.putString("Cookie", "uin=" + m4704d + ";skey=" + str3);
            bundle.putString("Referer", "http://buluo.qq.com");
            hashMap.put(HttpWebCgiAsyncTask.e, bundle);
            hashMap.put(HttpWebCgiAsyncTask.d, this.f32673a.getApp().getApplicationContext());
            new HttpWebCgiAsyncTask2(f32668c, "POST", new veh(this, troopChatPie, str, chatMessage, str2, i), 1000, null).a(hashMap);
        }
    }

    public JSONObject a(JSONObject jSONObject, String str) {
        JSONObject optJSONObject;
        if (jSONObject == null) {
            if (QLog.isColorLevel()) {
                QLog.d(LogTag.bi, 2, "TroopTopicMgr parsePublishableJson jsonObject is null");
                return null;
            }
            return null;
        }
        int i = -1;
        try {
            if (jSONObject.has(HttpWebCgiAsyncTask.f94008b)) {
                i = jSONObject.getInt(HttpWebCgiAsyncTask.f94008b);
            }
            if (QLog.isColorLevel()) {
                QLog.d(LogTag.bi, 2, "TroopTopicMgr parsePublishableJson retCode is " + i);
            }
            if (i != 0 || (optJSONObject = jSONObject.optJSONObject("result")) == null) {
                return null;
            }
            String optString = optJSONObject.optString("bid");
            int optInt = optJSONObject.optInt("group_type");
            JSONObject optJSONObject2 = optJSONObject.optJSONObject(TroopBarMyBar.q);
            if (optJSONObject2 != null) {
                optJSONObject2.put("bid", optString);
                optJSONObject2.put(TroopBarPublishUtils.f31727b, optInt);
                optJSONObject2.put(f32667b, System.currentTimeMillis() / 1000);
                optJSONObject2.put("groupUin", str);
                return optJSONObject2;
            }
            return null;
        } catch (JSONException e2) {
            QLog.d(LogTag.bi, 2, "TroopTopicMgr parsePublishableJson Exception.", e2);
            return null;
        }
    }

    public void a(TroopChatPie troopChatPie, String str) {
        Intent intent = new Intent(troopChatPie.f8332a, TroopBarPublishActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("options", str);
        intent.putExtras(bundle);
        troopChatPie.f8332a.startActivityForResult(intent, 11001);
        troopChatPie.f8332a.overridePendingTransition(R.anim.f37549name_res_0x7f040013, R.anim.f37551name_res_0x7f040015);
    }

    public void a(MessageRecord messageRecord, long j, String str, String str2, ArrayList arrayList, long j2, String str3, String str4, int i, WriteCommentCallback writeCommentCallback) {
        WebSsoBody.WebSsoRequestBody webSsoRequestBody = new WebSsoBody.WebSsoRequestBody();
        webSsoRequestBody.type.set(0);
        JSONObject jSONObject = new JSONObject();
        try {
            if (!TextUtils.isEmpty(str2)) {
                jSONObject.put("type", 1);
                jSONObject.put("post", str2);
            }
            jSONObject.put(MessageConstants.bE, j);
            jSONObject.put("bid", j2);
            jSONObject.put("pid", str3);
            if (!TextUtils.isEmpty(str4)) {
                jSONObject.put("ref_cid", str4);
            }
            jSONObject.put("cfrom", i);
            if (messageRecord instanceof MessageForReplyText) {
                MessageForReplyText messageForReplyText = (MessageForReplyText) messageRecord;
                messageForReplyText.mGroupPostElemInfo = new GroupPostElemInfo(1, j2, str3, str4);
                messageForReplyText.atInfoList = arrayList;
                im_msg_body.RichText a2 = MessageProtoCodec.a(messageForReplyText);
                if (a2 != null) {
                    jSONObject.put("comment_richtext", Base64Util.encodeToString(a2.toByteArray(), 0));
                }
                if (arrayList != null && arrayList.size() > 0) {
                    MessageForText.AtTroopMemberInfo atTroopMemberInfo = (MessageForText.AtTroopMemberInfo) arrayList.get(0);
                    if (atTroopMemberInfo.uin == messageForReplyText.mSourceMsgInfo.mSourceMsgSenderUin) {
                        str = str.substring(atTroopMemberInfo.textLen + atTroopMemberInfo.startPos + 1);
                    }
                }
            }
            jSONObject.put("comment", TroopBarPublishUtils.a(new QQText(str, 13).m8403a(), (ArrayList) null, (AudioInfo) null));
            jSONObject.put("msgRand", MessageUtils.a(messageRecord.msgUid));
            jSONObject.put("oriMsgSeq", String.valueOf(messageRecord.shmsgseq));
            jSONObject.put("version", "6.5.5.1834.tim");
            webSsoRequestBody.data.set(jSONObject.toString());
            ProtoUtils.a(this.f32673a, new ven(this, writeCommentCallback, messageRecord), webSsoRequestBody.toByteArray(), f32670e);
        } catch (JSONException e2) {
            if (QLog.isColorLevel()) {
                QLog.e(f32666a, 2, e2.toString());
            }
        }
    }

    public void a(ChatMessage chatMessage, int i, DoLikeCallback doLikeCallback) {
        WebSsoBody.WebSsoRequestBody webSsoRequestBody = new WebSsoBody.WebSsoRequestBody();
        webSsoRequestBody.type.set(0);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("like", 1);
            jSONObject.put("type", 1);
            jSONObject.put("lfrom", i);
            jSONObject.put(MessageConstants.bE, chatMessage.shmsgseq);
            jSONObject.put("pid", "0");
            jSONObject.put("bid", Long.parseLong(chatMessage.frienduin) + 10000000000L);
            jSONObject.put("post", a((MessageRecord) chatMessage));
            webSsoRequestBody.data.set(jSONObject.toString());
            ProtoUtils.a(this.f32673a, new veo(this, doLikeCallback), webSsoRequestBody.toByteArray(), f32671f);
        } catch (JSONException e2) {
            if (QLog.isColorLevel()) {
                QLog.e(f32666a, 2, e2.toString());
            }
        }
    }

    public class PlusProgressRunable implements Runnable {
        TroopChatPie f94144a;

        public PlusProgressRunable(TroopChatPie troopChatPie) {
            this.f94144a = troopChatPie;
        }

        @Override
        public void run() {
            this.f94144a.aZ();
        }
    }

    public void a() {
        if (this.f32676a != null) {
            this.f32672a.removeCallbacks(this.f32676a);
            this.f32676a = null;
        }
    }

    @Override
    public void onDestroy() {
        a();
        this.f32674a = null;
    }

    public JSONObject a(JSONObject jSONObject, ChatMessage chatMessage, String str, int i) {
        if (jSONObject != null) {
            try {
                JSONObject jSONObject2 = new JSONObject(jSONObject.toString());
                if (chatMessage instanceof MessageForText) {
                    jSONObject2.put("content", ((MessageForText) chatMessage).sb);
                } else if (chatMessage instanceof MessageForLongMsg) {
                    jSONObject2.put("content", ((MessageForLongMsg) chatMessage).sb);
                } else if (chatMessage instanceof MessageForPic) {
                    if (!TextUtils.isEmpty(str)) {
                        jSONObject2.put(TroopBarPublishUtils.f31750y, AbsPublishActivity.a((JSONArray) null, str));
                    }
                } else if (chatMessage instanceof MessageForReplyText) {
                    jSONObject2.put("content", ((MessageForReplyText) chatMessage).sb);
                }
                if (jSONObject2 != null) {
                    jSONObject2.put(TroopBarPublishUtils.f31741p, String.valueOf(i));
                }
                return jSONObject2;
            } catch (JSONException e2) {
                if (QLog.isColorLevel()) {
                    QLog.d(f32666a, 2, QLog.getStackTraceString(e2));
                    return jSONObject;
                }
                return jSONObject;
            }
        }
        return jSONObject;
    }

    public void a(MessageRecord messageRecord, boolean z) {
        boolean z2;
        TroopTopicDetailInfo troopTopicDetailInfo;
        MessageForTroopTopic messageForTroopTopic;
        String a2 = a(messageRecord.frienduin, messageRecord.shmsgseq);
        if (z) {
            z2 = false;
            troopTopicDetailInfo = null;
        } else {
            TroopTopicDetailInfo troopTopicDetailInfo2 = (TroopTopicDetailInfo) this.f32678a.get(a2);
            if (troopTopicDetailInfo2 == null) {
                troopTopicDetailInfo = troopTopicDetailInfo2;
                z2 = false;
            } else if (messageRecord instanceof MessageForTroopTopic) {
                if (((MessageForTroopTopic) messageRecord).pVersion < troopTopicDetailInfo2.pVersion) {
                    if (QLog.isColorLevel()) {
                        QLog.i(f32666a, 2, "syncTopicExtInfo cache hit, need update. message.frienduin:" + messageRecord.frienduin + " message.shmsgseq:" + messageRecord.shmsgseq + " detailInfo.msgSeq:" + troopTopicDetailInfo2.msgSeq + " message.pVerion:" + messageForTroopTopic.pVersion + " detailInfo.pVersion:" + troopTopicDetailInfo2.pVersion);
                    }
                    troopTopicDetailInfo = troopTopicDetailInfo2;
                    z2 = true;
                } else if (QLog.isColorLevel()) {
                    QLog.i(f32666a, 2, "syncTopicExtInfo cache hit, no update");
                    return;
                } else {
                    return;
                }
            } else if (troopTopicDetailInfo2.pVersion != troopTopicDetailInfo2.mOldVersion) {
                if (QLog.isColorLevel()) {
                    QLog.i(f32666a, 2, "syncTopicExtInfo cache hit 2, need update. message.frienduin:" + messageRecord.frienduin + " detailInfo.msgSeq:" + troopTopicDetailInfo2.msgSeq + " detailInfo.pVersion:" + troopTopicDetailInfo2.pVersion);
                }
                troopTopicDetailInfo = troopTopicDetailInfo2;
                z2 = true;
            } else if (QLog.isColorLevel()) {
                QLog.i(f32666a, 2, "syncTopicExtInfo cache hit, no update 2");
                return;
            } else {
                return;
            }
        }
        this.f32682b.put(a2, Long.valueOf(NetConnInfoCenter.getServerTime()));
        if (z || z2) {
            if (QLog.isColorLevel()) {
                QLog.i(f32666a, 2, "syncTopicExtInfo update, forceUpdate=" + z + " needUpdate=" + z2);
            }
            a(messageRecord, troopTopicDetailInfo);
            return;
        }
        ThreadManager.a(new vep(this, messageRecord), 8, null, true);
    }

    public static void a(QQAppInterface qQAppInterface, long j, String str, String str2, MessageRecord messageRecord, String str3, ArrayList arrayList) {
        if (j < 0 || TextUtils.isEmpty(str)) {
            if (QLog.isColorLevel()) {
                QLog.i(f32666a, 2, "error: bid = " + j + ", pid = " + str);
                return;
            }
            return;
        }
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("bid", j);
            jSONObject.put("pid", str);
            if (!TextUtils.isEmpty(str2)) {
                jSONObject.put("ref_cid", str2);
            }
            jSONObject.put("cfrom", 1);
            if (messageRecord instanceof MessageForReplyText) {
                MessageForReplyText messageForReplyText = (MessageForReplyText) messageRecord;
                messageForReplyText.mGroupPostElemInfo = new GroupPostElemInfo(1, j, str, str2);
                messageForReplyText.atInfoList = arrayList;
                im_msg_body.RichText a2 = MessageProtoCodec.a(messageForReplyText);
                if (a2 != null) {
                    jSONObject.put("comment_richtext", Base64Util.encodeToString(a2.toByteArray(), 0));
                }
                if (arrayList != null && arrayList.size() > 0) {
                    MessageForText.AtTroopMemberInfo atTroopMemberInfo = (MessageForText.AtTroopMemberInfo) arrayList.get(0);
                    if (atTroopMemberInfo.uin == messageForReplyText.mSourceMsgInfo.mSourceMsgSenderUin) {
                        str3 = str3.substring(atTroopMemberInfo.textLen + atTroopMemberInfo.startPos + 1);
                    }
                }
            }
            jSONObject.put("comment", TroopBarPublishUtils.a(new QQText(str3, 13).m8403a(), (ArrayList) null, (AudioInfo) null));
            jSONObject.put("msgRand", MessageUtils.a(messageRecord.msgUid));
            jSONObject.put("oriMsgSeq", String.valueOf(messageRecord.shmsgseq));
            jSONObject.put("version", "6.5.5.1834.tim");
            if (QLog.isColorLevel()) {
                QLog.d("zivonchen", 2, "commendTopic msgRand = " + MessageUtils.a(messageRecord.msgUid) + ", msgUid = " + messageRecord.msgUid);
            }
            NewIntent newIntent = new NewIntent(BaseApplicationImpl.getContext(), ProtoServlet.class);
            newIntent.putExtra("cmd", f32670e);
            WebSsoBody.WebSsoRequestBody webSsoRequestBody = new WebSsoBody.WebSsoRequestBody();
            webSsoRequestBody.type.set(0);
            webSsoRequestBody.data.set(jSONObject.toString());
            newIntent.putExtra("data", webSsoRequestBody.toByteArray());
            newIntent.setObserver(new veq(qQAppInterface, messageRecord));
            qQAppInterface.startServlet(newIntent);
        } catch (Exception e2) {
            if (QLog.isColorLevel()) {
                QLog.i(f32666a, 2, QLog.getStackTraceString(e2));
            }
        }
    }

    public static final boolean a(QQAppInterface qQAppInterface, SessionInfo sessionInfo, Editable editable, MessageRecord messageRecord, ChatActivityFacade.SendMsgParams sendMsgParams) {
        String str;
        String str2;
        if (messageRecord != null) {
            if (messageRecord instanceof MessageForTroopTopic) {
                MessageForTroopTopic messageForTroopTopic = (MessageForTroopTopic) messageRecord;
                ArrayList arrayList = new ArrayList();
                String a2 = AtTroopMemberSpan.a(editable, arrayList);
                MessageRecord a3 = a(qQAppInterface, sessionInfo.f12447a, sendMsgParams, a2, 1);
                a(qQAppInterface, a3);
                a(qQAppInterface, messageForTroopTopic.bid, messageForTroopTopic.pid, null, a3, a2, arrayList);
                if (QLog.isColorLevel()) {
                    QLog.d(f32666a, 2, "commend: 评论ok, send uniseq = " + a3.uniseq + ", msg = " + a2);
                }
                ReportController.b(qQAppInterface, "dc01332", ReportController.u, "", "obj", "aio_reply", 0, 0, messageRecord.frienduin + "", "1", "", "");
                return true;
            } else if (sendMsgParams.f8593a.mType == 1) {
                ArrayList arrayList2 = new ArrayList();
                sendMsgParams.f8593a.mType = 1;
                String str3 = "";
                String str4 = null;
                String str5 = "0";
                String a4 = AtTroopMemberSpan.a(editable, arrayList2);
                if (messageRecord instanceof MessageForStructing) {
                    str3 = a(messageRecord);
                    sendMsgParams.f8593a.mRichMsg = str3;
                    str = "0";
                    str2 = null;
                } else if (!(messageRecord instanceof MessageForReplyText)) {
                    str = "0";
                    str2 = null;
                } else {
                    MessageForReplyText messageForReplyText = (MessageForReplyText) messageRecord;
                    if (messageForReplyText.mGroupPostElemInfo != null && !TextUtils.isEmpty(messageForReplyText.mGroupPostElemInfo.cid)) {
                        str4 = messageForReplyText.mGroupPostElemInfo.cid;
                    }
                    if (messageForReplyText.mGroupPostElemInfo != null && !TextUtils.isEmpty(messageForReplyText.mGroupPostElemInfo.pid)) {
                        str5 = messageForReplyText.mGroupPostElemInfo.pid;
                    }
                    sendMsgParams.f8593a.mRichMsg = messageForReplyText.mSourceMsgInfo.mRichMsg;
                    str = str5;
                    str2 = str4;
                }
                MessageRecord a5 = a(qQAppInterface, sessionInfo.f12447a, sendMsgParams, a4, 3);
                a(qQAppInterface, a5);
                ((TroopTopicMgr) qQAppInterface.getManager(97)).a(a5, messageRecord.shmsgseq, a4, str3, arrayList2, Long.parseLong(messageRecord.frienduin) + 10000000000L, str, str2, 1, new ver());
                if (QLog.isColorLevel()) {
                    QLog.d(f32666a, 2, "commend: 评论ok, send uniseq = " + messageRecord.shmsgseq + ", msg = " + a4);
                }
                return true;
            } else if (messageRecord instanceof MessageForReplyText) {
                MessageForReplyText messageForReplyText2 = (MessageForReplyText) messageRecord;
                if (messageForReplyText2.mGroupPostElemInfo != null) {
                    ArrayList arrayList3 = new ArrayList();
                    String a6 = AtTroopMemberSpan.a(editable, arrayList3);
                    MessageRecord a7 = a(qQAppInterface, sessionInfo.f12447a, sendMsgParams, a6, 2);
                    a(qQAppInterface, a7);
                    a(qQAppInterface, messageForReplyText2.mGroupPostElemInfo.bid, messageForReplyText2.mGroupPostElemInfo.pid, messageForReplyText2.mGroupPostElemInfo.cid, a7, a6, arrayList3);
                    if (QLog.isColorLevel()) {
                        QLog.d(f32666a, 2, "commend: 二级评论ok, send uniseq = " + a7.uniseq + ", msg = " + a6);
                    }
                    ReportController.b(qQAppInterface, "dc01332", ReportController.u, "", "obj", "aio_reply", 0, 0, messageRecord.frienduin + "", "2", "", "");
                    return true;
                }
            }
        }
        return false;
    }

    public static String a(MessageRecord messageRecord) {
        JSONObject jSONObject = new JSONObject();
        try {
            if (messageRecord instanceof MessageForStructing) {
                MessageForStructing messageForStructing = (MessageForStructing) messageRecord;
                if (messageForStructing.structingMsg instanceof StructMsgForGeneralShare) {
                    StructMsgForGeneralShare structMsgForGeneralShare = (StructMsgForGeneralShare) messageForStructing.structingMsg;
                    jSONObject.put("url", structMsgForGeneralShare.mMsgUrl);
                    int i = 0;
                    while (true) {
                        if (i >= structMsgForGeneralShare.getItemCount()) {
                            break;
                        }
                        AbsStructMsgElement itemByIndex = structMsgForGeneralShare.getItemByIndex(i);
                        if (!(itemByIndex instanceof StructMsgItemLayout2)) {
                            i++;
                        } else {
                            StructMsgItemLayout2 structMsgItemLayout2 = (StructMsgItemLayout2) itemByIndex;
                            for (int i2 = 0; i2 < structMsgItemLayout2.f92934a.size(); i2++) {
                                AbsStructMsgElement absStructMsgElement = (AbsStructMsgElement) structMsgItemLayout2.f92934a.get(i2);
                                if (absStructMsgElement instanceof StructMsgItemCover) {
                                    jSONObject.put("cover", ((StructMsgItemCover) absStructMsgElement).p);
                                } else if (absStructMsgElement instanceof StructMsgItemTitle) {
                                    jSONObject.put("title", ((StructMsgItemTitle) absStructMsgElement).b());
                                } else if (absStructMsgElement instanceof StructMsgItemSummary) {
                                    jSONObject.put("summary", ((StructMsgItemSummary) absStructMsgElement).b());
                                }
                            }
                        }
                    }
                    jSONObject.put("uin", Long.parseLong(messageRecord.senderuin));
                }
            }
        } catch (JSONException e2) {
            if (QLog.isColorLevel()) {
                QLog.i(f32666a, 2, "getPostFromMessage JSONException:" + e2.getMessage());
            }
        }
        return jSONObject.toString();
    }

    public static void a(AppInterface appInterface, MessageForTroopTopic messageForTroopTopic) {
        if (QLog.isColorLevel()) {
            QLog.i(f32666a, 2, "sendSSORequest cmd=MQUpdateSvc_com_qq_buluo.web.sbar_like");
        }
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("pid", messageForTroopTopic.pid);
            jSONObject.put("bid", messageForTroopTopic.bid);
            jSONObject.put("like", 1);
            NewIntent newIntent = new NewIntent(BaseApplicationImpl.getContext(), ProtoServlet.class);
            newIntent.putExtra("cmd", f32671f);
            WebSsoBody.WebSsoRequestBody webSsoRequestBody = new WebSsoBody.WebSsoRequestBody();
            webSsoRequestBody.type.set(0);
            webSsoRequestBody.data.set(jSONObject.toString());
            newIntent.putExtra("data", webSsoRequestBody.toByteArray());
            newIntent.setObserver(new ves());
            appInterface.startServlet(newIntent);
        } catch (Exception e2) {
            if (QLog.isColorLevel()) {
                QLog.i(f32666a, 2, QLog.getStackTraceString(e2));
            }
        }
    }

    public void a(MessageRecord messageRecord, TroopTopicDetailInfo troopTopicDetailInfo) {
        if (QLog.isColorLevel()) {
            QLog.i(f32666a, 2, "sendSSORequest cmd=MQUpdateSvc_com_qq_buluo.web.sbar_post_extinfo");
        }
        WebSsoBody.WebSsoRequestBody webSsoRequestBody = new WebSsoBody.WebSsoRequestBody();
        webSsoRequestBody.type.set(0);
        JSONObject jSONObject = new JSONObject();
        try {
            if (messageRecord instanceof MessageForTroopTopic) {
                MessageForTroopTopic messageForTroopTopic = (MessageForTroopTopic) messageRecord;
                jSONObject.put("bid", messageForTroopTopic.bid);
                jSONObject.put("pid", messageForTroopTopic.pid);
            } else {
                jSONObject.put("type", 1);
                jSONObject.put(MessageConstants.bE, messageRecord.shmsgseq);
                jSONObject.put("bid", Long.parseLong(messageRecord.frienduin) + 10000000000L);
            }
            webSsoRequestBody.data.set(jSONObject.toString());
            ProtoUtils.a(this.f32673a, new vet(this, troopTopicDetailInfo, messageRecord), webSsoRequestBody.toByteArray(), f32669d);
        } catch (JSONException e2) {
            if (QLog.isColorLevel()) {
                QLog.e(f32666a, 2, e2.toString());
            }
        }
    }

    public void a(String str, long j, long j2) {
        ThreadManager.a(new vew(this, str, j, j2), 8, null, false);
    }

    public void m8843a(MessageRecord messageRecord) {
        if (QLog.isColorLevel()) {
            QLog.i(".troop.troop_topic.TroopTopicMgr.troop.troop_topic", 2, "syncTroopTopicMsg");
        }
        a(messageRecord, m8845a(messageRecord.frienduin, messageRecord.shmsgseq));
    }

    public TroopTopicDetailInfo a(MessageForTroopTopic messageForTroopTopic) {
        if (QLog.isColorLevel()) {
            QLog.i(f32666a, 2, "getTroopTopicDetailInfo");
        }
        TroopTopicDetailInfo troopTopicDetailInfo = (TroopTopicDetailInfo) this.f32678a.get(a(messageForTroopTopic.frienduin, messageForTroopTopic.shmsgseq));
        if (troopTopicDetailInfo != null && troopTopicDetailInfo.detailInfoData != null) {
            if (QLog.isColorLevel()) {
                QLog.i(f32666a, 2, "getTroopTopicDetailInfo has cache");
            }
            if (troopTopicDetailInfo.detailStructMsg == null) {
                troopTopicDetailInfo.detailStructMsg = StructMsgFactory.a(troopTopicDetailInfo.detailInfoData, 0);
            }
            if (troopTopicDetailInfo.detailStructMsg == null) {
                if (QLog.isColorLevel()) {
                    QLog.i(f32666a, 2, "getTroopTopicDetailInfo parse xml error");
                }
            } else {
                return troopTopicDetailInfo;
            }
        }
        ThreadManager.a(new vei(this, troopTopicDetailInfo, messageForTroopTopic), 8, null, false);
        return null;
    }

    public TroopTopicDetailInfo a(ChatMessage chatMessage) {
        if (QLog.isColorLevel()) {
            QLog.i(f32666a, 2, "getTroopShareInfoFromCache");
        }
        String a2 = a(chatMessage.frienduin, chatMessage.shmsgseq);
        if (a2 != null) {
            return (TroopTopicDetailInfo) this.f32678a.get(a2);
        }
        return null;
    }

    public void a(MessageForTroopTopic messageForTroopTopic, TroopTopicDetailInfo troopTopicDetailInfo) {
        if (QLog.isColorLevel()) {
            QLog.i(f32666a, 2, "sendSSORequest cmd=MQUpdateSvc_com_qq_buluo.web.sbar_aio_content");
        }
        WebSsoBody.WebSsoRequestBody webSsoRequestBody = new WebSsoBody.WebSsoRequestBody();
        webSsoRequestBody.type.set(0);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("bid", messageForTroopTopic.bid);
            jSONObject.put("pid", messageForTroopTopic.pid);
            webSsoRequestBody.data.set(jSONObject.toString());
            NewIntent newIntent = new NewIntent(BaseApplicationImpl.getContext(), ProtoServlet.class);
            newIntent.putExtra("timeout", 5000L);
            newIntent.putExtra("cmd", "MQUpdateSvc_com_qq_buluo.web.sbar_aio_content");
            newIntent.putExtra("data", webSsoRequestBody.toByteArray());
            newIntent.setObserver(new vej(this, troopTopicDetailInfo, messageForTroopTopic));
            this.f32673a.startServlet(newIntent);
        } catch (JSONException e2) {
            if (QLog.isColorLevel()) {
                QLog.e(f32666a, 2, e2.toString());
            }
        }
    }

    public boolean a(TroopTopicDetailInfo troopTopicDetailInfo) {
        return this.f32675a.a(troopTopicDetailInfo);
    }

    public String a(String str, long j) {
        return this.f32673a.getCurrentAccountUin() + "_" + str + "_" + j;
    }

    public boolean m8845a(String str, long j) {
        Long l = (Long) this.f32682b.get(a(str, j));
        return l == null || l.longValue() < NetConnInfoCenter.getServerTime() - 900;
    }

    public boolean b(TroopTopicDetailInfo troopTopicDetailInfo) {
        String a2 = a(troopTopicDetailInfo.troopUin, troopTopicDetailInfo.msgSeq);
        if (a2 == null) {
            return false;
        }
        TroopTopicDetailInfo troopTopicDetailInfo2 = (TroopTopicDetailInfo) this.f32678a.get(a2);
        if (troopTopicDetailInfo2 != null && troopTopicDetailInfo.detailStructMsg != null) {
            troopTopicDetailInfo2.pVersion = troopTopicDetailInfo.pVersion;
        } else {
            this.f32678a.put(a2, troopTopicDetailInfo);
        }
        return true;
    }

    public static void a(MessageForPic messageForPic, long j, int i, int i2, WeakReference weakReference, String str) {
        PicReq a2;
        int i3;
        switch (i2) {
            case 1:
                a2 = PicBusiManager.a(5, 1);
                i3 = 65537;
                break;
            case 2:
                a2 = PicBusiManager.a(6, PicReq.k, 1);
                i3 = 1;
                break;
            case 3:
            default:
                return;
            case 4:
                a2 = PicBusiManager.a(7, 1);
                i3 = 131075;
                break;
        }
        try {
            a2.a(messageForPic, messageForPic.getPicDownloadInfo());
            a2.a(new vel(weakReference, j, i, i2, messageForPic.size, AbsDownloader.d(URLDrawableHelper.a(messageForPic, i3, (String) null).toString().toString())));
            PicBusiManager.a(a2, (QQAppInterface) BaseApplicationImpl.f6970a.getAppRuntime(str));
        } catch (AccountNotMatchException e2) {
            if (QLog.isColorLevel()) {
                QLog.d(f32666a, 2, "no appRuntime");
            }
        }
    }

    public static MessageRecord a(QQAppInterface qQAppInterface, String str, ChatActivityFacade.SendMsgParams sendMsgParams, String str2, int i) {
        MessageRecord a2 = MessageRecordFactory.a((int) MessageRecord.MSG_TYPE_REPLY_TEXT);
        a2.selfuin = qQAppInterface.getCurrentAccountUin();
        a2.frienduin = str;
        a2.senderuin = qQAppInterface.getCurrentAccountUin();
        a2.f88923msg = str2;
        a2.msgtype = MessageRecord.MSG_TYPE_REPLY_TEXT;
        a2.isread = true;
        a2.issend = 1;
        a2.istroop = 1;
        a2.msgUid = MessageUtils.a(MessageUtils.a());
        List m5049a = qQAppInterface.m4635a().m5049a(a2.senderuin, 1);
        if (m5049a != null && !m5049a.isEmpty()) {
            a2.shmsgseq = ((ChatMessage) m5049a.get(m5049a.size() - 1)).shmsgseq;
        } else {
            a2.shmsgseq = Math.abs(new Random().nextInt());
        }
        a2.time = MessageCache.a();
        MessageForReplyText messageForReplyText = (MessageForReplyText) a2;
        if (i == 2) {
            sendMsgParams.f8593a.mSourceMsgText = "[话题评论]" + sendMsgParams.f8593a.mSourceMsgText;
        } else if (i == 3) {
            sendMsgParams.f8593a.mType = 1;
        }
        messageForReplyText.mSourceMsgInfo = new MessageForReplyText.SourceMsgInfo(sendMsgParams.f8593a);
        messageForReplyText.mSourceMsgInfo.mSourceSummaryFlag = 1;
        messageForReplyText.sb = str2;
        try {
            a2.saveExtInfoToExtStr(MQPSensitiveMsgUtil.u, HexUtil.a(MessagePkgUtils.a(messageForReplyText.mSourceMsgInfo)));
        } catch (Exception e2) {
            if (QLog.isColorLevel()) {
                QLog.d(f32666a, 2, QLog.getStackTraceString(e2));
            }
        }
        if (a2.isSend()) {
            ((SVIPHandler) qQAppInterface.getBusinessHandler(13)).a(a2);
        }
        return a2;
    }

    public static void a(QQAppInterface qQAppInterface, MessageRecord messageRecord) {
        qQAppInterface.m4654a().d(messageRecord);
        QQMessageFacade m4635a = qQAppInterface.m4635a();
        m4635a.a(messageRecord, qQAppInterface.getCurrentAccountUin());
        m4635a.a((Object) messageRecord);
        if (QLog.isColorLevel()) {
            QLog.i(f32666a, 1, "Inser msg to AIO, msgInfo: mrUinseq[" + String.valueOf(messageRecord.uniseq) + "], selfuin[" + FileManagerUtil.m6613e(messageRecord.selfuin) + "], frienduin[" + FileManagerUtil.m6613e(messageRecord.frienduin) + "], senderuin[" + FileManagerUtil.m6613e(messageRecord.senderuin) + "], issend[" + String.valueOf(messageRecord.issend) + "], istroop[" + String.valueOf(messageRecord.istroop) + "], shmsgseq[" + String.valueOf(messageRecord.shmsgseq) + "], msgUid[" + String.valueOf(messageRecord.msgUid) + "], time[" + String.valueOf(messageRecord.time) + "], vipBubbleID[" + String.valueOf(-1) + StepFactory.f18879b);
        }
    }

    public class GroupPostElemInfo implements Serializable {
        private static final long serialVersionUID = 1;
        public long bid;
        public String cid;
        public String pid;
        public int trans_type;

        public GroupPostElemInfo(int i, long j, String str, String str2) {
            this.trans_type = i;
            this.bid = j;
            this.pid = str;
            this.cid = str2;
        }

        public GroupPostElemInfo(GroupPostElemInfo groupPostElemInfo) {
            this.trans_type = groupPostElemInfo.trans_type;
            this.bid = groupPostElemInfo.bid;
            this.pid = groupPostElemInfo.pid;
            this.cid = groupPostElemInfo.cid;
        }

        public GroupPostElemInfo(int i, String str) {
            this.trans_type = i;
            try {
                JSONObject jSONObject = new JSONObject(str);
                this.bid = jSONObject.optLong("bid");
                this.pid = jSONObject.optString("pid");
                this.cid = jSONObject.optString(TroopBarReplyActivity.d);
            } catch (JSONException e) {
                if (QLog.isColorLevel()) {
                    QLog.d(TroopTopicMgr.f32666a, 2, QLog.getStackTraceString(e));
                }
            }
        }

        public String toString() {
            return new StringBuilder("GroupPostElemInfo: type = " + this.trans_type + ", bid = " + this.bid + ", pid = " + this.pid + ", cid = " + this.cid).toString();
        }
    }

    public static void a(QQAppInterface qQAppInterface, String str, String str2, MessageForReplyText messageForReplyText, boolean z) {
        if (messageForReplyText != null && messageForReplyText.mGroupPostElemInfo != null) {
            ReportController.b(qQAppInterface, "dc01332", ReportController.u, "", str, str2, 0, 0, messageForReplyText.frienduin, z ? "1" : "2", "", "");
        }
    }

    public boolean a(long j) {
        if (this.f32680a == null || this.f32680a.length <= 0) {
            return false;
        }
        for (int i = 0; i < this.f32680a.length; i++) {
            if (this.f32680a[i] == j) {
                return true;
            }
        }
        return false;
    }

    public boolean m8844a(String str) {
        if (this.f32681a == null || this.f32681a.length <= 0 || TextUtils.isEmpty(str)) {
            return false;
        }
        try {
            String host = new URL(str.toLowerCase()).getHost();
            if (TextUtils.isEmpty(host)) {
                return false;
            }
            for (int i = 0; i < this.f32681a.length; i++) {
                if (host.endsWith(this.f32681a[i])) {
                    return true;
                }
            }
            return false;
        } catch (MalformedURLException e2) {
            if (QLog.isColorLevel()) {
                QLog.d(f32666a, 2, "isDomainInWhiteList exception: " + e2.getMessage());
                return false;
            }
            return false;
        }
    }

    public void b(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            this.g = jSONObject.optInt("version");
            JSONArray optJSONArray = jSONObject.optJSONArray("appid");
            JSONArray optJSONArray2 = jSONObject.optJSONArray("domain");
            JSONArray optJSONArray3 = jSONObject.optJSONArray("sender");
            if (optJSONArray != null && optJSONArray.length() > 0) {
                this.f32680a = new long[optJSONArray.length()];
                for (int i = 0; i < optJSONArray.length(); i++) {
                    this.f32680a[i] = Long.parseLong(optJSONArray.getString(i));
                }
            }
            if (optJSONArray2 != null && optJSONArray2.length() > 0) {
                this.f32681a = new String[optJSONArray2.length()];
                for (int i2 = 0; i2 < optJSONArray2.length(); i2++) {
                    this.f32681a[i2] = optJSONArray2.getString(i2).toLowerCase();
                }
            }
            if (optJSONArray3 != null && optJSONArray3.length() > 0) {
                this.f32683b = new long[optJSONArray3.length()];
                for (int i3 = 0; i3 < optJSONArray3.length(); i3++) {
                    this.f32683b[i3] = Long.parseLong(optJSONArray3.getString(i3));
                }
            }
            this.f32679a = jSONObject.optBoolean("disable", true);
        } catch (NumberFormatException e2) {
            if (QLog.isColorLevel()) {
                QLog.d(f32666a, 2, "loadWhiteList exception: " + e2.getStackTrace());
            }
        } catch (JSONException e3) {
            if (QLog.isColorLevel()) {
                QLog.d(f32666a, 2, "loadWhiteList exception: " + e3.getMessage());
            }
        }
    }

    public void a(String str, int i) {
        if (QLog.isColorLevel()) {
            QLog.d(f32666a, 2, "configURL = " + str);
        }
        if (!TextUtils.isEmpty(str)) {
            File file = new File(AppConstants.bS);
            if (!file.exists()) {
                file.mkdirs();
            }
            String str2 = AppConstants.bS + "troopsharecommentwhitelist.tmp";
            DownloadTask downloadTask = new DownloadTask(str, new File(str2));
            downloadTask.A = 3;
            Bundle bundle = new Bundle();
            bundle.putString("filePath", str2);
            ((DownloaderFactory) this.f32673a.getManager(46)).a(1).a(downloadTask, new vem(this, i), bundle);
        }
    }

    public boolean b(long j) {
        if (this.f32683b == null || this.f32683b.length <= 0) {
            return false;
        }
        for (int i = 0; i < this.f32683b.length; i++) {
            if (this.f32683b[i] == j) {
                return true;
            }
        }
        return false;
    }
}