⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getmsgdlg.java

📁 手机中用的MobileQQ源代码
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 

import java.util.*;
import javax.microedition.lcdui.*;

public class GetMsgDlg
    implements CommandListener, HttpPosterListener
{

    protected Command cmdBack;
    protected Command cmdReply;
    private Timer getMsgTimer;
    private Vector vComMsg;
    private Vector vSysMsg;
    private int iComMsgNum;
    private int iSysMsgNum;
    private int iTimerCnt;
    private int iTimerToGet;
    private String strFromUin;
    private long curFindMinUIN;
    private Displayable backMenu;
    private boolean bControl;
    public static final int C_UpdateTimer_Send = 0;
    private final int C_UpdateTimer_Receive = 1;
    private final int C_UpdateTimer_Stat = 2;
    private final int C_UpdateTimer_NoReceive = 3;
    private boolean timerOn;

    public GetMsgDlg()
    {
        cmdBack = null;
        cmdReply = null;
        getMsgTimer = null;
        vComMsg = null;
        vSysMsg = null;
        iComMsgNum = 0;
        iSysMsgNum = 0;
        iTimerCnt = 0;
        iTimerToGet = 1;
        strFromUin = null;
        curFindMinUIN = 0L;
        backMenu = null;
        bControl = true;
        timerOn = false;
    }

    public void init()
    {
        cmdBack = new Command(KQQMIDlet.sysString.sBack, 2, 3);
        cmdReply = new Command(KQQMIDlet.sysString.sAnswer, 1, 1);
    }

    public boolean getControl()
    {
        return bControl;
    }

    public void switchControl()
    {
        if(bControl)
        {
            bControl = false;
            iTimerToGet = 1;
            PkgTools.setOtherInfo(null, "0", null);
        } else
        {
            bControl = true;
            PkgTools.setOtherInfo(null, "1", null);
        }
    }

    public void updateTimerSet(int i)
    {
        if(!bControl)
            return;
        switch(i)
        {
        default:
            break;

        case 0: // '\0'
            if(iTimerToGet > 3)
                iTimerToGet = 3;
            break;

        case 1: // '\001'
            iTimerToGet = 1;
            break;

        case 2: // '\002'
            if(iTimerToGet > 3)
                iTimerToGet = 3;
            break;

        case 3: // '\003'
            if(iTimerToGet < 12)
                iTimerToGet++;
            break;
        }
    }

    public void show(boolean flag, long l)
    {
        if(!flag && readSysMsg())
        {
            return;
        } else
        {
            readComMsg(l);
            return;
        }
    }

    public int getComMsgNum()
    {
        return iComMsgNum;
    }

    public int getSysMsgNum()
    {
        return iSysMsgNum;
    }

    private void doRecvComMsg(String s, String s1)
    {
        try
        {
            Calendar calendar = Calendar.getInstance();
            StringBuffer stringbuffer = new StringBuffer();
            stringbuffer.append(calendar.get(2) + 1).append("/").append(calendar.get(5)).append(" ").append(calendar.get(11)).append(":").append(PkgTools.To2Str(calendar.get(12))).append(":").append(PkgTools.To2Str(calendar.get(13))).append("\n").append(KQQMIDlet.friendRecord.getNamebyID(Long.parseLong(s))).append("[").append(s).append("]:").append(s1);
            appendComMsg(s, stringbuffer.toString());
        }
        catch(Exception exception) { }
    }

    private void appendComMsg(String s, String s1)
    {
        int i = KQQMIDlet.friendRecord.getUserLocation(s);
        if(KQQMIDlet.friendRecord.getUserLocation(s) == -1)
        {
            KQQMIDlet.friendRecord.addStrangerRecord(s);
            KQQMIDlet.friendList.buildFriendList();
        } else
        if(KQQMIDlet.friendRecord.getStatebyIndex(i) != 30)
            KQQMIDlet.mainForm.updateStat(s, "10");
        KQQMIDlet.instance.playAlert();
        if(vComMsg == null)
            vComMsg = new Vector();
        vComMsg.addElement(s);
        vComMsg.addElement(s1);
        iComMsgNum++;
    }

    private void appendSysMsg(String s, String s1, String s2)
    {
        KQQMIDlet.instance.playAlert();
        if(vSysMsg == null)
            vSysMsg = new Vector();
        vSysMsg.addElement(s);
        vSysMsg.addElement(s1);
        vSysMsg.addElement(s2);
        iSysMsgNum++;
    }

    public int findMsgByUIN(long l)
    {
        int i = -1;
        if(vComMsg == null)
            return -1;
        if(vComMsg.size() == 0)
            return -1;
        for(int j = 0; j < vComMsg.size(); j += 2)
        {
            if(!((String)vComMsg.elementAt(j)).equals(Long.toString(l)))
                continue;
            i = j;
            break;
        }

        return i;
    }

    public long getNextNeedRead()
    {
        long l2 = 0x7fffffffL;
        if(vComMsg == null)
            return 0L;
        if(vComMsg.size() == 0)
            return 0L;
        try
        {
            for(int i = 0; i < vComMsg.size(); i += 2)
            {
                long l = Long.parseLong((String)vComMsg.elementAt(i));
                if(!KQQMIDlet.blackList.inBlackList(l) && l > curFindMinUIN && l < l2)
                    l2 = l;
            }

            if(l2 == 0x7fffffffL)
            {
                for(int j = 0; j < vComMsg.size(); j += 2)
                {
                    long l1 = Long.parseLong((String)vComMsg.elementAt(j));
                    if(!KQQMIDlet.blackList.inBlackList(l1) && l1 < l2)
                        l2 = l1;
                }

            }
            if(l2 == 0x7fffffffL)
                l2 = 0L;
            curFindMinUIN = l2;
        }
        catch(Exception exception)
        {
            l2 = 0L;
        }
        return l2;
    }

    private boolean fetchComMsg(StringBuffer stringbuffer, long l)
    {
        if(vComMsg == null)
            return false;
        int i;
        if(l == 0L)
        {
            if(vComMsg.size() == 0)
                return false;
            i = 0;
        } else
        {
            i = findMsgByUIN(l);
            if(i < 0)
                return false;
        }
        strFromUin = (String)vComMsg.elementAt(i);
        vComMsg.removeElementAt(i);
        String s = (String)vComMsg.elementAt(i);
        vComMsg.removeElementAt(i);
        KQQMIDlet.historyMsg.appendComRecMsg(strFromUin, s);
        stringbuffer.append(s);
        iComMsgNum--;
        if(iComMsgNum < 0)
            iComMsgNum = 0;
        return true;
    }

    private boolean readSysMsg()
    {
        if(vSysMsg == null)
            return false;
        if(vSysMsg.size() == 0)
            return false;
        try
        {
          int i = Integer.parseInt((String)vSysMsg.elementAt(0));
        }
        catch(Exception exception)
        {
        }
        vSysMsg.removeElementAt(0);
        String s = (String)vSysMsg.elementAt(0);
        vSysMsg.removeElementAt(0);
        String s1 = (String)vSysMsg.elementAt(0);
        vSysMsg.removeElementAt(0);
        KQQMIDlet.ackSvrMsg.show(i, s, s1);
        iSysMsgNum--;
        if(iSysMsgNum < 0)
            iSysMsgNum = 0;
        return true;
        return false;
    }

    private void readComMsg(long l)
    {
        StringBuffer stringbuffer = new StringBuffer();
        boolean flag = fetchComMsg(stringbuffer, l);
        if(flag)
        {
            String s = new String(stringbuffer);
            showMessage(KQQMIDlet.sysString.sNewMessage, s);
        }
    }

    protected void showMessage(String s, String s1)
    {
        Form form = new Form(s);
        form.append(s1);
        form.addCommand(cmdBack);
        form.addCommand(cmdReply);
        form.setCommandListener(this);
        KQQMIDlet.display.setCurrent(form);
    }

    public void commandAction(Command command, Displayable displayable)
    {
        try
        {
            if(command == cmdBack)
                KQQMIDlet.mainForm.show();
            else
            if(command == cmdReply)
                KQQMIDlet.sendMsgDlg.show(Long.parseLong(strFromUin), false);
        }
        catch(Exception exception) { }
    }

    public void onMessage(String s, String s1, String s2)
    {
        int i;
        try
        {
            if(KQQMIDlet.blackList.inBlackList(Long.parseLong(s1)))
                return;
        }
        catch(Exception exception)
        {
            return;
        }
        i = Integer.parseInt(s);
        switch(i)
        {
        default:
            break;

        case 3: // '\003'
            if(!s1.equals(""))
            {
                KQQMIDlet.friendRecord.deleteRecord(s1);
                KQQMIDlet.friendRecord.addRecord(s1);
                KQQMIDlet.mainForm.updateStat(s1, "10");
                KQQMIDlet.friendList.buildFriendList();
                KQQMIDlet.finger.doGetInfor(s1, null);
            }
            // fall through

        case 1: // '\001'
        case 2: // '\002'
        case 4: // '\004'
            if(!s1.equals(""))
            {
                appendSysMsg(s, s1, s2);
                updateTimerSet(1);
                return;
            }
            break;

        case 9: // '\t'
            if(!s1.equals("") && !s2.equals(""))
            {
                doRecvComMsg(s1, s2);
                updateTimerSet(1);
                return;
            }
            break;

        case 99: // 'c'
            if(!s1.equals(""))
            {
                KQQMIDlet.mainForm.updateStat(s1, s2);
                updateTimerSet(2);
                return;
            }
            break;
        }
        return;
    }

    public void receiveHttpResponse(String s)
    {
        String s1;
        String s2;
        s1 = PkgTools.GetParaVal("CMD", s).toUpperCase();
        s2 = PkgTools.GetParaVal("RES", s);
        if(s2.equals("20"))
        {
            KQQMIDlet.instance.onNetError(true);
            return;
        }
        int i;
        if(!s1.equals("GETMSGEX") || !s2.equals("0"))
            break MISSING_BLOCK_LABEL_218;
        i = Integer.parseInt(PkgTools.GetParaVal("MN", s));
        if(i == 0)
        {
            updateTimerSet(3);
            return;
        }
        String s4;
        String s5;
        String as[];
        String as1[];
        String as2[];
        String s3 = PkgTools.GetParaVal("MT", s);
        s4 = PkgTools.GetParaVal("UN", s);
        s5 = PkgTools.GetParaVal("MG", s);
        as = new String[i];
        as1 = new String[i];
        as2 = new String[i];
        int j = 0;
        j = PkgTools.GetMultiPara(as, s3);
        if(i != j)
            return;
        int k = PkgTools.GetMultiPara(as1, s4);
        if(i != k)
            return;
        int l = PkgTools.GetMultiPara(as2, s5);
        if(i != l)
            return;
        try
        {
            for(int i1 = 0; i1 < i; i1++)
                onMessage(as[i1], as1[i1], PkgTools.Decodecgi(as2[i1]));

        }
        catch(Exception exception) { }
    }

    public void handleHttpError(String s)
    {
    }

    public void startTimer()
    {
        timerOn = true;
    }

    public void stopTimer()
    {
        timerOn = false;
    }

    public void OnTimer()
    {
        if(!timerOn)
            return;
        if(++iTimerCnt >= iTimerToGet)
        {
            KQQMIDlet.httpPoster.getMsg(this);
            iTimerCnt = 0;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -