Results 1 to 15 of 15
Like Tree1Likes
  • 1 Post By Norm

Thread: Java Source Chat Applet - Bytecode

  1. #1
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Java Source Chat Applet - Bytecode

    Hello all,

    I am new at the "Java Forums", i am here to learn to java and this is probably one of the best forums on the net. I need some help regarding my current java applet source (based on netbeans).
    I would like to edit and read the original functions, commands, options in the java source to edit basic things like changing the command from kick to remove for example. But i have a problem i dont know how this works, maybe somebody can provide me and tell me how this code part works, i have taken a random java source file to show what exactly i am talking about:

    Java Code:
                            if(inputCommand.equals("kick") && vector.size() >= 1)
                            {
                                attrlist.add(new ClientAttr((byte)43, "banned"));
                                sendCommand((byte)26, s, (String)vector.elementAt(0), attrlist);
                            }
    
                            if(inputCommand.equals("sop") && vector.size() >= 1 && getParameter("sop") != null)
                            {
                                attrlist.add(new ClientAttr((byte)43, vector.size() >= 2 ? (String)vector1.elementAt(1) : getParameter("sop")));
                                sendCommand((byte)26, null, (String)vector.elementAt(0), attrlist);
                            }
    attrlist.add(new ClientAttr((byte)43, "banned"));
    sendCommand((byte)26, s, (String)vector.elementAt(0), attrlist);



    How can i understand how this command works, how can i edit this command for example if i only able to see BYTE(26). Where does this code gets the information from, which java file? how can i decode and translate in order to RE-EDIT it?

    Please can somebody provide me information to understand this.

    Thank you very much guys.

    Best regards,
    Nino

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Java Source Chat Applet - Bytecode

    How can i understand how this command works
    What class is the sendCommand() method in? Is there any API doc for that class?
    Without doc for the method, it is very hard to know how to use it.
    Candesco likes this.

  3. #3
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Java Source Chat Applet - Bytecode

    Quote Originally Posted by Norm View Post
    What class is the sendCommand() method in? Is there any API doc for that class?
    Without doc for the method, it is very hard to know how to use it.
    Hi,

    I have no document. I have total netbeans java project.
    But i dont see where he gets the method SendCommand from which java file.
    What is the best way to find this out?

    Thanks!

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Java Source Chat Applet - Bytecode

    Where did you get this program? Who wrote it?
    What class is the sendCommand code in? Does that class extend another where sendCommand is defined?
    What import statements are in the program that would show the packages the program is using.

  5. #5
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Java Source Chat Applet - Bytecode

    Java Code:
       public void sendCommand(Command command)
            throws Exception
        {
            if(debug)
                System.err.println((new StringBuilder("Sending ")).append(command).toString());
            setBackground(clrCommand);
            cxn.sendCommand(command);
            repaint();
            if(idler != null)
                idler.activity();
        }
    
        private void sendCommand(byte byte0, String s, String s1, AttrList attrlist)
        {
            try
            {
                if(s1 != null && s1.length() > 0 && !s1.equals("*"))
                    attrlist.add(new ClientAttr((byte)2, s1));
                if(s != null)
                    attrlist.add(new ClientAttr((byte)12, s));
                sendCommand(new Command(byte0, attrlist));
            }
            catch(Exception exception)
            {
                setStatus(exception);
            }
        }
    
        private void sendCommand(byte byte0, String s, String s1)
        {
            sendCommand(byte0, s, s1, new AttrList());
        }
    
        private void sendCommand(byte byte0, AttrList attrlist)
        {
            sendCommand(byte0, null, null, attrlist);
        }
    
        private void sendCommand(byte byte0)
        {
            sendCommand(byte0, null, null, new AttrList());
        }
    will this help?

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Java Source Chat Applet - Bytecode

    One small step closer.
    What class is the cxn object? It also has a sendCommand() method.

    Why are you messing around with what looks like a program that does complicated stuff that I've never seen anyone work with before?
    There are a lot of basics that you need to learn before trying to do this.

  7. #7
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Java Source Chat Applet - Bytecode

    Quote Originally Posted by Norm View Post
    One small step closer.
    What class is the cxn object? It also has a sendCommand() method.
    Java Code:
        public void paint(Graphics g)
        {
            if(cxn == null)
                return;
            g.setColor(getBackground());
            g.setPaintMode();
            for(; pendingEvents.size() > 0; pendingEvents.removeElementAt(0))
                doEventInternal((Event)pendingEvents.elementAt(0));
    
        }
    
    private void cleanupChat()
        {
            hide();
            removeAllChatListeners();
            chats.remove(getParameter("name"));
            if(cxn != null)
            {
                Connection connection = cxn;
                cxn = null;
                connection.destroy();
            }
            if(idler != null)
                idler.quit();
        }
    
    public boolean connect(String s, int i)
        {
            if(cxn != null)
                cleanupChat();
            doInternalEvent("connecting");
            try
            {
                cxn = new Connection(s == null ? getCodeBase().getHost() : s, i, this);
                doInternalEvent("connect");
            }
            catch(Exception exception)
            {
                setStatus(exception);
                doInternalEvent("error");
            }
            if(cxn != null)
                try
                {
                    Vector vector = new Vector();
                    parseStrings(vector, ',', getParameter("idletime"));
                    if(vector.size() > 0)
                    {
                        for(int j = 0; j < vector.size(); j++)
                            vector.setElementAt(new Integer((String)vector.elementAt(j)), j);
    
                        idler = new Idler(this, vector);
                    }
                }
                catch(Exception exception1)
                {
                    exception1.printStackTrace();
                }
            return true;
        }
    
        private Connection cxn;
    This is what i could find about CXn.

  8. #8
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Java Source Chat Applet - Bytecode

    Where is the definition of the variable cxn? That will show what class it is.
    I see where it is given the value of a new Connection.
    What package is the Connection class in? Does it have something to do with SQL?

  9. #9
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Java Source Chat Applet - Bytecode

    Quote Originally Posted by Norm View Post
    Where is the definition of the variable cxn? That will show what class it is.
    I see where it is given the value of a new Connection.
    What package is the Connection class in? Does it have something to do with SQL?
    Yes, there is a file called connection.java it needs a basic server connection.
    It needs a basic socket, ip, port matching with the applet files.

    Anyway is it possible to upload the files i only need some explenation how to edit simple things.

    Thanks sir

  10. #10
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Java Source Chat Applet - Bytecode

    Sorry, this looks like it is past your current knowledge level. I suggested in post #6

    Why are you messing around with what looks like a program that does complicated stuff that I've never seen anyone work with before?
    There are a lot of basics that you need to learn before trying to do this.

    You need to find some doc for this program so you can understand what it does.
    Can you contact the author?

  11. #11
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Java Source Chat Applet - Bytecode

    Hi,

    Currently i am having the original java chat source as i said in the last post.
    My goal is, i would like to know how i can EDIT the chat commands for example. (i will not edit it, but a java coder will do it for me). The chat applet needs a chat server, i am currently trying to explain how to INPLENT all functions, chat, commands, to the chat server. I have all descriptions how commands work, but for example at the HTML document i have different parameters:

    Java Code:
    textparams = '';
    textparams += '<param name="joined" value=" < |%1% komt het kanaal binnen >">\n';
    textparams += '<param name="myjoined" value=" < |%1% komt kanaal %12% binnen >">\n';
    textparams += '<param name="parted" value=" < |%1% verlaat het kanaal >">\n';
    So my questions is HOW does it com i am not able to find these parameters names in the original source, if it actually getting the information from the HTML files to the java applet.

    Thanks!

  12. #12
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Java Source Chat Applet - Bytecode

    i am not able to find these parameters names in the original source,
    Look at all the calls to getParameter() in the Applet to see if any of them could have those Strings.
    Add a println before each of the getParameter() calls and print out the value of its argument if the arguments are hard to understand.

    I assume you are talking about how the applet get the values from the <param tag in the html file with the <applet tags.

  13. #13
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Java Source Chat Applet - Bytecode

    Quote Originally Posted by Norm View Post
    Look at all the calls to getParameter() in the Applet to see if any of them could have those Strings.
    Add a println before each of the getParameter() calls and print out the value of its argument if the arguments are hard to understand.

    I assume you are talking about how the applet get the values from the <param tag in the html file with the <applet tags.

    Java Code:
                if(getParameter("smileyFilter") != null)
                    smileyFilter = new Filter(new URL(getCodeBase(), getParameter("smileyFilter")));
            }
    --------------------
     params += '<param name="smileyFilter"       value="'+cfgbase+'/smiley.txt">\n';
    like this?

  14. #14
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Java Source Chat Applet - Bytecode

    if it actually getting the information from the HTML files to the java applet.
    If that is the only call to getParameter() in the applet code then I can not answer this question.

  15. #15
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Java Source Chat Applet - Bytecode

    params += '<param name="smileyFilter"
    The red above is strange syntax for HTML.
    There is a lot more going on here than a simple HTML page with some tags.

Similar Threads

  1. source code for j2me voice chat
    By armin in forum New To Java
    Replies: 6
    Last Post: 05-21-2011, 12:18 PM
  2. Open Source web based Java Chat application
    By anitha2324 in forum Advanced Java
    Replies: 4
    Last Post: 07-01-2009, 09:55 AM
  3. Help with bytecode in java
    By coco in forum New To Java
    Replies: 3
    Last Post: 04-16-2009, 09:48 AM
  4. Replies: 1
    Last Post: 08-08-2008, 04:20 AM
  5. Chat Applet in HTML
    By Flynazn in forum Java Applets
    Replies: 3
    Last Post: 05-27-2008, 10:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •