Page 1 of 1

Modifying Chat service

PostPosted: Tue Dec 20, 2011 6:21 pm
by neodawg
I am looking for some help modifying the subsonic chat

I am hoping to just simply change it so messages expire after 3 days, I have tried doing it via a hack solution of changing the MAX_MESSAGES to 1000 in the ChatService.java file. This however doesnt seem to work, it still deletes the 1st message when the 11th message is posted.

Note: I have no experience with java programming or much programming experience at all other than some php and html. With that said I have managed to setup eclipse and get subsonic to compile/install, I have successfully changed the share url domain for the sharing feature on SubSonic.

Code: Select all
   
private static final Object CACHE_KEY = 1;
private static final int MAX_MESSAGES = 1000;
private static final long TTL_MILLIS = 3L * 24L * 60L * 60L * 1000L; // 3 days.


If someone with java experience could give me a hand in tweaking this it would much appreciated.

For testing i have been just extracting the changed .class file from the newly compiled war and then adding/updating the war on my server and restarting the SS service.

EDIT: Server is Server 2008R2, mem limit 1gig, SS version 4.6


Thanks for any help.

neodawg

Re: Modifying Chat service

PostPosted: Mon Jan 02, 2012 11:12 pm
by ytechie
After playing with the right.jsp, but not the java files, I gave up on modifying the chat service.

However, I do know that if you manage to edit the java files correctly, you still need to modify right.jsp to reflect those changes.
Specifically, this:

Code: Select all
for (var i = 0; i < messages.messages.length; i++) {
                var message = messages.messages[i];
                var id = i + 1;
                dwr.util.cloneNode("pattern", { idSuffix:id });
                dwr.util.setValue("user" + id, message.username);
                dwr.util.setValue("date" + id, " [" + formatDate(message.date) + "]");
                dwr.util.setValue("content" + id, message.content);
                $("pattern" + id).show();
            }


Can you see what it is doing?

It is re-writing all the chat messages onto the screen. It clones the first row 9 times. You have to change i < messages.messages.length to the number of messages the backend will keep.

Or, you could change the value of messages.messages.length.

Re: Modifying Chat service

PostPosted: Tue Apr 10, 2012 11:40 pm
by fonsoy
I have tried to edit the static final int MAX_MESSAGES as well. It failed, as expected now I read.

I would love to hear from somebody who got this working.

Re: Modifying Chat service

PostPosted: Wed Apr 11, 2012 4:42 am
by ytechie
A while back I looked through the java source code, and the chat size was hard coded into the backend.

Re: Modifying Chat service

PostPosted: Wed Apr 11, 2012 4:51 pm
by neodawg
ytechie wrote:A while back I looked through the java source code, and the chat size was hard coded into the backend.



Can you explain hard coded, would you be able to change that there?