I am working on incorporating the drupalchat module inside a website such that people can use it as a "chat with site maintainers" function to get help on the website.

Therefore I needed to make it work for anonymous users. So I've included support for the session api module (not as a dependency but for when anonymous users have permission to chat it looks if the module exists).

For this I've also made a function where users can set their chatname. So the chatname does not have to be similar to the username (it initially is).

I've also cleaned up large parts of the code. Made the jquery more "drupalish", moved the chat functions from the module file in a separate file and I replaced the YUI code with similar Jquery code.

I also added jquery code to show the status of a person in the chatpane (idle and offline).

I added the complete module here. I didn't test it yet with nodejs. If you are interested in merging this then I will also check nodejs and create a proper patch.

Comments

Johnny vd Laar’s picture

StatusFileSize
new161.6 KB
darklrd’s picture

Awesome! :D

Thanks a lot for your contribution! :)

I will review it soon and merge it into the module code. Is this archive based on latest dev version?

Johnny vd Laar’s picture

Yes it's based on the latest code. I will post an update monday with the Ajax polling fixed as I found a bug in it.

On thursday I have time to do some extra "out of project" research so I'll review the nodejs part then.

darklrd’s picture

Thanks a lot! :)

Johnny vd Laar’s picture

Ok it's taking me some more time then half a day so I'll look back at it next week. I got nodejs working but not yet for anonymous users. But I never used nodejs before so it's still a bit of learning as well. But I think next week it'll be done.

darklrd’s picture

Great, looking forward to it! Thanks.

Johnny vd Laar’s picture

StatusFileSize
new164.93 KB

I haven't forgotten on this but things have been quite busy here and nodejs seems to be more work as I previously thought. So this is going to last several extra weeks I think.

Attached is my current version but this isn't finished yet.

Johnny vd Laar’s picture

StatusFileSize
new166.77 KB

I see that you've added the chatting for anonymous users. I didn't compare it yet to my version. But does it also include chatting for anonymous users in nodejs?

In the attached version chatting with nodejs is working completely for logged in users. But not for anonymous yet. It also has nodejs support for changing chatname and status.

There is an issue with when you reload the page that it forgets your login status as it logs you out and in again. So i'm still working on this.

darklrd’s picture

Hi,

Yes, I had gone through your code and used the integration with session_api module in order to provide chatting for anonymous users (via _drupalchat_get_sid() function) although the rest of the implementation is different. Thanks a lot for your providing your code! :-)

No, chatting for anonymous users in nodejs has not been implemented yet. Thanks a lot for your providing your updated version. I will try to incorporate it whenever I am free.

Thanks again!

Johnny vd Laar’s picture

StatusFileSize
new166.98 KB

I have a new version. Your version is very different now but I don't have the time to merge them together. Mostly because we are using this version in a project.

This version has nodejs chatting working, also the status change, username change are working. What I still need to implement is buddylist.

Also I didn't explain this before but there is a drupalchat.php file that does a limited Bootstrap. This is a bit of a performance saving for when you use ajax/long polling.

darklrd’s picture

Thanks a lot for uploading the new version. I will try to add new features to the main project whenever possible.

Thanks again!

Johnny vd Laar’s picture

StatusFileSize
new168.32 KB

Last version with also the buddylist functionality built in. I won't be adding any additional features as my project doesn't require more then this. So hopefully this is of use for you :)

darklrd’s picture

Thanks a lot! :-) I will try to merge it.

Thanks again!