// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 12.08.2011 2:53:57
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 

import agent.JAgent;
import java.io.*;
import java.util.*;

public final class p
{

    public p()
    {
    }

    public static String[] a(String s, boolean flag, boolean flag1)
    {
        String as[] = new String[3];
        Vector vector = new Vector();
        if(s != null && s.length() > 0)
        {
            StringBuffer stringbuffer = new StringBuffer();
            int i = s.length();
            for(int j = 0; j < i; j++)
            {
                char c1;
                if((c1 = s.charAt(j)) == ',')
                {
                    String s1 = stringbuffer.toString();
                    if(!flag1 || s1 != null && s1.length() > 0)
                        vector.addElement(s1);
                    stringbuffer.setLength(0);
                    continue;
                }
                if(flag && stringbuffer.length() == 0 && c1 == '7')
                    stringbuffer.append('+');
                stringbuffer.append(c1);
            }

            if(stringbuffer.length() > 0)
                vector.addElement(stringbuffer.toString());
            int k;
            if((k = vector.size()) > 0)
            {
                for(int l = 0; l < k; l++)
                    as[l] = (String)vector.elementAt(l);

            }
        }
        if(flag1)
        {
            as = new String[vector.size()];
            vector.copyInto(as);
        }
        return as;
    }

    public static byte[] a(String s)
    {
        String s1;
        if((s1 = (String)o.a.get("MRIM.NICKNAME")) == null)
            s1 = y.a;
        byte abyte0[];
        a(abyte0 = new byte[12 + s1.length() + s.length()], 0, 2);
        a(abyte0, 4, s1);
        a(abyte0, 8 + s1.length(), s);
        return abyte0;
    }

    public static String a(String as[])
    {
        StringBuffer stringbuffer = new StringBuffer();
        for(int i = 0; i < 3; i++)
        {
            if(as[i] == null || as[i].length() <= 0)
                continue;
            if(stringbuffer.length() > 0)
                stringbuffer.append(",");
            stringbuffer.append(as[i]);
        }

        return stringbuffer.toString();
    }

    public static int a(byte abyte0[], int i)
    {
        int j;
        return j = (j = (j = (j = abyte0[i] & 0xff) | abyte0[++i] << 8 & 0xff00) | abyte0[++i] << 16 & 0xff0000) | abyte0[++i] << 24 & 0xff000000;
    }

    public static String a(String s)
    {
        StringBuffer stringbuffer = new StringBuffer();
        int i = s.length();
        for(int j = 0; j < i; j++)
        {
            char c1;
            if((c1 = s.charAt(j)) <= '(')
            {
                stringbuffer.append('%');
                stringbuffer.append(Integer.toHexString(c1));
            } else
            {
                stringbuffer.append(c1);
            }
        }

        return stringbuffer.toString();
    }

    public static void a(byte abyte0[], int i, int j)
    {
        abyte0[i] = (byte)(j & 0xff);
        abyte0[++i] = (byte)(j >> 8 & 0xff);
        abyte0[++i] = (byte)(j >> 16 & 0xff);
        abyte0[++i] = (byte)(j >> 24 & 0xff);
    }

    private static String d(String s)
    {
        int i = s.length();
        StringBuffer stringbuffer = new StringBuffer(i);
        for(int j = 0; j < i; j++)
        {
            char c1;
            switch(c1 = s.charAt(j))
            {
            case 1025: 
                stringbuffer.append('\250');
                break;

            case 1105: 
                stringbuffer.append('\270');
                break;

            default:
                if((c1 >= '\u0410') & (c1 <= '\u044F'))
                    stringbuffer.append((char)(c1 - 848 & 0xff));
                else
                    stringbuffer.append((char)(c1 & 0xff));
                break;
            }
        }

        return stringbuffer.toString();
    }

    public static int a(byte abyte0[], int i, String s)
    {
        int j = s.length();
        s = d(s);
        a(abyte0, i, j);
        i += 4;
        for(int k = 0; k < j; k++)
            abyte0[i++] = (byte)(s.charAt(k) & 0xff);

        return j;
    }

    public static int b(byte abyte0[], int i, String s)
    {
        int j = s.length();
        a(abyte0, i, j);
        i += 4;
        for(int k = 0; k < j;)
        {
            char c1 = s.charAt(k);
            abyte0[i] = (byte)(c1 & 0xff);
            k++;
            i++;
        }

        return j;
    }

    public static String a(byte abyte0[], int i, int j)
    {
        StringBuffer stringbuffer = new StringBuffer(j);
        do
        {
            if(j-- == 0)
                break;
            int k;
            switch(k = abyte0[i++] & 0xff)
            {
            case 168: 
                stringbuffer.append('\u0401');
                break;

            case 184: 
                stringbuffer.append('\u0451');
                break;

            default:
                if((k >= 128) & (k <= 255))
                    stringbuffer.append((char)(k + 848));
                else
                    stringbuffer.append((char)k);
                break;
            }
        } while(true);
        return stringbuffer.toString();
    }

    public static String a(int i)
    {
        StringBuffer stringbuffer = new StringBuffer();
        if(i < 10)
            stringbuffer.append('0');
        stringbuffer.append(i);
        return stringbuffer.toString();
    }

    public static String a(Date date)
    {
        Calendar calendar = Calendar.getInstance();
        if(date != null)
            calendar.setTime(date);
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append(a(calendar.get(11)));
        stringbuffer.append(':');
        stringbuffer.append(a(calendar.get(12)));
        return stringbuffer.toString();
    }

    public static String b(String s)
    {
        StringBuffer stringbuffer = new StringBuffer();
        Vector vector = a("http", s);
        Vector vector1 = a("ftp", s);
        Vector vector2 = a("mailto", s);
        Vector vector3 = a("www", s);
        int i = s.length();
        int j = 0;
        for(int k = 0; k < i && k < 160; k++)
        {
            char c1 = s.charAt(k);
            if((j = a(j, c1)) == 0)
            {
                if(c1 == 'h' && a(k, vector))
                {
                    j = 1;
                    k += "http".length() - 1;
                    continue;
                }
                if(c1 == 'f')
                {
                    if(a(k, vector1))
                    {
                        j = 1;
                        k += "ftp".length() - 1;
                    }
                } else
                if(c1 == 'm')
                {
                    if(a(k, vector2))
                    {
                        j = 5;
                        k += "mailto".length() - 1;
                        continue;
                    }
                } else
                if(c1 == 'w' && a(k, vector3))
                {
                    j = 7;
                    k += "www".length() - 1;
                    continue;
                }
            }
            if(j == 0 && (c1 < '0' || c1 > '9'))
                stringbuffer.append(c1);
        }

        return stringbuffer.toString();
    }

    public static void a(String s)
    {
        try
        {
            int i = s.indexOf('|');
            y.a = s.substring(0, i);
            y.b = s.substring(i + 1);
            y.d = 0;
            for(int j = 0; j < y.a.length(); j++)
                y.d += y.a.charAt(j);

            return;
        }
        catch(Exception _ex)
        {
            y.a = "\u0410\u0433\u0435\u043D\u0442@mail.ru";
        }
        y.b = "pwd";
        y.d = 0;
    }

    public static String b(int i)
    {
        int j = 195;
        int k = i;
        int l = 0;
        for(int i1 = 0; i1 < 2 && k > 1024; i1++)
        {
            l = k % 1024;
            k /= 1024;
            j++;
        }

        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append(k);
        if(l != 0)
        {
            stringbuffer.append(".");
            stringbuffer.append(l);
        }
        stringbuffer.append(" ");
        stringbuffer.append(v.a(j));
        return stringbuffer.toString();
    }

    public static String c(String s)
    {
        byte abyte0[];
        byte abyte1[] = new byte[(abyte0 = s.getBytes()).length];
        for(int i = 0; i < abyte0.length; i++)
            abyte1[i] = (byte)(abyte0[i] ^ a[i % 16]);

        return new String(abyte1);
    }

    public static byte[] b(String s)
    {
        int i;
        byte abyte0[] = new byte[i = a(s)];
        try
        {
            InputStream inputstream = JAgent.a.getClass().getResourceAsStream(s);
            DataInputStream datainputstream;
            (datainputstream = new DataInputStream(inputstream)).readFully(abyte0);
            datainputstream.close();
            inputstream.close();
        }
        catch(IOException _ex) { }
        return abyte0;
    }

    private static int a(int i, char c1)
    {
        byte byte0 = 0;
        if(i == 1)
        {
            if(c1 == ':' || c1 == ';')
                byte0 = 2;
            else
            if(c1 == '/')
                byte0 = 3;
        } else
        if(i == 2)
        {
            if(c1 == '/')
                byte0 = 3;
        } else
        if(i == 3)
        {
            if(c1 == '/')
                byte0 = 4;
        } else
        if(i == 5 && (c1 == ':' || c1 == ';'))
            byte0 = 6;
        return byte0;
    }

    private static boolean a(int i, Vector vector)
    {
        boolean flag = false;
        int j = vector.size();
        int k = 0;
        do
        {
            if(k >= j)
                break;
            int l;
            if((l = ((Integer)vector.elementAt(k)).intValue()) == i)
            {
                flag = true;
                break;
            }
            if(l > i)
                break;
            k++;
        } while(true);
        return flag;
    }

    private static Vector a(String s, String s1)
    {
        Vector vector = new Vector();
        int i = 0;
        int j = s1.length();
        int k = s.length();
        int l;
        for(; i < j && (l = s1.indexOf(s, i)) != -1 && l < 160; i = l + k)
            vector.addElement(new Integer(l));

        return vector;
    }

    private static int a(String s)
    {
        int i = 0;
        InputStream inputstream = null;
        try
        {
            inputstream = JAgent.a.getClass().getResourceAsStream(s);
            int j;
            while((j = inputstream.read()) != -1) 
                i++;
        }
        catch(EOFException _ex) { }
        catch(IOException _ex) { }
        try
        {
            inputstream.close();
        }
        catch(IOException _ex) { }
        return i;
    }

    private static final byte a[] = {
        77, 111, 98, 105, 108, 101, 65, 103, 101, 110, 
        116, 76, 111, 103, 105, 110
    };

}